| 2025-11-18 | pan | ![]() |
| 2025-11-18 | pan | ![]() |
| 2025-11-18 | pan | ![]() |
| 2025-11-18 | pan | ![]() |
| 2025-11-18 | heshaofeng | ![]() |
ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/extension/outbound/outboundOrder.js
@@ -314,6 +314,13 @@ ); }, click: (row) => { const table = this.$refs.table.$refs.table; if(table){ table.clearSelection(); table.toggleRowSelection(row,true); } const rowId =row.id; console.log(rowId); this.$refs.gridBody.open(row); } }); ÏîÄ¿´úÂë/WIDESEA_WMSClient/src/views/outbound/PickingConfirm.vue
@@ -1068,12 +1068,15 @@ if (res.status) { this.$message.success('æå æå'); this.showSplitDialog = false; this.splitLoading = false; this.resetSplitForm(); this.loadData(); } else { this.splitLoading = false; this.$message.error(res.message || 'æå 失败'); } } catch (error) { this.splitLoading = false; this.$message.error('æå 失败'); } }, @@ -1121,12 +1124,15 @@ if (res.status) { this.$message.success('æ¤éæå æå'); this.showRevertSplitDialog = false; this.revertSplitLoading = false; this.revertSplitForm.originalBarcode = ''; this.loadData(); } else { this.revertSplitLoading = false; this.$message.error(res.message || 'æ¤éæå 失败'); } } catch (error) { this.revertSplitLoading = false; this.$message.error('æ¤éæå 失败'); } }, ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs
@@ -64,7 +64,7 @@ return JsonConvert.DeserializeObject<ResponseModel>(body); } public async Task FeedbackOutbound(FeedbackOutboundRequestModel model) public async Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model) { string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings { @@ -75,6 +75,8 @@ _client.DefaultRequestHeaders.Clear(); _client.DefaultRequestHeaders.Add("Accept", "application/json"); _logger.LogInformation("InvokeMESService FeedbackOutbound : " + json); var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content); string body = await response.Content.ReadAsStringAsync(); @@ -84,7 +86,8 @@ throw new HttpRequestException(body); } // JsonConvert.DeserializeObject<ResponseModel>(body); return JsonConvert.DeserializeObject<ResponseModel>(body); } public async Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model) @@ -113,7 +116,9 @@ var content = new StringContent(json, Encoding.UTF8, "application/json"); using var response = await client.PostAsync("", content); _logger.LogInformation("InvokeMESService FeedbackInbound : " + json); using var response = await client.PostAsync("AldBarcodeInformation/BarcodeInformation", content); var responseText = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { @@ -214,6 +219,7 @@ supplyCode = group.Key.SupplyCode, batchNo = group.Key.BatchNo, lineNo = group.Key.InboundOrderRowNo, qty = group.Sum(x=>x.BarcodeQty), // warehouseCode = group.Key.WarehouseCode=="0"?"1072": group.Key.WarehouseCode, warehouseCode =group.Key.WarehouseCode, unit = group.Key.BarcodeUnit, ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_BasicService/MaterielToMesService.cs
@@ -9,6 +9,7 @@ using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Helper; using WIDESEA_DTO.Outbound; using WIDESEA_IBasicService; using WIDESEA_Model.Models; using WIDESEA_Model.Models.Basic; @@ -17,10 +18,11 @@ { internal class MaterielToMesService : ServiceBase<Dt_MaterielToMes, IRepository<Dt_MaterielToMes>>, IMaterielToMesService { public MaterielToMesService(IRepository<Dt_MaterielToMes> BaseDal ) : base(BaseDal) private readonly IInvokeMESService _invokeMESService; public MaterielToMesService(IRepository<Dt_MaterielToMes> BaseDal, IInvokeMESService invokeMESService) : base(BaseDal) { _invokeMESService = invokeMESService; } // å建ä¸ä¸ªä½¿ç¨å°é©¼å³°å½åæ³çåºåå设置 JsonSerializerSettings settings = new JsonSerializerSettings @@ -35,9 +37,11 @@ WebResponseContent content = base.AddData(saveModel); if (content.Status) { string request = JsonConvert.SerializeObject(saveModel, settings); var url = AppSettings.GetValue("MESUrl").ObjToString(); string response = HttpHelper.Post( url+"", request); return WebResponseContent.Instance.OK(); } else ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/AllocateEnum/BusinessTypeEnum.cs
@@ -1,5 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -11,5 +12,58 @@ æºä»è°æºä»=1, æºä»è°å¤é¨ä»åº=2, å¤é¨ä»åºè°æºä»=3 } public enum MESDocumentType { /// <summary>éè´å ¥åºï¼å ¥åºç±»åï¼</summary> [Description("éè´å ¥åº")] PurchaseInbound = 11, /// <summary>ææ¶åï¼å ¥åºç±»åï¼</summary> [Description("ææ¶å")] MiscellaneousInbound = 12, /// <summary>ç产éæåï¼å ¥åºç±»åï¼</summary> [Description("ç产éæå")] ProductionReturn = 13, /// <summary>å¤åéæåï¼å ¥åºç±»åï¼</summary> [Description("å¤åéæå")] OutsourcingReturn = 14, /// <summary>éå®éåºåï¼å ¥åºç±»åï¼</summary> [Description("éå®éåºå")] SalesReturn = 15, /// <summary>å·¥å颿åç³è¯·åï¼åºåºç±»åï¼</summary> [Description("å·¥å颿åç³è¯·å")] WorkOrderMaterialRequest = 21, /// <summary>æååï¼åºåºç±»åï¼</summary> [Description("æåå")] MiscellaneousOutbound = 22, /// <summary>éè´§åï¼åºåºç±»åï¼</summary> [Description("éè´§å")] ReturnOrder = 23, /// <summary>éå®åºåºåï¼åºåºç±»åï¼</summary> [Description("éå®åºåºå")] SalesOutbound = 24, /// <summary>å¤å颿ç³è¯·åï¼åºåºç±»åï¼</summary> [Description("å¤å颿ç³è¯·å")] OutsourcingMaterialRequest = 25 } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs
@@ -912,8 +912,8 @@ _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand(); } } // return DeleteData(entity); return true; return DeleteData(entity); } public bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType) ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielToMesDTO.cs
@@ -26,7 +26,7 @@ public string newmaterialCode { get; set; } public string unit { get; set; } public string factoryArea { get; set; } public string qty { get; set; } public decimal qty { get; set; } public string supplyCode { get; set; } public string warehouseCode { get; set; } public string batchNo { get; set; } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_DTO/Outbound/OutboundOrderAddDTO.cs
@@ -97,7 +97,7 @@ public int status { get; set; } public string factoryArea { get; set; } public string Operator { get; set; } public List<FeedbackOutboundDetailsModel> details { get; set; } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IBasicService/IInvokeMESService.cs
@@ -14,12 +14,11 @@ { Task<ResponseModel> FeedbackInbound(FeedbackInboundRequestModel model); Task FeedbackOutbound(FeedbackOutboundRequestModel model); Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model); Task<string> GetToken(String username, string password); Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model); Task<WebResponseContent> BatchOrderFeedbackToMes(List<string> orderNos, int inout); } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderDetailService.cs
@@ -22,7 +22,7 @@ WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); //List<Dt_OutboundOrderDetail> GetOutboundStockDataById(int id); } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs
@@ -109,6 +109,10 @@ public int? TaskNum { get; set; } public string SupplyCode { get; set; } [SugarColumn(ColumnName = "lineNo", ColumnDescription = "è¡å·")] public string? lineNo { get; set; } public string WarehouseCode { get; set; } /// <summary> /// ç¶æ ç¶æï¼0-å·²åé 1-åºåºä¸ 2-é¨åæ£é 3å·²æ£é ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs
@@ -84,7 +84,8 @@ return new Dt_OutStockLockInfo() { lineNo= outboundOrderDetail.lineNo, PalletCode = outStock.PalletCode, AssignQuantity = assignQuantity, MaterielCode = outboundOrderDetail.MaterielCode, ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs
@@ -1,9 +1,12 @@ using Microsoft.Extensions.Logging; using SqlSugar; using WIDESEA_Common.LocationEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Helper; using WIDESEA_DTO.Stock; using WIDESEA_IBasicService; using WIDESEA_IOutboundService; using WIDESEA_IRecordService; @@ -255,5 +258,35 @@ } } public override PageGridData<Dt_OutboundOrderDetail> GetPageData(PageDataOptions options) { //var pageGridData = base.GetPageData(options); ISugarQueryable<Dt_OutboundOrderDetail> sugarQueryable1 = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>(); if (!string.IsNullOrEmpty(options.Wheres)) { List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); int totalCount = 0; if (searchParametersList.Count > 0) { { SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_InboundOrderDetail.OrderId).FirstLetterToLower()); if (searchParameters != null) { sugarQueryable1 = sugarQueryable1.Where(x => x.OrderId== searchParameters.Value.ObjToInt()); var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount); return new PageGridData<Dt_OutboundOrderDetail>(totalCount, dataList); } } } } return new PageGridData<Dt_OutboundOrderDetail> (); } } } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs
@@ -17,6 +17,7 @@ using WIDESEA_Core.BaseServices; using WIDESEA_Core.Helper; using WIDESEA_DTO.Basic; using WIDESEA_DTO.Inbound; using WIDESEA_DTO.Outbound; using WIDESEA_IBasicService; using WIDESEA_IOutboundService; @@ -43,7 +44,7 @@ private readonly ISplitPackageService _splitPackageService; private readonly IRepository<Dt_Task> _taskRepository; private readonly IESSApiService _eSSApiService; private readonly IInvokeMESService _invokeMESService; private readonly ILogger<OutboundPickingService> _logger; @@ -61,7 +62,7 @@ }; public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger) : base(BaseDal) public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; _stockInfoService = stockInfoService; @@ -75,6 +76,7 @@ _taskRepository = taskRepository; _eSSApiService = eSSApiService; _logger = logger; _invokeMESService = invokeMESService; } @@ -177,6 +179,12 @@ if (lockInfo.PalletCode != palletCode) throw new Exception($"æ¡ç {barcode}ä¸å±äºæç{palletCode}"); var outorderdetail = _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().First(x => x.Id == lockInfo.OrderDetailId); if (outorderdetail != null && lockInfo.AssignQuantity > outorderdetail.OrderQuantity) { throw new Exception($"æ¡ç {barcode}çåºåºæ°é大äºè®¢åçæ°é"); } var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(x => x.Barcode == barcode && x.StockId == lockInfo.StockId) .FirstAsync(); @@ -248,10 +256,15 @@ private async Task CheckAndUpdateOrderStatus(string orderNo) { var orderDetails = _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>() .LeftJoin<Dt_OutboundOrder>((o, item) => o.OrderId == item.Id) // å ³èæ¡ä»¶ï¼ç¶è¡¨ Id = å表 OrderId .Where((o, item) => item.OrderNo == orderNo) // è¿æ»¤ç¶è¡¨ OrderNo .Select((o, item) => o) // åªè¿ååè¡¨æ°æ® .ToList(); var orderDetails = await _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>() .Where(x => x.OrderId == orderNo.ObjToInt()) .ToListAsync(); //var orderDetails = await _stockInfoDetailService.Db.Queryable<Dt_OutboundOrderDetail>() // .Where(x => x.OrderId == orderNo.ObjToInt()) // .ToListAsync(); bool allCompleted = true; foreach (var detail in orderDetails) @@ -265,10 +278,60 @@ if (allCompleted) { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => x.OrderStatus == 2) // 已宿 .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); try { await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() .SetColumns(x => x.OrderStatus == 2) // 已宿 .Where(x => x.OrderNo == orderNo) .ExecuteCommandAsync(); var outboundOrder = _stockInfoService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == orderNo); if (outboundOrder != null && outboundOrder.OrderStatus == InOrderStatusEnum.å ¥åºå®æ.ObjToInt()) { var feedmodel = new FeedbackOutboundRequestModel { reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString(), business_type = outboundOrder.BusinessType, factoryArea = outboundOrder.FactoryArea, operationType = 1, Operator = outboundOrder.Operator, orderNo = outboundOrder.UpperOrderNo, status = outboundOrder.OrderStatus, details = new List<FeedbackOutboundDetailsModel>() }; var lists = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.OrderNo == orderNo).ToList(); var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode }) .Select(group => new FeedbackOutboundDetailsModel { materialCode = group.Key.MaterielCode, lineNo = group.Key.lineNo, warehouseCode = group.Key.WarehouseCode, currentDeliveryQty = group.Sum(x => x.OrderQuantity), // warehouseCode= "1072", unit = group.Key.Unit, barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel { barcode = row.CurrentBarcode, supplyCode = row.SupplyCode, batchNo = row.BatchNo, unit = row.Unit, qty = row.AssignQuantity }).ToList() }).ToList(); feedmodel.details = groupedData; _invokeMESService.FeedbackOutbound(feedmodel); } } catch (Exception ex) { _logger.LogError(" OutboundPickingService FeedbackOutbound : " + ex.Message); } } } @@ -276,165 +339,18 @@ /// <summary> /// ååºæä½ /// </summary> //public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason) //{ // try // { // // 1. è·åæææªåæ£çåºåºéå®è®°å½ï¼å æ¬æå 产ççè®°å½ // var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() // .Where(it => it.OrderNo == orderNo && it.Status == 1) // .ToListAsync(); // if (!remainingLocks.Any()) // { // return WebResponseContent.Instance.Error("没æéè¦ååºçå©ä½è´§ç©"); // } // var tasks = new List<Dt_Task>(); // // ææçåç» // var palletGroups = remainingLocks.GroupBy(x => x.PalletCode); // //æ¥è¯¢ä»»å¡è¡¨ // var task = _taskRepository.QueryData(x => x.TaskNum == remainingLocks.First().TaskNum).FirstOrDefault(); // foreach (var group in palletGroups) // { // if (group.Key == palletCode) // { // var totalReturnQty = group.Sum(x => x.AssignQuantity - x.PickedQty); // if (totalReturnQty <= 0) continue; // // åé æ°è´§ä½ // var newLocation = _locationInfoService.AssignLocation(); // // æ´æ°åºåºéå®è®°å½ç¶æ // var lockIds = group.Where(x => x.PalletCode == palletCode).Select(x => x.Id).ToList(); // await _outStockLockInfoService.Db.Updateable<Dt_OutStockLockInfo>() // .SetColumns(it => new Dt_OutStockLockInfo { Status = OutLockStockStatusEnum.ååºä¸.ObjToInt() }) // .Where(it => lockIds.Contains(it.Id)) // .ExecuteCommandAsync(); // // æ´æ°æå æ¡ç è®°å½ç¶æ // var splitBarcodes = await _splitPackageService.Db.Queryable<Dt_SplitPackageRecord>() // .Where(it => lockIds.Contains(it.OutStockLockInfoId)) // .ToListAsync(); // foreach (var splitBarcode in splitBarcodes) // { // splitBarcode.Status = 3; // await _splitPackageService.Db.Updateable(splitBarcode).ExecuteCommandAsync(); // } // foreach (var lockInfo in group) // { // if (lockInfo.PalletCode == palletCode) // { // decimal returnQty = lockInfo.AssignQuantity - lockInfo.PickedQty; // // æ£æ¥åºåè®°å½æ¯å¦åå¨ // var existingStock = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() // .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId) // .FirstAsync(); // if (existingStock != null) // { // // åºåè®°å½åå¨ï¼æ¢å¤é宿°é // await _stockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>() // .SetColumns(it => new Dt_StockInfoDetail // { // OutboundQuantity = it.OutboundQuantity - returnQty // }) // .Where(it => it.Barcode == lockInfo.CurrentBarcode && it.StockId == lockInfo.StockId) // .ExecuteCommandAsync(); // } // else // { // // åºåè®°å½ä¸åå¨ï¼å¯è½æ¯æå 产ççæ°æ¡ç ï¼ï¼å建æ°çåºåè®°å½ // var newStockDetail = new Dt_StockInfoDetail // { // StockId = lockInfo.StockId, // MaterielCode = lockInfo.MaterielCode, // OrderNo = lockInfo.OrderNo, // BatchNo = lockInfo.BatchNo, // StockQuantity = returnQty, // å®é åºåæ°é // OutboundQuantity = 0, // ååºåä¸åéå® // Barcode = lockInfo.CurrentBarcode, // InboundOrderRowNo = "0", // Status = StockStatusEmun.å ¥åºç¡®è®¤.ObjToInt(), // }; // await _stockInfoDetailService.Db.Insertable(newStockDetail).ExecuteCommandAsync(); // } // } // } // Dt_Task newtask = new() // { // CurrentAddress = stations[task.TargetAddress], // Grade = 0, // PalletCode = palletCode, // NextAddress = "", // OrderNo= task.OrderNo, // Roadway = newLocation.RoadwayNo, // SourceAddress = stations[task.TargetAddress], // TargetAddress = newLocation.LocationCode, // TaskStatus = TaskStatusEnum.New.ObjToInt(), // TaskType = TaskTypeEnum.InPick.ObjToInt(), // // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), // PalletType = task.PalletType, // WarehouseId = task.WarehouseId, // }; // tasks.Add(newtask); // } // } // try // { // await _taskRepository.Db.Insertable(tasks).ExecuteCommandAsync(); // //å é¤ åºåºç task // //ç» ess æµå¨ä¿¡å· ååå»ºä»»å¡ // } // catch (Exception ex) // { // } // return WebResponseContent.Instance.OK(); // } // catch (Exception ex) // { // return WebResponseContent.Instance.Error($"ååºæä½å¤±è´¥: {ex.Message}"); // } //} public async Task<WebResponseContent> ReturnRemaining(string orderNo, string palletCode, string reason) { try { // 1. è·åæææªåæ£çåºåºéå®è®°å½ï¼å æ¬æå 产ççè®°å½ // è·åæææªåæ£çåºåºéå®è®°å½ï¼å æ¬æå 产ççè®°å½ var remainingLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() .Where(it => it.OrderNo == orderNo && it.Status == 1) .ToListAsync(); var stockinfo = _stockInfoService.Db.Queryable<Dt_StockInfo>().First(x => x.PalletCode == palletCode); // 2. æ£æ¥æç䏿¯å¦æå ¶ä»éåºåºè´§ç©ï¼åºåè´§ç©ï¼ var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(it => it.StockId == stockinfo.Id && it.Status == StockStatusEmun.å ¥åºç¡®è®¤.ObjToInt()) .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity) // æªå®å ¨åºåºç .ToListAsync(); // 3. å¦ææ²¡æéè¦ååºçè´§ç©ï¼æ¢æ æªåæ£åºåºè´§ç©ï¼ä¹æ å ¶ä»åºåè´§ç©ï¼ if (!remainingLocks.Any() && !palletStockGoods.Any()) { return WebResponseContent.Instance.Error("没æéè¦ååºçå©ä½è´§ç©"); } var tasks = new List<Dt_Task>(); @@ -447,6 +363,21 @@ { return WebResponseContent.Instance.Error("æªæ¾å°å¯¹åºçä»»å¡ä¿¡æ¯"); } // æ£æ¥æç䏿¯å¦æå ¶ä»éåºåºè´§ç©ï¼åºåè´§ç©ï¼ var palletStockGoods = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(it => it.StockId == stockinfo.Id && (it.Status == StockStatusEmun.å ¥åºç¡®è®¤.ObjToInt() || it.Status == StockStatusEmun.å ¥åºå®æ.ObjToInt())) .Where(it => it.OutboundQuantity == 0 || it.OutboundQuantity < it.StockQuantity) // æªå®å ¨åºåºç .ToListAsync(); // å¦ææ²¡æéè¦ååºçè´§ç©ï¼æ¢æ æªåæ£åºåºè´§ç©ï¼ä¹æ å ¶ä»åºåè´§ç©ï¼ if (!remainingLocks.Any() && !palletStockGoods.Any()) { //æ¯å¦èªå¨ååºï¼æä¹ååºåºçä»»å¡å é¤ï¼ç¶åç»ä¸ªç©ºçå ¥åºã return WebResponseContent.Instance.Error("没æéè¦ååºçå©ä½è´§ç©"); } var firstlocation = _locationInfoService.Db.Queryable<Dt_LocationInfo>().First(x => x.LocationCode == task.SourceAddress); decimal totalReturnQty = 0; var hasRemainingLocks = remainingLocks.Any(x => x.PalletCode == palletCode); @@ -687,11 +618,11 @@ var stockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(x => x.Barcode == barcode && x.StockId == outStockInfo.StockId) .FirstAsync(); stockDetail.StockQuantity += outStockInfo.AssignQuantity; stockDetail.OutboundQuantity += outStockInfo.AssignQuantity; await _stockInfoDetailService.Db.Updateable(stockDetail).ExecuteCommandAsync(); // è¿ååºåºåæç» var orderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>() @@ -699,6 +630,7 @@ .FirstAsync(); orderDetail.OverOutQuantity -= outStockInfo.AssignQuantity; orderDetail.PickedQty = 0; await _outboundOrderDetailService.Db.Updateable(orderDetail).ExecuteCommandAsync(); // å 餿£éåå² ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs
@@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Org.BouncyCastle.Asn1.Ocsp; using System; using System.Collections.Generic; @@ -9,6 +10,7 @@ using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_DTO.Basic; using WIDESEA_DTO.Outbound; using WIDESEA_IBasicService; using WIDESEA_IOutboundService; @@ -26,14 +28,18 @@ private readonly IStockInfoDetailService _stockInfoDetailService; private readonly IOutStockLockInfoService _outStockLockInfoService; private readonly IDailySequenceService _dailySequenceService; private readonly IInvokeMESService _invokeMESService; public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService) : base(BaseDal) private readonly ILogger<SplitPackageService> _logger; public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService, IInvokeMESService invokeMESService, ILogger<SplitPackageService> logger) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; _stockInfoService = stockInfoService; _outStockLockInfoService = outStockLockInfoService; _stockInfoDetailService = stockInfoDetailService; _dailySequenceService = dailySequenceService; _invokeMESService = invokeMESService; _logger = logger; } /// <summary> @@ -84,7 +90,7 @@ SupplyCode = stockDetail.SupplyCode, WarehouseCode = stockDetail.WarehouseCode, BarcodeQty = stockDetail.BarcodeQty, BarcodeUnit = stockDetail.Barcode, BarcodeUnit = stockDetail.BarcodeUnit, BusinessType = stockDetail.BusinessType, Unit = stockDetail.Unit, StockId = lockInfo.StockId, @@ -153,10 +159,30 @@ await Db.Insertable(splitHistory).ExecuteCommandAsync(); _unitOfWorkManage.CommitTran(); // 7. åä¼ æ°æ¡ç ç»MES // await SendBarcodeToMES(newBarcode, request.MaterielCode, request.SplitQuantity); try { MaterielToMesDTO dto = new MaterielToMesDTO { batchNo = stockDetail.BatchNo, factoryArea = stockDetail.FactoryArea, materialCode = stockDetail.MaterielCode, newmaterialCode = newBarcode, oldmaterialCode = request.OriginalBarcode, operationType = 1, qty = remainingQty, supplyCode = stockDetail.SupplyCode, unit = stockDetail.BarcodeUnit, warehouseCode = stockDetail.WarehouseCode, reqCode = Guid.NewGuid().ToString(), reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }; _invokeMESService.NewMaterielToMes(dto); } catch(Exception ex) { _logger.LogError("SplitPackage åä¼ MES: " + ex.Message); } return WebResponseContent.Instance.OK("æå æå", new { NewBarcode = newBarcode, @@ -170,48 +196,180 @@ } } // æ¤éæå //public async Task<WebResponseContent> RevertSplitPackage(string originalBarcode) //{ // try // { // _unitOfWorkManage.BeginTran(); // // 1. æ¥æ¾æè¿çæªæ¤éæå è®°å½ // var splitRecord = await Db.Queryable<Dt_SplitPackageRecord>() // .Where(x => x.OriginalBarcode == originalBarcode && !x.IsReverted) // .OrderByDescending(x => x.SplitTime) // .FirstAsync(); // if (splitRecord == null) // return WebResponseContent.Instance.Error("æªæ¾å°å¯æ¤éçæå è®°å½"); // // 2. æ£æ¥æ°æ¡ç æ¯å¦å·²æ£é // var newLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() // .Where(x => x.CurrentBarcode == splitRecord.NewBarcode) // .FirstAsync(); // if (newLockInfo?.Status ==6) // åè®¾ç¶æ2表示已æ£é // return WebResponseContent.Instance.Error("æ°æ¡ç å·²æ£éï¼æ æ³æ¤éæå "); // // 3. è·ååæ¡ç çéå®ä¿¡æ¯ // var originalLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() // .Where(x => x.CurrentBarcode == originalBarcode) // .FirstAsync(); // if (originalLockInfo == null) // return WebResponseContent.Instance.Error("æªæ¾å°åæ¡ç éå®ä¿¡æ¯"); // originalLockInfo.AssignQuantity += splitRecord.RemainQuantity; // // originalLockInfo.Status = (int)OutLockStockStatusEnum.åºåºä¸; // originalLockInfo.IsSplitted = 0; // æ è®°ä¸ºæªæå // await _outStockLockInfoService.Db.Updateable(originalLockInfo).ExecuteCommandAsync(); // // 5. è¿ååæ¡ç åºåè®°å½ // var originalStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() // .Where(x => x.Barcode == originalBarcode && x.StockId == splitRecord.StockId) // .FirstAsync(); // if (originalStockDetail != null) // { // // å°æåºçæ°éå åå°åæ¡ç åºå // originalStockDetail.StockQuantity += splitRecord.RemainQuantity; // originalStockDetail.OutboundQuantity += splitRecord.RemainQuantity; // await _stockInfoDetailService.Db.Updateable(originalStockDetail).ExecuteCommandAsync(); // } // // 6. å 餿°æ¡ç çéå®ä¿¡æ¯ // if (newLockInfo != null) // { // await _outStockLockInfoService.Db.Deleteable<Dt_OutStockLockInfo>() // .Where(x => x.CurrentBarcode == splitRecord.NewBarcode) // .ExecuteCommandAsync(); // } // // 7. å 餿°æ¡ç çåºåè®°å½ // var newStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() // .Where(x => x.Barcode == splitRecord.NewBarcode) // .FirstAsync(); // if (newStockDetail != null) // { // await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>() // .Where(x => x.Barcode == splitRecord.NewBarcode) // .ExecuteCommandAsync(); // } // // 8. æ´æ°æå è®°å½ä¸ºå·²æ¤é // splitRecord.IsReverted = true; // await Db.Updateable(splitRecord).ExecuteCommandAsync(); // _unitOfWorkManage.CommitTran(); // return WebResponseContent.Instance.OK($"æ¤éæå æåï¼è¿åæ°éï¼{splitRecord.SplitQty}"); // } // catch (Exception ex) // { // _unitOfWorkManage.RollbackTran(); // return WebResponseContent.Instance.Error($"æ¤éæå 失败ï¼{ex.Message}"); // } //} public async Task<WebResponseContent> RevertSplitPackage(string originalBarcode) { try { _unitOfWorkManage.BeginTran(); // æ¥æ¾æè¿çæªæ¤éæå è®°å½ var splitPackage = await Db.Queryable<Dt_SplitPackageRecord>() // 1. æ¥æ¾æææªæ¤éçæå è®°å½ var splitRecords = await Db.Queryable<Dt_SplitPackageRecord>() .Where(x => x.OriginalBarcode == originalBarcode && !x.IsReverted) .OrderByDescending(x => x.CreateDate) .FirstAsync(); .OrderBy(x => x.SplitTime) // ææ¶é´æ£åºï¼ä»ææ©å¼å§æ¤é .ToListAsync(); if (splitPackage == null) return WebResponseContent.Instance.Error("æªæ¾å°æå è®°å½"); if (splitRecords == null || !splitRecords.Any()) return WebResponseContent.Instance.Error("æªæ¾å°å¯æ¤éçæå è®°å½"); // æ£æ¥æ°æ¡ç æ¯å¦å·²æ£é var newOutStockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() .Where(x => x.CurrentBarcode == splitPackage.NewBarcode) .FirstAsync(); // 2. æ£æ¥æææ°æ¡ç æ¯å¦å·²æ£é var newBarcodes = splitRecords.Select(x => x.NewBarcode).ToList(); var newLockInfos = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() .Where(x => newBarcodes.Contains(x.CurrentBarcode)) .ToListAsync(); if (newOutStockInfo.Status == 2) return WebResponseContent.Instance.Error("æ°æ¡ç å·²æ£éï¼æ æ³æ¤éæå "); var pickedBarcodes = newLockInfos.Where(x => x.Status == 2).Select(x => x.CurrentBarcode).ToList(); if (pickedBarcodes.Any()) return WebResponseContent.Instance.Error($"以䏿¡ç å·²æ£éï¼æ æ³æ¤éï¼{string.Join(",", pickedBarcodes)}"); // è¿åååºåºè¯¦æ æ°é var originalOutStockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() // 3. è·ååæ¡ç ä¿¡æ¯ var originalLockInfo = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>() .Where(x => x.CurrentBarcode == originalBarcode) .FirstAsync(); originalOutStockInfo.AssignQuantity += splitPackage.SplitQty; await _outStockLockInfoService.Db.Updateable(originalOutStockInfo).ExecuteCommandAsync(); if (originalLockInfo == null) return WebResponseContent.Instance.Error("æªæ¾å°åæ¡ç éå®ä¿¡æ¯"); // å 餿°åºåºè¯¦æ è®°å½ var originalStockDetail = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(x => x.Barcode == originalBarcode && x.StockId == originalLockInfo.StockId) .FirstAsync(); // 4. è·åæææ°æ¡ç çåºåè®°å½ var newStockDetails = await _stockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>() .Where(x => newBarcodes.Contains(x.Barcode)) .ToListAsync(); // 5. è®¡ç®æ»è¿åæ°é decimal totalRevertQty = newStockDetails.Sum(x => x.StockQuantity); // 6. è¿ååæ¡ç åºåè®°å½ if (originalStockDetail != null) { // åæ¡ç å½åæ°éå ä¸æææ°æ¡ç çæ°é originalStockDetail.StockQuantity += totalRevertQty; originalStockDetail.OutboundQuantity += totalRevertQty; await _stockInfoDetailService.Db.Updateable(originalStockDetail).ExecuteCommandAsync(); } // 7. è¿ååæ¡ç éå®ä¿¡æ¯ decimal totalAssignQty = newLockInfos.Sum(x => x.AssignQuantity); originalLockInfo.AssignQuantity += totalAssignQty; if (originalLockInfo.OrderQuantity < originalLockInfo.AssignQuantity) { originalLockInfo.AssignQuantity=originalLockInfo.OrderQuantity; } originalLockInfo.Status = (int)OutLockStockStatusEnum.åºåºä¸; originalLockInfo.IsSplitted = 0; await _outStockLockInfoService.Db.Updateable(originalLockInfo).ExecuteCommandAsync(); // 8. å é¤æææ°æ¡ç çéå®ä¿¡æ¯ await _outStockLockInfoService.Db.Deleteable<Dt_OutStockLockInfo>() .Where(x => x.CurrentBarcode == splitPackage.NewBarcode) .Where(x => newBarcodes.Contains(x.CurrentBarcode)) .ExecuteCommandAsync(); // æ è®°æå è®°å½ä¸ºå·²æ¤é splitPackage.IsReverted = true; await Db.Updateable(splitPackage).ExecuteCommandAsync(); // 9. å é¤æææ°æ¡ç çåºåè®°å½ await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>() .Where(x => newBarcodes.Contains(x.Barcode)) .ExecuteCommandAsync(); // 10. æ è®°æææå è®°å½ä¸ºå·²æ¤é foreach (var record in splitRecords) { record.IsReverted = true; } await Db.Updateable(splitRecords).ExecuteCommandAsync(); _unitOfWorkManage.CommitTran(); return WebResponseContent.Instance.OK("æ¤éæå æå"); return WebResponseContent.Instance.OK($"æ¤éæå æåï¼å ±è¿å{splitRecords.Count}次æå ï¼æ»æ°éï¼{totalRevertQty}"); } catch (Exception ex) @@ -220,7 +378,6 @@ return WebResponseContent.Instance.Error($"æ¤éæå 失败ï¼{ex.Message}"); } } // è·åæå ä¿¡æ¯ public async Task<WebResponseContent> GetSplitPackageInfo(string orderNo, string palletCode, string barcode) { ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -16,6 +16,7 @@ #endregion << ç æ¬ 注 é >> using AutoMapper; using Dm.filter; using MailKit.Search; using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -271,6 +272,7 @@ batchNo = group.Key.BatchNo, lineNo = group.Key.lineNo, warehouseCode = group.Key.WarehouseCode, qty=group.Sum(x=>x.BarcodeQty), // warehouseCode= "1072", unit = group.Key.BarcodeUnit, barcodes = group.Select(row => new FeedbackBarcodesModel @@ -307,18 +309,25 @@ _locationInfoService.Repository.UpdateData(locationInfo); var outloks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.TaskNum == task.TaskNum).ToList(); outloks.ForEach(o => { o.Status = OutLockStockStatusEnum.å·²åºåº.ObjToInt(); }); _outStockLockInfoService.Db.Updateable(outloks).ExecuteCommand(); var locationCodes = outloks.Select(it => it.LocationCode).Distinct().ToList(); var stockids = outloks.Select(x => x.StockId).ToList(); _stockService.StockInfoService.Db.Updateable<Dt_StockInfo>() .SetColumns(it => new Dt_StockInfo { StockStatus = StockStatusEmun.åºåºéå®.ObjToInt() }) .Where(it => stockids.Contains(it.Id)) .ExecuteCommand(); //_stockRepository.Db.Updateable<Dt_StockInfo>() // .SetColumns(it => new Dt_StockInfo { StockStatus = StockStatusEmun.}) // .Where(it => locationCodes.Contains(it.LocationCode)) // .ExecuteCommand(); _stockService.StockInfoDetailService.Db.Updateable<Dt_StockInfoDetail>() .SetColumns(it => new Dt_StockInfoDetail { Status = StockStatusEmun.åºåºéå®.ObjToInt() }) .Where(it => stockids.Contains( it.StockId)) .ExecuteCommand(); return WebResponseContent.Instance.OK(); @@ -378,10 +387,48 @@ } } public WebResponseContent InPickTaskCompleted(Dt_Task task) public WebResponseContent InPickTaskCompleted(Dt_Task task) { _logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum}"); //æ¥åºå Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == task.PalletCode).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçç»çä¿¡æ¯"); } if (stockInfo.Details.Count == 0 && stockInfo.PalletType != PalletTypeEnum.Empty.ObjToInt()) { return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥æçåºåæç»ä¿¡æ¯"); } //æ¥è´§ä½ Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); if (locationInfo == null) { return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); } stockInfo.LocationCode = task.TargetAddress; stockInfo.StockStatus = StockStatusEmun.å ¥åºå®æ.ObjToInt(); stockInfo.Details.ForEach(x => { x.Status = StockStatusEmun.å ¥åºå®æ.ObjToInt(); }); _stockService.StockInfoService.Repository.UpdateData(stockInfo); _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details); if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt()) { locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); } else { locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); } _locationInfoService.Repository.UpdateData(locationInfo); task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); return WebResponseContent.Instance.OK(); } ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -159,7 +159,7 @@ (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound, (int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate, (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality, _ => new TaskTypeEnum() _ => TaskTypeEnum.Outbound }; tasks = GetTasks(result.Item1, typeEnum, outStation); tasks.ForEach(x => ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderDetailController.cs
@@ -1,8 +1,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using SqlSugar; using WIDESEA_Core; using WIDESEA_Core.Attributes; using WIDESEA_Core.BaseController; using WIDESEA_Core.Helper; using WIDESEA_DTO.Stock; using WIDESEA_IOutboundService; using WIDESEA_Model.Models; @@ -19,6 +22,18 @@ public OutboundOrderDetailController(IOutboundOrderDetailService service) : base(service) { } //[HttpPost, Route("GetOutboundDetailStockDataById"), AllowAnonymous, MethodParamsValidate] //public List<Dt_OutboundOrderDetail> GetOutboundDetailStockDataById (int id) //{ // return Service.GetOutboundStockDataById(id); //} public override ActionResult GetPageData(PageDataOptions options) { return Json( Service.GetPageData(options)); } } }