From 4da2d52d803ff7da2651289b9283652cc3e9cdfc Mon Sep 17 00:00:00 2001
From: sjz <1240968267@qq.com>
Date: 星期二, 13 五月 2025 10:20:13 +0800
Subject: [PATCH] 送货单条码根据送货单号删除
---
StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs | 26 +++++++++++++
StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteController.cs | 1
StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs | 86 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 113 insertions(+), 0 deletions(-)
diff --git a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
index 782124d..072a2d0 100644
--- a/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
+++ b/StandardInterface/MES.Service/service/SRM/MesDeliveryNoteBarcodeManager.cs
@@ -36,6 +36,20 @@
return result.All(b => b);
}
+ public dynamic DeleteByNo(ErpDelivery delivery)
+ {
+ return UseTransaction(db =>
+ {
+ return DeleteDataByShd(db, delivery) ? 1 : 0;
+ }) > 0;
+ }
+
+ public dynamic DeleteListByNo(List<ErpDelivery> delivery)
+ {
+ var result = delivery.Select(DeleteByNo).ToList();
+ return result.All(b => b);
+ }
+
// 鍒犻櫎鏁版嵁鐨勬柟娉�
private bool DeleteData(SqlSugarScope db, ErpBarcode barcode)
{
@@ -47,6 +61,18 @@
throw new NotImplementedException("鍒犻櫎澶辫触");
}
+ // 鍒犻櫎鏁版嵁鐨勬柟娉�
+ private bool DeleteDataByShd(SqlSugarScope db, ErpDelivery delivery)
+ {
+ var del = db.Deleteable<MesDeliveryNoteBarcode>().Where(s => s.DeliveryNo == delivery.DeliveryNo).ExecuteCommand() > 0;
+
+ if (del)
+ {
+ return true;
+ }
+ throw new NotImplementedException("鍒犻櫎澶辫触");
+ }
+
// 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
private bool SaveOrUpdateData(SqlSugarScope db, MesDeliveryNoteBarcode mesDeliveryBarcode)
{
diff --git a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
index 0510f0f..6b195ec 100644
--- a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
+++ b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteBarcodeController.cs
@@ -198,5 +198,91 @@
}
}
+ [HttpPost("DeleteByNo")]
+ public ResponseResult DeleteByNo(ErpDelivery delivery)
+ {
+ var entity = new MessageCenter();
+ entity.TableName = TableName;
+ entity.Url = URL + "DeleteByNo";
+ entity.Method = METHOD;
+ entity.Data = JsonConvert.SerializeObject(delivery);
+ entity.Status = 1;
+ entity.CreateBy = "PL017";
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var save = m.DeleteByNo(delivery);
+ resultInfos = save;
+
+ entity.Result = 0;
+ if (save) entity.Result = 1;
+
+ entity.DealWith = 1;
+ _manager.save(entity);
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ entity.Result = 0;
+
+ entity.DealWith = 0;
+
+ entity.ResultData = ex.Message;
+
+ _manager.save(entity);
+
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("DeleteListByNo")]
+ public ResponseResult DeleteListByNo(List<ErpDelivery> delivery)
+ {
+ var entity = new MessageCenter();
+ entity.TableName = TableName;
+ entity.Url = URL + "DeleteListByNo";
+ entity.Method = METHOD;
+ entity.Data = JsonConvert.SerializeObject(delivery);
+ entity.Status = 1;
+ entity.CreateBy = "PL017";
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var save = m.DeleteListByNo(delivery);
+ resultInfos= save;
+
+ entity.Result = 0;
+ if (save) entity.Result = 1;
+
+ entity.DealWith = 1;
+ _manager.save(entity);
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ entity.Result = 0;
+
+ entity.DealWith = 0;
+
+ entity.ResultData = ex.Message;
+
+ _manager.save(entity);
+
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
}
diff --git a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteController.cs b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteController.cs
index 7b65c38..6fff745 100644
--- a/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteController.cs
+++ b/StandardInterface/MESApplication/Controllers/SRM/MesDeliveryNoteController.cs
@@ -192,4 +192,5 @@
return ResponseResult.ResponseError(ex);
}
}
+
}
\ No newline at end of file
--
Gitblit v1.9.3