From 98cf8b685af7f8e246a7db62639f528d38959f6c Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期四, 09 一月 2025 17:31:41 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs | 123 ++++++++++++++++++++++++++++++++++++---- 1 files changed, 110 insertions(+), 13 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 93eb1fa..98dacb1 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,34 +1,131 @@ 锘縰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_External.Model; +using WIDESEA_IBasicRepository; +using WIDESEA_IBasicService; +using WIDESEA_IInboundRepository; +using WIDESEA_IInboundService; +using WIDESEA_InboundService; +using WIDESEA_IOutboundService; +using WIDESEA_Model.Models; +using static WIDESEA_DTO.ErpResponseContent; namespace WIDESEA_WMSServer.Controllers.ERP { + /// <summary> + /// ERP鎺ュ彛 + /// </summary> [Route("api/Erp")] [ApiController] public class ErpController : ControllerBase { - private readonly IERPInvokeService _service; - public ErpController(IERPInvokeService service) + private readonly IBasicService _basicService; + private readonly IOutboundService _outboundService; + private readonly IInboundService _inboundService; + private readonly IInvokeERPService _invokeERPService; + + public ErpController(IBasicService basicService, IOutboundService outboundService, IInboundService inboundService, + IInvokeERPService invokeERPService) { - _service = service; + _basicService = basicService; + _outboundService = outboundService; + _inboundService = inboundService; + _invokeERPService = invokeERPService; } - [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous] - public WebResponseContent ReceivePurchaseOrder([FromBody] PurchaseOrderModel model) + /// <summary> + /// 鎺ユ敹ERP閲囪喘鍗曚俊鎭� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceivePurchaseOrder([FromBody] Root<PurchaseOrderModel> model) { - try - { - return _service.ReceivePurchaseOrder(model); - } - catch (Exception ex) - { - return WebResponseContent.Instance.Error(ex.Message); - } + WebResponseContent content = _inboundService.PurchaseOrderService.ReceivePurchaseOrder(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + + /// <summary> + /// 鎺ユ敹ERP浠撳簱鍛樺伐鍜岃川妫�鍛樺伐鏁版嵁 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveUser"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveUser([FromBody] Root<UserInfoDTO> model) + { + WebResponseContent content = _basicService.UserInfoService.ReceiveUser(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + + /// <summary> + /// 鎺ユ敹ERP渚涘簲鍟嗕俊鎭� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveSupplier"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveSupplier([FromBody] Root<SupplierDTO> model) + { + WebResponseContent content = _basicService.SupplierInfoService.ReceiveSupplier(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + + /// <summary> + /// 鎺ユ敹ERP鐗╂枡淇℃伅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveMaterial"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveMaterial([FromBody] Root<MaterielInfoDTO> model) + { + WebResponseContent content = _basicService.MaterielInfoService.ReceiveMaterial(model.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + + /// <summary> + /// 鎺ユ敹ERP瀹㈡埛淇℃伅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost, Route("ReceiveCustomer"), AllowAnonymous, MethodParamsValidate] + public ErpResponseContent ReceiveCustomer([FromBody] Root<CustomerInfoDTO> model) + { + WebResponseContent content = _basicService.CustomerInfoService.ReceiveCustomer(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 = _outboundService.OutboundOrderService.ReceiveOutOrder(erpOutOrder.Content); + if (content.Status) return Instance.OK(); + else return Instance.Error(content.Message); + } + [HttpPost, Route("InvokeOutStandardsApi"), AllowAnonymous] + public string InvokeOutStandardsApi(ERPIssueModel issueModel) + { + return _invokeERPService.InvokeOutStandardsApi(issueModel); } } } -- Gitblit v1.9.3