Browse Source

支持Pingku类型及优化库存处理逻辑

在 `FJService.cs` 文件中,进行了以下更改:
1. 在检查托盘条码号是否存在出库中任务的逻辑后,新增了获取机器信息的代码 `var mac = _basemachinforepository.GetFirst(x => x.MachNo == reqDto.LocCode);`。
2. 在创建入库任务时,将 `WorkBench` 字段从 `reqDto.LocCode` 修改为 `mac.Station`。
3. 在获取所有立库/虚拟货位的逻辑中,新增了对 `FjLocationType.Pingku` 类型的支持。
4. 在更新库存信息的逻辑中,新增了对 `FjLocationType.Pingku` 类型的处理。
5. 在处理 `FjLocationType.Pingku` 类型的库存信息变更时,新增了删除缓存信息、更新货位信息、更新流水信息和添加反馈信息的逻辑。
林豪 左 1 năm trước cách đây
mục cha
commit
8ff10e095c
1 tập tin đã thay đổi với 55 bổ sung4 xóa
  1. 55 4
      wms.service/Service/FJService.cs

+ 55 - 4
wms.service/Service/FJService.cs

@@ -1640,6 +1640,8 @@ namespace wms.service.Service
                 return res;
             }
 
+            var mac = _basemachinforepository.GetFirst(x => x.MachNo == reqDto.LocCode);
+
             try
             {
                 _db.BeginTran();
@@ -1657,7 +1659,7 @@ namespace wms.service.Service
                     EquCode = "",
                     Type = TaskType.EnterDepot,
                     DocCode = "",
-                    WorkBench = reqDto.LocCode,
+                    WorkBench = mac.Station, //TODO:是否是AGV站台
                     WarehouseCode = wareHouse.Code,
                 };
 
@@ -2702,7 +2704,7 @@ namespace wms.service.Service
                 }
 
                 //找到所有的立库/虚拟货位
-                var warehouse = _basewarehouserepository.GetList(x => x.TypeNum == FjLocationType.Storage||x.TypeNum==FjLocationType.Virtual).Select(x => x.Id).ToList();
+                var warehouse = _basewarehouserepository.GetList(x => x.TypeNum == FjLocationType.Storage||x.TypeNum==FjLocationType.Virtual||x.TypeNum==FjLocationType.Pingku).Select(x => x.Id).ToList();
                 var task = _wcstaskoldrepository.AsQueryable().With(SqlWith.NoLock).Where(p => p.WorkBench == mach.Station && p.Status < TaskStatus.Finish).SplitTable(tabs => tabs.Take(2));
                 if (task != null && task.Any())
                 {
@@ -6821,7 +6823,9 @@ namespace wms.service.Service
                         //更新库存
                         _billInvnowrepository.UpdateModelColumns(p => new BillInvnow() { PutRow = 0, PutCol = 0, PutLayer = 0 }, p => p.InvStateCode == InvState.InvEcecState_OutGoing.ToString() && p.ContGrpBarCode == wcstask.BarCode);
                         break;
-
+                    case FjLocationType.Pingku:
+                        _billInvnowrepository.UpdateModelColumns(p => new BillInvnow() { PutRow = 0, PutCol = 0, PutLayer = 0 }, p => p.InvStateCode == InvState.InvEcecState_OutGoing.ToString() && p.ContGrpBarCode == wcstask.BarCode);
+                        break;
                     case FjLocationType.RingLibrary:
                         //更新库存
                         _billInvnowrepository.UpdateModelColumns(p => new BillInvnow() { PutRow = 0, PutCol = 0, PutLayer = 0, InvStateCode = FJInvState.InvEcecState_BuildUp.ToString() },
@@ -7122,7 +7126,54 @@ namespace wms.service.Service
                                 break;
 
                             case FjLocationType.Pingku:
-                                result.ResMsg = task.Id + "没有平库";
+                                _billInvnowrepository.Delete(p => stocklist.Select(p => p.Id).ToList().Contains(p.Id));
+                                 hWBarCode = stocklist.Select(p => p.HWBarCode).ToList();
+                                _billInvinitrepository.Delete(p => hWBarCode.Contains(p.HWBarCode) && p.InvStateCode == InvState.InvEcecState_OutGoing.ToString());
+                                 contGrpBarCode = stocklist.Select(p => p.ContGrpBarCode).ToList();
+                                _billInvinitrepository.Delete(p => contGrpBarCode.Contains(p.ContGrpBarCode) && p.InvStateCode == InvState.InvEcecState_OutGoing.ToString());
+                                _billSpoolTransrepository.Delete(p => stocklist.Select(p => p.HWBarCode).ToList().Contains(p.ConBarCode));
+                                _logger.LogInformation($"删除缓存信息{JsonConvert.SerializeObject(stocklist.Select(x => x.HWBarCode).ToList())}");
+                                //更新货位信息
+                                _basewarecellrepository.UpdateModelColumns(p => new BaseWarecell()
+                                {
+                                    StateNum = FjLocationState.Empty,
+                                    ContGrpBarCode = "",
+                                    ContGrpId = 0,
+                                    EditTime = DateTime.Now
+                                }, p => p.StateNum == FjLocationState.StockOut && p.ContGrpBarCode == task.BarCode && p.Code.Contains(task.AddrFrom) && p.WarehouseCode == task.WarehouseCode);
+
+                                //更新流水信息
+                                _billInvflow.InsertRange(flowlist);
+                                //添加反馈信息
+                                 pushtype = fjFackbeekType.InterfaceType_FJ_StockOut.ToString();
+                                 list = new List<BillPushinfo>();
+                                foreach (var item in stocklist)
+                                {
+                                    list.Add(new BillPushinfo
+                                    {
+                                        DocsNo = item.ExecDocsNo,
+                                        TypeCode = pushtype,
+                                        RFIDBarCode = item.ContGrpBarCode,
+                                        HWBarCode = item.HWBarCode,
+                                        CLBarCode = item.CLBarCode,
+                                        WarehouseId = wareHouse.Id,
+                                        WarehouseCode = wareHouse.Code,
+                                        WareCellId = 0,
+                                        WareCellCode = task.AddrTo,
+                                        MatId = item.MatId,
+                                        MatCode = item.MatCode,
+                                        MatName = item.MatName,
+                                        TolWQty = item.TolWQty,
+                                        NetWQty = item.NetWQty,
+                                        TareWQty = item.TareWQty,
+                                        ReqNo = Guid.NewGuid().ToString()
+                                    });
+                                }
+                                if (stocklist.First().ContGrpType == FJContGrpType.Material)
+                                {
+                                    _billPushinforepository.InsertRange(list);
+                                }
+                                _db.CommitTran();
                                 break;
 
                             case FjLocationType.Virtual: