yanjinhui
9 天以前 4babfcfde8b26c755850e0066f1c07fac38e96a2
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs
@@ -7,6 +7,7 @@
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Common.WareHouseEnum;
@@ -234,36 +235,39 @@
                                    }
                                    #endregion
                                    #region åˆ›å»ºåº“存批次信息
                                    // 6️⃣ æŸ¥è¯¢åº“存批次信息
                                    var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
                                        .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
                                    #region åˆ›å»ºåº“存批次信息  åªæœ‰ä¸æ˜¯è°ƒæ‹¨å…¥åº“单(115)才对批次信息进行修改
                                    if (cabinOrder.Order_type != InOrderTypeEnum.Allocat.ObjToInt().ToString())
                                    {
                                        // 6️⃣ æŸ¥è¯¢åº“存批次信息
                                        var inventory_Batch = BaseDal.Db.Queryable<Dt_Inventory_Batch>()
                                            .First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
                                    if (inventory_Batch != null)
                                    {
                                        inventory_Batch.StockQuantity += orderQty;
                                        inventory_Batch.AvailableQuantity += orderQty;
                                        BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
                                    }
                                    else
                                    {
                                        inventory_Batch = new Dt_Inventory_Batch
                                        if (inventory_Batch != null)
                                        {
                                            MaterielCode = inventoryInfo.MaterielCode,
                                            MaterielName = inventoryInfo.MaterielName,
                                            MaterielSpec = inventoryInfo.MaterielSpec,
                                            BatchNo = inventoryInfo.BatchNo,
                                            StockQuantity = inventoryInfo.StockQuantity,
                                            OutboundQuantity = inventoryInfo.OutboundQuantity,
                                            AvailableQuantity = inventoryInfo.AvailableQuantity,
                                            SupplyQuantity = inventoryInfo.SupplyQuantity,
                                            ERPStockQuantity = 0,
                                            Status = false,
                                            ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
                                            ValidityPeriod = inventoryInfo.ValidityPeriod,
                                            Remark = "自动创建"
                                        };
                                        BaseDal.Db.Insertable(inventory_Batch).ExecuteCommand();
                                            inventory_Batch.StockQuantity += orderQty;
                                            inventory_Batch.AvailableQuantity += orderQty;
                                            BaseDal.Db.Updateable(inventory_Batch).ExecuteCommand();
                                        }
                                        else
                                        {
                                            inventory_Batch = new Dt_Inventory_Batch
                                            {
                                                MaterielCode = inventoryInfo.MaterielCode,
                                                MaterielName = inventoryInfo.MaterielName,
                                                MaterielSpec = inventoryInfo.MaterielSpec,
                                                BatchNo = inventoryInfo.BatchNo,
                                                StockQuantity = inventoryInfo.StockQuantity,
                                                OutboundQuantity = inventoryInfo.OutboundQuantity,
                                                AvailableQuantity = inventoryInfo.AvailableQuantity,
                                                SupplyQuantity = inventoryInfo.SupplyQuantity,
                                                ERPStockQuantity = 0,
                                                Status = false,
                                                ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
                                                ValidityPeriod = inventoryInfo.ValidityPeriod,
                                                Remark = "自动创建"
                                            };
                                            BaseDal.Db.Insertable(inventory_Batch).ExecuteCommand();
                                        }
                                    }
                                    #endregion
@@ -288,6 +292,8 @@
                                        SupplyQuantity = 0,
                                        Remark = "入库"
                                    };
                                    //这里这里的入库调拨单状态是115,就将调拨任务状态改为7
                                    if (cabinOrder.Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString()) supplyTask_Hty.TaskType = TaskTypeEnum.AllocatIn.ObjToInt();
                                    BaseDal.Db.Insertable(supplyTask_Hty).ExecuteCommand();
                                    #endregion
                                }