´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/extension/outbound/extend/StockSelect.vue
@@ -10,7 +10,7 @@ <div class="box-head"> <el-alert :closable="false" style="width: 100%"> <el-row> <el-col :span="20"> <el-col :span="16"> <span class="less-style">ç©æåç§°ï¼ {{ row.materielName }} </span> <el-divider direction="vertical"></el-divider> <span class="less-style">ç©æç¼å·ï¼ {{ row.materielCode }} </span> @@ -23,24 +23,29 @@ >已鿰éï¼ {{ selectionSum }} </span> </el-col> <el-col :span="2"> <el-col :span="8"> <el-link type="primary" size="small" style="float: right; height: 20px" @click="getData(false)" >{{ kcname }}</el-link > <el-link type="primary" size="small" style="float: right; height: 20px; margin-right: 10px" @click="getData" >å·æ°</el-link ></el-col > <el-col :span="2"> > <el-link type="primary" size="small" style="float: right; height: 20px" style="float: right; height: 20px; margin-right: 10px" @click="revokeAssign" >æ¤éåé </el-link ></el-col > > </el-col> </el-row> </el-alert> </div> @@ -102,11 +107,14 @@ </template> <script> import VolBox from "@/components/basic/VolBox.vue"; import { fa } from "element-plus/es/locales.mjs"; export default { components: { VolBox }, data() { return { row: null, kcname: "", pkcx: false, showDetialBox: false, tableData: [], tableColumns: [ @@ -179,15 +187,14 @@ }); }, outbound() { if(this.selection.length<=0){ if (this.selection.length <= 0) { return this.$message.error("请å¾é"); } let url = this.pkcx ? "api/Task/GeneratePKOutboundTask?orderDetailId=" : "api/Task/GenerateOutboundTask?orderDetailId="; this.http .post( "api/Task/GenerateOutboundTask?orderDetailId=" + this.row.id, this.selection, "æ°æ®å¤çä¸" ) .post(url + this.row.id, this.selection, "æ°æ®å¤çä¸") .then((x) => { if (!x.status) return this.$message.error(x.message); this.$message.success("æä½æå"); @@ -197,13 +204,15 @@ }); }); }, getData() { getData(a) { if (!a) this.pkcx = !this.pkcx; let url = this.pkcx ? "api/StockInfo/GetPKStockSelectViews?materielCode=" : "api/StockInfo/GetStockSelectViews?materielCode="; this.kcname = this.pkcx ? "ç«åºåºå" : "å¹³åºåºå"; this.http .post( "api/StockInfo/GetStockSelectViews?materielCode=" + this.row.materielCode + "&orderId=" + this.row.orderId, url + this.row.materielCode + "&orderId=" + this.row.orderId, null, "æ¥è¯¢ä¸" ) ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs
@@ -16,6 +16,7 @@ IStockInfoRepository Repository { get; } List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode); List<StockSelectViewDTO> GetPKStockSelectViews(int orderId, string materielCode); List<Dt_StockInfo> GetOutboundStocks(List<Dt_StockInfo> stockInfos, string materielCode, float needQuantity, out float residueQuantity); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs
@@ -218,5 +218,6 @@ /// <param name="task"></param> /// <returns></returns> WebResponseContent UpdateTaskInfo(WCSTaskDTO task); WebResponseContent GeneratePKOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); } } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -119,11 +119,11 @@ List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>(); if (string.IsNullOrEmpty(orderNo)) { dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.å ¥åºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.å ¥åºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); } else { dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.å ¥åºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.å ¥åºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); } content.OK(data: dt_ReceiveOrders); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs
@@ -1,4 +1,5 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using MailKit.Search; using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; using System; using System.Collections.Generic; using System.Linq; ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderService.cs
@@ -82,11 +82,11 @@ List<Dt_OutboundOrder> dt_ReceiveOrders = new List<Dt_OutboundOrder>(); if (string.IsNullOrEmpty(orderNo)) { dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); } else { dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); } content.OK(data: dt_ReceiveOrders); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -37,6 +37,12 @@ _outboundRepository = outboundRepository; } /// <summary> /// æ¥è¯¢è®¢åç«åºåºåè§å¾ /// </summary> /// <param name="orderId"></param> /// <param name="materielCode"></param> /// <returns></returns> public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode) { try @@ -71,6 +77,43 @@ } } /// <summary> /// æ¥è¯¢è®¢åå¹³åºåºåè§å¾ /// </summary> /// <param name="orderId"></param> /// <param name="materielCode"></param> /// <returns></returns> public List<StockSelectViewDTO> GetPKStockSelectViews(int orderId, string materielCode) { try { Dt_OutboundOrder outboundOrder = _outboundRepository.OutboundOrderRepository.QueryFirst(x => x.Id == orderId); if (outboundOrder == null) { throw new Exception($"æªæ¾å°åºåºåä¿¡æ¯"); } return BaseDal.QueryTabs<Dt_StockInfo, Dt_StockInfoDetail, StockSelectViewDTO>((a, b) => a.Id == b.StockId && a.WarehouseId == outboundOrder.WarehouseId, (a, b) => new StockSelectViewDTO { LocationCode = a.LocationCode, MaterielCode = b.MaterielCode, MaterielName = b.MaterielName, PalletCode = a.PalletCode, UseableQuantity = b.StockQuantity - b.OutboundQuantity }, a => a.LocationCode == "å¹³åºä½", b => b.StockQuantity > b.OutboundQuantity && b.MaterielCode == materielCode, x => true).GroupBy(x => x.PalletCode).Select(x => new StockSelectViewDTO { LocationCode = x.FirstOrDefault()?.LocationCode ?? "", MaterielCode = x.FirstOrDefault()?.MaterielCode ?? "", MaterielName = x.FirstOrDefault()?.MaterielName ?? "", PalletCode = x.Key, UseableQuantity = x.Sum(x => x.UseableQuantity) }).ToList(); } catch (Exception ex) { return null; } } public WebResponseContent StockQueryData(SaveModel saveModel) { try ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -15,6 +15,8 @@ using WIDESEA_Common.StockEnum; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; using MailKit.Search; using WIDESEA_External.Model; namespace WIDESEA_TaskInfoService { @@ -30,13 +32,13 @@ WebResponseContent content = new WebResponseContent(); try { Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x=>x.Id==id).Includes(x=>x.Details).First(); Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.Id == id).Includes(x => x.Details).First(); if (stockInfo == null) { return content.Error($"æªæ¾å°åºå"); } Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); if (locationInfo!=null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt() && stockInfo.StockStatus==StockStatusEmun.å ¥åºå®æ.ObjToInt()) if (locationInfo != null && (locationInfo.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || locationInfo.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && stockInfo.StockStatus == StockStatusEmun.å ¥åºå®æ.ObjToInt()) { List<Dt_Task> tasks = GetTasks(new List<Dt_StockInfo>() { stockInfo }, TaskTypeEnum.Outbound); if (tasks == null || tasks.Count <= 0) @@ -253,6 +255,152 @@ } /// <summary> /// å¹³åºç´æ¥åºåº /// </summary> /// <param name="orderDetailId"></param> /// <param name="stockSelectViews"></param> /// <returns></returns> public WebResponseContent GeneratePKOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) { try { Dt_OutboundOrderDetail OrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId); if (OrderDetail == null) { throw new Exception("æªæ¾å°åºåºåæç»ä¿¡æ¯"); } if (OrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()) throw new Exception("åºåºå已宿"); Dt_OutboundOrder outboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.Id == OrderDetail.OrderId).Includes(x => x.Details).First(); if (outboundOrder == null) { return WebResponseContent.Instance.Error($"æªæ¾å°åºåºåä¿¡æ¯"); } Dt_Warehouse warehouse = _basicService.WarehouseService.Repository.QueryFirst(x => x.WarehouseId == outboundOrder.WarehouseId); List<Dt_StockInfo> outStocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList()); if (outStocks.Count < 1) return WebResponseContent.Instance.Error($"åºåä¸è¶³"); List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); List<Dt_StockInfo> upStocks = new List<Dt_StockInfo>(); List<Dt_StockInfo> deStocks = new List<Dt_StockInfo>(); List<Dt_StockInfoDetail> upstockDetails = new List<Dt_StockInfoDetail>(); List<Dt_StockInfoDetail> destockDetails = new List<Dt_StockInfoDetail>(); outStocks.ForEach(x => { x.Details.Where(x => x.MaterielCode == OrderDetail.MaterielCode).ToList().ForEach(v => { float OriginalQuantity = v.StockQuantity; float assignQuantity = 0;//åé æ°é float assignAmount = OrderDetail.OrderQuantity - OrderDetail.OverOutQuantity;//å¾ åºæ°é if (assignAmount > 0) { if (v.StockQuantity >= assignAmount) { assignQuantity = assignAmount; v.StockQuantity -= assignAmount; OrderDetail.OverOutQuantity += assignAmount; OrderDetail.LockQuantity += assignAmount; upstockDetails.Add(v); } else { assignQuantity = v.StockQuantity; OrderDetail.OverOutQuantity += v.StockQuantity; OrderDetail.LockQuantity += v.StockQuantity; v.StockQuantity = 0; destockDetails.Add(v); } Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() { PalletCode = x.PalletCode, AssignQuantity = assignQuantity, MaterielCode = OrderDetail.MaterielCode, BatchNo = v.BatchNo, LocationCode = x.LocationCode, MaterielName = v.MaterielName, OrderDetailId = OrderDetail.Id, OrderNo = outboundOrder.OrderNo, OrderType = outboundOrder.OrderType, OriginalQuantity = OriginalQuantity, Status = OutLockStockStatusEnum.åºåºå®æ.ObjToInt(), StockId = x.Id, TaskNum = 0, OrderQuantity = OrderDetail.OrderQuantity, Unit = OrderDetail.Unit }; outStockLockInfos.Add(outStockLockInfo); } }); int overCount = x.Details.Where(x => x.StockQuantity == 0).Count(); if (overCount == x.Details.Count) deStocks.Add(x); else upStocks.Add(x); }); outboundOrder.OrderStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(); OrderDetail.OrderDetailStatus = OrderDetail.OrderQuantity > OrderDetail.OverOutQuantity ? OrderDetailStatusEnum.AssignOverPartial.ObjToInt() : OrderDetailStatusEnum.Over.ObjToInt(); if (OrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()) { int overCount = outboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).Count(); if (outboundOrder.Details.Count - 1 == overCount) outboundOrder.OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); } _unitOfWorkManage.BeginTran(); _outboundService.OutboundStockLockInfoService.AddData(outStockLockInfos); _outboundService.OutboundOrderService.UpdateData(outboundOrder); _outboundService.OutboundOrderDetailService.UpdateData(OrderDetail); _stockRepository.StockInfoRepository.UpdateData(upStocks); _stockRepository.StockInfoRepository.DeleteData(deStocks); _stockRepository.StockInfoDetailRepository.UpdateData(upstockDetails); _stockRepository.StockInfoDetailRepository.DeleteData(destockDetails); _unitOfWorkManage.CommitTran(); #region 䏿¥ERP List<ERPPickModel> eRPPickModels = new List<ERPPickModel>(); outStockLockInfos.ForEach(x => { ERPPickItemModel pickItemModel = new ERPPickItemModel() { Lotno = x.BatchNo, Qty = x.AssignQuantity.ToString(), Location = warehouse.WarehouseCode }; ERPPickModel pickModel = new ERPPickModel() { Rowindex = OrderDetail.RowNo, Material = OrderDetail.MaterielCode, Qty = pickItemModel.Qty, Dataitem = new List<ERPPickItemModel> { pickItemModel } }; eRPPickModels.Add(pickModel); }); ERPIssueItemModel issueItemModel = new ERPIssueItemModel() { Pickcode = outboundOrder.UpperOrderNo, PickList = eRPPickModels }; ERPIssueModel issueModel = new ERPIssueModel() { UniqueTag = outboundOrder.Id.ToString(), Code = outboundOrder.OrderNo, WarehouseCode = warehouse.WarehouseCode, Docremark = "", Deptno = outboundOrder.DepartmentCode, Deptname = outboundOrder.DepartmentName, Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Createuser = App.User.UserName, Issitem = new List<ERPIssueItemModel>() { issueItemModel } }; _invokeERPService.InvokeOutStandardsApi(issueModel); #endregion return WebResponseContent.Instance.OK(); } catch (Exception ex) { return WebResponseContent.Instance.Error(ex.Message); } } /// <summary> /// çæåºåºä»»å¡åæ°æ®æ´æ°å°æ°æ®åº /// </summary> /// <param name="tasks"></param> ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -22,11 +22,30 @@ { } /// <summary> /// æ¥è¯¢è®¢åç«åºåºåè§å¾ /// </summary> /// <param name="orderId"></param> /// <param name="materielCode"></param> /// <returns></returns> [HttpPost, HttpGet, Route("GetStockSelectViews")] public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode) { return Service.GetStockSelectViews(orderId, materielCode); } /// <summary> /// æ¥è¯¢è®¢åå¹³åºåºåè§å¾ /// </summary> /// <param name="orderId"></param> /// <param name="materielCode"></param> /// <returns></returns> [HttpPost, HttpGet, Route("GetPKStockSelectViews")] public List<StockSelectViewDTO> GetPKStockSelectViews(int orderId, string materielCode) { return Service.GetPKStockSelectViews(orderId, materielCode); } /// <summary> /// æ ¹æ®æçååºåºæ¥è¯¢åºåä¿¡æ¯ /// </summary> ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs
@@ -109,6 +109,18 @@ } /// <summary> /// å¹³åºç´æ¥åºåº /// </summary> /// <param name="orderDetailId"></param> /// <param name="stockSelectViews"></param> /// <returns></returns> [HttpPost, HttpGet, Route("GeneratePKOutboundTask"), AllowAnonymous] public WebResponseContent GeneratePKOutboundTask(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews) { return Service.GeneratePKOutboundTask(orderDetailId, stockSelectViews); } /// <summary> /// çæåºåºä»»å¡ /// </summary> /// <param name="keys"></param>