dengjunjie
2024-12-16 911a17b31eb1caa56d02a7be547176be6c259127
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using 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
{
    [Route("api/Erp")]
    [ApiController]
    public class ErpController : ControllerBase
    {
        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, ISupplierInfoService supplierInfoService, IMaterielInfoService materielInfoService, IOutboundOrderService outboundOrderService)
        {
            _purchaseOrderRepository = purchaseOrderRepository;
            _purchaseOrderService = purchaseOrderService;
            _supplierInfoService = supplierInfoService;
            _materielInfoService = materielInfoService;
            _outboundOrderService = outboundOrderService;
        }
 
        /// <summary>
        /// 接收ERP采购单信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost, Route("ReceivePurchaseOrderSingle"), AllowAnonymous, MethodParamsValidate]
        public ErpResponseContent ReceivePurchaseOrder([FromBody] Root model)
        {
            WebResponseContent content = _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("ReceiveSupplier"), AllowAnonymous, MethodParamsValidate]
        public ErpResponseContent ReceiveSupplier([FromBody] Supplier model)
        {
            WebResponseContent content = _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] MaterielInfo model)
        {
             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] ErpOutOrder erpOutOrder)
        {
             WebResponseContent content = _outboundOrderService.ReceiveOutOrder(erpOutOrder.Content);
            if (content.Status) return Instance.OK();
            else return Instance.Error(content.Message);
        }
    }
}