| | |
| | | { |
| | | string EndLocat = string.Empty;//目标位置 |
| | | |
| | | var log = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && (w.Status == "0" || w.Status == "1")); |
| | | if (log != null) |
| | | { |
| | | throw new Exception("该托盘已有小车等待执行或正在执行的任务!"); |
| | | } |
| | | var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == palletNo); |
| | | if (stockDetail == null) |
| | | { |
| | |
| | | { |
| | | throw new Exception("所选区域信息不存在,请检查!"); |
| | | } |
| | | EndLocat = GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo); |
| | | EndLocat = GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo,palletNo); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | throw new Exception("该托盘未在平库内,请检查!"); |
| | | } |
| | | //起始储位信息 |
| | | var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == stockDetail.LocatNo); |
| | | if (storageLocat == null) |
| | | { |
| | | throw new Exception("储位信息不存在,请检查!"); |
| | | } |
| | | //目标储位信息 |
| | | var storageLocatEnd = new SysStorageLocat(); |
| | | if (!string.IsNullOrEmpty(areaNo)) |
| | | { |
| | | storageLocatEnd = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0" && w.Status == "0"); |
| | | if (storageLocatEnd == null) |
| | | { |
| | | throw new Exception("目标储位信息不存在,请检查!"); |
| | | } |
| | | } |
| | | |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | |
| | | stock.LockQty += (decimal)stockDetail.Qty; |
| | | Db.Updateable(stock).ExecuteCommand(); |
| | | |
| | | //修改储位地址状态 |
| | | //修改起始储位地址状态 |
| | | storageLocat.Status = "5";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 |
| | | Db.Updateable(storageLocat).ExecuteCommand(); |
| | | |
| | | //修改目标储位地址状态 |
| | | if (storageLocatEnd != null) |
| | | { |
| | | storageLocatEnd.Status = "4";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 |
| | | Db.Updateable(storageLocatEnd).ExecuteCommand(); |
| | | } |
| | | //添加操作日志记录 |
| | | var k = new OperationCrServer().AddLogOperationCr("PDA模块", "AGV转运", palletNo, "移库", $"PDA呼叫小车对托盘号:{palletNo}发起转运", userId); |
| | | //提交事务 |
| | |
| | | } |
| | | try |
| | | { |
| | | var log = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.PalletNo == palletNo && (w.Status == "0" || w.Status == "1")); |
| | | if (log != null) |
| | | { |
| | | throw new Exception("该托盘已有小车等待执行或正在执行的任务!"); |
| | | } |
| | | |
| | | var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo); |
| | | if (notice == null) |
| | | { |
| | |
| | | throw new Exception("所选区域信息不存在,请检查!"); |
| | | } |
| | | string EndLocat = string.Empty;//目标位置 |
| | | EndLocat= GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo); |
| | | EndLocat= GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo,palletNo); |
| | | //目标储位信息 |
| | | var storageLocatEnd = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == EndLocat && w.Flag == "0" && w.Status == "0"); |
| | | if (storageLocatEnd == null) |
| | | { |
| | | throw new Exception("目标储位信息不存在,请检查!"); |
| | | } |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | |
| | | storageLocat.Status = "5";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 |
| | | Db.Updateable(storageLocat).ExecuteCommand(); |
| | | |
| | | //修改目标储位地址状态 |
| | | storageLocatEnd.Status = "4";//0:空储位 1:有物品 2:入库中 3:出库中 4:移入中 5:移出中 |
| | | Db.Updateable(storageLocatEnd).ExecuteCommand(); |
| | | |
| | | //添加操作日志记录 |
| | | var k = new OperationCrServer().AddLogOperationCr("PDA模块", "AGV转运", palletNo, "移库", $"PDA呼叫小车对托盘号:{palletNo}发起转运", userId); |
| | | //提交事务 |
| | |
| | | /// <param name="skuNo"></param> |
| | | /// <param name="lotNo"></param> |
| | | /// <returns></returns> |
| | | private string GetLocat(string areaNo,string skuNo,string lotNo) |
| | | private string GetLocat(string areaNo,string skuNo,string lotNo,string palletNo) |
| | | { |
| | | try |
| | | { |
| | |
| | | //当然区域所有储位信息 |
| | | var storageLocatList = Db.Queryable<SysStorageLocat>().Where(w => w.WareHouseNo == "W02" && w.AreaNo == areaNo).ToList(); |
| | | //同区域同批次物料的储位信息 |
| | | List<string> locatList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == skuNo && w.LotNo == lotNo && w.WareHouseNo == "W02" && w.AreaNo == areaNo) |
| | | List<string> locatList = Db.Queryable<DataStockDetail>().Where(w => w.IsDel == "0" && w.SkuNo == skuNo && w.LotNo == lotNo && w.WareHouseNo == "W02" && w.AreaNo == areaNo && w.PalletNo != palletNo) |
| | | .OrderByDescending(o=>o.LocatNo).Select(s=>s.LocatNo).Distinct().ToList(); |
| | | foreach (var item in locatList) |
| | | { |
| | |
| | | if (string.IsNullOrEmpty(endLocat)) |
| | | { |
| | | var locatInfo3 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0" && w.Status == "0") |
| | | .OrderByDescending(m => new { m.Layer, m.Column, m.Row }).First(); |
| | | .OrderByDescending(m => m.Layer).OrderByDescending(m=>m.Column).OrderByDescending(m=> m.Row).First(); |
| | | |
| | | if (locatInfo3 != null) |
| | | { |