| | |
| | | //List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>(); |
| | | List<Dt_SupplyTask> supplyTasks1 = new List<Dt_SupplyTask>(); |
| | | List<Dt_InventoryInfo> _InventoryInfos = new List<Dt_InventoryInfo>(); |
| | | List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id)); |
| | | List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => keys.Contains(x.Id)).ToList(); |
| | | foreach (var item in inventory_Batches) |
| | | { |
| | | var supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()).ToList(); |
| | | if (item.SupplyQuantity != 0) throw new Exception($"ç©æç¼å·ã{item.MaterielCode}ãæ¹æ¬¡å·ã{item.BatchNo}ãå·²åå¨çç¹å·®å¼!"); |
| | | //if (item.SupplyQuantity != 0) throw new Exception($"ç©æç¼å·ã{item.MaterielCode}ãæ¹æ¬¡å·ã{item.BatchNo}ãå·²åå¨çç¹å·®å¼!"); |
| | | if (item.SupplyQuantity != 0) |
| | | { |
| | | item.SupplyQuantity = 0; |
| | | // è¿ééè¦æ´æ°æ¹æ¬¡è¡¨ç差弿°é |
| | | _inventory_BatchServices.UpdateData(item); |
| | | } |
| | | |
| | | if (supplyTasks.Count > 0) throw new Exception($"ç©æç¼å·ã{item.MaterielCode}ãæ¹æ¬¡å·ã{item.BatchNo}ãå·²åå¨çç¹ä»»å¡ï¼è¯·å
宿å½åçç¹ä»»å¡"); |
| | | supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == item.MaterielCode && x.BatchNo == item.BatchNo && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt()).ToList(); |
| | | if (supplyTasks.Count > 0) throw new Exception($"ç©æç¼å·ã{item.MaterielCode}ãæ¹æ¬¡å·ã{item.BatchNo}ãå·²åå¨åºåºä»»å¡ï¼è¯·å
宿å½ååºåºä»»å¡"); |
| | |
| | | #region å建çç¹ä»»å¡ |
| | | foreach (var inventory in items) |
| | | { |
| | | //å¨å建çç¹ä»»å¡æ¶éç½®åºåççç¹å·®å¼ä¸º0 |
| | | inventory.SupplyQuantity = 0; |
| | | Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | | { |
| | | WarehouseCode = inventory.WarehouseCode, |
| | |
| | | { |
| | | var LocationCode = saveModel.MainData["locationCode"].ToString(); |
| | | var TaskId = saveModel.MainData["taskId"].ObjToInt(); |
| | | var qty = saveModel.MainData["qty"].ObjToInt(); |
| | | var qty = saveModel.MainData["qty"].ObjToDecimal(); |
| | | Dt_SupplyTask supplyTask = _supplyTaskService.Repository.QueryFirst(x => x.TaskId == TaskId && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt()); |
| | | if (supplyTask == null) throw new Exception("å½åçç¹ä»»å¡å·²å®æ"); |
| | | if (supplyTask.LocationCode != LocationCode) throw new Exception($"å½åçç¹è´§ä½ã{LocationCode}ãä¸ä»»å¡åé
è´§ä½ä¸å¹é
"); |
| | |
| | | #endregion |
| | | |
| | | #region åºå |
| | | List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode)); |
| | | List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode) && x.WarehouseCode == supplyTask.WarehouseCode && x.StockStatus == StockStatusEmun.çç¹éå®.ObjToInt()); |
| | | List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode)).ToList(); |
| | | List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).Contains(x.MaterielCode) && x.WarehouseCode == supplyTask.WarehouseCode && x.StockStatus == StockStatusEmun.çç¹éå®.ObjToInt()).ToList(); |
| | | Dt_InventoryInfo? inventoryInfo = new(); |
| | | List<Dt_InventoryInfo> inventoryInfosDel = new List<Dt_InventoryInfo>(); |
| | | if (supplyTask.WarehouseCode != WarehouseEnum.ç«åº.ObjToInt().ToString("000")) |
| | |
| | | inventoryInfo = inventoryInfos.FirstOrDefault(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no); |
| | | } |
| | | if (inventoryInfo == null) return WebResponseContent.Instance.Error($"æªæ¾å°ç«åºçåºåä¿¡æ¯"); |
| | | inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;//çç¹å·®å¼æ° |
| | | #endregion |
| | | |
| | | List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.OrderNo == supplyTask.OrderNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.TaskId != supplyTask.TaskId).ToList();//æ¥æ¾å½åçç¹åççç¹ä»»å¡ |
| | |
| | | #region å¤çå½åç©ææ¹æ¬¡çåºååæ¹æ¬¡ä¿¡æ¯ |
| | | Dt_Inventory_Batch inventory_Batch = inventory_Batchs.First(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode); |
| | | var SupplyQuantitys = inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode).Sum(x => x.SupplyQuantity); |
| | | if (SupplyQuantitys == 0) |
| | | if (SupplyQuantitys == 0)//ä¸åå¨çç¹å·®å¼ |
| | | { |
| | | foreach (var item in inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode)) |
| | | { |