From 157f0b8a78b200bf68ce96a163d8d59432e78283 Mon Sep 17 00:00:00 2001
From: zongzhibin <zongzhibin@weben-smart.com>
Date: 周四, 28 11月 2024 14:38:07 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/LA24030-LuLI_PackageLine

---
 CC/iWareCC_ASRS/ThreadService/05_BZ30(齐套验证)/DataProcess_ValidateQiTao.cs |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git "a/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs" "b/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs"
new file mode 100644
index 0000000..adb6ebe
--- /dev/null
+++ "b/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs"
@@ -0,0 +1,122 @@
+锘縰sing Admin.NET.Application;
+using iWareCC.Common.Helper;
+using iWareCC.StationService;
+using iWareCommon.Common.Globle;
+using iWareCommon.Utils;
+using iWareModel;
+using iWareSql.DataAccess;
+using iWareSql.DBModel;
+using iWareSql.WmsDBModel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.ServiceModel.Configuration;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using WZ.Useful.Commons;
+using XiGang.Core.Model;
+
+namespace iWareCC.ThreadService
+{
+    /// <summary>
+    /// BZ30榻愬楠岃瘉
+    /// </summary>
+    public static class DataProcess_ValidateQiTao
+    {
+        public static async void Handler()
+        {
+            var alertMsg = "";
+            LogType logType = LogType.DataProcess_ValidateQiTao;
+            while (true)
+            {
+                Thread.Sleep(2000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
+                SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = string.Empty;
+                try
+                {
+                    if (SystemValue.isAllowRuning_DataProcess_ValidateQiTao && SystemValue.isStartedModel)
+                    {
+                        var rgvLocation = StationLocationEnum.BZ39.ToString();
+
+                        using (WmsDBModel wmsDB = new WmsDBModel())
+                        {
+                            var bz30Config = wmsDB.SysConfig.Where(x => x.Code == "wms_bz30_qitao").FirstOrDefault();
+                            if (bz30Config == null)
+                            {
+                                SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"娌℃湁閰嶇疆 wms_bz30_qitao 鍊�";
+                                continue;
+                            }
+                            var configValue = bz30Config.Value;
+                            if (string.IsNullOrEmpty(configValue) || configValue.IndexOf('|') <= -1)
+                            {
+                                SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"閰嶇疆 wms_bz30_qitao 鍊納configValue}涓虹┖鎴栦笉姝g‘";
+                                continue;
+                            }
+                            var configValues = configValue.Split('|');
+                            var packageCode = configValues[0];
+                            var qitaoValue = configValues[1];//榻愬  涓嶉綈濂�
+
+                            //TODO:鎺ㄩ�佺粰PLC 鍘诲摢涓柟鍚戯紵
+                            /*
+                            using (StationServiceClient client = new StationServiceClient())
+                            {
+                                var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.鍏ュ簱妯″紡, rgvLocation);
+                                if (!res.result)
+                                {
+                                    SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 澶辫触,ChangeModeAsync 杩斿洖:{res.resMsg}";
+                                    continue;
+                                }
+                                else
+                                {
+                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 鎴愬姛,ChangeModeAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                                }
+                            }
+                            //*/
+
+
+                            //鏇存柊鍊�
+                            bz30Config.Value = "";
+                            var gahter = wmsDB.mes_package_gather.Where(x => x.PackageCode == packageCode).FirstOrDefault();
+                            if (gahter != null)
+                            {
+                                gahter.UpiStatus = (int)UpiStatusEnum.宸蹭笅绾�;
+                                gahter.AreaCode = (int)AreaCodeEnum.涓嬬嚎鍖哄煙;
+                            }
+                            var upiList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == packageCode).ToList();
+                            foreach (var item in upiList)
+                            {
+                                item.UpiStatus = (int)UpiStatusEnum.宸蹭笅绾�;
+                                item.AreaCode = (int)AreaCodeEnum.涓嬬嚎鍖哄煙;
+                                item.UpdateTime = DateTime.Now;
+                            }
+                            //鍒犻櫎闃熷垪淇℃伅
+                            var lineQueue = wmsDB.mes_package_linequeue.Where(x => x.PackageCode == packageCode).FirstOrDefault();
+                            if (lineQueue != null)
+                            {
+                                wmsDB.mes_package_linequeue.Remove(lineQueue);
+                            }
+                            //鏂板涓嬬嚎璁板綍
+                            mes_package_unline_record record = new mes_package_unline_record();
+                            record = ClassHelper.RotationMapping<mes_package_unline_record, mes_package_gather>(gahter);
+                            record.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+                            record.CreateTime = DateTime.Now;
+                            record.UpdateTime = DateTime.Now;
+                            record.OpRemark = "涓嬬嚎";
+                            wmsDB.mes_package_unline_record.Add(record);
+
+
+                            wmsDB.SaveChanges();
+                        }
+                    }
+
+                }
+                catch (Exception ex)
+                {
+                    SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao += " 鍑虹幇寮傚父:" + ex.Message + SysGloble.SPLIT_STR;
+                    Log4NetHelper.WriteErrorLog(logType, " 鍑虹幇寮傚父锛�" + ex.Message, ex);
+                }
+            }
+        }
+
+    }
+}

--
Gitblit v1.9.3