From 5914fe0b08afd48e6cca36d9f0db3488799c8096 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 25 十月 2024 18:34:36 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

---
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
index cd068af..7a00e46 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
@@ -3,7 +3,8 @@
 StaticMethod SplitShifts (
   RecycleBin owner,
   String shiftName,
-  Real shiftVolume
+  Real shiftVolume,
+  Real productLinesQuantity
 ) as owning DispatchShiftSchedulingInformations
 {
   TextBody:
@@ -11,31 +12,41 @@
     // Akari Oct-9-2024 (created)
     shiftSchedulingInformations := construct( DispatchShiftSchedulingInformations );
     if( shiftName = "3" ){
-      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 3 );
+      shiftQuantity := productLinesQuantity / 3 ;
+      
+      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := ifexpr( shiftVolume >= shiftQuantity, shiftQuantity, shiftVolume ) );
       shiftSchedulingInformation1.SingleShiftName( "鐧界彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation1 );
       
-      shiftSchedulingInformation2 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 3 );
+      shiftVolume := shiftVolume - shiftQuantity;
+      
+      shiftSchedulingInformation2 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := ifexpr( shiftVolume >= shiftQuantity, shiftQuantity, shiftVolume ) );
       shiftSchedulingInformation2.SingleShiftName( "浜岀彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation2 );
       
-      shiftSchedulingInformation3 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 3 );
+      shiftVolume := shiftVolume - shiftQuantity;
+      
+      shiftSchedulingInformation3 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := ifexpr( shiftVolume >= shiftQuantity, shiftQuantity, shiftVolume ) );
       shiftSchedulingInformation3.SingleShiftName( "涓夌彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation3 );
     }else if( shiftName = "2" ){
-      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 2 );
+      shiftQuantity := productLinesQuantity / 2 ;
+      
+      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := ifexpr( shiftVolume >= shiftQuantity, shiftQuantity, shiftVolume ));
       shiftSchedulingInformation1.SingleShiftName( "鐧界彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation1 );
       
-      shiftSchedulingInformation2 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 2 );
+      shiftVolume := shiftVolume - shiftQuantity;
+      
+      shiftSchedulingInformation2 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := ifexpr( shiftVolume >= shiftQuantity, shiftQuantity, shiftVolume ) );
       shiftSchedulingInformation2.SingleShiftName( "浜岀彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation2 );
     }else if( shiftName = "1" ){
-      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 1 );
+      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume );
       shiftSchedulingInformation1.SingleShiftName( "鐧界彮" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation1 );
     }else{
-      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 1 );
+      shiftSchedulingInformation1 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume );
       shiftSchedulingInformation1.SingleShiftName( "" );
       shiftSchedulingInformations.Add( shiftSchedulingInformation1 );
     }

--
Gitblit v1.9.3