From 12e2d0e41d52f36d0746118e24b3fed228f92f98 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期三, 18 十二月 2024 08:58:41 +0800 Subject: [PATCH] WMS --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs | 89 +++++++++++++++++++++++++++++--------------- 1 files changed, 58 insertions(+), 31 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" index 3a1f79d..4fd4a00 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" @@ -1,16 +1,24 @@ 锘縰sing Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using WIDESEA_Common.CommonEnum; +using WIDESEA_Common.MaterielEnum; using WIDESEA_Common.OrderEnum; using WIDESEA_Core; using WIDESEA_Core.Attributes; using WIDESEA_Core.Helper; using WIDESEA_DTO; using WIDESEA_DTO.Basic; +using WIDESEA_DTO.ERP; using WIDESEA_External.ERPService; +using WIDESEA_IBasicRepository; +using WIDESEA_IBasicService; using WIDESEA_IInboundRepository; using WIDESEA_IInboundService; +using WIDESEA_IOutboundService; using WIDESEA_Model.Models; +using static WIDESEA_DTO.ErpResponseContent; namespace WIDESEA_WMSServer.Controllers.ERP { @@ -20,50 +28,69 @@ { private readonly IPurchaseOrderRepository _purchaseOrderRepository; private readonly IPurchaseOrderService _purchaseOrderService; + private readonly ISupplierInfoService _supplierInfoService; + private readonly IMaterielInfoService _materielInfoService; + private readonly IOutboundOrderService _outboundOrderService; - public ErpController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService) + public ErpController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService, ISupplierInfoService supplierInfoService, IMaterielInfoService materielInfoService, IOutboundOrderService outboundOrderService) { _purchaseOrderRepository = purchaseOrderRepository; _purchaseOrderService = purchaseOrderService; + _supplierInfoService = supplierInfoService; + _materielInfoService = materielInfoService; + _outboundOrderService = outboundOrderService; } - [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous, MethodParamsValidate] - public WebResponseContent ReceivePurchaseOrder([FromBody] Dt_PurchaseOrder model) + /// <summary> + /// 鎺ユ敹ERP閲囪喘鍗曚俊鎭� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceivePurchaseOrderSingle"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceivePurchaseOrder([FromBody] Root<PurchaseOrderModel> model) { - try - { - _purchaseOrderRepository.AddData(model, x => x.Details); - - foreach (var item in model.Details) - { - Dt_ReceiveOrder receiveOrder = new Dt_ReceiveOrder() - { - ReceiveOrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(), - WarehouseId = item.WarehouseId, - SuppliersId = model.SupplierCode, - ReceiveOrderType = InOrderTypeEnum.Purchase.ObjToInt(), - ReceiveDate = DateTime.Now, - }; - } - - return WebResponseContent.Instance.OK(); - } - catch (Exception ex) - { - return WebResponseContent.Instance.Error(ex.Message); - } + WebResponseContent content = _purchaseOrderService.ReceivePurchaseOrder(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); } - public WebResponseContent ReceivePurchaseOrderSingle(PurchaseOrderModel model) + /// <summary> + /// 鎺ユ敹ERP渚涘簲鍟嗕俊鎭� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveSupplier"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveSupplier([FromBody] Root<SupplierDTO> model) { - return _purchaseOrderService.ReceivePurchaseOrderSingle(model); + WebResponseContent content = _supplierInfoService.ReceiveSupplier(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); } - [HttpPost, Route("Test"), AllowAnonymous] - public WebResponseContent Test(string str) + /// <summary> + /// 鎺ユ敹ERP鐗╂枡淇℃伅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveMaterial"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveMaterial([FromBody] Root<MaterielInfoDTO> model) { - MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(WIDESEA_Core.CodeConfigEnum.AnalysisCodeEnum.MatSerNumAnalysis, str); - return WebResponseContent.Instance.OK(model.Serialize()); + WebResponseContent content = _materielInfoService.ReceiveMaterial(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + + /// <summary> + /// 鎺ユ敹ERP鍑哄簱鍗曚俊鎭� + /// </summary> + /// <param name="erpOutOrder"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveOutOrder"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveOutOrder([FromBody] Root<ErpOutOrderDTO> erpOutOrder) + { + WebResponseContent content = _outboundOrderService.ReceiveOutOrder(erpOutOrder.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); } } } -- Gitblit v1.9.3