using LogLibrary.Log; using Masuit.Tools; using Newtonsoft.Json; using WIDESEA_Common.FangCang; using WIDESEA_Core; using WIDESEA_DTO; using WIDESEA_Model.Models; namespace WIDESEA_StoragIntegrationServices { public partial class ToMESService { /// /// EDI出库订单 接收医药出库订单数据 /// /// /// public WebResponseContent ediOut(object jsondata) { WebResponseContent content = new WebResponseContent(); try { if (string.IsNullOrEmpty(jsondata.ToString())) throw new Exception("上传参数为空"); var result = JsonConvert.DeserializeObject(jsondata.ToString()); //todo 完成添加出库订单逻辑 if(result.outOrderType == "10") //一般交易出库订单 { foreach (var item in result.details) { //to 循环查询库存是否满足 var stockInfos= _stockInfoRepository.QueryData(x => x.StockStatus == 1); if (stockInfos.Count <= 0) throw new Exception($"{item.productName}库存不足"); } } else if(result.outOrderType == "20") //盘点出库单 { } else if(result.outOrderType == "30") //盘亏出库单 { if (result.details[0].stocktakingDetails.Count <= 0) throw new Exception($"盘亏明细为空"); } LogFactory.GetLog("EDI出库订单接口").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("EDI出库订单接口").Info(true, jsondata.ToJsonString()); return content; } catch (Exception ex) { LogFactory.GetLog("EDI出库订单接口").Info(true, $"\r\r--------------------------------------"); LogFactory.GetLog("EDI出库订单接口").Info(true, ex.Message); return content.Error($"EDI出库订单接口请求异常:{ex.Message}"); } } } }