From 7e514494e595531a0517d6266823bc7f6d673831 Mon Sep 17 00:00:00 2001 From: bklLiudl <673013083@qq.com> Date: 星期四, 14 三月 2024 13:41:29 +0800 Subject: [PATCH] 呼叫小车 --- Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs | 154 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 145 insertions(+), 9 deletions(-) diff --git a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs index 34dfa59..a78bdc4 100644 --- a/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs +++ b/Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs @@ -264,7 +264,7 @@ .AndIF(!string.IsNullOrWhiteSpace(model.ProductionTime), it => it.ProductionTime >= Convert.ToDateTime(model.ProductionTime)) .AndIF(!string.IsNullOrWhiteSpace(model.InspectMark), it => it.InspectMark == model.InspectMark.Trim()) .AndIF(!string.IsNullOrWhiteSpace(model.BitBoxMark), it => it.BitBoxMark == model.BitBoxMark.Trim()) - .AndIF(!string.IsNullOrWhiteSpace(model.Origin), it => it.Origin == model.Origin.Trim()) + .AndIF(!string.IsNullOrWhiteSpace(model.Origin), it => model.Origin.Trim().Contains(it.Origin)) .And(m => m.SkuNo != "100099" && m.IsDel == "0" && m.Status == "0") .ToExpression();//娉ㄦ剰 杩欎竴鍙� 涓嶈兘灏� var total = 0; @@ -605,7 +605,7 @@ zNum = Convert.ToInt32(pack.L1Num); } - if (packLevel <= 1)//鍖呰绛夌骇灏忎簬1锛屾寜鐓�1绾ф爣绛炬墦鍗� + if (packLevel < 1)//鍖呰绛夌骇灏忎簬1锛屾寜鐓�1绾ф爣绛炬墦鍗� { throw new Exception("鍖呰淇℃伅鏈夎锛屽皬浜庝竴绾�"); } @@ -614,9 +614,9 @@ var modelList = new List<BllBoxInfo>(); var addLotNo = ""; - if (arriveQty < 0) + if (arriveQty <= 0) { - throw new Exception("鍒拌揣鏁伴噺涓嶈兘灏忎簬0!"); + throw new Exception("鍒拌揣鏁伴噺涓嶈兘灏忎簬绛変簬0!"); } Db.BeginTran(); if (packLevel == 1) @@ -681,12 +681,13 @@ { throw new Exception("褰撳墠鍗曟嵁鏄庣粏杩樻湭鐢熸垚鏍囩锛岃閫夋嫨閲嶇疆鎵规閫夐」涓衡�樻槸鈥欙紱"); } - maxLotNoStr = label.Max(a => a.LotNo); - maxBoxCode = label.Max(a => a.BoxNo); + maxLotNoStr = labelCount.Max(a => a.LotNo); + if (string.IsNullOrWhiteSpace(maxLotNoStr)) { maxLotNoStr = toDayTime.Substring(2, 6) + "0001"; } + maxBoxCode = label.Where(m => m.LotNo == maxLotNoStr).Max(a => a.BoxNo); } } @@ -846,13 +847,14 @@ { throw new Exception("褰撳墠鍗曟嵁鏄庣粏杩樻湭鐢熸垚鏍囩锛岃閫夋嫨閲嶇疆鎵规閫夐」涓衡�樻槸鈥欙紱"); } - maxCodestr2 = label.Max(a => a.LotNo); ; - maxboxcode2 = label.Max(a => a.BoxNo);//绠卞彿; - maxboxcode3 = label.Max(a => a.BoxNo3);//鏀彿; + maxCodestr2 = labelCount.Max(a => a.LotNo); ; + if (string.IsNullOrWhiteSpace(maxCodestr2)) { maxCodestr2 = toDayTime2.Substring(2, 6) + "0001"; } + maxboxcode2 = label.Where(m => m.LotNo == maxCodestr2).Max(a => a.BoxNo);//绠卞彿; + maxboxcode3 = label.Where(m => m.LotNo == maxCodestr2).Max(a => a.BoxNo3);//鏀彿; } } @@ -1590,5 +1592,139 @@ throw new Exception(e.Message); } } + + //鏍规嵁鍏ュ簱鍗曞彿杩囧幓鍗曟嵁涓嬫墍鏈夋壒娆″彿 + public List<string> GetLotNoListByAsn(string asnNo) + { + try + { + var data = new List<string>(); + var asnList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList(); + if (asnList.Count == 0) + { + throw new Exception("鏈煡璇㈠埌璇ュ崟鎹彿鐨勪俊鎭�"); + } + + foreach (var item in asnList) + { + if (string.IsNullOrWhiteSpace(item.LotNo)) + { + continue; + } + + var strList = item.LotNo.Split(";"); + foreach (var str in strList) + { + if (string.IsNullOrWhiteSpace(str)) + { + continue; + } + data.Add(str); + } + } + + return data; + } + catch (Exception e) + { + throw new Exception(e.Message); + } + } + + //鍒犻櫎鍗曟嵁涓嬪崟涓垨澶氫釜鎵规鐨勬爣绛� + public void DelLabelByAsnNo(string asnNo,string lotNo, int userId) + { + try + { + var asnList = Db.Queryable<BllArrivalNoticeDetail>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList(); + if (asnList.Count == 0) + { + throw new Exception("鏈煡璇㈠埌璇ュ崟鎹彿鐨勪俊鎭�"); + } + + Db.BeginTran(); + + //鎵规涓虹┖锛氬綋鍓嶅崟鎹笅鎵�鏈夋壒娆$殑鏍囩鍏ㄩ儴鍒犻櫎锛� 鏈夋壒娆★細浼ゅ褰撳墠鍗曟嵁涓嬪綋鍓嶆壒娆$殑鏍囩 + if (string.IsNullOrWhiteSpace(lotNo)) //鍒犻櫎鍏ㄩ儴鏍囩 + { + var labelList = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo).ToList(); + if (labelList.Count(m => m.Status != "0") >= 1) + { + throw new Exception("褰撳墠鍗曟嵁鎵规鐨勬爣绛惧凡鏈夊凡浣跨敤锛屼笉鑳藉垹闄�"); + } + + foreach (var item in asnList) + { + if (string.IsNullOrWhiteSpace(item.LotNo)) + { + continue; + } + + item.LotNo = ""; + Db.Updateable(item).ExecuteCommand(); + + } + Db.Deleteable(labelList).ExecuteCommand(); + } + else //鍒犻櫎鍥哄畾鎵规鏍囩 + { + var labelList = Db.Queryable<BllBoxInfo>().Where(m => m.IsDel == "0" && m.ASNNo == asnNo && m.LotNo == lotNo).ToList(); + if (labelList.Count(m=>m.Status != "0") >= 1 ) + { + throw new Exception("褰撳墠鍗曟嵁鎵规鐨勬爣绛惧凡鏈夊凡浣跨敤锛屼笉鑳藉垹闄�"); + } + + foreach (var item in asnList) + { + if (string.IsNullOrWhiteSpace(item.LotNo) || item.LotNo!=lotNo) + { + continue; + } + + var strList = item.LotNo.Split(";"); + var updateLotNo = ""; + foreach (var str in strList) + { + if (string.IsNullOrWhiteSpace(str) || str == lotNo) + { + continue; + } + + if (string.IsNullOrWhiteSpace(updateLotNo)) + { + updateLotNo = str; + } + else + { + updateLotNo += ";" + str; + } + + } + + item.LotNo = updateLotNo; + Db.Updateable(item).ExecuteCommand(); + + } + Db.Deleteable(labelList).ExecuteCommand(); + } + + Db.CommitTran(); + + var msg = $"鍒犻櫎浜嗗崟鎹彿锛歿asnNo}"; + if (!string.IsNullOrWhiteSpace(lotNo)) + { + msg += $"銆佹壒娆″彿锛歿lotNo}"; + } + msg += "鐨勬爣绛句俊鎭�"; + + new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鐗╂枡鏍囩", asnNo, "鍒犻櫎", msg, userId); + } + catch (Exception e) + { + Db.RollbackTran(); + throw new Exception(e.Message); + } + } + } } -- Gitblit v1.8.0