From 44fe437ed95b89a38fc78b2905073e085eeebf51 Mon Sep 17 00:00:00 2001 From: pulg <plg@Haninfo> Date: 星期日, 06 七月 2025 10:50:31 +0800 Subject: [PATCH] 1 --- HH.WCS.QingXiNongfu/process/DeviceProcess.cs | 143 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 112 insertions(+), 31 deletions(-) diff --git a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs index a391ae3..3efb1c9 100644 --- a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs +++ b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs @@ -1733,18 +1733,51 @@ 鐘舵�2 閫佺┖瀹屾垚涔嬪悗涓虹姸鎬� 鐘舵�3 婊℃墭鍙栬蛋锛岄�绌轰箣鍓嶄负鐘舵�3锛屽紑鏈洪粯璁ょ姸鎬佷篃涓虹姸鎬� */ + //3F 00 12 22 0D 0A--鏃犱换鍔′俊鍙�+ //3F 00 11 22 0D 0A--A鍙e伐浣滀俊鍙�+ //3F 00 12 21 0D 0A--B鍙d俊鍙�+ //3F 00 11 21 0D 0A--A銆丅鍙e伐浣滀俊鍙�+ + //A鍙e浣嶄俊鍙�- 3F 00 10 0D 0A + //B鍙e浣嶄俊鍙�- 3F 00 20 0D 0A if (data.Length == 4) { - if (data.Substring(1, 1) == "1") + if (data == "1122")//A鍙e伐浣滀俊鍙� { - if (BottlePEMInfoFull(plc, plc.location[0])) + if (BottlePEMInfoFullTwo(plc, plc.location[0])) { - //璁惧娌℃湁鎵樼洏锛屾垨鑰呭凡缁忔湁浠诲姟锛屼笉澶勭悊婊℃墭淇″彿锛岃繑鍥炲凡缁忓彇璐у畬鎴�- //3F 00 11 0d 0a - //PlcHelper.SendHex(plc.address, "3F00110d0a"); + } } + else if (data == "1221")//B鍙e伐浣滀俊鍙�+ { + if (BottlePEMInfoFullTwo(plc, plc.location[1])) + { + + } + } + else if (data == "1121")//B鍙e伐浣滀俊鍙�+ { + if (BottlePEMInfoFullTwo(plc, plc.location[0])) + { + + } + if (BottlePEMInfoFullTwo(plc, plc.location[1])) + { + + } + } + + //if (data.Substring(1, 1) == "1") + //{ + // if (BottlePEMInfoFull(plc, plc.location[0])) + // { + // //璁惧娌℃湁鎵樼洏锛屾垨鑰呭凡缁忔湁浠诲姟锛屼笉澶勭悊婊℃墭淇″彿锛岃繑鍥炲凡缁忓彇璐у畬鎴�+ // //3F 00 11 0d 0a + // //PlcHelper.SendHex(plc.address, "3F00110d0a"); + // } + //} //else if (data.Substring(1, 1) == "3") //{ // if (BottleCapInfoEmpty(plc, plc.location[0])) @@ -1753,13 +1786,13 @@ // } //} - if (data.Substring(3, 1) == "1") - { - if (BottlePEMInfoFull(plc, plc.location[1])) - { - //PlcHelper.SendHex(plc.address, "3F00210d0a"); - } - } + //if (data.Substring(3, 1) == "1") + //{ + // if (BottlePEMInfoFull(plc, plc.location[1])) + // { + // //PlcHelper.SendHex(plc.address, "3F00210d0a"); + // } + //} //else if (data.Substring(3, 1) == "3") //{ // if (BottleCapInfoEmpty(plc, plc.location[1])) @@ -1962,6 +1995,54 @@ } } } + } + } + private static object locko = new object(); + + static bool BottlePEMInfoFullTwo(Settings.deviceInfo plc, string location) + { + + + try + { + lock (locko) + { + var chi = new SqlHelper<object>().GetInstance(); + var newDb = chi.CopyNew(); + Location endBit = null; + if (location == "") + { + throw new Exception("璐т綅涓虹┖"); + } + var workOrder = WCSHelper.GetWorkOrder(plc.deviceName); + if (workOrder == null) + { + throw new Exception("娌℃湁銆愭墽琛屼腑銆戠殑宸ュ崟"); + } + if (workOrder.SQL_UsingNow == "Y")//鍗充骇鍗崇敤 + { + //鏌ヨ 鍗婃垚鍝佸尯鍩熻〃 BcpQyOrder + + } + else//闈炲嵆浜у嵆鐢�+ { + + } + if (endBit != null) + { + var _ctrl = LocationHelper.GetLocCntrRel(location); + int endLayer = endBit.N_CURRENT_NUM + 1; + var carryCntrs = new List<string> { _ctrl.FirstOrDefault().S_CNTR_CODE };//DateTime.Now.ToString("yyMMddHHmmss") }; + var bb = TaskProcess.CreateTransport(workOrder.SQL_WorkNo, location, endBit.S_LOC_CODE, "婊$摱鍧�鍏ュ簱", carryCntrs, 1, endLayer, carryCntrs.Count, plc.taskPri); + } + return true; + } + + } + catch (Exception ex) + { + LogHelper.Info(plc.deviceName + $" 鎶ラ敊: {ex.Message}"); + return false; } } @@ -2720,7 +2801,6 @@ //灏辨煡鐪嬫湁娌℃湁绌虹殑鎺掍簡銆� //if (endBit != null) /// 瀵绘壘鏈弧鎺掞紝 鐩存帴杩斿洖缁撴灉銆� return endBit; - //LogHelper.Info(" _tempList over锛�); //杩欓噷寮� 瀵绘壘绌烘帓 Empty: @@ -3491,26 +3571,27 @@ } if (endBit == null && _tempList.Any()) { - LogHelper.Info(" ar_RplaceRow over锛�); - var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "鎶ュ簾");//.Select(x => x.N_ROW).Distinct(); - //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "鏃�).Select(x => x.N_ROW).Distinct(); - IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "鍏ュ簱閿�鍑哄簱閿�.Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct(); - LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1)); //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1)); - var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct(); - LogHelper.Info(" 鏈夎揣鎺掞細 - " + JsonConvert.SerializeObject(ar_RplaceRow2)); - var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW); + LogHelper.Info(" ar_RplaceRow over锛� + JsonConvert.SerializeObject(_tempList.Select(x => x.N_ROW).Distinct())); + //var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "鎶ュ簾");//.Select(x => x.N_ROW).Distinct(); + // //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "鏃�).Select(x => x.N_ROW).Distinct(); + //IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "鍏ュ簱閿�鍑哄簱閿�.Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct(); + //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1)); //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1)); + //var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct(); + //LogHelper.Info(" 鏈夎揣鎺掞細 - " + JsonConvert.SerializeObject(ar_RplaceRow2)); + //var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW); - var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct(); + //var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct(); - if (ar_RplaceRow.Any()) - { - LogHelper.Info("鎺掗櫎闈炵┖鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow)); - _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW)); - } - if (_tempList.Any())//涓変釜搴撳尯鐨勪氦闆嗙┖鎺�- { - endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault(); - } + //if (ar_RplaceRow.Any()) + //{ + // LogHelper.Info("鎺掗櫎闈炵┖鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow)); + // _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW)); + //} + //if (_tempList.Any())//涓変釜搴撳尯鐨勪氦闆嗙┖鎺�+ //{ + // endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault(); + //} + endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault(); } #endregion -- Gitblit v1.9.1