wxw
2 天以前 950fac9fd7b9477fc2bbe3253d217f62ac7608e5
Wms/Wms/Controllers/UpApiController.cs
@@ -30,6 +30,7 @@
using System.Xml.Linq;
using WMS.IBLL.ISysServer;
using ZXing;
using WMS.IBLL.IBllQualityServer;
namespace Wms.Controllers
{
@@ -49,12 +50,13 @@
        private readonly IPdaAsnServer _pdaAsnServer;// PDA
        private readonly IMaterialsServer _materialSvc;//物料Svc 
        private readonly ICustomerServer _customerSvc;//客户Svc 
        private readonly IQualityInspectServer _inspectSvc;//质量Svc
        private readonly IHttpServer _http;
        private string logStr = $@".\log\SAP赋码\Sap下发报文" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
        public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc, IHttpServer http)
        public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc,IQualityInspectServer inspectSvc, IHttpServer http)
        {
            _config = setting.Value;
            _exNoticeSvc = exNoticeSvc;
@@ -64,6 +66,7 @@
            _pdaAsnServer = pdaAsnServer;
            _materialSvc = materialSvc;
            _customerSvc = customerSvc;
            _inspectSvc = inspectSvc;
            _http = http;
        }
        #endregion
@@ -154,21 +157,21 @@
            try
            {
                var jsonData = JsonConvert.SerializeObject(model);
                LogFile.SaveLogToFile($"Sap入库单下发:( {jsonData} ),", logStr);
                LogFile.SaveLogToFile($"Sap入库单数据:( {jsonData} ),", logStr);
                var _result = _arrivalNoticeSvc.CreateAsn(model.data, model.@operator);
                var list = new { Success = 0, Message = "下发成功" };
                if (_result.Success == 0)
                {
                    LogFile.SaveLogToFile($"客户供应商主数据同步:( {JsonConvert.SerializeObject(list)} ),", logStr);
                    LogFile.SaveLogToFile($"Sap入库单下发成功:( {JsonConvert.SerializeObject(list)} ),", logStr);
                    return Ok(new { result = true, code = "1", message = "success" });
                }
                else
                {
                    list = new { Success = -1, Message = _result.Message };
                    LogFile.SaveLogToFile($"客户供应商主数据同步:( {JsonConvert.SerializeObject(list)} ),", logStr);
                    LogFile.SaveLogToFile($"Sap入库单下发失败:( {JsonConvert.SerializeObject(list)} ),", logStr);
                    return Ok(new { result = false, code = "400", message = _result.Message });
                }                
            }
@@ -211,14 +214,15 @@
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        public IActionResult UpQuality(object model)
        public IActionResult UpQuality(SapQualityVm model)
        {
            var logStr = $@".\log\SAP\库存质量状态接收" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            try
            {
                //    var sd = JsonConvert.SerializeObject(model);
                //    var sd2 = JsonConvert.DeserializeObject<BoxPalletBindVm>(sd);
                LogFile.SaveLogToFile($"Sap质量状态变更:( {model} ),", logStr);
                var jsonData = JsonConvert.SerializeObject(model);
                LogFile.SaveLogToFile($"Sap库存质量状态下发:( {jsonData} ),", logStr);
                _inspectSvc.InsertQualitySap(model.data);
                return Ok(new { result = true, code = "1", message = "success" });
            }
            catch (Exception e)
@@ -375,7 +379,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, _config.ErpHost + _config.SoFinishUrl2, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "出库单复核并上传成功" });
            }
            catch (Exception e)