From fbb0bc175c8788f2f6ce4202d2630b01506bff80 Mon Sep 17 00:00:00 2001 From: sjz <1240968267@qq.com> Date: 星期五, 13 六月 2025 11:40:36 +0800 Subject: [PATCH] 发货通知单新增客户编码和客户名称。生产订单添加含税单价 --- MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs | 85 +++++++++++++----------------------------- 1 files changed, 27 insertions(+), 58 deletions(-) diff --git a/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs b/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs index 3c64061..d087bb8 100644 --- a/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs +++ b/MES.Service/service/BasicData/MesDeliveryNoteBarcodeManager.cs @@ -25,24 +25,11 @@ case "6": return DeleteData(db, mesDeliveryNoteBarcode) ? 1: 0; default: - throw new ArgumentNullException( - $"type娌℃湁{barcode.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); + throw new ArgumentNullException($"type娌℃湁{barcode.Type}杩欎釜绫诲瀷鐨勫弬鏁�"); } throw new NotImplementedException("鎿嶄綔澶辫触"); }) > 0; - } - - // 鎻掑叆鏁版嵁鐨勬柟娉� - private bool InsertData(SqlSugarScope db, MesDeliveryNoteBarcode mesDeliveryNoteBarcode) - { - - if (mesDeliveryNoteBarcode.Id != null) base.DeleteById(mesDeliveryNoteBarcode.Id); - - var insert = base.Insert(mesDeliveryNoteBarcode); - - if (insert) return true; - throw new NotImplementedException("鎻掑叆澶辫触"); } // 鏇存柊鏁版嵁鐨勬柟娉� @@ -52,6 +39,32 @@ if (detect) return true; throw new NotImplementedException("鏇存柊澶辫触"); + } + + // 鍒犻櫎鏁版嵁鐨勬柟娉� + private bool DeleteBarcode(SqlSugarScope db, DelBarcode barcode) + { + var del = db.Deleteable<MesDeliveryNoteBarcode>().Where(s => s.SmallBarcode == barcode.SmallBarcode).ExecuteCommand() > 0; + + if (del) + { + return true; + } + throw new NotImplementedException("鍒犻櫎澶辫触"); + } + + public dynamic Delete(DelBarcode barcode) + { + return UseTransaction(db => + { + return DeleteBarcode(db, barcode) ? 1 : 0; + }) > 0; + } + + public dynamic DeleteList(List<DelBarcode> barcode) + { + var result = barcode.Select(Delete).ToList(); + return result.All(b => b); } // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶 @@ -70,51 +83,7 @@ { var result = barcodes.Select(Save).ToList(); return result.All(b => b); - /* var list = barcodes.Select(GetMesDeliveryNoteBarcode).ToList(); - var groupBy = list.GroupBy(s => s.Type) - .ToDictionary(g => g.Key, g => g.ToList()); - - return UseTransaction(db => - { - foreach (var barcodeGroup in groupBy) - switch (barcodeGroup.Key) - { - case "1": - if (!UpdateItemStatusBatch(db, barcodeGroup.Value, "B")) - throw new NotImplementedException("绂佺敤澶辫触"); - break; - case "2": - if (!InsertItemBatch(db, barcodeGroup.Value)) - throw new NotImplementedException("鎻掑叆澶辫触"); - break; - default: - throw new ArgumentNullException( - $"type娌℃湁{barcodeGroup.Key}杩欎釜绫诲瀷鐨勫弬鏁�"); - } - - return 1; - }) > 0; */ } - - /* private bool InsertItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList) - { - var insertRange = db.Insertable(barcodeList).ExecuteCommand(); - if (insertRange > 0) - return true; - - throw new NotImplementedException("鎻掑叆澶辫触"); - } - - private bool DeleteItemBatch(SqlSugarScope db, List<MesDeliveryNoteBarcode> barcodeList) - { - var ids = barcodeList.Select(it => it.Id).ToArray(); - var deleteByIds = db.Deleteable<MesItems>().In(ids).ExecuteCommand(); - if (deleteByIds > 0) - return true; - - throw new NotImplementedException("鍒犻櫎澶辫触"); - } */ - public MesDeliveryNoteBarcode GetMesDeliveryNoteBarcode(ErpBarcode barcode) { -- Gitblit v1.9.3