From 57deece540ff0a66d80403f4bbd85edac5ed35ed Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期二, 15 十月 2024 16:54:51 +0800
Subject: [PATCH] 上线计划优化

---
 _Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
index 5718ef8..6dd9a3b 100644
--- a/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
+++ b/_Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
@@ -69,7 +69,16 @@
         traverse ( nopt, NewOfflinePlanColumn, nopc ) {
           cell   := select( nopr, NewOfflinePlanCell, tempNOPCell, tempNOPCell.NewOfflinePlanColumn() = nopc );
           if ( isnull( cell ) ) {
-            cell := nopr.NewOfflinePlanCell( relnew );
+            uptb := select( macroPlan, Unit.UnitPeriod.astype( UnitPeriodTimeBase ), tempUPTB, 
+                            tempUPTB.UnitID() = nopr.ProductionLine() and tempUPTB.StartDate() = nopc.StartDate() and tempUPTB.End().Date() = nopc.EndDate() );
+            // ShiftPattern
+            sp   := uptb.ShiftPattern();
+            // ShiftDayTime
+            sdt  := select( sp, ShiftDayTime, tempSDT, tempSDT.Name() = tempSDT.ShiftPattern().Name() );
+            cell := nopr.NewOfflinePlanCell( relnew, 
+                                             ShiftPatternName  := guard( sp.Name(), "" ), 
+                                             ShiftPatternStart := guard( sdt.StartDateTime().Format( "H:m" ), "" ),
+                                             ShiftPatternEnd   := guard( sdt.EndDateTIme().Format( "H:m" ), "" ) );
             cell.NewOfflinePlanColumn( relset, nopc );
           }
         }
@@ -79,15 +88,14 @@
       totalNOPR   := nopt.NewOfflinePlanRow( relnew, ProductID := "All", ProductionLine := u.ID(), Type := "2" );
       detailNOPRs := selectset( nopt, NewOfflinePlanRow, tempNOPR, tempNOPR.ProductionLine() = u.ID() and tempNOPR.Type() = "1" );
       traverse ( detailNOPRs, Elements, detailNOPR ) {
-        shiftPatternNOPCell := select( detailNOPR, NewOfflinePlanCell, tempNOPCell, tempNOPCell.ShiftPatternName() <> "" );
         traverse ( detailNOPR, NewOfflinePlanCell, detailNOPCell ) {
           // 鐢熶骇涓嬬嚎璁″垝銆愪骇绾垮悎璁°�戝崟鍏冩牸
           totalNOPRCell   := select( totalNOPR, NewOfflinePlanCell, tempNOPCell, tempNOPCell.NewOfflinePlanColumn() = detailNOPCell.NewOfflinePlanColumn() );
           if ( isnull( totalNOPRCell ) ) {
             totalNOPRCell := totalNOPR.NewOfflinePlanCell( relnew, 
-                                                           ShiftPatternName  := shiftPatternNOPCell.ShiftPatternName(),
-                                                           ShiftPatternStart := shiftPatternNOPCell.ShiftPatternStart(),
-                                                           ShiftPatternEnd   := shiftPatternNOPCell.ShiftPatternEnd() );
+                                                           ShiftPatternName  := detailNOPCell.ShiftPatternName(),
+                                                           ShiftPatternStart := detailNOPCell.ShiftPatternStart(),
+                                                           ShiftPatternEnd   := detailNOPCell.ShiftPatternEnd() );
             totalNOPRCell.NewOfflinePlanColumn( relset, detailNOPCell.NewOfflinePlanColumn() ); // 璁剧疆鍒�
             // 灏嗘槑缁嗗崟鍏冩牸鍏宠仈鍒板悎璁″崟鍏冩牸
             totalNOPRCell.Detailed( relinsert, detailNOPCell );

--
Gitblit v1.9.3