From d5c074b9e2daa5030a8e730a30d2ed31c8169e7d Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 25 十月 2024 17:26:52 +0800
Subject: [PATCH] 修复一些bug

---
 _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