| | |
| | | #region è´§ä½ |
| | | var location = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == LocationCode); |
| | | if (location == null) return WebResponseContent.Instance.Error($"请维æ¤è´§ä½ç¼å·ã{LocationCode}ãçè´§ä½ä¿¡æ¯"); |
| | | if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt()) |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¼å·ã{LocationCode}ãå·²ç¦ç¨ï¼è¯·æ¢å¤æ£å¸¸å使ç¨"); |
| | | //if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt()) |
| | | // return WebResponseContent.Instance.Error($"è´§ä½ç¼å·ã{LocationCode}ãå·²ç¦ç¨ï¼è¯·æ¢å¤æ£å¸¸å使ç¨"); |
| | | if (location.WarehouseCode != cabinOrderDetail.Reservoirarea) |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¼å·ã{LocationCode}ãæå±åºæ¿ä¸å½åå
¥åºåæå±åºæ¿ä¸å¹é
"); |
| | | if (location.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | |
| | | }; |
| | | #endregion |
| | | |
| | | List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => order.details.Select(x => x.goods_no).Contains(x.MaterielCode)); |
| | | List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => order.details.Select(x => x.goods_no).Contains(x.MaterielCode)).ToList(); |
| | | List<Dt_MaterielInfo> materielInfosUp = new List<Dt_MaterielInfo>(); |
| | | foreach (var item in order.details) |
| | | { |
| | |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First(); |
| | | var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity); |
| | | if (Qty != item.order_qty) throw new Exception($"ççå
¥åºåã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçççæ°éæè¯¯"); |
| | | if (inventory_Batch.SupplyQuantity != item.order_qty) throw new Exception($"ççå
¥åºåã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçççæ°éæè¯¯"); |
| | | //æ¾ææåºå |
| | | List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList(); |
| | | foreach (var inventoryInfo in inventoryInfos) |
| | | { |
| | | #region æ·»å ççå
¥åºä»»å¡ |
| | | if (inventoryInfo.StockQuantity != inventoryInfo.SupplyQuantity) |
| | | if (inventoryInfo.SupplyQuantity != 0) |
| | | { |
| | | Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty() |
| | | { |
| | |
| | | Creater = App.User.UserName, |
| | | LocationCode = inventoryInfo.LocationCode, |
| | | OrderNo = order.order_no, |
| | | StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity), |
| | | StockQuantity = inventoryInfo.SupplyQuantity, |
| | | SupplyQuantity = 0, |
| | | Remark = "ççå
¥åº" |
| | | }; |
| | |
| | | supplyTask_Hties.Add(supplyTask_Hty); |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | 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.StockQuantity += inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity; |
| | | inventory_Batch.SupplyQuantity = 0; |
| | | batchesUp.Add(inventory_Batch); |
| | | //_inventoryInfoService.UpdateData(inventoryInfos); |
| | |
| | | List<Dt_CabinOrder> cabinOrdersAdd = new List<Dt_CabinOrder>(); |
| | | string WareCodeLK = WarehouseEnum.ç«åº.ObjToInt().ToString("000"); |
| | | string WareCodeDJ = WarehouseEnum.大件åº.ObjToInt().ToString("000"); |
| | | List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode)); |
| | | List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode)); |
| | | List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode)).ToList(); |
| | | List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode)).ToList(); |
| | | foreach (var item in order.details) |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First(); |
| | | var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity); |
| | | var Qty = Math.Abs(inventory_Batch.SupplyQuantity); |
| | | if (Qty != item.order_qty) throw new Exception($"ççå
¥åºåã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçççæ°éæè¯¯"); |
| | | //æ¾ææåºå |
| | | List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList(); |
| | | //è·åç«åºçç¹å·®å¼æ° |
| | | var inventoryLK = inventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First(); |
| | | var LkQty = Math.Abs(inventoryLK.StockQuantity - inventoryLK.SupplyQuantity); |
| | | //var LkQty = Math.Abs(inventoryLK.SupplyQuantity); |
| | | var LkQty = inventoryLK.SupplyQuantity; |
| | | |
| | | //è·å大件åºçç¹å·®å¼æ° |
| | | var inventoryDJ = inventoryInfos.Where(x => x.WarehouseCode == WareCodeDJ).ToList(); |
| | | var DJQty = Math.Abs(inventoryDJ.Sum(x => x.StockQuantity) - inventoryDJ.Sum(x => x.SupplyQuantity)); |
| | | //var DJQty = Math.Abs(inventoryDJ.Sum(x => x.SupplyQuantity)); |
| | | var DJQty = inventoryDJ.Sum(x => x.SupplyQuantity); |
| | | |
| | | |
| | | if (LkQty + DJQty != Qty) throw new Exception($"ã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçç©æä¿¡æ¯ä¸ç©ææ¹æ¬¡ä¿¡æ¯ççæ°éä¸ç¬¦"); |
| | | if (LkQty == 0)//ç«åºæ å·®å¼ |
| | | { |
| | |
| | | Creater = App.User.UserName, |
| | | LocationCode = inventoryInfo.LocationCode, |
| | | OrderNo = order.order_no, |
| | | StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity), |
| | | StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity), |
| | | SupplyQuantity = 0, |
| | | Remark = "ççå
¥åº" |
| | | }; |
| | |
| | | supplyTask_Hties.Add(supplyTask_Hty); |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | 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.StockQuantity += inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity; |
| | | inventory_Batch.SupplyQuantity = 0; |
| | | //_inventory_BatchServices.UpdateData(inventory_Batch); |
| | | batchesUp.Add(inventory_Batch); |
| | |
| | | Creater = App.User.UserName, |
| | | LocationCode = inventoryInfo.LocationCode, |
| | | OrderNo = order.order_no, |
| | | StockQuantity = Math.Abs(inventoryInfo.StockQuantity - inventoryInfo.SupplyQuantity), |
| | | StockQuantity = Math.Abs(inventoryInfo.SupplyQuantity), |
| | | SupplyQuantity = 0, |
| | | Remark = "ççå
¥åº" |
| | | }; |
| | |
| | | supplyTask_Hties.Add(supplyTask_Hty); |
| | | } |
| | | #endregion |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | |
| | | Details = order.details.Select(d => new Dt_CabinOrderDetail |
| | | { |
| | | Goods_no = d.goods_no, |
| | | Order_qty = LkQty, |
| | | Order_qty =Math.Abs( LkQty), |
| | | Batch_num = d.batch_num, |
| | | Exp_date = d.exp_date, |
| | | Reservoirarea = WareCodeLK, |
| | |
| | | List<Dt_CabinOrderDetail> cabinOrderDetails = new List<Dt_CabinOrderDetail>(); |
| | | foreach (var item in cabinOrders) |
| | | { |
| | | if (item.Details != null) cabinOrderDetails.AddRange(cabinOrderDetails); |
| | | if (item.Details != null) cabinOrderDetails.AddRange(item.Details); |
| | | |
| | | item.Modifier = App.User.UserName; |
| | | item.ModifyDate = DateTime.Now; |
| | | item.Details = null; |