| | |
| | | _materielInfoService = materielInfoService; |
| | | _locationInfoService = locationInfoService; |
| | | } |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | return base.UpdateData(saveModel); |
| | | } |
| | | |
| | | #region å建åºåºå |
| | | /// <summary> |
| | | /// å建åºåºå |
| | |
| | | if (orderDetailLK != null) |
| | | { |
| | | #region æ·»å åºåºä»»å¡ãä¿®æ¹åºåä¿¡æ¯ |
| | | Dt_InventoryInfo inventoryInfo = dt_InventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First(); |
| | | Dt_InventoryInfo? inventoryInfo = dt_InventoryInfos.FirstOrDefault(x => x.WarehouseCode == WareCodeLK); |
| | | if (inventoryInfo == null) |
| | | throw new Exception($"æªæ¾å°ç©æç¼å·ã{detail.goods_no}ãå¨ç«åºä¸çåºåä¿¡æ¯"); |
| | | inventoryInfo.AvailableQuantity -= orderDetailLK.Order_qty; |
| | | inventoryInfo.OutboundQuantity += orderDetailLK.Order_qty; |
| | | Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | |
| | | //_supplyTaskService.AddData(supplyTasks); |
| | | } |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | _supplyTaskService.AddData(supplyTasks); |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _inventoryInfoService.UpdateData(inventoryInfosUp); |
| | | if (entityOrder.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (entityOrderLK.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | _supplyTaskService.AddData(supplyTasks); |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _inventoryInfoService.UpdateData(inventoryInfosUp); |
| | | if (entityOrder.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (entityOrderLK.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | #endregion |
| | | } |
| | | webResponseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.OutOrderAlarm, (outorder.order_type == "3" ? "å
¥åºéè´§" : "æ£å¸¸åºåº") + $"ï¼åå·ã{outorder.order_no}ã", ex.Message); |
| | | webResponseContent.Error(ex.Message); |
| | | } |
| | | return webResponseContent; |
| | |
| | | inventory_Batch.OutboundQuantity -= supplyTask.StockQuantity; |
| | | } |
| | | #endregion |
| | | if (supplyTask.WarehouseCode == WarehouseEnum.ç«åº.ObjToInt().ToString("000")) |
| | | { |
| | | materielInfo.Business_qty -= supplyTask.StockQuantity; |
| | | if (materielInfo.Business_qty < materielInfo.MinQty) |
| | | CreateAllocatInOut(materielInfo);//åå»ºè°æ¨ä»»å¡ |
| | | } |
| | | supplyTask.TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | |
| | | if (location != null) _locationInfoService.UpdateData(location); |
| | | _deliveryOrderDetailServices.UpdateData(cabinOrderDetail); |
| | | _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | #region å¤æè¯¦æ
æ¯å¦å
¨é¨å®æ |
| | | if (!_deliveryOrderDetailServices.Repository.QueryData(x => x.DeliveryOrderId == deliveryOrder.Id && x.OotDetailStatus != "已宿").Any()) |
| | | deliveryOrder.OutStatus = "已宿"; |
| | | BaseDal.UpdateData(deliveryOrder); |
| | | if (supplyTask.WarehouseCode == WarehouseEnum.ç«åº.ObjToInt().ToString("000")) |
| | | { |
| | | materielInfo.Business_qty -= supplyTask.StockQuantity; |
| | | if (materielInfo.Business_qty < materielInfo.MinQty) |
| | | CreateAllocatInOut(materielInfo);//åå»ºè°æ¨ä»»å¡ |
| | | } |
| | | #endregion |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | else |
| | | { |
| | | var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk"; |
| | | if (deliveryOrder.Out_type == "3") url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk"; |
| | | var requestDate = new |
| | | { |
| | | order_no = deliveryOrder.Out_no |
| | |
| | | var result = HttpHelper.Post(url, requestDate.ToJsonString()); |
| | | var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result); |
| | | if (response == null) throw new Exception("䏿¥ERPåºåºåå®æå¤±è´¥ï¼"); |
| | | if (response.resultCode != "0") throw new Exception(response.resultMsg); |
| | | if (response.resultCode != "0" && response.resultMsg != "æªæ¾å°åæ³åæ®") throw new Exception(response.resultMsg); |
| | | _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(deliveryOrderDetails, OperateTypeEnum.äººå·¥å®æ); |
| | | BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.äººå·¥å®æ); |
| | | } |