| | |
| | | using Model.ModelDto.BllCheckDto; |
| | | using Model.ModelDto.PdaDto; |
| | | using SqlSugar; |
| | | using Utility; |
| | | using WMS.BLL.LogServer; |
| | | using WMS.DAL; |
| | | using WMS.Entity.BllAsnEntity; |
| | |
| | | { |
| | | if (string.IsNullOrWhiteSpace(crNo)) |
| | | { |
| | | throw new Exception("盘点单据不能为空"); |
| | | throw Oops.Bah("盘点单据不能为空"); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(crDetail)) |
| | | { |
| | | throw new Exception("物料批次不能为空"); |
| | | throw Oops.Bah("物料批次不能为空"); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(palletNo)) |
| | | { |
| | | throw new Exception("托盘码不能为空"); |
| | | throw Oops.Bah("托盘码不能为空"); |
| | | } |
| | | //箱码为空 是整托要盘点的都正常 |
| | | var detail = crDetail.Split("-"); |
| | |
| | | m.IsDel == "0" && m.CRNo == crNo && m.PalletNo == palletNo && m.SkuNo == sku && m.LotNo == lotNo); |
| | | if (checkDetail == null) |
| | | { |
| | | throw new Exception("未查询到未盘点的盘点明细信息"); |
| | | throw Oops.Bah("未查询到未盘点的盘点明细信息"); |
| | | } |
| | | var modSku = Db.Queryable<SysMaterials>().Where(s => s.SkuNo == sku).First(); |
| | | if (modSku.IsPasteCode == "1" && isContinue == "1") |
| | | { |
| | | throw Oops.Bah("贴标物料不允许数量盘点"); |
| | | } |
| | | else if (modSku.IsPasteCode == "0" && isContinue == "0") |
| | | { |
| | | throw Oops.Bah("不贴标物料请使用数量盘点"); |
| | | } |
| | | //盘点记录 |
| | | var checkLog = Db.Queryable<BllStockCheckLog>().Where(m => |
| | |
| | | |
| | | if (checkLog.Count() == 0 && isContinue == "0") |
| | | { |
| | | throw new Exception("未查询到未盘点的箱支信息"); |
| | | throw Oops.Bah("未查询到未盘点的箱支信息"); |
| | | } |
| | | |
| | | var list = checkLog.ToList(); |
| | |
| | | l.CheckDate = time; |
| | | l.CheckUserId = userId; |
| | | |
| | | num += int.Parse(l.Qty.ToString()); |
| | | num += Convert.ToInt32(l.Qty); |
| | | } |
| | | |
| | | if (checkDetail.RealQty == null) |
| | |
| | | |
| | | if (checkLog.Count() == 0 && isContinue == "0") |
| | | { |
| | | throw new Exception("未查询到箱支信息"); |
| | | throw Oops.Bah("未查询到箱支信息"); |
| | | } |
| | | |
| | | // |
| | |
| | | { |
| | | if (qty == null || qty <= 0) |
| | | { |
| | | throw new Exception("数量盘点时、盘亏数量不能为空且需大于0"); |
| | | throw Oops.Bah("数量盘点时、盘亏数量不能为空且需大于0"); |
| | | } |
| | | } |
| | | |
| | |
| | | l.CheckResult = 1; |
| | | l.CheckDate = time; |
| | | l.CheckUserId = userId; |
| | | num -= int.Parse(l.RealQty.ToString()); |
| | | num -= Convert.ToInt32(l.RealQty); |
| | | } |
| | | if (checkDetail.RealQty == null) |
| | | { |
| | |
| | | { |
| | | if (string.IsNullOrWhiteSpace(boxNo) || string.IsNullOrWhiteSpace(boxNo3)) |
| | | { |
| | | throw new Exception("盘盈时箱码与支码不能为空"); |
| | | throw Oops.Bah("盘盈时箱码与支码不能为空"); |
| | | } |
| | | } |
| | | if (qty == null || qty <= 0) |
| | | { |
| | | throw new Exception("盘盈时数量不能为空且需大于0"); |
| | | throw Oops.Bah("盘盈时数量不能为空且需大于0"); |
| | | } |
| | | if (isContinue == "0") |
| | | { |
| | |
| | | .Count(m => m.IsDel == "0" && m.BoxNo == boxNo && m.BoxNo3 == boxNo3); |
| | | if (count > 0 || count2 > 0) |
| | | { |
| | | throw new Exception("当前库存中已存在该箱支信息"); |
| | | throw Oops.Bah("当前库存中已存在该箱支信息"); |
| | | } |
| | | } |
| | | BllStockCheckLog crLog = new BllStockCheckLog(); |
| | |
| | | else |
| | | { |
| | | Db.RollbackTran(); |
| | | throw new Exception("盘点结果不符,请核实!"); |
| | | throw Oops.Bah("盘点结果不符,请核实!"); |
| | | } |
| | | var checkLogNum = Db.Queryable<BllStockCheckLog>().Where(m => m.IsDel == "0" && m.CRNo == crNo && m.PalletNo == palletNo && m.SkuNo == sku && m.LotNo == lotNo); |
| | | if (checkLogNum.Count(m => m.CheckResult == null) == 0) |
| | |
| | | var storageArea = new List<SysStorageArea>(); |
| | | if (string.IsNullOrEmpty(palletNo)) |
| | | { |
| | | storageArea = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.WareHouseNo == "W02").OrderBy(o=>o.AreaNo).ToList(); |
| | | storageArea = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.WareHouseNo == "W02").OrderBy(o => o.AreaNo).ToList(); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | throw new Exception("储位信息不存在,请检查!"); |
| | | } |
| | | |
| | | |
| | | if (storageLocat.AreaNo.Contains("B0")) |
| | | { |
| | | storageArea = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.AreaNo.Contains("B0") && w.WareHouseNo == "W02").OrderBy(o => o.AreaNo).ToList(); |
| | |
| | | { |
| | | storageArea = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.AreaNo.Contains("B1") && w.WareHouseNo == "W02").OrderBy(o => o.AreaNo).ToList(); |
| | | } |
| | | } |
| | | } |
| | | return storageArea; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | if (!string.IsNullOrEmpty(areaNo) && !string.IsNullOrEmpty(ruku)) |
| | | { |
| | | throw new Exception("目标区域和入库口不能同时选择!"); |
| | | } |
| | | } |
| | | try |
| | | { |
| | | string EndLocat = string.Empty;//目标位置 |
| | |
| | | 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,palletNo); |
| | | EndLocat = GetLocat(areaNo, stockDetail.SkuNo, stockDetail.LotNo, palletNo); |
| | | } |
| | | else |
| | | { |
| | |
| | | throw new Exception("目标储位信息不存在,请检查!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | |
| | |
| | | { |
| | | 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="palletNo"></param> |
| | | /// <param name="areaNo"></param> |
| | | /// <param name="userId"></param> |
| | | public void AgvTransport2(string soNo,string palletNo, string areaNo, int userId) |
| | | public void AgvTransport2(string soNo, string palletNo, string areaNo, int userId) |
| | | { |
| | | if (string.IsNullOrEmpty(soNo)) |
| | | { |
| | |
| | | string sqlStr = $"select * from DataStockDetail where PalletNo in (select PalletNo from BllExportAllot where IsDel='0' and SONo='{soNo}')"; |
| | | stockDetailList = Db.Ado.SqlQuery<DataStockDetail>(sqlStr).ToList(); |
| | | } |
| | | if (stockDetailList.Count<=0) |
| | | if (stockDetailList.Count <= 0) |
| | | { |
| | | throw new Exception("托盘明细不存在,请检查!"); |
| | | } |
| | |
| | | foreach (var item in stockDetailList) |
| | | { |
| | | //任务信息 |
| | | var logInfo = log.First(w =>w.PalletNo == item.PalletNo); |
| | | var logInfo = log.First(w => w.PalletNo == item.PalletNo); |
| | | if (logInfo != null) |
| | | { |
| | | throw new Exception($"托盘号:{item.PalletNo}已有小车等待执行或正在执行的任务!"); |
| | |
| | | /// <param name="skuNo"></param> |
| | | /// <param name="lotNo"></param> |
| | | /// <returns></returns> |
| | | private string GetLocat(string areaNo,string skuNo,string lotNo,string palletNo,string hasLocatNoList="") |
| | | private string GetLocat(string areaNo, string skuNo, string lotNo, string palletNo, string hasLocatNoList = "") |
| | | { |
| | | 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 && w.PalletNo != palletNo) |
| | | .OrderByDescending(o=>o.LocatNo).Select(s=>s.LocatNo).Distinct().ToList(); |
| | | .OrderByDescending(o => o.LocatNo).Select(s => s.LocatNo).Distinct().ToList(); |
| | | foreach (var item in locatList) |
| | | { |
| | | var locatInfo = storageLocatList.Where(w => w.LocatNo == item).First(); |
| | |
| | | if (string.IsNullOrEmpty(endLocat)) |
| | | { |
| | | var locatInfo3 = storageLocatList.Where(w => w.IsDel == "0" && w.Flag == "0" && w.Status == "0" && !hasLocatNoList.Contains(w.LocatNo)) |
| | | .OrderByDescending(m => m.Layer).OrderByDescending(m=>m.Column).OrderByDescending(m=> m.Row).First(); |
| | | .OrderByDescending(m => m.Layer).OrderByDescending(m => m.Column).OrderByDescending(m => m.Row).First(); |
| | | |
| | | if (locatInfo3 != null) |
| | | { |