| | |
| | | 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; |
| | |
| | | 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 (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}ãå·²åå¨åºåºä»»å¡ï¼è¯·å
宿å½ååºåºä»»å¡"); |
| | |
| | | if (materielInfo == null) return WebResponseContent.Instance.Error($"请维æ¤ç©æç¼å·ã{cabinOrderDetail.Goods_no}ãçç©æä¿¡æ¯"); |
| | | cabinOrderDetail.Order_Outqty += supplyTask.SupplyQuantity; |
| | | #region å¹³åºçç¹åªè½åºç°æ´ç®±å·®å¼ |
| | | if (supplyTask.WarehouseCode == WarehouseEnum.大件åº.ObjToInt().ToString("000")) |
| | | if (supplyTask.WarehouseCode == WarehouseEnum.大件åº.ObjToInt().ToString("000") && materielInfo.MaterielSourceType != MaterielSourceTypeEnum.PurchasePart) |
| | | { |
| | | var Qty = supplyTask.SupplyQuantity % materielInfo.BoxQty; |
| | | if (Qty != 0) return WebResponseContent.Instance.Error($"大件åºåºå为æ´ç®±ï¼çç¹æ°éä¸è½å卿£ä»¶"); |
| | |
| | | #endregion |
| | | |
| | | #region åºå |
| | | Dt_InventoryInfo inventoryInfo = new Dt_InventoryInfo(); |
| | | 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()); |
| | | Dt_InventoryInfo? inventoryInfo = new(); |
| | | List<Dt_InventoryInfo> inventoryInfosDel = new List<Dt_InventoryInfo>(); |
| | | if (supplyTask.WarehouseCode != WarehouseEnum.ç«åº.ObjToInt().ToString("000")) |
| | | { |
| | | inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode && x.LocationCode == supplyTask.LocationCode); |
| | | inventoryInfo = inventoryInfos.FirstOrDefault(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.LocationCode == supplyTask.LocationCode); |
| | | if (inventoryInfo == null) return WebResponseContent.Instance.Error($"æªæ¾å°è´§ä½ã{LocationCode}ãçåºåä¿¡æ¯"); |
| | | } |
| | | else |
| | | { |
| | | inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode); |
| | | 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; |
| | | #endregion |
| | | |
| | | #region 夿å½åç©ææ¹æ¬¡ççç¹ä»»å¡æ¯å¦å
¨é¨å®æ |
| | | List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == supplyTask.MaterielCode && x.BatchNo == supplyTask.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.WarehouseCode == supplyTask.WarehouseCode && x.TaskId != supplyTask.TaskId).ToList(); |
| | | List<Dt_SupplyTask> supplyTasks1 = _supplyTaskService.Repository.QueryData(x => x.MaterielCode == supplyTask.MaterielCode && x.BatchNo == supplyTask.BatchNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.TaskId != supplyTask.TaskId).ToList(); |
| | | Dt_Inventory_Batch inventory_Batch = new Dt_Inventory_Batch(); |
| | | List<Dt_InventoryInfo> inventoryInfos = new List<Dt_InventoryInfo>(); |
| | | if (supplyTasks1.Count < 1) |
| | | List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.OrderNo == supplyTask.OrderNo && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt() && x.TaskId != supplyTask.TaskId).ToList();//æ¥æ¾å½åçç¹åççç¹ä»»å¡ |
| | | if (!supplyTasks.Where(x => cabinOrderDetail.Goods_no == x.MaterielCode && x.BatchNo == cabinOrderDetail.Batch_num).Any()) |
| | | cabinOrderDetail.OotDetailStatus = "已宿"; |
| | | #region 夿å½åçç¹å任塿¯å¦å
¨é¨å®æ |
| | | if (supplyTasks.Count < 1) |
| | | { |
| | | #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) + inventoryInfo.SupplyQuantity;//计ç®çç¹æ»æ° |
| | | #endregion |
| | | |
| | | #region åºåæ¹æ¬¡ |
| | | inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no); |
| | | |
| | | #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) |
| | | { |
| | | foreach (var item in inventoryInfos) |
| | | foreach (var item in inventoryInfos.Where(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode == inventoryInfo.MaterielCode)) |
| | | { |
| | | item.StockQuantity += item.SupplyQuantity; |
| | | if (item.StockQuantity <= 0) |
| | | { |
| | | inventoryInfosDel.Add(item); |
| | | continue; |
| | | } |
| | | item.AvailableQuantity = item.StockQuantity; |
| | | item.SupplyQuantity = 0; |
| | | item.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | inventoryInfo.SupplyQuantity = 0; |
| | | inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | //inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity; |
| | | //if (inventoryInfo.StockQuantity <= 0) |
| | | //{ |
| | | // inventoryInfosDel.Add(inventoryInfo); |
| | | // inventoryInfo = null; |
| | | //} |
| | | //else |
| | | //{ |
| | | // inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity; |
| | | // inventoryInfo.SupplyQuantity = 0; |
| | | // inventoryInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | inventory_Batch.SupplyQuantity += SupplyQuantitys; |
| | | } |
| | | #endregion |
| | | |
| | | #region å¤çå
¶ä»åºåæ¹æ¬¡ååºå |
| | | foreach (var detail in cabinOrder.Details.Where(x => x.Id != cabinOrderDetail.Id)) |
| | | { |
| | | SupplyQuantitys = inventoryInfos.Where(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no).Sum(x => x.SupplyQuantity);//计ç®çç¹æ»æ° |
| | | inventory_Batch = inventory_Batchs.First(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no); |
| | | #region åºåæ¹æ¬¡ |
| | | if (SupplyQuantitys == 0) |
| | | { |
| | | foreach (var item in inventoryInfos.Where(x => x.BatchNo == detail.Batch_num && x.MaterielCode == detail.Goods_no)) |
| | | { |
| | | item.StockQuantity += item.SupplyQuantity; |
| | | if (item.StockQuantity <= 0) |
| | | { |
| | | inventoryInfosDel.Add(item); |
| | | continue; |
| | | } |
| | | item.AvailableQuantity = item.StockQuantity; |
| | | item.SupplyQuantity = 0; |
| | | item.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | } |
| | | #endregion |
| | | } |
| | | #endregion |
| | | _unitOfWorkManage.BeginTran(); |
| | | #region å¤ççç¹å |
| | | if (supplyTasks.Count < 1) |
| | |
| | | _deliveryOrderDetailServices.Repository.UpdateData(cabinOrderDetail); |
| | | } |
| | | #endregion |
| | | _inventoryInfoService.UpdateData(inventoryInfo); |
| | | //_inventoryInfoService.UpdateData(inventoryInfo); |
| | | _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.èªå¨å®æ); |
| | | _inventoryInfoService.UpdateData(inventoryInfos); |
| | | _inventory_BatchServices.UpdateData(inventory_Batch); |
| | | if (inventoryInfosDel.Count > 0) _inventoryInfoService.DeleteData(inventoryInfosDel); |
| | | _inventory_BatchServices.UpdateData(inventory_Batchs); |
| | | _unitOfWorkManage.CommitTran(); |
| | | #endregion |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | *ä¸å¡è¯·å¨@/extension/widesea_wcs/order/Dt_OutboundOrder_Hty.jsæ¤å¤ç¼å |
| | | --> |
| | | <template> |
| | | <view-grid ref="grid" |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend"> |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: 'id', |
| | | key: "id", |
| | | footer: "Foots", |
| | | cnName: 'åå²åºåºå', |
| | | name: 'DeliveryOrderHty', |
| | | cnName: "åå²åºåºå", |
| | | name: "DeliveryOrderHty", |
| | | url: "/DeliveryOrderHty/", |
| | | sortName: "id" |
| | | sortName: "id", |
| | | }); |
| | | const editFormFields = ref({}); |
| | | const editFormOptions = ref([]); |
| | |
| | | }, |
| | | { title: "客æ·åç§°", field: "client_name", type: "like" }, |
| | | { title: "åºåºè®°è´¦æ¶é´", field: "account_time", type: "datetime" }, |
| | | ] |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: 'id', |
| | | title: 'åå²è®°å½ä¸»é®', |
| | | type: 'int', |
| | | field: "id", |
| | | title: "åå²è®°å½ä¸»é®", |
| | | type: "int", |
| | | width: 120, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'sourceId', |
| | | title: 'å主é®', |
| | | type: 'int', |
| | | field: "sourceId", |
| | | title: "å主é®", |
| | | type: "int", |
| | | width: 100, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'out_no', |
| | | title: 'åºåºåå·', |
| | | type: 'string', |
| | | field: "out_no", |
| | | title: "åºåºåå·", |
| | | type: "string", |
| | | width: 150, |
| | | require: true, |
| | | align: 'left', |
| | | align: "left", |
| | | sort: true, |
| | | link: true |
| | | link: true, |
| | | }, |
| | | { |
| | | field: 'out_type', |
| | | title: 'åºåºåç±»å', |
| | | type: 'string', |
| | | field: "out_type", |
| | | title: "åºåºåç±»å", |
| | | type: "string", |
| | | width: 120, |
| | | require: true, |
| | | align: 'left', |
| | | bind: { key: "out_type", data: [] } |
| | | align: "left", |
| | | bind: { key: "out_type", data: [] }, |
| | | }, |
| | | { |
| | | field: 'client_no', |
| | | title: '客æ·ä»£ç ', |
| | | type: 'string', |
| | | field: "client_no", |
| | | title: "客æ·ä»£ç ", |
| | | type: "string", |
| | | width: 120, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'client_name', |
| | | title: '客æ·åç§°', |
| | | type: 'string', |
| | | field: "client_name", |
| | | title: "客æ·åç§°", |
| | | type: "string", |
| | | width: 150, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'warehouse_no', |
| | | title: 'åºåå·', |
| | | type: 'string', |
| | | field: "warehouse_no", |
| | | title: "åºåå·", |
| | | type: "string", |
| | | width: 100, |
| | | align: 'left', |
| | | bind: { key: "warehouseNuber", data: [] } |
| | | align: "left", |
| | | bind: { key: "warehouseNuber", data: [] }, |
| | | }, |
| | | { |
| | | field: 'account_time', |
| | | title: 'åºåºè®°è´¦æ¶é´', |
| | | type: 'datetime', |
| | | field: "account_time", |
| | | title: "åºåºè®°è´¦æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'outStatus', |
| | | title: '头æ ç¶æ', |
| | | type: 'string', |
| | | field: "outStatus", |
| | | title: "头æ ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: 'left', |
| | | bind: { key: "outStatus", data: [] } |
| | | align: "left", |
| | | bind: { key: "outStatus", data: [] }, |
| | | }, |
| | | // { |
| | | // field: 'creater', |
| | |
| | | // align: 'left' |
| | | // }, |
| | | { |
| | | field: 'createDate', |
| | | title: 'å建æ¶é´', |
| | | type: 'datetime', |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: 'left', |
| | | sort: true |
| | | align: "left", |
| | | sort: true, |
| | | }, |
| | | // { |
| | | // field: 'modifier', |
| | |
| | | table: "DtDeliveryOrderDetailHty", |
| | | columns: [ |
| | | { |
| | | field: 'id', |
| | | title: 'åå²è®°å½ä¸»é®', |
| | | type: 'int', |
| | | field: "id", |
| | | title: "åå²è®°å½ä¸»é®", |
| | | type: "int", |
| | | width: 120, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'sourceId', |
| | | title: 'å主é®', |
| | | type: 'int', |
| | | field: "sourceId", |
| | | title: "å主é®", |
| | | type: "int", |
| | | width: 100, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | // { |
| | | // field: 'deliveryOrderId', |
| | |
| | | // hidden: true |
| | | // }, |
| | | { |
| | | field: 'reservoirarea', |
| | | title: 'åºåº', |
| | | type: 'string', |
| | | field: "reservoirarea", |
| | | title: "åºåº", |
| | | type: "string", |
| | | width: 120, |
| | | align: 'left', |
| | | bind: { key: "warehouseNuber", data: [] } |
| | | align: "left", |
| | | bind: { key: "warehouseNuber", data: [] }, |
| | | }, |
| | | { |
| | | field: "goods_no", |
| | |
| | | bind: { key: "MaterielNames", data: [] }, |
| | | }, |
| | | { |
| | | field: 'goods_no', |
| | | title: 'è¯åç¼ç ', |
| | | type: 'string', |
| | | field: "goods_no", |
| | | title: "è¯åç¼ç ", |
| | | type: "string", |
| | | width: 150, |
| | | require: true, |
| | | align: 'left', |
| | | bind: { key: "medicineGoods", data: [] } |
| | | align: "left", |
| | | bind: { key: "medicineGoods", data: [] }, |
| | | }, |
| | | { |
| | | field: 'order_qty', |
| | | title: 'è®¢åæ°é', |
| | | type: 'decimal', |
| | | field: "order_qty", |
| | | title: "è®¢åæ°é", |
| | | type: "decimal", |
| | | width: 100, |
| | | require: true, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'batch_num', |
| | | title: 'æ¹å·', |
| | | type: 'string', |
| | | field: "order_Outqty", |
| | | title: "宿æ°é", |
| | | type: "decimal", |
| | | width: 100, |
| | | require: true, |
| | | align: "left", |
| | | // edit:{type:"number"} |
| | | }, |
| | | { |
| | | field: "batch_num", |
| | | title: "æ¹å·", |
| | | type: "string", |
| | | width: 120, |
| | | require: true, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'exp_date', |
| | | title: 'æ ¡æ', |
| | | type: 'string', |
| | | field: "exp_date", |
| | | title: "æ ¡æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'ootDetailStatus', |
| | | title: 'ç¶æ', |
| | | type: 'string', |
| | | field: "ootDetailStatus", |
| | | title: "ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: 'left', |
| | | bind: { key: "ootDetailStatus", data: [] } |
| | | align: "left", |
| | | bind: { key: "ootDetailStatus", data: [] }, |
| | | }, |
| | | { |
| | | field: 'status', |
| | | title: 'åæ¥ç¶æ', |
| | | type: 'int', |
| | | field: "status", |
| | | title: "åæ¥ç¶æ", |
| | | type: "int", |
| | | width: 120, |
| | | align: 'left', |
| | | bind: { key: "syncStatus", data: [] } |
| | | align: "left", |
| | | bind: { key: "syncStatus", data: [] }, |
| | | }, |
| | | { |
| | | field: 'creater', |
| | | title: 'å建人', |
| | | type: 'string', |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'createDate', |
| | | title: 'å建æ¶é´', |
| | | type: 'datetime', |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: 'left', |
| | | sort: true |
| | | align: "left", |
| | | sort: true, |
| | | }, |
| | | { |
| | | field: 'modifier', |
| | | title: 'ä¿®æ¹äºº', |
| | | type: 'string', |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: 'left' |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: 'modifyDate', |
| | | title: 'ä¿®æ¹æ¶é´', |
| | | type: 'datetime', |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: 'left', |
| | | sort: true |
| | | } |
| | | align: "left", |
| | | sort: true, |
| | | }, |
| | | ], |
| | | sortName: "id", |
| | | key: "id" |
| | | key: "id", |
| | | }); |
| | | return { |
| | | table, |