| | |
| | | _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails1); |
| | | |
| | | |
| | | AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails1); |
| | | AddCPRetrueOrder(task,stockInfo, outboundOrder, outboundOrderDetails1); |
| | | |
| | | // 区分单据数据来源更新货位状态 |
| | | if (outboundOrder.System == null) |
| | |
| | | _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | |
| | | |
| | | AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails); |
| | | AddCPRetrueOrder(task,stockInfo, outboundOrder, outboundOrderDetails); |
| | | |
| | | // 区分单据数据来源更新货位状态 |
| | | if (outboundOrder.System == null) |
| | |
| | | |
| | | // 更新库存状态 回库单 |
| | | |
| | | AddRetrueOrder(stockInfo, inboundOrder); |
| | | AddRetrueOrder(task,stockInfo, inboundOrder); |
| | | |
| | | |
| | | // 区分单据数据来源更新货位状态 |
| | |
| | | } |
| | | else if (newOutboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | newOutboundOrderDetail.OrderDetailStatus = OutboundStatusEnum.出库中.ObjToInt(); |
| | | |
| | | inboundOrder.OrderStatus = OutboundStatusEnum.出库中.ObjToInt(); |
| | | } |
| | | } |
| | |
| | | App.User.UserId == 0 ? OperateType.自动完成 : OperateType.人工完成); |
| | | } |
| | | |
| | | private void AddRetrueOrder(Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder) |
| | | private void AddRetrueOrder(Dt_Task task,Dt_StockInfo stockInfo, Dt_OutboundOrder outboundOrder) |
| | | { |
| | | Dt_StockInfoDetail stockInfoDetail = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(x => x.StockId == stockInfo.Id).First(); |
| | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 }); |
| | | var postData = new |
| | | { |
| | | DeviceCode = task.NextAddress, // 屏幕编号 |
| | | MaterialCode = stockInfoDetail.MaterielCode,//物料类型 |
| | | SendNum = stockInfoDetail.OutboundQuantity,//发料数 |
| | | BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数 |
| | | }; |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文2 = postData }); |
| | | string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData); |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json }); |
| | | using (var client = new HttpClient()) |
| | | { |
| | | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
| | | var response = client.PostAsync(LEDAPI, content).Result; |
| | | string result = response.Content.ReadAsStringAsync().Result; |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result }); |
| | | } |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 }); |
| | | |
| | | decimal returnQuantity = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity; |
| | | if (returnQuantity > 0) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 }); |
| | | var postData = new |
| | | { |
| | | DeviceCode = task.NextAddress, // 屏幕编号 |
| | | MaterialCode = outboundOrder.Details.FirstOrDefault()?.MaterielCode,//物料类型 |
| | | BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity,//回库数 |
| | | SendNum = outboundOrder.Details.FirstOrDefault()?.OrderQuantity//发料数 |
| | | MaterialCode = stockInfoDetail.MaterielCode,//物料类型 |
| | | SendNum = stockInfoDetail.OutboundQuantity,//发料数 |
| | | BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数 |
| | | }; |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文2 = postData }); |
| | | string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData); |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json }); |
| | | using (var client = new HttpClient()) |
| | | { |
| | | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
| | | var response = client.PostAsync(LEDAPI, content).Result; |
| | | string result = response.Content.ReadAsStringAsync().Result; |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result }); |
| | | } |
| | | |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 }); |
| | | |
| | | bool allowCompeted = stockInfo.Details.All(x => x.StockQuantity == x.OutboundQuantity); |
| | | if (allowCompeted) |
| | |
| | | } |
| | | |
| | | //成品回库单 |
| | | private void AddCPRetrueOrder(Dt_StockInfo stockInfo, Dt_NewOutboundOrder outboundOrder, List<Dt_NewOutboundOrderDetail> outboundOrderDetails) |
| | | private void AddCPRetrueOrder(Dt_Task task,Dt_StockInfo stockInfo, Dt_NewOutboundOrder outboundOrder, List<Dt_NewOutboundOrderDetail> outboundOrderDetails) |
| | | { |
| | | List<Dt_StockInfoDetail> stockInfoDetails = _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(x => x.StockId == stockInfo.Id) |
| | |
| | | } |
| | | else |
| | | { |
| | | foreach(var stockInfoDetail in stockInfoDetails) |
| | | { |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 1 }); |
| | | var postData = new |
| | | { |
| | | DeviceCode = task.NextAddress, // 屏幕编号 |
| | | MaterialCode = stockInfoDetail.MaterielCode,//物料类型 |
| | | SendNum = stockInfoDetail.OutboundQuantity,//发料数 |
| | | BackNum = stockInfoDetail.StockQuantity - stockInfoDetail.OutboundQuantity//回库数 |
| | | }; |
| | | WriteLog.Write_Log("API", "成品库入库—请求LED", "请求成功", new { 请求报文2 = postData }); |
| | | string json = Newtonsoft.Json.JsonConvert.SerializeObject(postData); |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文3 = json }); |
| | | using (var client = new HttpClient()) |
| | | { |
| | | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
| | | var response = client.PostAsync(LEDAPI, content).Result; |
| | | string result = response.Content.ReadAsStringAsync().Result; |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = response, 接收报文 = result }); |
| | | } |
| | | WriteLog.Write_Log("API", "出库—请求LED", "请求成功", new { 请求报文 = 4 }); |
| | | } |
| | | var groupedDetails = outboundOrderDetails |
| | | .GroupBy(d => new { d.MaterielCode, d.BatchNo }) |
| | | .ToList(); |