From 42bf1ec27f194af9e6deecd0af3179f50583ab8a Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期一, 23 六月 2025 15:32:56 +0800
Subject: [PATCH] 退货接口
---
MES.Service/Modes/SalesReturnNoticeDetail.cs | 132 +++-----
MES.Service/Dto/webApi/ErpSalesReturnDto.cs | 39 ++
MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs | 4
MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs | 26 +
MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs | 105 +++++++
MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs | 2
MES.Service/service/BasicData/SalesReturnNoticeManager.cs | 251 +++++++++++++----
MES.Service/Dto/webApi/ErpSalesReturn.cs | 10
MES.Service/Modes/Organize.cs | 2
MES.Service/Modes/SalesReturnNotice.cs | 263 +++++++++++++-----
10 files changed, 609 insertions(+), 225 deletions(-)
diff --git a/MES.Service/Dto/webApi/ErpSalesReturn.cs b/MES.Service/Dto/webApi/ErpSalesReturn.cs
new file mode 100644
index 0000000..9a03469
--- /dev/null
+++ b/MES.Service/Dto/webApi/ErpSalesReturn.cs
@@ -0,0 +1,10 @@
+锘縰sing MES.Service.Modes;
+
+namespace MES.Service.Dto.webApi;
+
+public class ErpSalesRerurn
+{
+ public ErpSalesReturnDto OrderDto { get; set; }
+
+ public List<ErpSalesReturnDetailDto> Items { get; set; }
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs b/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs
new file mode 100644
index 0000000..06a86fa
--- /dev/null
+++ b/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs
@@ -0,0 +1,26 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class ErpSalesReturnDetailDto
+{
+ public string? Type { get; set; }
+ public string? FMaterialId { get; set; } // 鐗╂枡缂栫爜
+ public string? FUnitID { get; set; } // 閿�鍞崟浣�
+ public string? FQty { get; set; } // 閿�鍞暟閲�
+ public string? FIsFree { get; set; } // 鏄惁璧犲搧
+ public string? FDeliverydate { get; set; } // 閫�璐ф棩鏈�
+ public string? FStockId { get; set; } // 浠撳簱
+ public string? FMtoNo { get; set; } // 璁″垝璺熻釜鍙�
+ public string? FLot { get; set; } // 鎵瑰彿
+ public string? FEntryDescription { get; set; } // 澶囨敞
+ public string? FRmType { get; set; } // 閫�璐х被鍨�
+ public string? FStockUnitID { get; set; } // 搴撳瓨鍗曚綅
+ public decimal? FStockQty { get; set; } // 搴撳瓨鏁伴噺
+ public string? FOwnerTypeID { get; set; } // 璐т富绫诲瀷
+ public string? FOwnerId { get; set; } // 璐т富
+ public string? FSrcType { get; set; } // 婧愬崟绫诲瀷
+ public string? FSrcBillNo { get; set; } // 婧愬崟缂栧彿
+ public string? FOrderNo { get; set; } // 璁㈠崟鍗曞彿
+ public string? ErpID { get; set; } // ERPID
+ public string? EHID { get; set; } // ERP澶碔D
+
+}
\ No newline at end of file
diff --git a/MES.Service/Dto/webApi/ErpSalesReturnDto.cs b/MES.Service/Dto/webApi/ErpSalesReturnDto.cs
new file mode 100644
index 0000000..4afbbc1
--- /dev/null
+++ b/MES.Service/Dto/webApi/ErpSalesReturnDto.cs
@@ -0,0 +1,39 @@
+锘縩amespace MES.Service.Dto.webApi;
+
+public class ErpSalesReturnDto
+{
+ public string? Type { get; set; }
+ public string? ErpID { get; set; } // ERPID
+ public string? FBillTypeID { get; set; } // 鍗曟嵁绫诲瀷
+ public string? FBillNo { get; set; } // 鍗曟嵁缂栧彿
+ public string? FDate { get; set; } // 鏃ユ湡
+ public string? FSettleCurrld { get; set; } // 缁撶畻甯佸埆
+ public string? FSaleDeptId { get; set; } // 閿�鍞儴闂�
+ public string? FRetcustId { get; set; } // 閫�璐у鎴�
+ public string? FRetcustReason { get; set; } // 閫�璐у師鍥�
+ public string? FHeadLocId { get; set; } // 浜よ揣鍦扮偣
+ public string? FRetDeptId { get; set; } // 搴撳瓨閮ㄩ棬
+ public string? FStockerGroupId { get; set; } // 搴撳瓨缁�
+ public string? FStockerId { get; set; } // 浠撶鍛�
+ public string? FSaleGroupId { get; set; } // 閿�鍞粍
+ public string? FSalesManId { get; set; } // 閿�鍞憳
+ public string? FReceiveCusId { get; set; } // 鏀惰揣鏂�
+ public string? FReceiveCusContact { get; set; } // 鏀惰揣鏂硅仈绯讳汉
+ public string? FReceiveAddress { get; set; } // 鏀惰揣鏂瑰湴鍧�
+ public string? FLinkMan { get; set; } // 鏀惰揣鏂瑰鍚�
+ public string? FSettleCusId { get; set; } // 缁撶畻鏂�
+ public string? FCreatorId { get; set; } // 鍒涘缓浜�
+ public string? FCreateDate { get; set; } // 鍒涘缓鏃ユ湡
+ public string? FModifierId { get; set; } // 鏈�鍚庝慨鏀逛汉
+ public string? FModifyDate { get; set; } // 鏈�鍚庝慨鏀规棩鏈�
+ public string? FCloserId { get; set; } // 鍏抽棴浜�
+ public string? FCloseReason { get; set; } // 鍏抽棴鍘熷洜
+ public string? FCloseDate { get; set; } // 鍏抽棴鏃ユ湡
+ public string? FApproverId { get; set; } // 瀹℃牳浜�
+ public string? FApproveDate { get; set; } // 瀹℃牳鏃ユ湡
+ public string? FCancelStatus { get; set; } // 浣滃簾鐘舵��
+ public string? FCancellerId { get; set; } // 浣滃簾浜�
+ public string? FCancelDate { get; set; } // 浣滃簾鏃ユ湡
+ public string? FBillCloseStatus { get; set; } // 鍏抽棴鐘舵��
+ public string? FDocumentStatus { get; set; } // 鍗曟嵁鐘舵��
+}
\ No newline at end of file
diff --git a/MES.Service/Modes/Organize.cs b/MES.Service/Modes/Organize.cs
index 1a6f4aa..c94bd65 100644
--- a/MES.Service/Modes/Organize.cs
+++ b/MES.Service/Modes/Organize.cs
@@ -9,7 +9,7 @@
{
/// <summary>
/// </summary>
- [SugarColumn(ColumnName = "ID")]
+ [SugarColumn(ColumnName = "ID" ,IsPrimaryKey = true)]
public decimal Id { get; set; }
/// <summary>
diff --git a/MES.Service/Modes/SalesReturnNotice.cs b/MES.Service/Modes/SalesReturnNotice.cs
index f3c462d..480458a 100644
--- a/MES.Service/Modes/SalesReturnNotice.cs
+++ b/MES.Service/Modes/SalesReturnNotice.cs
@@ -1,83 +1,184 @@
-锘縰sing SqlSugar;
-
-namespace MES.Service.Modes;
-
-/// <summary>
-/// 閿�鍞��璐ч�氱煡鍗曡〃
-/// </summary>
-[SugarTable("SALES_RETURN_NOTICE")]
-public class SalesReturnNotice
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using SqlSugar;
+namespace MES.Service.Modes
{
/// <summary>
- /// SEQ_sales
- /// </summary>
- [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales",
- IsPrimaryKey = true)]
- public decimal Id { get; set; }
-
- /// <summary>
- /// 鍒跺崟浜�
- /// </summary>
- [SugarColumn(ColumnName = "CREATED_BY")]
- public string CreatedBy { get; set; }
-
- /// <summary>
- /// 鍗曟嵁缂栧彿
- /// </summary>
- [SugarColumn(ColumnName = "DOCUMENT_ID")]
- public string DocumentId { get; set; }
-
- /// <summary>
- /// 瀹℃牳浜哄悕绉�
- /// </summary>
- [SugarColumn(ColumnName = "APPROVED_BY")]
- public string ApprovedBy { get; set; }
-
- /// <summary>
- /// 鍒跺崟/瀹℃牳鏃ユ湡
- /// </summary>
- [SugarColumn(ColumnName = "CREATED_OR_APPROVED_DATE")]
- public DateTime? CreatedOrApprovedDate { get; set; }
-
- /// <summary>
- /// 閮ㄩ棬浠g爜
- /// </summary>
- [SugarColumn(ColumnName = "DEPARTMENT_CODE")]
- public string DepartmentCode { get; set; }
-
- /// <summary>
- /// 閮ㄩ棬鍚嶇О
- /// </summary>
- [SugarColumn(ColumnName = "DEPARTMENT_NAME")]
- public string DepartmentName { get; set; }
-
- /// <summary>
- /// 璐揣鍗曚綅浠g爜
- /// </summary>
- [SugarColumn(ColumnName = "PURCHASER_CODE")]
- public string PurchaserCode { get; set; }
-
- /// <summary>
- /// 璐揣鍗曚綅鍚嶇О
- /// </summary>
- [SugarColumn(ColumnName = "PURCHASER_NAME")]
- public string PurchaserName { get; set; }
-
- /// <summary>
- /// 涓氬姟鍛樹唬鐮�
- /// </summary>
- [SugarColumn(ColumnName = "SALESPERSON_CODE")]
- public string SalespersonCode { get; set; }
-
- /// <summary>
- /// 涓氬姟鍛樺悕绉�
- /// </summary>
- [SugarColumn(ColumnName = "SALESPERSON_NAME")]
- public string SalespersonName { get; set; }
-
- /// <summary>
- /// ERPID
- /// </summary>
- [SugarColumn(ColumnName = "ERP_ID")]
- public string ErpId { get; set; }
-}
\ No newline at end of file
+ /// 閿�鍞��璐ч�氱煡鍗曡〃
+ ///</summary>
+ [SugarTable("SALES_RETURN_NOTICE")]
+ public class SalesReturnNotice
+ {
+ /// <summary>
+ ///
+ ///</summary>
+ [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", IsPrimaryKey = true)]
+ public decimal? Id { get; set; }
+ /// <summary>
+ /// 鍗曟嵁绫诲瀷
+ ///</summary>
+ [SugarColumn(ColumnName = "BILL_TYPE")]
+ public string BillType { get; set; }
+ /// <summary>
+ /// 鍗曟嵁缂栧彿
+ ///</summary>
+ [SugarColumn(ColumnName = "BILL_NO")]
+ public string BillNo { get; set; }
+ /// <summary>
+ /// 鏃ユ湡
+ ///</summary>
+ [SugarColumn(ColumnName = "F_DATE")]
+ public DateTime? FDate { get; set; }
+ /// <summary>
+ /// 缁撶畻甯佸埆
+ ///</summary>
+ [SugarColumn(ColumnName = "CURRENCY")]
+ public string Currency { get; set; }
+ /// <summary>
+ /// 閿�鍞儴闂�
+ ///</summary>
+ [SugarColumn(ColumnName = "SALES_DEPT")]
+ public string SalesDept { get; set; }
+ /// <summary>
+ /// 閫�璐у鎴�
+ ///</summary>
+ [SugarColumn(ColumnName = "RETURN_CUSTOMER")]
+ public string ReturnCustomer { get; set; }
+ /// <summary>
+ /// 閫�璐у師鍥�
+ ///</summary>
+ [SugarColumn(ColumnName = "RETURN_REASON")]
+ public string ReturnReason { get; set; }
+ /// <summary>
+ /// 浜よ揣鍦扮偣
+ ///</summary>
+ [SugarColumn(ColumnName = "DELIVERY_LOCATION")]
+ public string DeliveryLocation { get; set; }
+ /// <summary>
+ /// 搴撳瓨閮ㄩ棬
+ ///</summary>
+ [SugarColumn(ColumnName = "INVENTORY_DEPT")]
+ public string InventoryDept { get; set; }
+ /// <summary>
+ /// 搴撳瓨缁�
+ ///</summary>
+ [SugarColumn(ColumnName = "INVENTORY_GROUP")]
+ public string InventoryGroup { get; set; }
+ /// <summary>
+ /// 浠撶鍛�
+ ///</summary>
+ [SugarColumn(ColumnName = "WAREHOUSE_MANAGER")]
+ public string WarehouseManager { get; set; }
+ /// <summary>
+ /// 閿�鍞粍
+ ///</summary>
+ [SugarColumn(ColumnName = "SALES_GROUP")]
+ public string SalesGroup { get; set; }
+ /// <summary>
+ /// 閿�鍞憳
+ ///</summary>
+ [SugarColumn(ColumnName = "SALES_PERSON")]
+ public string SalesPerson { get; set; }
+ /// <summary>
+ /// 鏀惰揣鏂�
+ ///</summary>
+ [SugarColumn(ColumnName = "RECEIVER")]
+ public string Receiver { get; set; }
+ /// <summary>
+ /// 鏀惰揣鏂硅仈绯讳汉
+ ///</summary>
+ [SugarColumn(ColumnName = "RECEIVER_CONTACT")]
+ public string ReceiverContact { get; set; }
+ /// <summary>
+ /// 鏀惰揣鏂瑰湴鍧�
+ ///</summary>
+ [SugarColumn(ColumnName = "RECEIVER_ADDRESS")]
+ public string ReceiverAddress { get; set; }
+ /// <summary>
+ /// 鏀惰揣鏂瑰鍚�
+ ///</summary>
+ [SugarColumn(ColumnName = "RECEIVER_NAME")]
+ public string ReceiverName { get; set; }
+ /// <summary>
+ /// 缁撶畻鏂�
+ ///</summary>
+ [SugarColumn(ColumnName = "SETTLE_PARTY")]
+ public string SettleParty { get; set; }
+ /// <summary>
+ /// 鍒涘缓浜�
+ ///</summary>
+ [SugarColumn(ColumnName = "CREATED_BY")]
+ public string CreatedBy { get; set; }
+ /// <summary>
+ /// 鍒涘缓鏃堕棿
+ ///</summary>
+ [SugarColumn(ColumnName = "CREATED_DATE")]
+ public DateTime? CreatedDate { get; set; }
+ /// <summary>
+ /// 淇敼浜�
+ ///</summary>
+ [SugarColumn(ColumnName = "MODIFIED_BY")]
+ public string ModifiedBy { get; set; }
+ /// <summary>
+ /// 淇敼鏃堕棿
+ ///</summary>
+ [SugarColumn(ColumnName = "MODIFIED_DATE")]
+ public DateTime? ModifiedDate { get; set; }
+ /// <summary>
+ /// 鍏抽棴浜�
+ ///</summary>
+ [SugarColumn(ColumnName = "CLOSED_BY")]
+ public string ClosedBy { get; set; }
+ /// <summary>
+ /// 鍏抽棴鍘熷洜
+ ///</summary>
+ [SugarColumn(ColumnName = "CLOSE_REASON")]
+ public string CloseReason { get; set; }
+ /// <summary>
+ /// 鍏抽棴鏃ユ湡
+ ///</summary>
+ [SugarColumn(ColumnName = "CLOSE_DATE")]
+ public DateTime? CloseDate { get; set; }
+ /// <summary>
+ /// 瀹℃牳浜�
+ ///</summary>
+ [SugarColumn(ColumnName = "APPROVED_BY")]
+ public string ApprovedBy { get; set; }
+ /// <summary>
+ /// 瀹℃牳鏃ユ湡
+ ///</summary>
+ [SugarColumn(ColumnName = "APPROVED_DATE")]
+ public DateTime? ApprovedDate { get; set; }
+ /// <summary>
+ /// 浣滃簾鐘舵��
+ ///</summary>
+ [SugarColumn(ColumnName = "CANCEL_STATUS")]
+ public string CancelStatus { get; set; }
+ /// <summary>
+ /// 浣滃簾浜�
+ ///</summary>
+ [SugarColumn(ColumnName = "CANCELLED_BY")]
+ public string CancelledBy { get; set; }
+ /// <summary>
+ /// 浣滃簾鏃ユ湡
+ ///</summary>
+ [SugarColumn(ColumnName = "CANCEL_DATE")]
+ public DateTime? CancelDate { get; set; }
+ /// <summary>
+ /// 鍏抽棴鐘舵��
+ ///</summary>
+ [SugarColumn(ColumnName = "CLOSE_STATUS")]
+ public string CloseStatus { get; set; }
+ /// <summary>
+ /// ERP澶碔D
+ ///</summary>
+ [SugarColumn(ColumnName = "ERP_ID")]
+ public string ErpId { get; set; }
+ /// <summary>
+ /// 鍗曟嵁鐘舵��
+ ///</summary>
+ [SugarColumn(ColumnName = "BILL_STATUS")]
+ public string BillStatus { get; set; }
+ }
+}
diff --git a/MES.Service/Modes/SalesReturnNoticeDetail.cs b/MES.Service/Modes/SalesReturnNoticeDetail.cs
index 3d64ef4..6c92886 100644
--- a/MES.Service/Modes/SalesReturnNoticeDetail.cs
+++ b/MES.Service/Modes/SalesReturnNoticeDetail.cs
@@ -11,145 +11,121 @@
/// <summary>
/// SEQ_sales
/// </summary>
- [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales",
- IsPrimaryKey = true)]
+ [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_sales", IsPrimaryKey = true)]
public decimal Id { get; set; }
/// <summary>
- /// 鍗曟嵁琛屽彿
+ /// 鐗╂枡缂栫爜
/// </summary>
- [SugarColumn(ColumnName = "LINE_NUMBER")]
- public long? LineNumber { get; set; }
+ [SugarColumn(ColumnName = "MATERIAL_ID")]
+ public string MaterialId { get; set; }
/// <summary>
- /// 浜у搧浠g爜
+ /// 閿�鍞崟浣�
/// </summary>
- [SugarColumn(ColumnName = "PRODUCT_CODE")]
- public string ProductCode { get; set; }
+ [SugarColumn(ColumnName = "SALES_UNIT_ID")]
+ public string SalesUnitId { get; set; }
/// <summary>
- /// 浜у搧鍚嶇О
+ /// 閿�鍞暟閲�
/// </summary>
- [SugarColumn(ColumnName = "PRODUCT_NAME")]
- public string ProductName { get; set; }
+ [SugarColumn(ColumnName = "SALES_QUANTITY")]
+ public decimal SalesQuantity { get; set; }
/// <summary>
- /// 浜у搧瑙勬牸
+ /// 鏄惁璧犲搧
/// </summary>
- [SugarColumn(ColumnName = "PRODUCT_SPEC")]
- public string ProductSpec { get; set; }
+ [SugarColumn(ColumnName = "IS_FREE")]
+ public string IsFree { get; set; }
/// <summary>
- /// 閲戦
+ /// 閫�璐ф棩鏈�
/// </summary>
- [SugarColumn(ColumnName = "AMOUNT")]
- public decimal? Amount { get; set; }
+ [SugarColumn(ColumnName = "RETURN_DATE")]
+ public DateTime? ReturnDate { get; set; }
/// <summary>
- /// 鍗曚环
+ /// 浠撳簱
/// </summary>
- [SugarColumn(ColumnName = "UNIT_PRICE")]
- public decimal? UnitPrice { get; set; }
+ [SugarColumn(ColumnName = "WAREHOUSE")]
+ public string Warehouse { get; set; }
/// <summary>
- /// 鏁伴噺
+ /// 璁″垝璺熻釜鍙�
/// </summary>
- [SugarColumn(ColumnName = "QUANTITY")]
- public decimal? Quantity { get; set; }
-
- /// <summary>
- /// 鍑哄簱鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "OUT_QUANTITY")]
- public decimal? OutQuantity { get; set; }
+ [SugarColumn(ColumnName = "PLAN_TRACKING_NUMBER")]
+ public string PlanTrackingNumber { get; set; }
/// <summary>
/// 鎵瑰彿
/// </summary>
- [SugarColumn(ColumnName = "BATCH_NUMBER")]
- public string BatchNumber { get; set; }
-
- /// <summary>
- /// 閫�璐ф暟閲�
- /// </summary>
- [SugarColumn(ColumnName = "RETURN_QUANTITY")]
- public decimal? ReturnQuantity { get; set; }
-
- /// <summary>
- /// 鍙戣揣鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "DELIVERY_QUANTITY")]
- public decimal? DeliveryQuantity { get; set; }
+ [SugarColumn(ColumnName = "LOT_NUMBER")]
+ public string LotNumber { get; set; }
/// <summary>
/// 澶囨敞
/// </summary>
- [SugarColumn(ColumnName = "REMARKS")]
- public string Remarks { get; set; }
+ [SugarColumn(ColumnName = "NOTE")]
+ public string Note { get; set; }
/// <summary>
- /// 閿�鍞鍗曞崟鍙�
+ /// 閫�璐х被鍨�
/// </summary>
- [SugarColumn(ColumnName = "SALES_ORDER_ID")]
- public string SalesOrderId { get; set; }
+ [SugarColumn(ColumnName = "RETURN_TYPE")]
+ public string ReturnType { get; set; }
/// <summary>
- /// 閿�鍞鍗曞垎褰�
+ /// 搴撳瓨鍗曚綅
/// </summary>
- [SugarColumn(ColumnName = "SALES_ORDER_ENTRY")]
- public string SalesOrderEntry { get; set; }
+ [SugarColumn(ColumnName = "INVENTORY_UNIT")]
+ public string InventoryUnit { get; set; }
/// <summary>
- /// 閿�鍞鍗旾D
+ /// 搴撳瓨鏁伴噺
/// </summary>
- [SugarColumn(ColumnName = "SALES_ORDER_DETAIL_ID")]
- public string SalesOrderDetailId { get; set; }
+ [SugarColumn(ColumnName = "INVENTORY_QUANTITY")]
+ public decimal InventoryQuantity { get; set; }
/// <summary>
- /// 鍩烘湰鍗曚环
+ /// 璐т富绫诲瀷
/// </summary>
- [SugarColumn(ColumnName = "BASE_UNIT_PRICE")]
- public decimal? BaseUnitPrice { get; set; }
+ [SugarColumn(ColumnName = "OWNER_TYPE_ID")]
+ public string OwnerTypeId { get; set; }
/// <summary>
- /// 鍩烘湰鍗曚綅鏁伴噺
+ /// 璐т富
/// </summary>
- [SugarColumn(ColumnName = "BASE_UNIT_QUANTITY")]
- public decimal? BaseUnitQuantity { get; set; }
+ [SugarColumn(ColumnName = "OWNER_ID")]
+ public string OwnerId { get; set; }
/// <summary>
- /// 浠撳簱浠g爜
+ /// 婧愬崟绫诲瀷
/// </summary>
- [SugarColumn(ColumnName = "WAREHOUSE_CODE")]
- public string WarehouseCode { get; set; }
+ [SugarColumn(ColumnName = "SOURCE_BILL_TYPE")]
+ public string SourceBillType { get; set; }
/// <summary>
- /// 浠撳簱鍚嶇О
+ /// 婧愬崟鍗曞彿
/// </summary>
- [SugarColumn(ColumnName = "WAREHOUSE_NAME")]
- public string WarehouseName { get; set; }
+ [SugarColumn(ColumnName = "SOURCE_BILL_NO")]
+ public string SourceBillNo { get; set; }
/// <summary>
- /// 鍩烘湰鍗曚綅鍑哄簱鏁伴噺
+ /// 璁㈠崟鍗曞彿
/// </summary>
- [SugarColumn(ColumnName = "BASE_UNIT_OUT_QUANTITY")]
- public decimal? BaseUnitOutQuantity { get; set; }
+ [SugarColumn(ColumnName = "ORDER_BILL_NO")]
+ public string OrderBillNo { get; set; }
/// <summary>
- /// 鍗曚綅
+ /// ERP琛孖D
/// </summary>
- [SugarColumn(ColumnName = "UNIT")]
- public string Unit { get; set; }
-
- /// <summary>
- /// ERPID
- /// </summary>
- [SugarColumn(ColumnName = "ERP_ID")]
- public string ErpId { get; set; }
+ [SugarColumn(ColumnName = "ERP_LINE_ID")]
+ public string ErpLineId { get; set; }
/// <summary>
/// ERP澶碔D
/// </summary>
[SugarColumn(ColumnName = "ERP_HEAD_ID")]
public string ErpHeadId { get; set; }
+
}
\ No newline at end of file
diff --git a/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs b/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs
index 78d4c7b..961ede4 100644
--- a/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs
+++ b/MES.Service/service/BasicData/SalesReturnNoticeDetailManager.cs
@@ -5,7 +5,7 @@
namespace MES.Service.service.BasicData;
public class
- SalesReturnNoticeDetailManager : Repository<SalesReturnNoticeDetail>
+ SalesReturnDetailManager : Repository<SalesReturnNoticeDetail>
{
//褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉�
diff --git a/MES.Service/service/BasicData/SalesReturnNoticeManager.cs b/MES.Service/service/BasicData/SalesReturnNoticeManager.cs
index 206f0ea..9175278 100644
--- a/MES.Service/service/BasicData/SalesReturnNoticeManager.cs
+++ b/MES.Service/service/BasicData/SalesReturnNoticeManager.cs
@@ -1,6 +1,10 @@
锘縰sing MES.Service.DB;
+using System.Data;
+using System.Globalization;
+using MES.Service.Dto.webApi;
using MES.Service.Modes;
using SqlSugar;
+using DbType = System.Data.DbType;
namespace MES.Service.service.BasicData;
@@ -8,71 +12,194 @@
{
//褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉�
- //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 SalesReturnNoticeManager.cs
-
-
- #region 鏁欏鏂规硶
-
- /// <summary>
- /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉�
- /// </summary>
- public void Study()
+ private readonly SalesReturnDetailManager _SalesReturnDetailManager =
+ new();
+ //ErpSalesRerurn
+ public bool Save(ErpSalesRerurn SalesReturn)
{
- /*********鏌ヨ*********/
+ var erpSalesReturnDto = SalesReturn.OrderDto;
+ var mesSalesReturn = ConvertErpToSalesReturn(SalesReturn.OrderDto);
+ var mesSalesReturnDatas = ConvertErpToSalesReturnDetail(SalesReturn.Items);
- var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ
- var data2 = base.GetList(); //鏌ヨ鎵�鏈�
- var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ
- //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊
-
- var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ
- var data5 = base.GetPageList(it => 1 == 1, p);
- Console.Write(p.TotalCount); //杩斿洖鎬绘暟
-
- var data6 =
- base.GetPageList(it => 1 == 1, p,
- it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴�
- Console.Write(p.TotalCount); //杩斿洖鎬绘暟
-
- var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴�
- conModels.Add(new ConditionalModel
+ return UseTransaction(db =>
{
- FieldName = typeof(SalesReturnNotice).GetProperties()[0].Name,
- ConditionalType = ConditionalType.Equal, FieldValue = "1"
- }); //id=1
- var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom());
-
- AsQueryable().Where(x => 1 == 1)
- .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘
-
-
- /*********鎻掑叆*********/
- var insertData = new SalesReturnNotice(); //娴嬭瘯鍙傛暟
- var insertArray = new[] { insertData };
- base.Insert(insertData); //鎻掑叆
- base.InsertRange(insertArray); //鎵归噺鎻掑叆
- var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒�
- AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆
-
-
- /*********鏇存柊*********/
- var updateData = new SalesReturnNotice(); //娴嬭瘯鍙傛暟
- var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟
- base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊
- base.UpdateRange(updateArray); //鎵归噺鏇存柊
- //base.Update(it => new SalesReturnNotice() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1
- AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏�
-
-
- /*********鍒犻櫎*********/
- var deldata = new SalesReturnNotice(); //娴嬭瘯鍙傛暟
- base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎
- base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎
- base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎
- base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎
- AsDeleteable().Where(it => 1 == 2)
- .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣�
+ switch (erpSalesReturnDto.Type)
+ {
+ // case "2":
+ // return InsertData(db, mesSalesReturn, mesSalesReturnDatas,
+ // rohInErpRohIn.FBILLTYPE)
+ // ? 1
+ // : 0;
+ case "3":
+ return UpdateData(db, mesSalesReturn, mesSalesReturnDatas) ? 1 : 0;
+ case "2":
+ case "4":
+ return SaveOrUpdateData(db, mesSalesReturn, mesSalesReturnDatas, erpSalesReturnDto.Type)
+ ? 1
+ : 0;
+ default:
+ throw new NotImplementedException(
+ $"type娌℃湁{erpSalesReturnDto.Type}杩欎釜绫诲瀷");
+ }
+ }) > 0;
}
- #endregion
+ private bool UpdateData(SqlSugarScope db, SalesReturnNotice mesSalesReturn,
+ List<SalesReturnNoticeDetail> mesSalesReturnDatas)
+ {
+ var decimals = mesSalesReturnDatas.Select(s => s.Id).ToArray();
+ var update = base.DeleteById(mesSalesReturn.Id);
+ var insertOrUpdate = db
+ .Deleteable<SalesReturnNoticeDetail>().In(decimals)
+ .ExecuteCommand() > 0;
+
+ if (update && insertOrUpdate) return true;
+ throw new NotImplementedException("鏇存柊澶辫触");
+ }
+
+ // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
+ private bool SaveOrUpdateData(SqlSugarScope db, SalesReturnNotice mesSalesReturn,
+ List<SalesReturnNoticeDetail> mesSalesReturnDatas,string type)
+ {
+ if (mesSalesReturn.Id != null) base.DeleteById(mesSalesReturn.Id);
+
+ if (mesSalesReturnDatas.Count > 0)
+ db.Deleteable<SalesReturnNoticeDetail>()
+ .Where(s => s.ErpHeadId == mesSalesReturn.ErpId).ExecuteCommand();
+
+ var orUpdate = base.Insert(mesSalesReturn);
+ var baOrUpdate = _SalesReturnDetailManager.InsertRange(mesSalesReturnDatas);
+ if (orUpdate && baOrUpdate) return true;
+
+
+ throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
+ }
+
+ // 鎵归噺淇濆瓨璁板綍鐨勬柟娉�
+ public bool SaveList(List<ErpSalesRerurn> salesOrder)
+ {
+ var result = salesOrder.Select(Save).ToList();
+ return result.All(b => b);
+ }
+
+ private SalesReturnNotice ConvertErpToSalesReturn(
+ ErpSalesReturnDto erpDto)
+ {
+ DateTime parsedDate;
+
+ // 鏃堕棿鏍煎紡杞崲鍑芥暟锛孍RP鏃堕棿鏍煎紡涓� "yyyy-MM-dd HH:mm:ss"
+ DateTime? ParseDateTime(string dateStr)
+ {
+ if (DateTime.TryParseExact(dateStr, "yyyy-MM-dd HH:mm:ss",
+ CultureInfo.InvariantCulture,
+ DateTimeStyles.None,
+ out parsedDate))
+ return parsedDate;
+
+ return null; // 濡傛灉杞崲澶辫触锛岃繑鍥瀗ull
+ }
+
+ var salesOrder = new SalesReturnNotice
+ {
+ BillNo = erpDto.FBillNo,
+ ErpId = erpDto.ErpID,
+ FDate = ParseDateTime(erpDto.FDate) ?? null,
+ BillType = erpDto.FBillTypeID, // 鍗曟嵁绫诲瀷
+ Currency = erpDto.FSettleCurrld, // 缁撶畻甯佸埆
+ SalesDept = erpDto.FSaleDeptId, //閿�鍞儴闂�
+ ReturnCustomer = erpDto.FRetcustId, // 閫�璐у鎴�
+ ReturnReason = erpDto.FRetcustReason, // 閫�璐у師鍥�
+ DeliveryLocation = erpDto.FHeadLocId, // 浜よ揣鍦扮偣
+ InventoryDept = erpDto.FRetDeptId, // 搴撳瓨閮ㄩ棬
+ InventoryGroup = erpDto.FStockerGroupId, // 搴撳瓨缁�
+ WarehouseManager = erpDto.FStockerId, // 浠撶鍛�
+ SalesGroup = erpDto.FSaleGroupId, // 閿�鍞粍
+ SalesPerson = erpDto.FSalesManId,//閿�鍞憳
+ Receiver = erpDto.FReceiveCusId, // 鏀惰揣鏂�
+ ReceiverContact = erpDto.FReceiveCusContact, // 鏀惰揣鏂硅仈绯讳汉
+ ReceiverAddress = erpDto.FReceiveAddress, // 鏀惰揣鏂瑰湴鍧�
+ ReceiverName = erpDto.FLinkMan, // 鏀惰揣鏂瑰鍚�
+ SettleParty = erpDto.FSettleCusId, // 缁撶畻鏂�
+ CreatedBy = erpDto.FCreatorId, // 鍒涘缓浜�
+ CreatedDate = ParseDateTime(erpDto.FCreateDate) ?? null, // 鍒涘缓鏃堕棿
+ ModifiedBy = erpDto.FModifierId, // 淇敼浜�
+ ModifiedDate = ParseDateTime(erpDto.FModifyDate) ?? null, // 淇敼鏃堕棿
+ ClosedBy = erpDto.FCloserId, // 鍏抽棴浜�
+ CloseReason = erpDto.FCloseReason, // 鍏抽棴鍘熷洜
+ CloseDate = ParseDateTime(erpDto.FCloseDate) ?? null, // 鍏抽棴鏃ユ湡
+ ApprovedBy = erpDto.FApproverId, // 瀹℃牳浜�
+ ApprovedDate = ParseDateTime(erpDto.FApproveDate) ?? null, // 瀹℃牳鏃ユ湡
+ CancelStatus = erpDto.FCancelStatus, // 浣滃簾鐘舵��
+ CancelledBy = erpDto.FCancellerId, // 浣滃簾浜�
+ CancelDate = ParseDateTime(erpDto.FCancelDate) ?? null, // 浣滃簾鏃ユ湡
+ CloseStatus = erpDto.FBillCloseStatus, // 鍏抽棴鐘舵��
+ BillStatus = erpDto.FDocumentStatus //鍗曟嵁鐘舵��
+
+ };
+
+ var single = base.GetSingle(it => it.ErpId == erpDto.ErpID);
+ if (single != null) salesOrder.Id = single.Id;
+
+ return salesOrder;
+ }
+
+ private List<SalesReturnNoticeDetail> ConvertErpToSalesReturnDetail(
+ List<ErpSalesReturnDetailDto> erpDtoList)
+
+ {
+ var salesOrderSubList =
+ new List<SalesReturnNoticeDetail>();
+
+ DateTime parsedDate;
+ // 鏃堕棿鏍煎紡杞崲鍑芥暟锛孍RP鏃堕棿鏍煎紡涓� "yyyy-MM-dd HH:mm:ss"
+ DateTime? ParseDateTime(string dateStr)
+ {
+ if (DateTime.TryParseExact(dateStr, "yyyy-MM-dd HH:mm:ss",
+ CultureInfo.InvariantCulture,
+ DateTimeStyles.None,
+ out parsedDate))
+ return parsedDate;
+
+ return null; // 濡傛灉杞崲澶辫触锛岃繑鍥瀗ull
+ }
+
+
+
+ foreach (var erpDto in erpDtoList)
+ {
+ var salesOrderSub = new SalesReturnNoticeDetail
+ {
+ ErpLineId = erpDto.ErpID,//ERP琛孖D
+ ErpHeadId = erpDto.EHID,//ERP澶碔D
+ MaterialId = erpDto.FMaterialId,//鐗╂枡缂栧彿
+ SalesUnitId = erpDto.FUnitID,//閿�鍞崟浣�
+ SalesQuantity = Convert.ToDecimal(erpDto.FQty),//閿�鍞暟閲�
+ IsFree = erpDto.FIsFree,//鏄惁璧犲搧
+ ReturnDate = ParseDateTime(erpDto.FDeliverydate),//閫�璐ф棩鏈�
+ Warehouse = erpDto.FStockId,//浠撳簱
+ PlanTrackingNumber = erpDto.FMtoNo,//璁″垝璺熻釜鍙�
+ LotNumber = erpDto.FLot,//鎵瑰彿
+ Note = erpDto.FEntryDescription,//澶囨敞
+ ReturnType = erpDto.FRmType,//閫�璐х被鍨�
+ InventoryUnit = erpDto.FStockUnitID,//搴撳瓨鍗曚綅
+ InventoryQuantity = Convert.ToDecimal(erpDto.FStockQty),//搴撳瓨鏁伴噺
+ OwnerTypeId = erpDto.FOwnerTypeID,//璐т富绫诲瀷
+ OwnerId = erpDto.FOwnerId,//璐т富
+ SourceBillType = erpDto.FSrcType,
+ SourceBillNo = erpDto.FSrcBillNo,
+ OrderBillNo = erpDto.FOrderNo
+
+ };
+
+ var single = _SalesReturnDetailManager.GetSingle(it =>
+ it.ErpLineId == salesOrderSub.ErpLineId);
+ if (single != null) salesOrderSub.Id = single.Id;
+
+ salesOrderSubList.Add(salesOrderSub);
+ }
+
+ return salesOrderSubList;
+ }
+
+
}
\ No newline at end of file
diff --git a/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs b/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs
index 8df7421..de68b97 100644
--- a/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs
+++ b/MESApplication/Controllers/BasicData/SalesReturnNoticeController.cs
@@ -1,8 +1,11 @@
锘縰sing System.Dynamic;
+using MES.Service.Dto.webApi;
using MES.Service.Modes;
+using MES.Service.service;
using MES.Service.service.BasicData;
using MES.Service.util;
using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
namespace MESApplication.Controllers.BasicData;
@@ -10,8 +13,110 @@
[Route("api/[controller]")]
public class SalesReturnNoticeController : ControllerBase
{
+ private readonly MessageCenterManager _manager = new();
+
private readonly SalesReturnNoticeManager m = new();
+ private readonly string METHOD = "POST";
+
+ private readonly string TableName = "SALES_RETURN_NOTICE";
+
+ private readonly string URL = "http://localhost:10054/api/SalesReturnNotice/";
+
+
+ //
+ [HttpPost("Save")]
+ public ResponseResult Save(ErpSalesRerurn salesOrder)
+ {
+ var entity = new MessageCenter();
+ entity.TableName = TableName;
+ entity.Url = URL + "Save";
+ entity.Method = METHOD;
+ entity.Route = salesOrder.OrderDto.FBillNo;
+ entity.Data = JsonConvert.SerializeObject(salesOrder);
+ entity.Status = 1;
+ entity.CreateBy = "PL017";
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var save = m.Save(salesOrder);
+
+ resultInfos.tbBillList = 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("SaveList")]
+ public ResponseResult SaveList(List<ErpSalesRerurn> units)
+ {
+ var entity = new MessageCenter();
+ entity.TableName = TableName;
+ entity.Url = URL + "SaveList";
+ entity.Method = METHOD;
+ entity.Data = JsonConvert.SerializeObject(units);
+ entity.Status = 1;
+ entity.CreateBy = "PL017";
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var save = m.SaveList(units);
+ resultInfos.tbBillList = 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/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs b/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs
index 3ed35a0..e8d3092 100644
--- a/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs
+++ b/MESApplication/Controllers/BasicData/SalesReturnNoticeDetailController.cs
@@ -8,9 +8,9 @@
[ApiController]
[Route("api/[controller]")]
-public class SalesReturnNoticeDetailController : ControllerBase
+public class SalesReturnDetailController : ControllerBase
{
- private readonly SalesReturnNoticeDetailManager m = new();
+ private readonly SalesReturnDetailManager m = new();
/***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/
--
Gitblit v1.9.3