| | |
| | | var LocationCode = saveModel.MainData["LocationCode"].ToString(); |
| | | var orderNo = saveModel.MainData["orderNo"].ToString(); |
| | | var batchNo = saveModel.MainData["batchNo"].ToString(); |
| | | var id = saveModel.MainData["id"].ObjToInt(); |
| | | var materielCode = saveModel.MainData["materielCode"].ToString(); |
| | | var Inqty = saveModel.MainData["Inqty"].ObjToInt(); |
| | | var warehouseCode = saveModel.MainData["warehouseCode"].ToString(); |
| | | Dt_CabinOrder cabinOrder = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == orderNo && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First(); |
| | | if (cabinOrder == null || cabinOrder.OdrderStatus == "已宿") |
| | | return WebResponseContent.Instance.Error($"å
¥åºå已宿"); |
| | | Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault(); |
| | | //Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).FirstOrDefault(); |
| | | Dt_CabinOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Id == id).FirstOrDefault(); |
| | | if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "已宿") |
| | | return WebResponseContent.Instance.Error($"å
¥åºåæç»å·²å®æ"); |
| | | Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no); |
| | |
| | | } |
| | | //_materielInfoService.UpdateData(materielInfo); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp); |
| | | if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder); |
| | | if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK); |
| | | if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp); |
| | | if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder); |
| | | if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK); |
| | | if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | //webResponseContent.OK(data: dt_CabinOrders); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, (order.order_type == "2" ? "åºåºéè´§" : "æ£å¸¸å
¥åº") + $"ï¼åå·ã{order.order_no}ã", ex.Message); |
| | | webResponseContent.Error(ex.Message); |
| | | } |
| | | return webResponseContent; |
| | |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | infosUp.AddRange(inventoryInfos); |
| | | inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity; |
| | | inventory_Batch.SupplyQuantity = 0; |
| | | batchesUp.Add(inventory_Batch); |
| | | //_inventoryInfoService.UpdateData(inventoryInfos); |
| | |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | //_inventoryInfoService.UpdateData(inventoryInfos); |
| | | infosUp.AddRange(inventoryInfos); |
| | | inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity; |
| | | inventory_Batch.SupplyQuantity = 0; |
| | | //_inventory_BatchServices.UpdateData(inventory_Batch); |
| | | batchesUp.Add(inventory_Batch); |
| | |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | |
| | | else |
| | | { |
| | | var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk"; |
| | | if (cabinOrder.Order_type == "2") url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk"; |
| | | var requestDate = new |
| | | { |
| | | order_no = cabinOrder.Order_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); |
| | | |
| | | _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.äººå·¥å®æ); |
| | | BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.äººå·¥å®æ); |