| | |
| | | using System; |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing.Drawing2D; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | |
| | | public class Inventory_BatchServices : ServiceBase<Dt_Inventory_Batch, IRepository<Dt_Inventory_Batch>>, IInventory_BatchServices |
| | | { |
| | | private IMessageInfoService _messageInfoService; |
| | | public Inventory_BatchServices(IRepository<Dt_Inventory_Batch> BaseDal, IMessageInfoService messageInfoService) : base(BaseDal) |
| | | private IMaterielInfoService _materielInfoService; |
| | | private IInventoryInfoService _inventoryInfoService; |
| | | private ISupplyTaskService _supplyTaskService; |
| | | public Inventory_BatchServices(IRepository<Dt_Inventory_Batch> BaseDal, IMessageInfoService messageInfoService, IMaterielInfoService materielInfoService, IInventoryInfoService inventoryInfoService, ISupplyTaskService supplyTaskService) : base(BaseDal) |
| | | { |
| | | _messageInfoService = messageInfoService; |
| | | _materielInfoService = materielInfoService; |
| | | _inventoryInfoService = inventoryInfoService; |
| | | _supplyTaskService = supplyTaskService; |
| | | } |
| | | |
| | | public IRepository<Dt_Inventory_Batch> Repository => BaseDal; |
| | | |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | try |
| | | { |
| | | string WareCode = WarehouseEnum.大件åº.ObjToInt().ToString("000"); |
| | | var qty = saveModel.MainData["availableQuantity"].ObjToInt(); |
| | | var id = saveModel.MainData["id"].ObjToInt(); |
| | | var materielCode = saveModel.MainData["materielCode"].ToString(); |
| | | var batchNo = saveModel.MainData["batchNo"].ToString(); |
| | | //var Inventory_Batch = BaseDal.QueryFirst(x => x.Id == id); |
| | | //if (qty > Inventory_Batch.AvailableQuantity) throw new Exception("è°æ¨æ°éä¸å¯å¤§äºå¯ç¨æ°é"); |
| | | var materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == materielCode); |
| | | if (materielInfo == null) return WebResponseContent.Instance.Error($"请维æ¤è¯åç¼å·ã{materielCode}ãçä¿¡æ¯"); |
| | | if (!Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType)) |
| | | return WebResponseContent.Instance.Error($"请设置è¯åç¼å·ã{materielCode}ãç屿§åç±»"); |
| | | if (materielInfo.MaterielSourceType == MaterielSourceTypeEnum.PurchasePart) |
| | | return WebResponseContent.Instance.Error($"è¯åç¼å·ã{materielCode}ãç屿§å类为大件,ä¸å¯è°æ¨"); |
| | | List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.BatchNo == batchNo && x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == WareCode).OrderBy(x => x.InDate).ToList(); |
| | | if (dt_InventoryInfos.Count < 1) return WebResponseContent.Instance.Error($"ç©æç¼å·ã{materielInfo.MaterielCode}ãå¤§ä»¶åºæ åºåï¼è¯·åæ¶è¡¥å
åºåï¼"); |
| | | var StockQty = dt_InventoryInfos.Sum(x => x.AvailableQuantity); |
| | | if (StockQty < qty) return WebResponseContent.Instance.Error($"è°æ¨æ°éä¸å¯å¤§äºå¤§ä»¶åºå¯ç¨æ°é,大件åºå¯ç¨æ°é为ã{StockQty}ã"); |
| | | var zx = (qty / materielInfo.BoxQty).ObjToInt(); |
| | | var ys = qty % materielInfo.BoxQty; |
| | | if (ys > 0) zx++; |
| | | decimal Qty = 0; |
| | | List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>(); |
| | | Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder() |
| | | { |
| | | Out_no = DateTime.Now.ToString("yyMMddHHmmss"), |
| | | Warehouse_no = WareCode, |
| | | Out_type = OutOrderTypeEnum.Allocate.ObjToInt().ToString(), |
| | | OutStatus = "æ°å»º", |
| | | Details = new List<Dt_DeliveryOrderDetail>() |
| | | }; |
| | | foreach (var item in dt_InventoryInfos) |
| | | { |
| | | decimal taskQty = 0; |
| | | if (zx < 1) break; |
| | | while (item.AvailableQuantity > 0 && zx > 0) |
| | | { |
| | | zx--; |
| | | Qty += materielInfo.BoxQty; |
| | | taskQty += materielInfo.BoxQty; |
| | | materielInfo.Business_qty += materielInfo.BoxQty; |
| | | item.OutboundQuantity += materielInfo.BoxQty; |
| | | item.AvailableQuantity -= materielInfo.BoxQty; |
| | | } |
| | | #region æ·»å è°æ¨åºåºä»»å¡ |
| | | Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | | { |
| | | WarehouseCode = item.WarehouseCode, |
| | | BatchNo = item.BatchNo, |
| | | MaterielName = item.MaterielName, |
| | | MaterielCode = item.MaterielCode, |
| | | MaterielSpec = item.MaterielSpec, |
| | | TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(), |
| | | TaskType = TaskTypeEnum.AllocatOut.ObjToInt(), |
| | | CreateDate = DateTime.Now, |
| | | Creater = App.User.UserName ?? "System", |
| | | LocationCode = item.LocationCode, |
| | | OrderNo = deliveryOrder.Out_no, |
| | | StockQuantity = taskQty, |
| | | SupplyQuantity = 0, |
| | | Remark = "è°æ¨åºåº" |
| | | }; |
| | | supplyTasks.Add(supplyTask); |
| | | #endregion |
| | | } |
| | | Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail() |
| | | { |
| | | Batch_num = batchNo, |
| | | Order_Outqty = 0, |
| | | Order_qty = Qty, |
| | | CreateDate = DateTime.Now, |
| | | Creater = App.User.UserName ?? "System", |
| | | Goods_no = materielCode, |
| | | OotDetailStatus = "æ°å»º", |
| | | Status = 2, |
| | | Reservoirarea = WareCode |
| | | }; |
| | | deliveryOrder.Details.Add(deliveryOrderDetail); |
| | | #region æ·»å è°æ¨å
¥åºå |
| | | Dt_CabinOrder cabinOrder = new Dt_CabinOrder() |
| | | { |
| | | Order_no = deliveryOrder.Out_no, |
| | | Order_type = InOrderTypeEnum.Allocat.ObjToInt().ToString(), |
| | | Warehouse_no = "001", |
| | | OdrderStatus = "æ°å»º", |
| | | Details = new List<Dt_CabinOrderDetail>() |
| | | }; |
| | | foreach (var item in deliveryOrder.Details) |
| | | { |
| | | Dt_CabinOrderDetail orderDetail = new Dt_CabinOrderDetail() |
| | | { |
| | | Reservoirarea = cabinOrder.Warehouse_no, |
| | | Goods_no = item.Goods_no, |
| | | Order_qty = item.Order_qty, |
| | | Batch_num = item.Batch_num, |
| | | OrderDetailStatus = "æ°å»º", |
| | | Status = 0 |
| | | }; |
| | | cabinOrder.Details.Add(orderDetail); |
| | | } |
| | | #endregion |
| | | Db.Ado.BeginTran(); |
| | | _materielInfoService.UpdateData(materielInfo); |
| | | _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos); |
| | | _supplyTaskService.AddData(supplyTasks); |
| | | if (deliveryOrder.Details.Count > 0) Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (cabinOrder.Details.Count > 0) Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand(); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK("è°æ¨åºå
¥åºåçææå,请æä½è°æ¨å"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | public WebResponseContent GetExpiredAndlow() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | { |
| | | public string customerCode { get; set; } |
| | | public string materialCode { get; set; } |
| | | public string externalOrderNo { get; set; } |
| | | public string orderNo { get; set; } |
| | | public string externalOrderNo { get; set; }//wmsåºåºåå· |
| | | public string orderNo { get; set; }//ç«æ¹ä» |
| | | public string orderType { get; set; } |
| | | public List<EdiOrderDetailDto> details { get; set; } |
| | | |
| | |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | 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); |
| | |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | 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, |
| | |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | 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(); |
| | |
| | | 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(); |
| | | } |
| | | inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity; |
| | | inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity; |
| | | inventory_Batch.SupplyQuantity = 0; |
| | | infosUp.AddRange(inventoryInfos); |
| | | batchesUp.Add(inventory_Batch); |
| | |
| | | { |
| | | //æ¾åºåæ¹æ¬¡ä¿¡æ¯ |
| | | 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)); |
| | | if (LkQty + DJQty != Qty) throw new Exception($"ã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçç©æä¿¡æ¯ä¸ç©ææ¹æ¬¡ä¿¡æ¯ççæ°éä¸ç¬¦"); |
| | | //var DJQty = Math.Abs(inventoryDJ.Sum(x => x.SupplyQuantity)); |
| | | var DJQty = inventoryDJ.Sum(x => x.SupplyQuantity); |
| | | var count = Math.Abs(LkQty + DJQty); |
| | | if (count != Qty) throw new Exception($"ã{order.order_no}ãç©æç¼å·ã{item.goods_no}ãç©ææ¹æ¬¡ã{item.batch_num}ãçç©æä¿¡æ¯ä¸ç©ææ¹æ¬¡ä¿¡æ¯çäºæ°éä¸ç¬¦"); |
| | | if (LkQty == 0)//ç«åºæ å·®å¼ |
| | | { |
| | | #region åºåãåºåæ¹æ¬¡å¹³è´¦ |
| | |
| | | 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); |
| | | 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); |
| | | infosUp.AddRange(inventoryInfos); |
| | |
| | | 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(); |
| | | } |
| | |
| | | deliveryOrdersAdd.Add(cabinOrder); |
| | | } |
| | | #endregion |
| | | |
| | | //è¿é |
| | | #region å建ç«åºçç¹å |
| | | var entityOrder = new Dt_DeliveryOrder |
| | | { |
| | |
| | | Details = order.details.Select(d => new Dt_DeliveryOrderDetail |
| | | { |
| | | Goods_no = d.goods_no, |
| | | Order_qty = LkQty, |
| | | Order_qty = Math.Abs(LkQty), //ç»ä¸æ¸¸WCSçæ¯è¦æ´æ° |
| | | Batch_num = d.batch_num, |
| | | Exp_date = d.exp_date, |
| | | Reservoirarea = WareCodeLK, |
| | |
| | | List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Warehouse_no == x.WarehouseCode && cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_MaterielInfo> MaterieInfoBusiness = new List<Dt_MaterielInfo>(); |
| | | #region ççå
¥åºå |
| | | if (cabinOrder.Order_type == "5") |
| | | { |
| | |
| | | if (orderDetail == null) throw new Exception($"æªæ¾å°çç¹åã{cabinOrder.Order_no}ãç©æç¼å·ã{detail.productCode}ãç©ææ¹æ¬¡ã{detail.batchNo}ãçæç»ä¿¡æ¯"); |
| | | decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0; |
| | | Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First(); |
| | | var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity; |
| | | if (orderQty != qty) |
| | | throw new Exception($"ççå
¥åºæ°éä¸ä¸è´,ä¸ä¼ æ°éã{orderQty}ã,åºåççæ°éã{qty}ã"); |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | if (orderQty != inventoryInfo.SupplyQuantity) |
| | | throw new Exception($"ççå
¥åºæ°éä¸ä¸è´,ä¸ä¼ æ°éã{orderQty}ã,åºåççæ°éã{inventoryInfo.SupplyQuantity}ã"); |
| | | var mater = materielInfos.FirstOrDefault(x => x.MaterielCode == detail.productCode); |
| | | //æ·»å ç©æä¿¡æ¯ä¸çç«åºä¸å¡åºåä¿¡æ¯ |
| | | if (mater != null) |
| | | { |
| | | mater.Business_qty += inventoryInfo.SupplyQuantity; |
| | | MaterieInfoBusiness.Add(mater); |
| | | } |
| | | |
| | | inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | infosUp.Add(inventoryInfo); |
| | | Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo); |
| | | 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); |
| | | orderDetail.OrderDetailStatus = "已宿"; |
| | |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _cabinOrderDetailServices.UpdateData(cabinOrderDetailsUp); |
| | | BaseDal.UpdateData(cabinOrder); |
| | | //æ·»å ç©æçç«åºä¸å¡åºç¡æ°æ® |
| | | _materielInfoService.UpdateData(MaterieInfoBusiness); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | #endregion |
| | |
| | | List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => deliveryOrder.Warehouse_no == x.WarehouseCode && deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode)); |
| | | List<Dt_MaterielInfo> MaterieInfoBusiness =new List<Dt_MaterielInfo>(); |
| | | #region çäºåºåºå |
| | | if (deliveryOrder.Out_type == "6") |
| | | { |
| | |
| | | if (orderDetail == null) throw new Exception($"æªæ¾å°çç¹åã{deliveryOrder.Out_no}ãç©æç¼å·ã{detail.productCode}ãç©ææ¹æ¬¡ã{detail.batchNo}ãçæç»ä¿¡æ¯"); |
| | | decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0; |
| | | Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First(); |
| | | var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity; |
| | | if (orderQty != qty) |
| | | throw new Exception($"çäºåºåºæ°éä¸ä¸è´,ä¸ä¼ æ°éã{orderQty}ã,åºåçäºæ°éã{qty}ã"); |
| | | inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity; |
| | | if (orderQty != Math.Abs(inventoryInfo.SupplyQuantity)) |
| | | throw new Exception($"çäºåºåºæ°éä¸ä¸è´,ä¸ä¼ æ°éã{orderQty}ã,åºåçäºæ°éã{Math.Abs(inventoryInfo.SupplyQuantity)}ã"); |
| | | //æ·»å ç©æä¿¡æ¯ä¸çç«åºä¸å¡åºåä¿¡æ¯ |
| | | var mater = materielInfos.FirstOrDefault(x => x.MaterielCode == detail.productCode); |
| | | if (mater != null) |
| | | { |
| | | mater.Business_qty += inventoryInfo.SupplyQuantity; |
| | | MaterieInfoBusiness.Add(mater); |
| | | } |
| | | inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | infosUp.Add(inventoryInfo); |
| | | Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo); |
| | | 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); |
| | | orderDetail.OotDetailStatus = "已宿"; |
| | | cabinOrderDetailsUp.Add(orderDetail); |
| | | #region æ·»å ççå
¥åºä»»å¡ |
| | | #region æ·»å çäºåºåºä»»å¡ |
| | | Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty() |
| | | { |
| | | WarehouseCode = inventoryInfo.WarehouseCode, |
| | |
| | | _inventory_BatchServices.UpdateData(batchesUp); |
| | | _deliveryOrderDetailServices.UpdateData(cabinOrderDetailsUp); |
| | | BaseDal.UpdateData(deliveryOrder); |
| | | //æ·»å ç©æä¿¡æ¯ä¸çç«åºä¸å¡åºåä¿¡æ¯ |
| | | _materielInfoService.UpdateData(MaterieInfoBusiness); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList(); |
| | | else |
| | | dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.InDate).ToList(); |
| | | decimal Qty = 0; |
| | | Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder() |
| | | { |
| | | Out_no = DateTime.Now.ToString("yyMMddHHmmss"), |
| | | Warehouse_no = WareCode, |
| | | Out_type = OutOrderTypeEnum.Allocate.ObjToInt().ToString(), |
| | | OutStatus = "æ°å»º", |
| | | Details = new List<Dt_DeliveryOrderDetail>() |
| | | }; |
| | | foreach (var item in dt_InventoryInfos) |
| | | { |
| | | decimal Qty = 0; |
| | | if (materielInfo.Business_qty >= materielInfo.MinQty) break; |
| | | //item.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | while (item.StockQuantity > item.OutboundQuantity && materielInfo.Business_qty < materielInfo.MinQty) |
| | |
| | | item.OutboundQuantity += materielInfo.BoxQty; |
| | | } |
| | | item.AvailableQuantity = item.StockQuantity - item.OutboundQuantity; |
| | | } |
| | | #region 大件åºè¡¥ç«åºåç«åºä¸å¡åºåæ°è¿æ¯å°äºç«åºæå°åºåæ°ï¼æ·»å æç¤ºä¿¡æ¯ |
| | | //æ·»å æ¥è¦ä¿¡æ¯ |
| | | if (materielInfo.Business_qty < materielInfo.MinQty) |
| | | { |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"ç©æåç§°:{materielInfo.MaterielName}", $"ãç©æç¼ç {materielInfo.MaterielCode}å·²çæè°æ¨åºå
¥åºåï¼è¯·è¿è¡åºå
¥åºæµç¨ã大件åºåºåè¿ä½ï¼è¯·åæ¶è¡¥å
åºåï¼ã"); |
| | | } |
| | | else |
| | | { |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"ç©æåç§°:{materielInfo.MaterielName}", $"ãç©æç¼ç {materielInfo.MaterielCode}å·²çæè°æ¨åºå
¥åºåï¼è¯·è¿è¡åºå
¥åºæµç¨ã"); |
| | | } |
| | | #endregion |
| | | #region æ·»å è°æ¨åºåºå |
| | | Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder() |
| | | { |
| | | Out_no = DateTime.Now.ToString("yyMMddHHmmss"), |
| | | Out_type = OutOrderTypeEnum.Allocate.ObjToInt().ToString(), |
| | | OutStatus = "æ°å»º", |
| | | Details = new List<Dt_DeliveryOrderDetail>() |
| | | }; |
| | | dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.åºåºéå®.ObjToInt()).ToList(); |
| | | foreach (var item in dt_InventoryInfos.GroupBy(x => x.BatchNo)) //è¿éææ¹æ¬¡åç»äº |
| | | { |
| | | Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail() |
| | | #region æ·»å è°æ¨åºåºå |
| | | Dt_DeliveryOrderDetail? deliveryOrderDetail = deliveryOrder.Details.FirstOrDefault(x => x.Batch_num == item.BatchNo); |
| | | if (deliveryOrderDetail == null) |
| | | { |
| | | Batch_num = item.Key, |
| | | Order_Outqty = 0, |
| | | Order_qty = item.Select(x => x.OutboundQuantity).Sum(), |
| | | CreateDate = DateTime.Now, |
| | | Creater = App.User.UserName ?? "System", |
| | | Goods_no = item.First().MaterielCode, |
| | | OotDetailStatus = "æ°å»º", |
| | | Status = 2, |
| | | Reservoirarea = item.First().WarehouseCode |
| | | }; |
| | | deliveryOrder.Warehouse_no = item.First().WarehouseCode; |
| | | deliveryOrder.Details.Add(deliveryOrderDetail); |
| | | } |
| | | #endregion |
| | | |
| | | #region æ·»å è°æ¨åºåºä»»å¡ |
| | | foreach (var item in dt_InventoryInfos) |
| | | { |
| | | deliveryOrderDetail = new Dt_DeliveryOrderDetail() |
| | | { |
| | | Batch_num = item.BatchNo, |
| | | Order_Outqty = 0, |
| | | Order_qty = Qty, |
| | | CreateDate = DateTime.Now, |
| | | Creater = App.User.UserName ?? "System", |
| | | Goods_no = item.MaterielCode, |
| | | OotDetailStatus = "æ°å»º", |
| | | Status = 2, |
| | | Reservoirarea = WareCode |
| | | }; |
| | | deliveryOrder.Details.Add(deliveryOrderDetail); |
| | | } |
| | | else |
| | | { |
| | | deliveryOrderDetail.Order_qty += Qty; |
| | | } |
| | | deliveryOrder.Details.Add(deliveryOrderDetail); |
| | | #endregion |
| | | #region æ·»å è°æ¨åºåºä»»å¡ |
| | | Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | | { |
| | | WarehouseCode = item.WarehouseCode, |
| | |
| | | Creater = App.User.UserName ?? "System", |
| | | LocationCode = item.LocationCode, |
| | | OrderNo = deliveryOrder.Out_no, |
| | | StockQuantity = item.OutboundQuantity, |
| | | StockQuantity = Qty, |
| | | SupplyQuantity = 0, |
| | | Remark = "è°æ¨åºåº" |
| | | }; |
| | | supplyTasks.Add(supplyTask); |
| | | supplyTasks.Add(supplyTask); |
| | | #endregion |
| | | } |
| | | #region 大件åºè¡¥ç«åºåç«åºä¸å¡åºåæ°è¿æ¯å°äºç«åºæå°åºåæ°ï¼æ·»å æç¤ºä¿¡æ¯ |
| | | //æ·»å æ¥è¦ä¿¡æ¯ |
| | | if (materielInfo.Business_qty < materielInfo.MinQty) |
| | | { |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"ç©æåç§°:{materielInfo.MaterielName}", $"ãç©æç¼ç {materielInfo.MaterielCode}å·²çæè°æ¨åºå
¥åºåï¼è¯·è¿è¡åºå
¥åºæµç¨ã大件åºåºåè¿ä½ï¼è¯·åæ¶è¡¥å
åºåï¼ã"); |
| | | } |
| | | else |
| | | { |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryLowAlarm, $"ç©æåç§°:{materielInfo.MaterielName}", $"ãç©æç¼ç {materielInfo.MaterielCode}å·²çæè°æ¨åºå
¥åºåï¼è¯·è¿è¡åºå
¥åºæµç¨ã"); |
| | | } |
| | | #endregion |
| | | #region æ·»å è°æ¨åºåºå |
| | | //dt_InventoryInfos = dt_InventoryInfos.Where(X => X.StockStatus == StockStatusEmun.åºåºéå®.ObjToInt()).ToList(); |
| | | //foreach (var item in dt_InventoryInfos.GroupBy(x => x.BatchNo)) //è¿éææ¹æ¬¡åç»äº |
| | | //{ |
| | | // Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail() |
| | | // { |
| | | // Batch_num = item.Key, |
| | | // Order_Outqty = 0, |
| | | // Order_qty = item.Select(x => x.OutboundQuantity).Sum(), |
| | | // CreateDate = DateTime.Now, |
| | | // Creater = App.User.UserName ?? "System", |
| | | // Goods_no = item.First().MaterielCode, |
| | | // OotDetailStatus = "æ°å»º", |
| | | // Status = 2, |
| | | // Reservoirarea = item.First().WarehouseCode |
| | | // }; |
| | | // deliveryOrder.Warehouse_no = item.First().WarehouseCode; |
| | | // deliveryOrder.Details.Add(deliveryOrderDetail); |
| | | //} |
| | | #endregion |
| | | |
| | | #region æ·»å è°æ¨åºåºä»»å¡ |
| | | //foreach (var item in dt_InventoryInfos) |
| | | //{ |
| | | // Dt_SupplyTask supplyTask = new Dt_SupplyTask() |
| | | // { |
| | | // WarehouseCode = item.WarehouseCode, |
| | | // BatchNo = item.BatchNo, |
| | | // MaterielName = item.MaterielName, |
| | | // MaterielCode = item.MaterielCode, |
| | | // MaterielSpec = item.MaterielSpec, |
| | | // TaskStatus = SupplyStatusEnum.NewOut.ObjToInt(), |
| | | // TaskType = TaskTypeEnum.AllocatOut.ObjToInt(), |
| | | // CreateDate = DateTime.Now, |
| | | // Creater = App.User.UserName ?? "System", |
| | | // LocationCode = item.LocationCode, |
| | | // OrderNo = deliveryOrder.Out_no, |
| | | // StockQuantity = item.OutboundQuantity, |
| | | // SupplyQuantity = 0, |
| | | // Remark = "è°æ¨åºåº" |
| | | // }; |
| | | // supplyTasks.Add(supplyTask); |
| | | //} |
| | | #endregion |
| | | |
| | | #region æ·»å è°æ¨å
¥åºå |
| | |
| | | _materielInfoService.UpdateData(materielInfo); |
| | | _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos); |
| | | _supplyTaskService.AddData(supplyTasks); |
| | | if (deliveryOrder.Details.Count > 1) BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (cabinOrder.Details.Count > 1) _cabinOrderServices.Repository.Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (deliveryOrder.Details.Count > 0) BaseDal.Db.InsertNav(deliveryOrder).Include(x => x.Details).ExecuteCommand(); |
| | | if (cabinOrder.Details.Count > 0) _cabinOrderServices.Repository.Db.InsertNav(cabinOrder).Include(x => x.Details).ExecuteCommand(); |
| | | //_unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode); |
| | | } |
| | | inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity; |
| | | inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity; |
| | | #endregion |
| | | |
| | | #region 夿å½åç©ææ¹æ¬¡ççç¹ä»»å¡æ¯å¦å
¨é¨å®æ |
| | |
| | | { |
| | | #region æ¥æ¾åºå |
| | | inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.Id != inventoryInfo.Id); |
| | | var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + supplyTask.SupplyQuantity; |
| | | var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + inventoryInfo.SupplyQuantity;//计ç®çç¹æ»æ° |
| | | #endregion |
| | | |
| | | #region åºåæ¹æ¬¡ |
| | | inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no); |
| | | //妿çç¹æ°åæ¹æ¬¡æ»æ°å¯¹ä¸äºï¼çç¹æ°èµå¼ä¸º0ï¼èµå¼å°±æ·»å çç¹æ° |
| | | if (SupplyQuantitys == inventory_Batch.StockQuantity) |
| | | |
| | | if (SupplyQuantitys == 0) |
| | | { |
| | | foreach (var item in inventoryInfos) |
| | | { |
| | | item.StockQuantity = item.SupplyQuantity; |
| | | item.StockQuantity += item.SupplyQuantity; |
| | | item.SupplyQuantity = 0; |
| | | item.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | inventoryInfo.StockQuantity = supplyTask.SupplyQuantity; |
| | | inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | inventory_Batch.SupplyQuantity = SupplyQuantitys; |
| | | inventory_Batch.SupplyQuantity += SupplyQuantitys; |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | #endregion |
| | | _inventoryInfoService.UpdateData(inventoryInfo); |
| | | _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.èªå¨å®æ); |
| | | if (inventoryInfos.Count >= 1) |
| | | { |
| | | _inventoryInfoService.UpdateData(inventoryInfos); |
| | | _inventory_BatchServices.UpdateData(inventory_Batch); |
| | | } |
| | | _inventoryInfoService.UpdateData(inventoryInfos); |
| | | _inventory_BatchServices.UpdateData(inventory_Batch); |
| | | _unitOfWorkManage.CommitTran(); |
| | | #endregion |
| | | content.OK(); |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | import { el } from "element-plus/es/locales.mjs"; |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | this.buttons.forEach(x => {//nameæ¹ä¸ºè¦éèçæé®åå |
| | | if (x.name == 'ç¼ è¾') { |
| | | x.name = 'è° æ¨'; |
| | | } |
| | | }) |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | // this.editFormFields.availableQuantity = 1; |
| | | this.editFormOptions.forEach((editForm) => { |
| | | editForm.forEach((x) => { |
| | | if (x.field == "availableQuantity") { |
| | | |
| | | } else { |
| | | x.readonly = true |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | |
| | | <template> |
| | | <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions" |
| | | :table="table" :extend="extend"> |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | |
| | | productionDate: "", |
| | | validityPeriod: "", |
| | | remark: "", |
| | | AvailableQuantity: "", |
| | | availableQuantity: "", |
| | | }); |
| | | const editFormOptions = ref([ |
| | | [ |
| | |
| | | field: "materielCode", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | [ |
| | | { |
| | | title: "ç©æåç§°", |
| | | required: true, |
| | | field: "materielName", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "ç©æè§æ ¼", |
| | | required: true, |
| | | field: "materielSpec", |
| | | type: "string", |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | |
| | | field: "batchNo", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | [ |
| | | { |
| | | title: "åºåæ°", |
| | | required: true, |
| | | field: "stockQuantity", |
| | | type: "number", |
| | | }, |
| | | { |
| | | title: "å¾
åºåºæ°é", |
| | | required: true, |
| | | field: "outboundQuantity", |
| | | type: "number", |
| | | }, |
| | | { |
| | | title: "å¯ç¨åºåæ°", |
| | | title: "è°æ¨æ°é", |
| | | required: true, |
| | | field: "availableQuantity", |
| | | type: "number", |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | title: "çç¹æ°", |
| | | required: true, |
| | | field: "supplyQuantity", |
| | | type: "number", |
| | | }, |
| | | { |
| | | title: "ERPå®é
åºåæ°", |
| | | required: true, |
| | | field: "erpStockQuantity", |
| | | type: "number", |
| | | }, |
| | | // { |
| | | // title: "åºåå·®å¼", |
| | | // field: "status", |
| | | // type: "select", |
| | | // bind: { key: "stockDifference", data: [] } |
| | | // } |
| | | ], |
| | | [ |
| | | // { |
| | | // title: "çäº§æ¥æ", |
| | | // field: "productionDate", |
| | | // type: "date", |
| | | // span: 12 |
| | | // }, |
| | | { |
| | | title: "æææè³", |
| | | field: "validityPeriod", |
| | | type: "date", |
| | | span: 12 |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | title: "夿³¨", |
| | | field: "remark", |
| | | type: "string", |
| | | span: 24 |
| | | } |
| | | ] |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | materielCode: "", |
| | |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "ç©æç¼å·", field: "materielCode" ,type: "like" }, |
| | | { title: "ç©æåç§°", field: "materielName" ,type: "like"}, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo" ,type: "like"}, |
| | | { title: "ç©æç¼å·", field: "materielCode", type: "like" }, |
| | | { title: "ç©æåç§°", field: "materielName", type: "like" }, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo", type: "like" }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | }, |
| | | { |
| | | field: "supplyQuantity", |
| | | title: "çç¹æ°", |
| | | title: "çç¹å·®å¼æ°", |
| | | type: "number", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | title: "å¯ç¨åºåæ°", |
| | | required: true, |
| | | field: "availableQuantity", |
| | | type: "number", |
| | | cellStyle: (row) => { |
| | | const value = row.supplyQuantity; |
| | | if (value > 0) { |
| | | return { color: "#00ff00" }; // ç»¿è² |
| | | } else if (value < 0) { |
| | | return { color: "#ff0000" }; // çº¢è² |
| | | } |
| | | // else { |
| | | // return { color: '#000000' }; // é»è² |
| | | // } |
| | | }, |
| | | }, |
| | | { |
| | | title: "å¯ç¨åºåæ°", |
| | | required: true, |
| | | field: "availableQuantity", |
| | | type: "number", |
| | | }, |
| | | { |
| | | field: "erpStockQuantity", |
| | | title: "ERPå®é
åºåæ°", |
| | |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | hidden: true |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "remark", |
| | |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true |
| | | hidden: true, |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | |
| | | }, |
| | | { |
| | | field: "supplyQuantity", |
| | | title: "çç¹æ°", |
| | | title: "çç¹å·®å¼æ°", |
| | | type: "number", |
| | | span: 8 |
| | | }, |
| | |
| | | }, |
| | | { |
| | | field: "supplyQuantity", |
| | | title: "çç¹æ°", |
| | | title: "çç¹å·®å¼æ°", |
| | | type: "number", |
| | | width: 100, |
| | | align: "left", |