From 040a7959a61619b35a655352d523b6763250e1ea Mon Sep 17 00:00:00 2001 From: hao <1836460075@qq.com> Date: 星期四, 26 六月 2025 10:36:29 +0800 Subject: [PATCH] 来料检 --- StandardInterface/MES.Service/Dto/webApi/ErpSalesOrderDto.cs | 38 + StandardInterface/MES.Service/Dto/webApi/ErpSalesReturn.cs | 10 StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeController.cs | 272 ++++++++++ StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs | 26 + StandardInterface/MES.Service/Dto/webApi/ErpSalesOrdeDetailDto.cs | 37 + StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDetailDto.cs | 43 + StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs | 260 ++++++++++ StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDto.cs | 49 + StandardInterface/MES.Service/Modes/SalesDeliveryNoticeDetail.cs | 184 +++++++ StandardInterface/MES.Service/Dto/webApi/ErpSalesOrder.cs | 8 StandardInterface/MES.Service/Modes/SalesDeliveryNotice.cs | 235 +++++++++ StandardInterface/MES.Service/service/QC/LljService.cs | 3 StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDto.cs | 39 + StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeDetailManager.cs | 78 +++ StandardInterface/MES.Service/Dto/webApi/ErpSalesDelivery.cs | 10 StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeDetailController.cs | 169 ++++++ 16 files changed, 1,460 insertions(+), 1 deletions(-) diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesDelivery.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDelivery.cs new file mode 100644 index 0000000..a6559c8 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDelivery.cs @@ -0,0 +1,10 @@ +锘縰sing MES.Service.Modes; + +namespace MES.Service.Dto.webApi; + +public class ErpSalesDelivery +{ + public ErpSalesDeliveryDto OrderDto { get; set; } + + public List<ErpSalesDeliveryDetailDto> Items { get; set; } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDetailDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDetailDto.cs new file mode 100644 index 0000000..075c459 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDetailDto.cs @@ -0,0 +1,43 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpSalesDeliveryDetailDto +{ + public string? Type { get; set; } + public string? FMaterialId { get; set; } // 鐗╂枡缂栫爜 + public string? FMaterialName { get; set; } // 鐗╂枡鍚嶇О + public string? FMaterialModel { 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? FSrcBillNo { get; set; } // 婧愬崟缂栧彿 + public decimal? FPriceUnitQty { get; set; } // 璁′环鏁伴噺 + public string? FOwnerId { get; set; } // 璐т富 + public string? FStockUnitID { get; set; } // 搴撳瓨鍗曚綅 + public decimal? FStockQty { get; set; } // 搴撳瓨鏁伴噺 + public string? FMaterialType { get; set; } // 鐗╂枡绫诲埆 + public string? FOwnerTypeID { get; set; } // 璐т富绫诲瀷 + public string? FSrcType { get; set; } // 婧愬崟绫诲瀷 + public string? FOrderNo { get; set; } // 璁㈠崟鍗曞彿 + + public string? FOwnerIdHead { get; set; } // 璐т富 + + public string? FPlanDeliveryDate { get; set; } //璁″垝鍙戣揣鏃ユ湡 + public string? FOutLmtUnit { get; set; } // 瓒呭彂鎺у埗鍗曚綅 + public decimal? FOutMaxQty { get; set; } // 鍑哄簱涓婇檺 + public decimal? FOutMinQty { get; set; } // 鍑哄簱涓嬮檺 + public string? FDeliveryLoc { get; set; } // 浜よ揣鍦扮偣 + public string? FDeliveryLAddress { get; set; } // 浜よ揣鍦板潃 + public string? FTerminationStatus { get; set; } // 缁堟鐘舵�� + public string? FTerminateDate { get; set; } // 涓氬姟缁堟鏃ユ湡 + public decimal? FSumOutQty { get; set; } // 绱鍑哄簱鏁伴噺 + public decimal? FRemainOutQty { get; set; } // 鏈嚭搴撴暟閲� + + public string? ErpID { get; set; } // ERPID + public string? EHID { get; set; } // ERP澶碔D + public string? FEntrynote { get; set; } // 澶囨敞 + +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDto.cs new file mode 100644 index 0000000..18a1f6d --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesDeliveryDto.cs @@ -0,0 +1,49 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpSalesDeliveryDto +{ + 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? FSaleOrgId { get; set; } // 閿�鍞粍缁� + public string? FSaleDeptId { get; set; } // 閿�鍞儴闂� + public string? F_UNW_Text_KHDD { get; set; } // 瀹㈡埛璁㈠崟 + + public string? FCustomerID { get; set; } // 瀹㈡埛 + //public string? F_UNW_LargeText_TBKHBZ { get; set; } // 娣樺疂瀹㈡埛澶囨敞 + public string? FHeadDeliveryWay { get; set; } // 浜よ揣鏂瑰紡 + public string? FHeadLocId { get; set; } // 浜よ揣鍦扮偣 + public string? FCarrierID { get; set; } // 鎵胯繍鍟� + public string? FCarriageNO { get; set; } // 杩愯緭鍗曞彿 + public string? FDocumentStatus { get; set; } // 鍗曟嵁鐘舵�� + public string? FDeliveryOrgID { get; set; } // 鍙戣揣缁勭粐 + public string? FDeliveryDeptID { 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? FLinkPhone { get; set; } // 鑱旂郴鐢佃瘽 + public string? FSettleID { get; set; } // 缁撶畻鏂� + public string? FPayerID { get; set; } // 浠樻鏂� + public string? FCreatorId { get; set; } // 鍒涘缓浜� + public string? FCreateDate { get; set; } // 鍒涘缓鏃ユ湡 + public string? FModifierId { get; set; } // 鏈�鍚庝慨鏀逛汉 + public string? FModifyDate { get; set; } // 鏈�鍚庝慨鏀规棩鏈� + public string? FApproverId { get; set; } // 瀹℃牳浜� + public string? FApproveDate { get; set; } // 瀹℃牳鏃ユ湡 + public string? FCloserId { get; set; } // 鍏抽棴浜� + public string? FCloseReason { get; set; } // 鍏抽棴鍘熷洜 + public string? FBillCloseStatus { get; set; } // 鍏抽棴鐘舵�� + public string? FCancelStatus { get; set; } // 浣滃簾鐘舵�� + public string? FCancellerId { get; set; } // 浣滃簾浜� + public string? FCancelDate { get; set; } // 浣滃簾鏃ユ湡 + + +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrdeDetailDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrdeDetailDto.cs new file mode 100644 index 0000000..fc7ddc3 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrdeDetailDto.cs @@ -0,0 +1,37 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpSalesOrderDetailDto +{ + public string? FMaterialId { get; set; } // 鐗╂枡缂栫爜 + public string? FUnitID { get; set; } // 閿�鍞崟浣� + public string? FQty { get; set; } // 閿�鍞暟閲� + public string? FPriceUnitId { get; set; } // 璁′环鍗曚綅 + public string? FPriceUnitQty { get; set; } // 璁′环鏁伴噺 + public string? FDeliveryDate { get; set; } // 瑕佽揣鏃ユ湡 + public string? FIsFree { get; set; } // 鏄惁璧犲搧 + public string? FOwnerTypeId { get; set; } // 璐т富绫诲瀷 + public string? FOwnerId { get; set; } // 璐т富 + public string? FEntryNote { get; set; } // 澶囨敞 + public string? FMtoNo { get; set; } // 璁″垝璺熻釜鍙� + public string? FLot { get; set; } // 鎵瑰彿 + public string? FDeliveryMaxQty { get; set; } // 鍙戣揣涓婇檺 + public string? FDeliveryMinQty { get; set; } // 鍙戣揣涓嬮檺 + public string? FOutLmtUnitID { get; set; } // 瓒呭彂鎺у埗鍗曚綅 + public string? FMrpCloseStatus { get; set; } // 涓氬姟鍏抽棴 + public string? FMrpTerminateStatus { get; set; } // 涓氬姟缁堟 + public string? FTerminateDate { get; set; } // 缁堟鏃ユ湡 + public string? FTerminatorId { get; set; } // 缁堟浜� + public string? FSrcType { get; set; } // 婧愬崟绫诲瀷 + public string? FSrcBillNo { get; set; } // 婧愬崟鍗曞彿 + public string? FDeliQty { get; set; } // 绱鍙戣揣閫氱煡鏁伴噺 + public string? FStockOutQty { get; set; } // 绱鍑哄簱鏁伴噺 + public string? FBaseRetNoticeQty { get; set; } // 绱閫�璐ч�氱煡鏁伴噺锛堥攢鍞熀鏈級 + public string? FBaseReturnQty { get; set; } // 绱閫�璐ф暟閲忥紙閿�鍞熀鏈級 + public string? FBaseRemainOutQty { get; set; } // 鍓╀綑鏈嚭鏁伴噺锛堥攢鍞熀鏈級 + public string? FBASEARQTY { get; set; } // 绱搴旀敹鏁伴噺锛堥攢鍞熀鏈級 + public string? ErpID { get; set; } // ERPID + public string? EHID { get; set; } // ERP澶碔D + public string? FMapId { get; set; } //瀹㈡埛鐗╂枡缂栫爜 + public string? FMapName { get; set; } //瀹㈡埛鐗╂枡鍚嶇О + public string? FMapSpec { get; set; } //瀹㈡埛鐗╂枡瑙勬牸鍨嬪彿 +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrder.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrder.cs new file mode 100644 index 0000000..c9849e6 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrder.cs @@ -0,0 +1,8 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpSalesOrder +{ + public ErpSalesOrderDto OrderDto { get; set; } + + public List<ErpSalesOrderDetailDto> Items { get; set; } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrderDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrderDto.cs new file mode 100644 index 0000000..0667f3a --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpSalesOrderDto.cs @@ -0,0 +1,38 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpSalesOrderDto +{ + public string? Type { get; set; } + public string? ErpID { get; set; } // ERPID + public string? FBillNo { get; set; } // 鍗曟嵁缂栧彿 + public string? FBillTypeID { get; set; } // 鍗曟嵁绫诲瀷 + public string? FDocumentStatus { get; set; } // 鍗曟嵁鐘舵�� + public string? FDate { get; set; } // 鍗曟嵁鏃ユ湡 + public string? FBusinessType { get; set; } // 涓氬姟绫诲瀷 + public string? FHeadDeliveryWay { get; set; } // 浜よ揣鏂瑰紡 + public string? FHEADLOCID { get; set; } // 浜よ揣鍦扮偣 + public string? FCustId { get; set; } // 瀹㈡埛 + public string? FCloseStatus { get; set; } // 鍏抽棴鐘舵�� + public string? FSaleDeptId { get; set; } // 閿�鍞儴闂� + public string? FSalerId { get; set; } // 閿�鍞憳 + public string? FChangeReason { get; set; } // 鍙樻洿鍘熷洜 + public string? FNote { get; set; } // 澶囨敞 + public string? FSettleId { get; set; } // 缁撶畻鏂� + public string? FApproverId { get; set; } // 瀹℃牳浜� + public string? FLinkMan { get; set; } // 鏀惰揣浜哄鍚� + public string? FChargeId { get; set; } // 浠樻鏂� + public string? FLinkPhone { get; set; } // 鑱旂郴鐢佃瘽 + public string? FCreatorId { get; set; } // 鍒涘缓浜� + public string? FCreateDate { get; set; } // 鍒涘缓鏃ユ湡 + public string? FModifierId { get; set; } // 鏈�鍚庝慨鏀逛汉 + public string? FModifyDate { get; set; } // 鏈�鍚庝慨鏀规棩鏈� + public string? FApproveDate { get; set; } // 瀹℃牳鏃ユ湡 + public string? FCloserId { get; set; } // 鍏抽棴浜� + public string? FCloseDate { get; set; } // 鍏抽棴鏃ユ湡 + public string? FChangeDate { get; set; } // 鍙樻洿鏃ユ湡 + public string? FCancelStatus { get; set; } // 浣滃簾鐘舵�� + public string? FCancellerId { get; set; } // 浣滃簾浜� + public string? FVersionNo { get; set; } // 鐗堟湰鍙� + public string? FChangerId { get; set; } // 鍙樻洿浜� + public string? FEntryNote { get; set; } // 澶囨敞 +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturn.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturn.cs new file mode 100644 index 0000000..9a03469 --- /dev/null +++ b/StandardInterface/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/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDetailDto.cs new file mode 100644 index 0000000..06a86fa --- /dev/null +++ b/StandardInterface/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/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpSalesReturnDto.cs new file mode 100644 index 0000000..4afbbc1 --- /dev/null +++ b/StandardInterface/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/StandardInterface/MES.Service/Modes/SalesDeliveryNotice.cs b/StandardInterface/MES.Service/Modes/SalesDeliveryNotice.cs new file mode 100644 index 0000000..e5ad985 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/SalesDeliveryNotice.cs @@ -0,0 +1,235 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace MES.Service.Modes +{ + /// <summary> + /// 閿�鍞彂璐ч�氱煡鍗� + ///</summary> + [SugarTable("SALES_DELIVERY_NOTICE")] + public class SalesDeliveryNotice + { + /// <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_ORG" )] + public string? SalesOrg { get; set; } + /// <summary> + /// 閿�鍞儴闂� + ///</summary> + [SugarColumn(ColumnName="SALES_DEPT" )] + public string? SalesDept { get; set; } + /// <summary> + /// 瀹㈡埛璁㈠崟 + ///</summary> + [SugarColumn(ColumnName="CUSTOMER_ORDER_NO" )] + public string? CustomerOrderNo { get; set; } + /// <summary> + /// 瀹㈡埛 + ///</summary> + [SugarColumn(ColumnName="CUSTOMER" )] + public string? Customer { get; set; } + + /// <summary> + /// 浜よ揣鏂瑰紡 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_METHOD" )] + public string? DeliveryMethod { get; set; } + /// <summary> + /// 浜よ揣鍦扮偣 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_LOCATION" )] + public string? DeliveryLocation { get; set; } + /// <summary> + /// 鎵胯繍鍟� + ///</summary> + [SugarColumn(ColumnName="CARRIER" )] + public string? Carrier { get; set; } + /// <summary> + /// 杩愯緭鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="TRANSPORT_NO" )] + public string? TransportNo { get; set; } + /// <summary> + /// 鍗曟嵁鐘舵�� + ///</summary> + [SugarColumn(ColumnName="BILL_NO_TYPE" )] + public string? BillNoType { get; set; } + /// <summary> + /// 鍙戣揣缁勭粐 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_ORG" )] + public string? DeliveryOrg { get; set; } + /// <summary> + /// 鍙戣揣閮ㄩ棬 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_DEPT" )] + public string? DeliveryDept { 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="LINK_PHONE" )] + public string? LinkPhone { get; set; } + /// <summary> + /// 缁撶畻鏂� + ///</summary> + [SugarColumn(ColumnName="SETTLE_PARTY" )] + public string? SettleParty { get; set; } + /// <summary> + /// 浠樻鏂� + ///</summary> + [SugarColumn(ColumnName="PAYER_PARTY" )] + public string? PayerParty { 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> + /// 鏄惁鎵嬪姩鍏抽棴 + ///</summary> + [SugarColumn(ColumnName="MANUAL_CLOSE_FLAG" )] + public string? ManualCloseFlag { 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/StandardInterface/MES.Service/Modes/SalesDeliveryNoticeDetail.cs b/StandardInterface/MES.Service/Modes/SalesDeliveryNoticeDetail.cs new file mode 100644 index 0000000..6ef6d52 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/SalesDeliveryNoticeDetail.cs @@ -0,0 +1,184 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace MES.Service.Modes +{ + /// <summary> + /// 閿�鍞彂璐ч�氱煡鍗曟槑缁嗚〃 + ///</summary> + [SugarTable("SALES_DELIVERY_NOTICE_DETAIL")] + public class SalesDeliveryNoticeDetail + { + /// <summary> + /// + ///</summary> + [SugarColumn(ColumnName="ID", OracleSequenceName = "SEQ_sales", IsPrimaryKey = true)] + public decimal? Id { get; set; } + /// <summary> + /// 閿�鍞鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="SALES_ORDER_ID" )] + public string SalesOrderId { get; set; } + /// <summary> + /// 鐗╂枡缂栫爜 + ///</summary> + [SugarColumn(ColumnName="MATERIAL_ID" )] + public string MaterialId { get; set; } + /// <summary> + /// 鐗╂枡鍚嶇О + ///</summary> + [SugarColumn(ColumnName="MATERIAL_NAME" )] + public string MaterialName { get; set; } + /// <summary> + /// 鐗╂枡瑙勬牸 + ///</summary> + [SugarColumn(ColumnName="MATERIAL_SPECIFICATION" )] + public string MaterialSpecification { get; set; } + /// <summary> + /// 閿�鍞崟浣� + ///</summary> + [SugarColumn(ColumnName="SALES_UNIT_ID" )] + public string SalesUnitId { get; set; } + /// <summary> + /// 閿�鍞暟閲� + ///</summary> + [SugarColumn(ColumnName="SALES_QUANTITY" )] + public decimal? SalesQuantity { get; set; } + /// <summary> + /// 鏄惁璧犲搧 + ///</summary> + [SugarColumn(ColumnName="IS_FREE" )] + public string IsFree { get; set; } + /// <summary> + /// 瑕佽揣鏃ユ湡 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_DATE" )] + public DateTime? DeliveryDate { get; set; } + /// <summary> + /// 鍑鸿揣浠撳簱 + ///</summary> + [SugarColumn(ColumnName="WAREHOUSE" )] + public string Warehouse { get; set; } + /// <summary> + /// 璁″垝璺熻釜鍙� + ///</summary> + [SugarColumn(ColumnName="PLAN_TRACKING_NUMBER" )] + public string PlanTrackingNumber { get; set; } + /// <summary> + /// 鎵瑰彿 + ///</summary> + [SugarColumn(ColumnName="LOT_NUMBER" )] + public string LotNumber { get; set; } + /// <summary> + /// 婧愬崟缂栧彿 + ///</summary> + [SugarColumn(ColumnName="SRC_BILL_NO" )] + public string SrcBillNo { get; set; } + /// <summary> + /// 璁′环鏁伴噺 + ///</summary> + [SugarColumn(ColumnName="PRICE_QTY" )] + public decimal? PriceQty { get; set; } + /// <summary> + /// 璐т富 + ///</summary> + [SugarColumn(ColumnName="OWNER_ID" )] + public string OwnerId { get; set; } + /// <summary> + /// 搴撳瓨鍗曚綅 + ///</summary> + [SugarColumn(ColumnName="INVENTORY_UNIT" )] + public string InventoryUnit { get; set; } + /// <summary> + /// 搴撳瓨鏁伴噺 + ///</summary> + [SugarColumn(ColumnName="INVENTORY_QUANTITY" )] + public decimal? InventoryQuantity { get; set; } + /// <summary> + /// 鐗╂枡绫诲埆 + ///</summary> + [SugarColumn(ColumnName="MATERIAL_CATEGORY" )] + public string MaterialCategory { get; set; } + /// <summary> + /// 璁″垝鍙戣揣鏃ユ湡 + ///</summary> + [SugarColumn(ColumnName="PLAN_DELIVERY_DATE" )] + public DateTime? PlanDeliveryDate { get; set; } + /// <summary> + /// 瓒呭彂鎺у埗鍗曚綅 + ///</summary> + [SugarColumn(ColumnName="OUT_LMT_UNIT" )] + public string OutLmtUnit { get; set; } + /// <summary> + /// 鍑哄簱涓婇檺 + ///</summary> + [SugarColumn(ColumnName="OUT_MAX_QTY" )] + public decimal? OutMaxQty { get; set; } + /// <summary> + /// 鍑哄簱涓嬮檺 + ///</summary> + [SugarColumn(ColumnName="OUT_MIN_QTY" )] + public decimal? OutMinQty { get; set; } + /// <summary> + /// 浜よ揣鍦扮偣 + ///</summary> + [SugarColumn(ColumnName="DELIVERY_LOC" )] + public string DeliveryLoc { get; set; } + /// <summary> + /// 浜よ揣鍦板潃 + ///</summary> + [SugarColumn(ColumnName="DELIVERYL_ADDRESS" )] + public string DeliverylAddress { get; set; } + /// <summary> + /// 婧愬崟鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="SOURCE_BILL_NO" )] + public string SourceBillNo { get; set; } + /// <summary> + /// 璁㈠崟鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="ORDER_BILL_NO" )] + public string OrderBillNo { get; set; } + /// <summary> + /// 缁堟鐘舵�� + ///</summary> + [SugarColumn(ColumnName="TERMINATION_STATUS" )] + public string TerminationStatus { get; set; } + /// <summary> + /// 缁堟鏃ユ湡 + ///</summary> + [SugarColumn(ColumnName="TERMINATION_DATE" )] + public DateTime? TerminationDate { get; set; } + /// <summary> + /// 绱鍑哄簱鏁伴噺 + ///</summary> + [SugarColumn(ColumnName="SUM_OUT_QTY" )] + public decimal? SumOutQty { get; set; } + /// <summary> + /// 鏈嚭搴撴暟閲� + ///</summary> + [SugarColumn(ColumnName="REMAIN_OUT_QTY" )] + public decimal? RemainOutQty { get; set; } + /// <summary> + /// ERP琛孖D + ///</summary> + [SugarColumn(ColumnName="ERP_LINE_ID" )] + public string ErpLineId { get; set; } + /// <summary> + /// ERP澶碔D + ///</summary> + [SugarColumn(ColumnName="ERP_HEAD_ID" )] + public string ErpHeadId { get; set; } + /// <summary> + /// ERP澶碔D + ///</summary> + [SugarColumn(ColumnName = "f_UNW_Base_GDY")] + public string GDY { get; set; } + /// <summary> + /// 澶囨敞 + ///</summary> + [SugarColumn(ColumnName = "FEntrynote")] + public string NOTE { get; set; } + } +} diff --git a/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeDetailManager.cs b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeDetailManager.cs new file mode 100644 index 0000000..d083dde --- /dev/null +++ b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeDetailManager.cs @@ -0,0 +1,78 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using MES.Service.DB; +using MES.Service.Modes; + +namespace MES.Service.service +{ +public class SalesDeliveryNoticeDetailManager : Repository<SalesDeliveryNoticeDetail> +{ + + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 SalesDeliveryNoticeDetailManager.cs + + + #region 鏁欏鏂规硶 + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + + /*********鏌ヨ*********/ + + 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(), OrderByType.Asc);// 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount);//杩斿洖鎬绘暟 + + List<IConditionalModel> conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel() { FieldName= typeof(SalesDeliveryNoticeDetail).GetProperties()[0].Name, ConditionalType = ConditionalType.Equal, FieldValue = "1" });//id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom(), OrderByType.Asc); + + base.AsQueryable().Where(x => 1 == 1).ToList();//鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + + /*********鎻掑叆*********/ + var insertData = new SalesDeliveryNoticeDetail() { };//娴嬭瘯鍙傛暟 + var insertArray = new SalesDeliveryNoticeDetail[] { insertData }; + base.Insert(insertData);//鎻掑叆 + base.InsertRange(insertArray);//鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData);//鎻掑叆杩斿洖鑷鍒� + base.AsInsertable(insertData).ExecuteCommand();//鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + + /*********鏇存柊*********/ + var updateData = new SalesDeliveryNoticeDetail() { };//娴嬭瘯鍙傛暟 + var updateArray = new SalesDeliveryNoticeDetail[] { updateData };//娴嬭瘯鍙傛暟 + base.Update(updateData);//鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray);//鎵归噺鏇存柊 + //base.Update(it => new SalesDeliveryNoticeDetail() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + base.AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + + /*********鍒犻櫎*********/ + var deldata = new SalesDeliveryNoticeDetail() { };//娴嬭瘯鍙傛暟 + base.Delete(deldata);//鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1);//鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new int[] { 1,2});//鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it=>1==2);//鏍规嵁鏉′欢鍒犻櫎 + base.AsDeleteable().Where(it=>1==2).ExecuteCommand();//杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + #endregion + + + } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs new file mode 100644 index 0000000..3fc4c37 --- /dev/null +++ b/StandardInterface/MES.Service/service/BasicData/Sales/SalesDeliveryNoticeManager.cs @@ -0,0 +1,260 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using MES.Service.DB; +using MES.Service.Modes; +using MES.Service.Dto.webApi; +using MES.Service.service.BasicData; +using System.Globalization; + + + +namespace MES.Service.service +{ + public class SalesDeliveryNoticeManager : Repository<SalesDeliveryNotice> + { + + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + private readonly SalesDeliveryNoticeDetailManager _SalesDeliveryDetailManager = + new(); + //ErpSalesRerurn + public bool Save(ErpSalesDelivery SalesDelivery) + { + var erpSalesDeliveryDto = SalesDelivery.OrderDto; + var mesSalesDelivery = ConvertErpToSalesDelivery(SalesDelivery.OrderDto); + var mesSalesDeliveryDatas = ConvertErpToSalesDeliveryDetail(SalesDelivery.Items); + + return UseTransaction(db => + { + switch (erpSalesDeliveryDto.Type) + { + // case "2": + // return InsertData(db, mesSalesReturn, mesSalesReturnDatas, + // rohInErpRohIn.FBILLTYPE) + // ? 1 + // : 0; + case "3": + return UpdateData(db, mesSalesDelivery, mesSalesDeliveryDatas) ? 1 : 0; + case "2": + case "4": + return SaveOrUpdateData(db, mesSalesDelivery, mesSalesDeliveryDatas, erpSalesDeliveryDto.Type) + ? 1 + : 0; + default: + throw new NotImplementedException( + $"type娌℃湁{erpSalesDeliveryDto.Type}杩欎釜绫诲瀷"); + } + }) > 0; + } + + private bool UpdateData(SqlSugarScope db, SalesDeliveryNotice mesSalesDelivery, + List<SalesDeliveryNoticeDetail> mesSalesDeliveryDatas) + { + + // 鍏堝垽鏂� MES_INV_ITEM_OUTS 鏄惁瀛樺湪瀵瑰簲棰嗘枡璁板綍 + var hasMaterialOut = db.Queryable<MesInvItemOuts>() + .Any(x => x.WorkNo == mesSalesDelivery.BillNo); + + if (hasMaterialOut) + { + throw new Exception($"MES鏈夐鏂欒褰曪紝鍗曞彿锛歿mesSalesDelivery.BillNo}锛屼笉鑳藉垹闄わ紒"); + } + // var decimals = mesSalesDeliveryDatas.Select(s => s.Id).ToArray(); + var decimals = mesSalesDeliveryDatas + ?.Where(x => x.Id.HasValue) + .Select(x => x.Id.Value) + .ToArray() ?? new decimal[0]; + var update = true; + if (mesSalesDelivery != null) + { + if (mesSalesDelivery.Id != null) + { + update = base.DeleteById(mesSalesDelivery.Id); + } + } + var insertOrUpdate = true; + if (decimals != null && decimals.Length > 0) + { + insertOrUpdate = db.Deleteable<SalesDeliveryNoticeDetail>().In(decimals).ExecuteCommand() > 0; + } + + if (update && insertOrUpdate) + { + return true; + } + throw new NotImplementedException("鏇存柊澶辫触"); + } + + // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶 + private bool SaveOrUpdateData(SqlSugarScope db, SalesDeliveryNotice mesSalesDelivery, + List<SalesDeliveryNoticeDetail> mesSalesDeliveryDatas, string type) + { + if (mesSalesDelivery.Id != null) base.DeleteById(mesSalesDelivery.Id); + + if (mesSalesDeliveryDatas.Count > 0) + db.Deleteable<SalesDeliveryNoticeDetail>() + .Where(s => s.ErpHeadId == mesSalesDelivery.ErpId).ExecuteCommand(); + + var orUpdate = base.Insert(mesSalesDelivery); + //var baOrUpdate = _SalesDeliveryDetailManager.InsertRange(mesSalesDeliveryDatas); + foreach (var item in mesSalesDeliveryDatas) + { + _SalesDeliveryDetailManager.Insert(item); + } + + //if (orUpdate && baOrUpdate) return true; + return orUpdate; + + + throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); + } + + // 鎵归噺淇濆瓨璁板綍鐨勬柟娉� + public bool SaveList(List<ErpSalesDelivery> salesOrder) + { + var result = salesOrder.Select(Save).ToList(); + return result.All(b => b); + } + + private SalesDeliveryNotice ConvertErpToSalesDelivery( + ErpSalesDeliveryDto 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 SalesDeliveryNotice + { + BillNo = erpDto.FBillNo, + ErpId = erpDto.ErpID, + FDate = ParseDateTime(erpDto.FDate) ?? null, + BillType = erpDto.FBillTypeID, // 鍗曟嵁绫诲瀷 + Currency = erpDto.FSettleCurrld, // 缁撶畻甯佸埆 + SalesDept = erpDto.FSaleDeptId, //閿�鍞儴闂� + CustomerOrderNo = erpDto.F_UNW_Text_KHDD, //閿�鍞儴闂� + Customer = erpDto.FCustomerID, // 瀹㈡埛 + DeliveryMethod = erpDto.FHeadDeliveryWay, // 浜よ揣鏂瑰紡 + DeliveryLocation = erpDto.FHeadLocId, // 浜よ揣鍦扮偣 + Carrier = erpDto.FCarrierID, // 鎵胯繍鍟� + TransportNo = erpDto.FCarriageNO, // 杩愯緭鍗曞彿 + BillNoType = erpDto.FCarriageNO, // 鍗曟嵁鐘舵�� + DeliveryDept = erpDto.FDeliveryDeptID, // 鍙戣揣閮ㄩ棬 + InventoryGroup = erpDto.FStockerGroupId, // 搴撳瓨缁� + WarehouseManager = erpDto.FStockerId, // 浠撶鍛� + SalesGroup = erpDto.FSaleGroupId, // 閿�鍞粍 + SalesPerson = erpDto.FSalesManId,//閿�鍞憳 + Receiver = erpDto.FReceiveCusId, // 鏀惰揣鏂� + ReceiverContact = erpDto.FReceiveCusContact, // 鏀惰揣鏂硅仈绯讳汉 + ReceiverAddress = erpDto.FReceiveAddress, // 鏀惰揣鏂瑰湴鍧� + ReceiverName = erpDto.FLinkMan, // 鏀惰揣鏂瑰鍚� + LinkPhone = erpDto.FLinkPhone,//鑱旂郴鐢佃瘽 + SettleParty = erpDto.FSettleID, // 缁撶畻鏂� + PayerParty = erpDto.FPayerID,//浠樻鏂� + 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, //鍗曟嵁鐘舵�� + DeliveryOrg = erpDto.FDeliveryOrgID, //鍙戣揣缁勭粐 + SalesOrg = erpDto.FSaleOrgId //閿�鍞粍缁� + + }; + + var single = base.GetSingle(it => it.ErpId == erpDto.ErpID); + if (single != null) salesOrder.Id = single.Id; + + return salesOrder; + } + + private List<SalesDeliveryNoticeDetail> ConvertErpToSalesDeliveryDetail( + List<ErpSalesDeliveryDetailDto> erpDtoList) + + { + var salesOrderSubList = + new List<SalesDeliveryNoticeDetail>(); + + 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 SalesDeliveryNoticeDetail + { + ErpLineId = erpDto.ErpID,//ERP琛孖D + ErpHeadId = erpDto.EHID,//ERP澶碔D + MaterialId = erpDto.FMaterialId,//鐗╂枡缂栧彿 + MaterialName = erpDto.FMaterialName,// 鐗╂枡鍚嶇О + MaterialSpecification = erpDto.FMaterialModel,//瑙勬牸鍨嬪彿 + SalesUnitId = erpDto.FUnitID,//閿�鍞崟浣� + SalesQuantity = Convert.ToDecimal(erpDto.FQty),//閿�鍞暟閲� + IsFree = erpDto.FIsFree,//鏄惁璧犲搧 + DeliveryDate = ParseDateTime(erpDto.FDeliverydate),//瑕佽揣鏃ユ湡 + Warehouse = erpDto.FStockId,//鍑鸿揣浠撳簱 + PlanTrackingNumber = erpDto.FMtoNo,//璁″垝璺熻釜鍙� + LotNumber = erpDto.FLot,//鎵瑰彿 + SrcBillNo = erpDto.FSrcBillNo,//婧愬崟缂栧彿 + PriceQty = erpDto.FPriceUnitQty,//璁′环鏁伴噺 + OwnerId = erpDto.FOwnerIdHead,//璐т富 + InventoryUnit = erpDto.FStockUnitID,//搴撳瓨鍗曚綅 + InventoryQuantity = Convert.ToDecimal(erpDto.FStockQty),//搴撳瓨鏁伴噺 + //MaterialCategory = erpDto.FMaterialType,//鐗╂枡绫诲埆 + PlanDeliveryDate = ParseDateTime(erpDto.FPlanDeliveryDate),//璁″垝鍙戣揣鏃ユ湡 + OutLmtUnit = erpDto.FOutLmtUnit,//瓒呭彂鎺у埗鍗曚綅 + OutMaxQty = erpDto.FOutMaxQty,//鍑哄簱涓婇檺 + OutMinQty = erpDto.FOutMinQty,//鍑哄簱涓嬮檺 + DeliveryLoc = erpDto.FDeliveryLoc,//浜よ揣鍦扮偣 + DeliverylAddress = erpDto.FDeliveryLAddress,//浜よ揣鍦板潃 + SourceBillNo = erpDto.FSrcBillNo,//鍘熷崟鍗曞彿 + OrderBillNo = erpDto.FOrderNo,//璁㈠崟鍗曞彿 + TerminationStatus = erpDto.FTerminationStatus,//缁堟鐘舵�� + TerminationDate = ParseDateTime(erpDto.FTerminateDate),//涓氬姟缁堟鏃ユ湡 + SumOutQty = erpDto.FSumOutQty,//绱鍑哄簱鏁伴噺 + RemainOutQty = erpDto.FRemainOutQty,//鏈嚭搴撴暟閲� + NOTE = erpDto.FEntrynote//澶囨敞 + + }; + + var single = _SalesDeliveryDetailManager.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/StandardInterface/MES.Service/service/QC/LljService.cs b/StandardInterface/MES.Service/service/QC/LljService.cs index d5adec6..f396676 100644 --- a/StandardInterface/MES.Service/service/QC/LljService.cs +++ b/StandardInterface/MES.Service/service/QC/LljService.cs @@ -65,7 +65,8 @@ .Contains(queryObj.SearchValue.ToLower()) || a.ItemModel.ToLower() .Contains(queryObj.SearchValue.ToLower())) - .OrderByDescending((a, b, + // .OrderByDescending((a, b, + .OrderBy ((a, b, e, f, g, i) => a.Id) //.Select((a, b, // e, f, g, i) => new LtsLlj diff --git a/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeController.cs b/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeController.cs new file mode 100644 index 0000000..3e81528 --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeController.cs @@ -0,0 +1,272 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Dynamic; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.util; +using MES.Service.service.BasicData; +using MES.Service.Dto.webApi; +using Newtonsoft.Json; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class SalesDeliveryNoticeController : ControllerBase + { + + + + private readonly MessageCenterManager _manager = new(); + + private SalesDeliveryNoticeManager m = new SalesDeliveryNoticeManager(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "SALES_DELIVERY_NOTICE"; + + private readonly string URL = "http://localhost:10054/api/SalesDeliveryNotice/"; + + + // + [HttpPost("Save")] + public ResponseResult Save(ErpSalesDelivery 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<ErpSalesDelivery> 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); + } + } + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesDeliveryNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] SalesDeliveryNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesDeliveryNotice data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + } +} diff --git a/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeDetailController.cs b/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeDetailController.cs new file mode 100644 index 0000000..935a343 --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/BasicData/SalesDeliveryNoticeDetailController.cs @@ -0,0 +1,169 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Dynamic; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.util; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class SalesDeliveryNoticeDetailController : ControllerBase + { + + private SalesDeliveryNoticeDetailManager m = new SalesDeliveryNoticeDetailManager(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] SalesDeliveryNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity([FromBody] SalesDeliveryNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] SalesDeliveryNoticeDetail data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + } +} -- Gitblit v1.9.3