| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_External.ERPService; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.ERP |
| | | { |
| | |
| | | [ApiController] |
| | | public class ErpController : ControllerBase |
| | | { |
| | | private readonly IERPInvokeService _service; |
| | | public ErpController(IERPInvokeService service) |
| | | private readonly IPurchaseOrderRepository _purchaseOrderRepository; |
| | | private readonly IPurchaseOrderService _purchaseOrderService; |
| | | |
| | | public ErpController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService) |
| | | { |
| | | _service = service; |
| | | _purchaseOrderRepository = purchaseOrderRepository; |
| | | _purchaseOrderService = purchaseOrderService; |
| | | } |
| | | |
| | | [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous] |
| | | public WebResponseContent ReceivePurchaseOrder([FromBody] PurchaseOrderModel model) |
| | | [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous, MethodParamsValidate] |
| | | public WebResponseContent ReceivePurchaseOrder([FromBody] Dt_PurchaseOrder model) |
| | | { |
| | | try |
| | | { |
| | | return _service.ReceivePurchaseOrder(model); |
| | | _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) |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | [HttpPost, Route("ReceivePurchaseOrderSingle"), AllowAnonymous, MethodParamsValidate] |
| | | public WebResponseContent ReceivePurchaseOrderSingle(PurchaseOrderModel model) |
| | | { |
| | | return _purchaseOrderService.ReceivePurchaseOrderSingle(model); |
| | | } |
| | | |
| | | [HttpPost, Route("Test"), AllowAnonymous] |
| | | public WebResponseContent Test(string str) |
| | | { |
| | | MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(WIDESEA_Core.CodeConfigEnum.AnalysisCodeEnum.MatSerNumAnalysis, str); |
| | | return WebResponseContent.Instance.OK(model.Serialize()); |
| | | } |
| | | } |
| | | } |