From c2d6e0a51f9e47e04a7a24a06141e4414d0ea418 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周五, 13 12月 2024 13:03:40 +0800
Subject: [PATCH] 222

---
 CC/iWareCC_ASRS/ThreadService/03_BZ12(机器人码包工位)/1、DataProcess_BZ12.cs |  126 +++++++++++++++++++++++------------------
 1 files changed, 70 insertions(+), 56 deletions(-)

diff --git "a/CC/iWareCC_ASRS/ThreadService/03_BZ12\050\346\234\272\345\231\250\344\272\272\347\240\201\345\214\205\345\267\245\344\275\215\051/1\343\200\201DataProcess_BZ12.cs" "b/CC/iWareCC_ASRS/ThreadService/03_BZ12\050\346\234\272\345\231\250\344\272\272\347\240\201\345\214\205\345\267\245\344\275\215\051/1\343\200\201DataProcess_BZ12.cs"
index 70cb7ae..f70e50a 100644
--- "a/CC/iWareCC_ASRS/ThreadService/03_BZ12\050\346\234\272\345\231\250\344\272\272\347\240\201\345\214\205\345\267\245\344\275\215\051/1\343\200\201DataProcess_BZ12.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/03_BZ12\050\346\234\272\345\231\250\344\272\272\347\240\201\345\214\205\345\267\245\344\275\215\051/1\343\200\201DataProcess_BZ12.cs"
@@ -117,64 +117,77 @@
                                 //鏌ュ杩欏寘鎵�鏈夌殑鏁伴噺
                                 var upiList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList();
                                 //鏌ヨ鏄惁鏈澘骞朵笖鍒ゆ柇鏈夋病鏈夋贩鎵�
-                                var wms_rbline_runmode = wmsDB.wms_rbline_runmode.FirstOrDefault();
-                                if (wms_rbline_runmode != null)
+                                //澧炲姞瀵瑰弬鏁伴厤缃殑绠$悊 銆怑ditby shaocx,2024-12-13銆�
+                                var sysConfig = wmsDB.SysConfig.Where(x => x.Code == "LastPalletizingData").FirstOrDefault();
+                                if (sysConfig == null)
                                 {
-                                    //鏌ヨ鏄惁娣锋壒
-                                    if (!string.IsNullOrEmpty(wms_rbline_runmode.PalletizingUPI))
-                                    {
-                                        if (upiObj.PackageCode != wms_rbline_runmode.PalletizingUPI)
-                                        {
-                                            //鍐欏叆鎶ヨ淇℃伅
-                                            await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ12_4);
-
-                                            SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()},UPI:{upiCode}鐮佸寘閮ㄤ欢娣锋壒 ";
-                                            continue;
-                                        }
-                                    }
-                                    //鑾峰彇鐮佸灈鐩爣浣�
-                                    if (wms_rbline_runmode.PalletizingStation != 0)
-                                    {
-                                        place = wms_rbline_runmode.PalletizingStation.ToString();
-                                    }
-                                    else
-                                    {//琛ㄧず杩欐槸 鍖呯殑绗竴鍧楁澘
-                                        lastnum = 1;
-                                        wms_rbline_runmode.PalletizingUPI = upiObj.PackageCode;
-                                        if (obj.R_PalletizingStation1 == 1)
-                                        {
-                                            place = "1";
-                                        }
-                                        else if (obj.R_PalletizingStation2 == 1)
-                                        {
-                                            place = "2";
-
-                                        }
-                                        else
-                                        {
-                                            //鍐欏叆鎶ヨ淇℃伅
-                                            await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ12_6);
-
-                                            SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()},UPI:{upiCode}鏃犲彲鐢ㄧ爜鍨涚洰鏍囦綅 ";
-                                            continue;
-                                        }
-
-                                        wms_rbline_runmode.PalletizingStation = int.Parse(place);
-                                    }
-                                    //濡傛灉娆″簭绛変簬褰撻挶鍖呮�绘暟閲忥紝鏄惁鏈澘缃负true
-                                    if (upiObj.Shelf == upiList.Count())
-                                    {
-                                        lastnum = 2;
-                                        wms_rbline_runmode.PalletizingUPI = null;
-                                        wms_rbline_runmode.PalletizingStation = 0;
-                                    }
-
-                                }
-                                else
-                                {
-                                    SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()},琛╳ms_rbline_runmode鏃犳暟鎹� ";
+                                    SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"娌℃湁鑾峰彇鍒� LastPalletizingData 鐨勯厤缃俊鎭� ";
                                     continue;
                                 }
+                                string palletizingUPI = "";
+                                int palletizingStation = 0;
+
+                                var config_value = sysConfig.Value;
+                                if (config_value.IndexOf('|') > -1)
+                                {//鏍煎紡涓� 鍖呰鍙穦绔欑偣
+                                    var arr = config_value.Split('|');
+                                    palletizingUPI = arr[0];
+                                    palletizingStation = Convert.ToInt32(arr[1]);
+                                }
+                                else
+                                {//琛ㄧず杩樻病鏈夐厤缃� 
+                                }
+
+                                //鏌ヨ鏄惁娣锋壒
+                                if (!string.IsNullOrEmpty(palletizingUPI))
+                                {
+                                    if (upiObj.PackageCode != palletizingUPI)
+                                    {
+                                        //鍐欏叆鎶ヨ淇℃伅
+                                        await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ12_4);
+
+                                        SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()},UPI:{upiCode}鐮佸寘閮ㄤ欢娣锋壒 ";
+                                        continue;
+                                    }
+                                }
+                                //鑾峰彇鐮佸灈鐩爣浣�
+                                if (palletizingStation != 0)
+                                {
+                                    place = palletizingStation.ToString();
+                                }
+                                else
+                                {//琛ㄧず杩欐槸 鍖呯殑绗竴鍧楁澘
+                                    lastnum = 1;
+                                    palletizingUPI = upiObj.PackageCode;
+                                    if (obj.R_PalletizingStation1 == 1)
+                                    {
+                                        place = "1";
+                                    }
+                                    else if (obj.R_PalletizingStation2 == 1)
+                                    {
+                                        place = "2";
+
+                                    }
+                                    else
+                                    {
+                                        //鍐欏叆鎶ヨ淇℃伅
+                                        await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ12_6);
+
+                                        SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()},UPI:{upiCode}鏃犲彲鐢ㄧ爜鍨涚洰鏍囦綅 ";
+                                        continue;
+                                    }
+
+                                    palletizingStation = int.Parse(place);
+                                }
+                                //濡傛灉娆″簭绛変簬褰撻挶鍖呮�绘暟閲忥紝鏄惁鏈澘缃负true
+                                if (upiObj.Shelf == upiList.Count())
+                                {
+                                    lastnum = 2;
+                                    palletizingUPI = null;
+                                    palletizingStation = 0;
+                                }
+
+
                                 //鏌ヨ鏈夋病鏈夋搴忓皬浜庡綋鍓嶆搴忓苟涓旀病鏈夌爜鍨涚殑
                                 var oldupi = upiList.Where(x => x.Shelf < upiObj.Shelf && (x.UpiStatus != (int)UpiStatusEnum.宸茬爜鍨� && x.UpiStatus != (int)UpiStatusEnum.鐮佸灈涓�)).FirstOrDefault();
                                 if (oldupi != null)
@@ -220,7 +233,8 @@
 
                                 wmsDB.wms_rbline_task.Add(task);
 
-
+                                //鏇存柊閰嶇疆
+                                sysConfig.Value = palletizingUPI + "|" + palletizingStation;
 
 
                                 WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ12绔欑偣", "鐮佸寘");

--
Gitblit v1.9.3