From 1be2fc056943ba8b9e62328430e15beee03e8a9f Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期一, 02 六月 2025 13:46:48 +0800 Subject: [PATCH] 1.生产补料优化 2.首检开发-v1 --- service/Warehouse/MesItemBlManager.cs | 264 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 182 insertions(+), 82 deletions(-) diff --git a/service/Warehouse/MesItemBlManager.cs b/service/Warehouse/MesItemBlManager.cs index b8f5a7a..ca78cba 100644 --- a/service/Warehouse/MesItemBlManager.cs +++ b/service/Warehouse/MesItemBlManager.cs @@ -1,6 +1,8 @@ -锘縰sing NewPdaSqlServer.DB; +锘縰sing Masuit.Tools; +using NewPdaSqlServer.DB; using NewPdaSqlServer.Dto.service; using NewPdaSqlServer.entity; +using NewPdaSqlServer.entity.Base; using NewPdaSqlServer.util; using SqlSugar; @@ -18,8 +20,9 @@ { var list = Db.Queryable<MesItemBl>() .Where(s => (s.Bl018 ?? false) == true - && (s.Bl019 ?? false) == false + //&& (s.Bl019 ?? false) == false && s.Bl008 == query.Type) + .OrderByDescending(s => s.Bl006) .Select(s => s.BlNo) .ToList(); return list; @@ -30,7 +33,7 @@ /// </summary> /// <param name="billNo">琛ユ枡鍗曞彿</param> /// <returns>琛ユ枡鍗曟槑缁嗗垪琛�</returns> - public (string bl001, List<MesItemBlDetail> item) + public ProductionPickDto GetMesItemBlDetailByBillNo( WarehouseQuery query) { @@ -39,32 +42,56 @@ // 妫�鏌ヨˉ鏂欏崟鏄惁瀛樺湪涓斾负鐢熶骇琛ユ枡绫诲瀷 var mesItemBl = Db.Queryable<MesItemBl>() - .Where(a => a.BlNo == query.billNo && a.Bl008 == query.Type) + .Where(a => a.BlNo == query.billNo && a.Bl008 == query.Type && a.Bl018 == true) .First(); if (mesItemBl == null) - throw new Exception("鍗曟嵁鍙蜂笉姝g‘锛�"); + throw new Exception("鍗曟嵁鍙蜂笉瀛樺湪鎴栨湭瀹℃牳锛�"); - if (mesItemBl.Bl019 == true) - throw new Exception("鍗曟嵁鍙峰凡瀹屾垚锛�"); + //if (mesItemBl.Bl019 == true) + // throw new Exception("鍗曟嵁鍙峰凡瀹屾垚锛�"); - // 鑾峰彇鏈畬鎴愮殑琛ユ枡鍗曟槑缁� - var blDetails = Db.Queryable<MesItemBl, MesItemBlDetail>((a, b) => - new JoinQueryInfos(JoinType.Left, a.Id == b.Mid)) - .Where((a, b) => a.BlNo == query.billNo - && (b.Bld007 ?? 0) - (b.Bld008 ?? 0) > 0) - .Select((a, b) => new MesItemBlDetail - { - Bld012 = b.Bld012, - Bld002 = b.Bld002, - Bld003 = b.Bld003, - Bld004 = b.Bld004, - Bld007 = b.Bld007, - Bld008 = b.Bld008 - }) - .ToList(); + //// 鑾峰彇鏈畬鎴愮殑琛ユ枡鍗曟槑缁� + //var blDetails = Db.Queryable<MesItemBl, MesItemBlDetail>((a, b) => + // new JoinQueryInfos(JoinType.Left, a.Id == b.Mid)) + // .Where((a, b) => a.BlNo == query.billNo + // && (b.Bld007 ?? 0) - (b.Bld008 ?? 0) > 0) + // .Select((a, b) => new MesItemBlDetail + // { + // Bld012 = b.Bld012, + // Bld002 = b.Bld002, + // Bld003 = b.Bld003, + // Bld004 = b.Bld004, + // Bld007 = b.Bld007, + // Bld008 = b.Bld008 + // }) + // .ToList(); - return (mesItemBl.Bl001, blDetails); + //return (mesItemBl.Bl001, blDetails); + var sql = string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,A.BLD007 FQty,A.BLD008 SQty,A.BLD007 - A.BLD008 DSQty, + dbo.F_QX_GETRECODEPOTSE(A.bld012) as RecoKw,D.daa001 +fROM MES_ITEM_BL_DETAIL A + LEFT JOIN MES_ITEM_BL B ON A.MID = B.ID + LEFT JOIN MES_ITEMS C ON A.bld012 = CAST(C.item_id AS VARCHAR(50)) + LEFT JOIN WOMDAA D ON B.about_guid = D.guid +WHERE B.bl_no = '{0}'", query.billNo); + + var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql); + + + var DS_list = womdabs.Where(s => s.DSQty > 0).ToList(); + + var YS_list = womdabs.Where(s => s.SQty > 0).ToList(); + + var dto = new ProductionPickDto + { + daa001 = womdabs[0].DAA001, + //PlanNo = womcaa.Caa020, + items = DS_list, + Ysitems = YS_list + }; + + return dto; } /// <summary> @@ -84,8 +111,8 @@ ScblScanBarcode( WarehouseQuery query) { - if (string.IsNullOrEmpty(query.billNo)) - throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒"); + //if (string.IsNullOrEmpty(query.billNo)) + // throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒"); if (string.IsNullOrEmpty(query.barcode)) throw new Exception("璇锋壂鎻忔潯鐮侊紒"); @@ -94,7 +121,7 @@ throw new Exception("鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒"); if (string.IsNullOrEmpty(query.blNo)) - throw new Exception("琛ユ枡鍗曞彿涓嶈兘涓虹┖锛�"); + throw new Exception("鐢宠鍗曞彿涓嶈兘涓虹┖锛�"); // 妫�楠屾槸鍚﹂噸澶嶆壂鎻� @@ -112,6 +139,10 @@ if (stockBarcode == null) throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮�,璇锋牳瀵癸紒{query.barcode}"); + + var depots = Db.Queryable<MesDepots>() + .Where(t => t.DepotId == stockBarcode.DepotId) + .First(); // 妫�鏌ヨˉ鏂欏崟鐘舵�� var mesItemBl = Db.Queryable<MesItemBl>() @@ -140,6 +171,16 @@ var quantity = (blDetail.Bld007 ?? 0) - (blDetail.Bld008 ?? 0); if (quantity == 0) throw new Exception("鐗╂枡宸叉壂鐮佸畬鎴愶紝璇锋牳瀵癸紒"); + + + if(stockBarcode.Quantity > quantity) + { + query.status = 2; + query.message = "鏉$爜搴撳瓨澶т簬闇�棰嗭紝璇锋媶鍒嗭紒"; + query.CfNum = quantity; + query.Num = stockBarcode.Quantity; + return (query, []); + } // 妫�鏌ュ伐鍗曚俊鎭� var womdaa = Db.Queryable<Womdaa>() @@ -185,13 +226,21 @@ // 寮�鍚簨鍔″鐞� var success = UseTransaction(db => { + var outNoType = ""; + if(query.Type == "鐢熶骇琛ユ枡") + { + outNoType = "SCBL(鐢熶骇琛ユ枡)"; + }else + { + outNoType = "SCCL(鐢熶骇瓒呴)"; + } // 鑾峰彇鎴栧垱寤哄嚭搴撳崟 var outId = Guid.NewGuid(); - var outNo = BillNo.GetBillNo("BL(宸ュ崟琛ユ枡)"); + var outNo = BillNo.GetBillNo(outNoType); var existingOut = db.Queryable<MesInvItemOuts>() - .Where(a => a.BbillNo == query.blNo - && a.DepotCode == womdab.Dab017 + .Where(a => a.TaskNo == query.blNo + && a.DepotId == stockBarcode.DepotId && a.OutDate.Value.Date.ToString("yyyy-MM-dd") == DateTime.Now.Date.ToString("yyyy-MM-dd") && a.BillTypeId == 200 @@ -219,8 +268,9 @@ BillTypeId = 200, TransactionNo = 209, Remark = mesItemBl.Bl007, - DepotCode = womdab.Dab017, + DepotCode = depots.DepotCode, OutPart = womdaa.Daa013, + OutType = query.Type, FType = 0, Factory = stockBarcode.Factory, Company = stockBarcode.Company, @@ -229,23 +279,25 @@ PbillNo = womdaa.Daa001, OutDate = DateTime.Now, Status = 0, - BbillNo = query.blNo + DepotId = stockBarcode.DepotId, + THORGID = stockBarcode.StockOrgId, + //BbillNo = query.billNo }).IgnoreColumns(true).ExecuteCommand(); } // 妫�鏌ュ苟鏇存柊鍑哄簱鍗曠墿鏂欐槑缁� var itemCount = db.Queryable<MesInvItemOutItems>() .Where(i => - i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId) + i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId && i.ItemOutId == outId && i.DepotId == stockBarcode.DepotsId.ToString()) .Count(); if (itemCount > 0) // 鏇存柊宸插瓨鍦ㄧ殑鐗╂枡鏄庣粏鏁伴噺 db.Updateable<MesInvItemOutItems>() .SetColumns(i => - i.Quantity == i.Quantity + stockBarcode.Quantity) + i.TlQty == i.TlQty + stockBarcode.Quantity) .Where(i => - i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId) + i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId && i.ItemOutId == outId && i.DepotId == stockBarcode.DepotsId.ToString()) .ExecuteCommand(); else // 鎻掑叆鏂扮殑鐗╂枡鏄庣粏璁板綍 @@ -255,13 +307,14 @@ ItemOutId = outId, ItemNo = blDetail.Bld002, Quantity = stockBarcode.Quantity, + TlQty = stockBarcode.Quantity, CreateBy = query.userName, CreateDate = DateTime.Now, LastupdateBy = query.userName, LastupdateDate = DateTime.Now, Factory = stockBarcode.Factory, Company = stockBarcode.Company, - DepotCode = womdab.Dab017, + DepotCode = depots.DepotCode, TaskNo = query.blNo, WorkNo = womdaa.Daa021, WorkLine = blDetail.Bld013, @@ -269,7 +322,9 @@ ErpId = womdab.Eid, ErpAutoid = womdab.Erpid, PbillNo = query.billNo, - ItemId = blDetail.Bld012 + ItemId = blDetail.Bld012, + DepotId = stockBarcode.DepotsId.ToString(), + ItemDabid = blDetail.Id, // Unit = blDetail.Bld009, // DepotId = (int)stockBarcode.DepotsId }).IgnoreColumns(true).ExecuteCommand(); @@ -288,7 +343,7 @@ CreateDate = DateTime.Now, LastupdateBy = query.userName, LastupdateDate = DateTime.Now, - DepotCode = stockBarcode.DepotsCode, + DepotCode = depots.DepotCode, DepotSectionCode = stockBarcode.DepotSectionsCode, Remark = blDetail.Bld010, Factory = stockBarcode.Factory, @@ -302,7 +357,7 @@ PbillNo = query.billNo, ItemId = blDetail.Bld012, Unit = blDetail.Bld009, - DepotId = (int)stockBarcode.DepotsId, + DepotId = (int)stockBarcode.DepotId, EbelnK3id = womdab.Eid, LineK3id = womdab.Erpid }).IgnoreColumns(true).ExecuteCommand(); @@ -313,7 +368,7 @@ Guid = Guid.NewGuid(), Status = 1, BillTypeId = 200, // p_bill_type_id - TransactionCode = "210", // p_transaction_no + TransactionCode = "209", // p_transaction_no BusinessType = -1, ItemBarcode = stockBarcode.ItemBarcode, ItemNo = stockBarcode.ItemNo, @@ -346,7 +401,7 @@ Dab020 = (it.Dab020 ?? 0) + stockBarcode.Quantity, Dab021 = (it.Dab021 ?? 0) + stockBarcode.Quantity }) - .Where(it => it.Id == womdab.Id && it.Dab003 == womdab.Dab003) + .Where(it => it.Guid == womdab.DaaGuid && it.Dab003 == womdab.Dab003) .ExecuteCommand(); // 鏇存柊琛ユ枡鍗曟槑缁嗗凡琛ユ暟閲� @@ -444,7 +499,7 @@ if (string.IsNullOrEmpty(query.barcode)) throw new Exception("璇锋壂鎻忔潯鐮侊紒"); - if (query.Num <= 0) + if ((query.Num ?? 0) <= 0) throw new Exception("璇疯緭鍏ユ纭殑鍙戞枡鏁伴噺锛�"); if (string.IsNullOrEmpty(query.blNo)) @@ -470,6 +525,16 @@ var totalQty = stockBarcode.Quantity; string newBarcode = null; + var outNoType = ""; + if (query.Type == "鐢熶骇琛ユ枡") + { + outNoType = "SCBL(鐢熶骇琛ユ枡)"; + } + else + { + outNoType = "SCCL(鐢熶骇瓒呴)"; + } + // 寮�鍚簨鍔″鐞� var success = UseTransaction(db => { @@ -482,7 +547,7 @@ .Where(s => s.Id == stockBarcode.ItemId).First(); // 鐢熸垚鏂版潯鐮佸彿 - newBarcode = BillNo.GetBillNo("TMBH(鏉$爜缂栧彿)", mesItems.ItemNo); + newBarcode = BillNo.GetBillNo("TM(鏉$爜)", mesItems.ItemNo); // 鍐欏叆鏂版潯鐮� executeCommand += db.Insertable(new MesInvItemBarcodes @@ -529,24 +594,30 @@ // 鏇存柊鍘熸潯鐮佹暟閲� executeCommand += db.Updateable<MesInvItemBarcodes>() - .SetColumns(it => it.Quantity == totalQty - query.Num) + .SetColumns(it => it.Quantity == it.Quantity - query.Num) .Where(it => it.ItemBarcode == query.barcode) .ExecuteCommand(); - // 鍒犻櫎鍘熸潯鐮佸簱瀛樿褰� - executeCommand += db.Deleteable<MesInvItemStocks>() + // 鏇存柊鍘熸潯鐮佹暟閲� + executeCommand += db.Updateable<MesInvItemStocks>() + .SetColumns(it => it.Quantity == it.Quantity - query.Num) .Where(it => it.ItemBarcode == query.barcode) .ExecuteCommand(); + + //// 鍒犻櫎鍘熸潯鐮佸簱瀛樿褰� + //executeCommand += db.Deleteable<MesInvItemStocks>() + // .Where(it => it.ItemBarcode == query.barcode) + // .ExecuteCommand(); // 鎻掑叆鍓╀綑鏉$爜鏁伴噺鐨勬柊搴撳瓨璁板綍 executeCommand += db.Insertable(new MesInvItemStocks { Guid = Guid.NewGuid(), TaskNo = stockBarcode.TaskNo, - ItemBarcode = stockBarcode.ItemBarcode, + ItemBarcode = newBarcode, ItemNo = stockBarcode.ItemNo, LotNo = stockBarcode.LotNo, - Quantity = totalQty - query.Num, + Quantity = query.Num, EpFlag = stockBarcode.EpFlag, CustomerNo = stockBarcode.CustomerNo, ItemWt = stockBarcode.ItemWt, @@ -574,7 +645,7 @@ Status = 1, BillTypeId = 200, // p_bill_type_id TransactionCode = "209", // p_transaction_no - BusinessType = -1, + BusinessType = 0, ItemBarcode = newBarcode, ItemNo = stockBarcode.ItemNo, LotNo = stockBarcode.LotNo, @@ -584,7 +655,7 @@ FromInvDepotSectionsCode = null, ToInvDepotsCode = stockBarcode.DepotsCode, ToInvDepotSectionsCode = stockBarcode.DepotSectionsCode, - Description = null, + Description = query.Type + "鎷嗗垎鐢熸垚", CreateBy = query.userName, CreateDate = DateTime.Now, LastupdateBy = query.userName, @@ -606,11 +677,11 @@ throw new Exception("鍙戞枡鏁伴噺澶т簬鏉$爜鏁�,璇锋牳瀵癸紒"); } - if (string.IsNullOrEmpty(newBarcode)) newBarcode = query.barcode; + //if (string.IsNullOrEmpty(newBarcode)) newBarcode = query.barcode; // 妫�鏌ヨˉ鏂欏崟鐘舵�� var mesItemBl = Db.Queryable<MesItemBl>() - .Where(a => a.BlNo == query.blNo && (a.Bl018 ?? false) == false) + .Where(a => a.BlNo == query.blNo && (a.Bl018 ?? false) == true) .First(); if (mesItemBl == null) @@ -661,14 +732,19 @@ it.TaskNo == query.blNo && it.ItemId == stockBarcode.ItemId) .Sum(it => it.Quantity); - if (sumQty > remainingQty) - throw new Exception( - $"鎷嗗垎鏁伴噺锛歿sumQty} 澶т簬寰呭彂鏂欐暟閲忥細{remainingQty}锛岃鏍稿锛�"); + //if (sumQty > remainingQty) + // throw new Exception( + // $"鎷嗗垎鏁伴噺锛歿sumQty} 澶т簬寰呭彂鏂欐暟閲忥細{remainingQty}锛岃鏍稿锛�"); + + + var depots = Db.Queryable<MesDepots>() + .Where(t => t.DepotId == stockBarcode.DepotId) + .First(); // 鑾峰彇鎴栧垱寤哄嚭搴撳崟 var itemOut = db.Queryable<MesInvItemOuts>() - .Where(a => a.BbillNo == query.blNo - && a.DepotCode == womdab.Dab017 + .Where(a => a.TaskNo == query.blNo + && a.DepotId == stockBarcode.DepotId && a.OutDate.Value.Date.ToString("yyyy-MM-dd") == DateTime.Now.Date.ToString("yyyy-MM-dd") && a.BillTypeId == 200 @@ -676,11 +752,13 @@ && a.Status == 0) .First(); + var outId = new Guid(); + var outNo = ""; if (itemOut == null) { // 鍒涘缓鏂扮殑鍑哄簱鍗� - var outId = Guid.NewGuid(); - var outNo = BillNo.GetBillNo("BL(宸ュ崟琛ユ枡)"); + outId = Guid.NewGuid(); + outNo = BillNo.GetBillNo(outNoType); // 鎻掑叆鍑哄簱鍗曚富琛� executeCommand += db.Insertable(new MesInvItemOuts @@ -695,7 +773,7 @@ BillTypeId = 200, TransactionNo = 209, Remark = mesItemBl.Bl007, - DepotCode = womdab.Dab017, + DepotCode = depots.DepotCode, OutPart = womdaa.Daa013, FType = 0, Factory = stockBarcode.Factory, @@ -705,15 +783,24 @@ PbillNo = womdaa.Daa001, OutDate = DateTime.Now, Status = 0, - BbillNo = query.blNo + DepotId = stockBarcode.DepotId, + THORGID = stockBarcode.StockOrgId, + OutType = query.Type, + //BbillNo = query.blNo }).IgnoreColumns(true).ExecuteCommand(); + } + else + { + outId = itemOut.Guid; + outNo = itemOut.ItemOutNo; } // 妫�鏌ユ槸鍚﹀凡瀛樺湪鍑哄簱鍗曟槑缁� var itemOutItemCount = db.Queryable<MesInvItemOutItems>() .Where(it => - it.ItemOutId == itemOut.Guid && - it.ItemId == stockBarcode.ItemId) + it.ItemOutId == outId && + it.ItemId == stockBarcode.ItemId && + it.DepotId == stockBarcode.DepotId.ToString()) .Count(); if (itemOutItemCount == 0) @@ -721,16 +808,17 @@ executeCommand += db.Insertable(new MesInvItemOutItems { Guid = Guid.NewGuid(), - ItemOutId = itemOut.Guid, + ItemOutId = outId, ItemNo = blDetail.Bld002, Quantity = query.Num, + TlQty = query.Num, CreateBy = query.userName, CreateDate = DateTime.Now, LastupdateBy = query.userName, LastupdateDate = DateTime.Now, Factory = stockBarcode.Factory, Company = stockBarcode.Company, - DepotCode = womdab.Dab017, + DepotCode = depots.DepotCode, TaskNo = query.blNo, WorkNo = womdaa.Daa021, WorkLine = blDetail.Bld013, @@ -738,24 +826,27 @@ ErpId = womdab.Eid, ErpAutoid = womdab.Erpid, PbillNo = query.billNo, - ItemId = blDetail.Bld012 + ItemId = blDetail.Bld012, + DepotId = stockBarcode.DepotId.ToString(), + ItemDabid = blDetail.Id, // Unit = blDetail.Bld009, // DepotId = (int)stockBarcode.DepotsId }).IgnoreColumns(true).ExecuteCommand(); else // 鏇存柊宸叉湁鍑哄簱鍗曟槑缁嗘暟閲� executeCommand += db.Updateable<MesInvItemOutItems>() - .SetColumns(it => it.Quantity == it.Quantity + query.Num) + .SetColumns(it => it.TlQty == (it.TlQty ?? 0) + query.Num) .Where(it => - it.ItemOutId == itemOut.Guid && - it.ItemId == stockBarcode.ItemId) + it.ItemOutId == outId && + it.ItemId == stockBarcode.ItemId && + it.DepotId == stockBarcode.DepotId.ToString()) .ExecuteCommand(); // 鎻掑叆鍑哄簱鏉$爜鏄庣粏 executeCommand += db.Insertable(new MesInvItemOutCDetails { Guid = Guid.NewGuid(), - ItemOutId = itemOut.Guid, + ItemOutId = outId, ItemBarcode = newBarcode ?? query.barcode, ItemNo = stockBarcode.ItemNo, LotNo = stockBarcode.LotNo, @@ -765,7 +856,7 @@ CreateDate = DateTime.Now, LastupdateBy = query.userName, LastupdateDate = DateTime.Now, - DepotCode = stockBarcode.DepotsCode, + DepotCode = depots.DepotCode, DepotSectionCode = stockBarcode.DepotSectionsCode, Remark = blDetail.Bld010, Factory = stockBarcode.Factory, @@ -779,7 +870,8 @@ PbillNo = query.billNo, ItemId = blDetail.Bld012, Unit = blDetail.Bld009, - DepotId = (int)stockBarcode.DepotsId + DepotId = (int)stockBarcode.DepotId, + Dabid = womdab.Guid, }).IgnoreColumns(true).ExecuteCommand(); // 鎻掑叆涓氬姟娴佹按 @@ -788,7 +880,7 @@ Guid = Guid.NewGuid(), Status = 1, BillTypeId = 200, // p_bill_type_id - TransactionCode = "210", // p_transaction_no + TransactionCode = "209", // p_transaction_no BusinessType = 1, ItemBarcode = newBarcode ?? query.barcode, ItemNo = stockBarcode.ItemNo, @@ -797,7 +889,7 @@ Quantity = query.Num, FromInvDepotsCode = stockBarcode.DepotsCode, FromInvDepotSectionsCode = stockBarcode.DepotSectionsCode, - Description = null, + Description = query.Type, CreateBy = query.userName, CreateDate = DateTime.Now, LastupdateBy = query.userName, @@ -821,8 +913,7 @@ Dab020 = (it.Dab020 ?? 0) + query.Num, // 宸插彂鏂欐暟閲� Dab021 = (it.Dab021 ?? 0) + query.Num // 宸插彂鏂欐暟閲� }) - .Where(it => it.Id == womdab.Id && it.Dab003 == womdab.Dab003) - .IgnoreColumns(true) + .Where(it => it.Guid == womdab.DaaGuid && it.Dab003 == womdab.Dab003) .ExecuteCommand(); // 鏇存柊琛ユ枡鍗曟槑缁嗗凡琛ユ暟閲� @@ -866,6 +957,13 @@ .ExecuteCommand(); if (executeCommand <= 1) throw new Exception("鏇存柊澶辫触"); + + + // 鍒涘缓 鎻掑叆鏃ュ織 + var logService = new LogService(); + var LogMsg = "[PDA]" + query.Type + "銆傛潯鐮併��" + query.barcode + "銆� 鍑哄簱鍗曞彿銆�" + outNo + "銆�"; + logService.CreateLog(db, query.userName, womdaa.Guid.ToString(), "WOMDAA", LogMsg, womdaa.Daa001); + return executeCommand; }) > 0; @@ -1101,8 +1199,8 @@ var outId = Guid.Empty; var outNo = ""; var outRecord = db.Queryable<MesInvItemOuts>() - .Where(a => a.BbillNo == query.blNo - && a.DepotCode == womdab.Dab017 + .Where(a => a.TaskNo == query.blNo + && a.DepotId == stockBarcode.DepotId && a.OutDate.Value.Date == DateTime.Now.Date && a.BillTypeId == 200 && a.TransactionNo == 210 @@ -1131,7 +1229,7 @@ OutPart = womdaa.Daa013, FType = 0, WorkNo = womdaa.Daa021, - OutType = "鐢熶骇瓒呴鍗�", + OutType = query.Type, BoardItem = womdaa.Daa002, PbillNo = womdaa.Daa001, OutDate = DateTime.Now, @@ -1171,7 +1269,8 @@ ErpId = womdab.Eid, ErpAutoid = womdab.Erpid, PbillNo = query.billNo, - ItemId = blDetail.Bld012 + ItemId = blDetail.Bld012, + DepotId = stockBarcode.DepotId.ToString(), // Unit = blDetail.Bld009, // DepotId = stockBarcode.DepotsId }).IgnoreColumns(true).ExecuteCommand(); @@ -1210,7 +1309,8 @@ PbillNo = query.billNo, ItemId = blDetail.Bld012, Unit = blDetail.Bld009, - DepotId = (int)stockBarcode.DepotsId + DepotId = (int)stockBarcode.DepotsId, + Dabid = womdab.Guid, }).IgnoreColumns(true).ExecuteCommand(); // 鎻掑叆涓氬姟娴佹按 @@ -1249,7 +1349,7 @@ Dab020 = (it.Dab020 ?? 0) + stockBarcode.Quantity, Dab023 = (it.Dab023 ?? 0) + stockBarcode.Quantity }) - .Where(it => it.Id == womdab.Id) + .Where(it => it.Guid == womdab.Guid) .ExecuteCommand(); // 鏇存柊瓒呴鍗曟槑缁� @@ -1653,7 +1753,7 @@ Dab020 = (it.Dab020 ?? 0) + stockBarcode.Quantity, Dab023 = (it.Dab023 ?? 0) + stockBarcode.Quantity }) - .Where(it => it.Id == workOrderDetail.Id) + .Where(it => it.Guid == workOrderDetail.Guid) .ExecuteCommand(); // 鏇存柊琛ユ枡鍗曟槑缁嗗凡琛ユ暟閲� -- Gitblit v1.9.3