From 906a6021decf8c7b0cbd745c24d54dd114b08dfe Mon Sep 17 00:00:00 2001 From: Rodney Chen <rodney.chen@hotmail.com> Date: 星期五, 14 三月 2025 11:23:53 +0800 Subject: [PATCH] 增加咋发咋收的尸体,优化了一些已知问题 --- Tiger.Business.WMS/Transaction/Yada/Count_BIZ_U9_ASN.cs | 100 +++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 78 insertions(+), 22 deletions(-) diff --git a/Tiger.Business.WMS/Transaction/Yada/Count_BIZ_U9_ASN.cs b/Tiger.Business.WMS/Transaction/Yada/Count_BIZ_U9_ASN.cs index 775502d..69f11c8 100644 --- a/Tiger.Business.WMS/Transaction/Yada/Count_BIZ_U9_ASN.cs +++ b/Tiger.Business.WMS/Transaction/Yada/Count_BIZ_U9_ASN.cs @@ -9,17 +9,8 @@ using System.Threading.Tasks; using Tiger.Model; using Tiger.IBusiness; -using Tiger.Model.Sharetronic.Shelf; -using Tiger.Business.WMS.Sharetronic.Shelf; using Tiger.Model.MES.Yada; -using static IronPython.SQLite.PythonSQLite; -using static Community.CsharpSqlite.Sqlite3; -using Tiger.Model.Entitys.MES.Position; -using MailKit.Search; -using static IronPython.Modules._ast; using Tiger.Model.Entitys.MES.U9C; -using System.Security.Policy; -using Org.BouncyCastle.Asn1.X509; namespace Tiger.Business.WMS.Transaction { @@ -229,6 +220,7 @@ { var item = CurInvItem.Items.First(q => q.SN == qty.Code); item.QTY = qty.WhQty; + item.SUPP_LOTNO = qty.Segment7; //渚涘簲鍟嗘壒娆″彿 } action.Data.Data = CurInvItem.Items.Select(q => new { q.SN, q.QTY }); action.Data.Command = Command = "ComfirmQty"; @@ -366,12 +358,12 @@ { var order = item.TRANS_CODE; item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); - item.TRANS_CODE = item.SOURCE_CODE; - item.TRANS_NO = item.SOURCE_ORDER; - item.TRANS_LINE = item.SOURCE_LINE; item.SOURCE_CODE = ""; item.SOURCE_ORDER = ""; item.SOURCE_LINE = ""; + item.TRANS_CODE = item.SOURCE_CODE; + item.TRANS_NO = item.SOURCE_ORDER; + item.TRANS_LINE = item.SOURCE_LINE; historys.Add(new WMS_ITEM_HIS(item, $"鏉$爜[{item.SN}]鍙栨秷娓呯偣锛屾搷浣滃崟鎹甗{order}]")); } @@ -414,12 +406,13 @@ var item = await Biz.Db.Queryable<WMS_ITEM>().Where(q => q.SN == input.SN).FirstAsync(); var order = item.TRANS_CODE; item.STATUS = WMS_ITEM.STATUSs.Incoming.GetValue(); - item.TRANS_CODE = item.SOURCE_CODE; - item.TRANS_NO = item.SOURCE_ORDER; - item.TRANS_LINE = item.SOURCE_LINE; item.SOURCE_CODE = ""; item.SOURCE_ORDER = ""; item.SOURCE_LINE = ""; + item.TRANS_CODE = item.SOURCE_CODE; + item.TRANS_NO = item.SOURCE_ORDER; + item.TRANS_LINE = item.SOURCE_LINE; + //浣跨敤缁熶竴鐨勪簨鍔B瀵硅薄 var db = GetCommitDB(); var dbTran = db.UseTran(() => @@ -523,7 +516,7 @@ var orderNo = input.Data; try { - var order = await Biz.Db.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == orderNo).IncludesAllFirstLayer().FirstAsync(); + var order = await MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO == orderNo).IncludesAllFirstLayer().FirstAsync(); if (order.IsNullOrEmpty()) { action.IsSuccessed = false; @@ -559,7 +552,7 @@ aSNToRcvTransDTOs = order.Details.Select(q => new ASNToRcvTransDTO { ASNLineKey = q.ID, TransQty = new() { m_amount1 = q.QTY + q.QTY_GIFT } }).ToList(), } }; - var result = await DI.Resolve<WMS_U9C>().CreateRcvBySrcASN(iInput); + var result = await DI.Resolve<IWMS_U9C>().CreateRcvBySrcASN(iInput); if (!result.IsSuccessed) { action.IsSuccessed = false; @@ -569,20 +562,83 @@ //鏍规嵁鎺ュ彛杩斿洖鏀惰揣鍗曞崟鍙锋煡璇㈠崟鎹槑缁嗭紝骞跺垱寤烘潯鐮佹槑缁� var receipt = new BIZ_U9_RECEIPT(); - throw new NotImplementedException(); + receipt.Details = new(); + receipt.SnList = new(); + DbClient U9Cdb = Biz.DataSource["YadaU9C"].Client; + var list = U9Cdb.Queryable<mes_ReturnedDocInfo>().Where(x => x.RcvId == result.Data[0].ID.ToDouble() && x.DocNo == result.Data[0].Code).ToList(); + + if (list != null && list.Count > 0) + { + receipt.AUTH_ORG = order.AUTH_ORG; + receipt.STATUS = BIZ_U9_RECEIPT.STATUSs.InQC.GetValue(); + receipt.ORDER_NO = list.First().DocNo; + receipt.SUPP_CODE = list.First().SupplierCode; + receipt.SUPP_NAME = list.First().SupplierName; + receipt.RECEIVER = UserCode; + receipt.RECEIVE_DATE = DateTime.Now; + receipt.ASN_ID = order.ID; + receipt.ASN_NO = order.ORDER_NO; + receipt.ORDER_DATE = list.First().ModifiedOn; + receipt.HANDLED = 0; + receipt.HANDLED_DATE = DateTime.Now; + + foreach (var item in list) + { + var asnDtl = order.Details.First(q => q.ID == item.SrcASNDocLineId.ToString()); + BIZ_U9_RECEIPT_DTL receiptDt = new() + { + AUTH_ORG = receipt.AUTH_ORG, + STATUS = BIZ_U9_RECEIPT.STATUSs.InQC.GetValue(), + ORDER_NO = item.DocNo, + LINE_NO = item.DocLineNo.ToString(), + ITEM_CODE = item.ItemCode, + QTY = item.RtnFillQtyTU.ToDouble(), // mes鍗曟嵁鏁伴噺 --U9閫�琛ユ暟閲� + QTY_GIFT = asnDtl.QTY_GIFT, + ASN_ID = item.SrcASNDocId.ToString(), + ASN_NO =asnDtl.ORDER_NO, + ASN_LINE_ID = item.SrcASNDocLineId.ToString(), + ASN_LINE = asnDtl.LINE_NO, + ERP_CODE = item.ItemCode1, + }; + receipt.Details.Add(receiptDt); + } + + foreach (var sn in order.SnList) + { + var dtl = receipt.Details.First(q => q.ASN_LINE == sn.LINE_NO); + BIZ_U9_RECEIPT_SN receiptSn = new() + { + AUTH_ORG = dtl.AUTH_ORG, + ORDER_NO = dtl.ORDER_NO, + LINE_NO = dtl.LINE_NO, + SN = sn.SN, + META_SN = sn.META_SN, + ITEM_CODE = sn.ITEM_CODE, + STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(), + QTY = sn.QTY, + UNIT = sn.UNIT, + IS_OK = sn.IS_OK, + IS_IN = sn.IS_IN, + LOTNO = sn.LOTNO, + CARTON_NO = sn.CARTON_NO, + PALLET_NO = sn.PALLET_NO, + }; + receipt.SnList.Add(receiptSn); + } + } //鏇存柊搴撳瓨琛ㄤ俊鎭� - var items = Biz.Db.Queryable<WMS_ITEM>().Where(q => SqlFunc.Subqueryable<BIZ_U9_ASN_SN>().Where(s => s.SN == q.SN && s.ORDER_NO == order.ORDER_NO).Any()).ToList(); + var items = MainDB.Queryable<WMS_ITEM>().Where(q => SqlFunc.Subqueryable<BIZ_U9_ASN_SN>().Where(s => s.SN == q.SN && s.ORDER_NO == order.ORDER_NO).Any()).ToList(); var historys = new List<WMS_ITEM_HIS>(); foreach (var item in items) { item.STATUS = WMS_ITEM.STATUSs.WaitIn.GetValue(); - item.TRANS_CODE = nameof(BIZ_U9_RECEIPT); - item.TRANS_NO = receipt.ORDER_NO; - item.TRANS_LINE = receipt.SnList.First(q => q.SN == item.SN).LINE_NO; item.SOURCE_CODE = item.TRANS_CODE; item.SOURCE_ORDER = item.TRANS_NO; item.SOURCE_LINE = item.TRANS_LINE; + item.TRANS_CODE = nameof(BIZ_U9_RECEIPT); + item.TRANS_NO = receipt.ORDER_NO; + item.TRANS_LINE = receipt.SnList.First(q => q.SN == item.SN).LINE_NO; historys.Add(new WMS_ITEM_HIS(item, $"閫佽揣鍗昜{order.ORDER_NO}]鐨勬潯鐮乕{item.SN}]鐢熸垚鏀惰揣鍗昜{receipt.ORDER_NO}]锛屽緟妫�楠屽畬鎴愬悗鍙叆搴�")); } -- Gitblit v1.9.3