| | |
| | | List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>(); |
| | | List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>(); |
| | | List<Dt_InventoryInfo> inventoryInfosUp = new List<Dt_InventoryInfo>(); |
| | | var inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode)); |
| | | var InventoryInfos = _inventoryInfoService.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode) && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == outorder.warehouse_no); |
| | | var inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode)).ToList(); |
| | | var InventoryInfos = _inventoryInfoService.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode) && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == outorder.warehouse_no).ToList(); |
| | | foreach (var item in entityOrder.Details) |
| | | { |
| | | Dt_Inventory_Batch? inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num).FirstOrDefault(); |
| | |
| | | _supplyTaskService.AddData(supplyTasks); |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _inventoryInfoService.UpdateData(inventoryInfosUp); |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | #endregion |
| | | } |
| | |
| | | #region æ·»å åºåºä»»å¡ãä¿®æ¹åºåä¿¡æ¯ |
| | | Dt_InventoryInfo? inventoryInfo = dt_InventoryInfos.FirstOrDefault(x => x.WarehouseCode == WareCodeLK); |
| | | if (inventoryInfo == null) |
| | | throw new Exception($"æªæ¾å°ç©æç¼å·ã{detail.goods_no}ãç©ææ¹æ¬¡ã{detail.batch_num}ãå¨ç«åºä¸çåºåä¿¡æ¯ï¼æéæ°éã{orderDetailLK.Order_qty}ã请补货"); |
| | | throw new Exception($"åºåºåã{outorder.order_no}ã详æ
å卿£ä»¶,ç©æç¼å·ã{detail.goods_no}ãç©ææ¹æ¬¡ã{detail.batch_num}ãæéæ°éã{Convert.ToInt32(orderDetailLK.Order_qty)}ãè¯·äººå·¥è°æ¨è¡¥è´§å
¥ç«åº"); |
| | | inventoryInfo.AvailableQuantity -= orderDetailLK.Order_qty; |
| | | inventoryInfo.OutboundQuantity += orderDetailLK.Order_qty; |
| | | Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _inventoryInfoService.UpdateData(inventoryInfosUp); |
| | | if (entityOrder.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (entityOrderLK.Details.Count > 0) |
| | | BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.Db.InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | #endregion |
| | | |
| | | |
| | | //çç¹ æ¿æ´ä¸ªæ¹æ¬¡ä¿¡æ¯è¡¨çååæ¹å·åååç¼å·æ¥è¿è¡çç¹ |
| | | public WebResponseContent InventoryGood(string batchNo, string goodsNo) |
| | | { |
| | | var response = new WebResponseContent(); |
| | | try |
| | | { |
| | | // 1ï¸â£ æ¥æ¾æå®æ¹æ¬¡ä¸ç©æçåºåä¿¡æ¯ |
| | | var batchInfo = BaseDal.Db.CopyNew().Queryable<Dt_Inventory_Batch>() |
| | | .Where(x => x.BatchNo == batchNo && x.MaterielCode == goodsNo) |
| | | .First(); |
| | | |
| | | if (batchInfo == null) |
| | | return response.Error($"æªæ¾å°è¯¥ç©æ [{goodsNo}] æ¹æ¬¡ [{batchNo}] çåºåä¿¡æ¯"); |
| | | |
| | | // 2ï¸â£ ç»è£
è¯·æ± DTOï¼å®å
¨ç¬¦åæ¥å£ææ¡£ç»æï¼ |
| | | var ediDto = new TowcsDto.ToediOutInfo |
| | | { |
| | | customerCode = "905", |
| | | materialCode = "YY", // ç©æç±»åCODE |
| | | externalOrderNo = $"PDCK-{batchInfo.Id}", // å¤é¨åºåºåå· |
| | | outOrderType = "20", // çç¹åºåºå |
| | | priority = 1, |
| | | Is_cancel = 0, |
| | | details = new List<TowcsDto.ToeOutdiInDetail> |
| | | { |
| | | new TowcsDto.ToeOutdiInDetail |
| | | { |
| | | batchNo = batchInfo.BatchNo, |
| | | productCode = batchInfo.MaterielCode, |
| | | productName = batchInfo.MaterielName, |
| | | productSpecifications = batchInfo.MaterielSpec, |
| | | quantity = (int)batchInfo.SupplyQuantity, |
| | | //stocktakingDetails = new List<TowcsDto.ToOutediInStock> |
| | | //{ |
| | | // // çç¹æç»å¯æ ¹æ®å®é
æçæåï¼æ¤å¤ç¤ºä¾ä»
1æ¡ |
| | | // new TowcsDto.ToOutediInStock |
| | | // { |
| | | // palletCode = "FC00001", |
| | | // quantity = batchInfo.SupplyQuantity.ToString() |
| | | // } |
| | | //} |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // 3ï¸â£ è°ç¨æ¥å£ |
| | | string url = "http://172.16.1.2:9357/file-admin/api/out/ediOut"; |
| | | var result = HttpHelper.Post(url, ediDto.ToJsonString()); |
| | | var resp = JsonConvert.DeserializeObject<TowcsDto.TowcsResponse<object>>(result); |
| | | |
| | | // 4ï¸â£ ååºå¤ç |
| | | if (resp == null) |
| | | return response.Error("WCS æ ååº"); |
| | | if (resp.code != "0") |
| | | return response.Error($"WCSè¿å失败: {resp.msg}"); |
| | | |
| | | return response.OK("çç¹åºåºä¸åæå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return response.Error("çç¹å¤±è´¥ï¼" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¥è¯¢åºåºåå表 |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | public WebResponseContent OutTaskFinish(Dt_SupplyTask supplyTask, Dt_DeliveryOrder deliveryOrder) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | _inventory_BatchServices.DeleteData(inventory_Batch); |
| | | else |
| | | _inventory_BatchServices.UpdateData(inventory_Batch); |
| | | _materielInfoService.UpdateData(materielInfo); |
| | | //_materielInfoService.UpdateData(materielInfo); |
| | | if (inventoryInfo.StockQuantity <= 0) |
| | | _inventoryInfoService.DeleteData(inventoryInfo); |
| | | else |
| | |
| | | { |
| | | materielInfo.Business_qty -= supplyTask.StockQuantity; |
| | | if (materielInfo.Business_qty < materielInfo.MinQty) |
| | | { |
| | | CreateAllocatInOut(materielInfo);//åå»ºè°æ¨ä»»å¡ |
| | | } |
| | | else |
| | | { |
| | | _materielInfoService.UpdateData(materielInfo); |
| | | } |
| | | |
| | | |
| | | } |
| | | #endregion |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent OutTaskFinish(Dt_SupplyTask supplyTask) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_DeliveryOrder? cabinOrder = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).Includes(x => x.Details).First(); |
| | | Dt_DeliveryOrder? cabinOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).Includes(x => x.Details).First(); |
| | | if (cabinOrder == null) return WebResponseContent.Instance.OK($"åºåºå已宿"); |
| | | |
| | | Dt_DeliveryOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).FirstOrDefault(); |
| | |
| | | //_deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.èªå¨å®æ); |
| | | } |
| | | _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail); |
| | | var cabinOrder1 = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type != "20").Includes(x => x.Details).First(); |
| | | var cabinOrder1 = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == cabinOrder.Out_no && x.Warehouse_no == supplyTask.WarehouseCode && x.Out_type != "20").Includes(x => x.Details).First(); |
| | | if (!cabinOrder1.Details.Where(x => x.OotDetailStatus != "已宿").Any()) |
| | | cabinOrder.OutStatus = "已宿"; |
| | | Repository.UpdateData(cabinOrder); |