| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证储位地址(地码)是否可用 |
| | | /// </summary> |
| | | /// <param name="locatNo">储位编码</param> |
| | | /// <returns></returns> |
| | | public string CheckLocatNo(string locatNo) |
| | | { |
| | | try |
| | | { |
| | | string strMsg = ""; |
| | | var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == locatNo && w.Status == "0" && w.WareHouseNo == "W02"); |
| | | if (storageLocat == null) |
| | | { |
| | | throw new Exception("-1:地码(储位信息)不存在或非空闲状态,请核查!"); |
| | | } |
| | | |
| | | return strMsg; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | //根据箱码获取物料、批次、数量等信息 |
| | | public PdaPalletNoCheckDto GetBoxInfoByBoxNo(string boxNo) |
| | | { |
| | |
| | | { |
| | | throw new Exception("-1:单据号不可为空!"); |
| | | } |
| | | //根据单据号获取入库单总单 |
| | | var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); |
| | | if (model.AsnDetailId == null || model.AsnDetailId == 0) |
| | | { |
| | | throw new Exception("-1:物料不可为空!"); |
| | |
| | | if (string.IsNullOrEmpty(model.PalletNo)) |
| | | { |
| | | throw new Exception("-1:托盘号不可为空!"); |
| | | } |
| | | //根据单据号获取入库单总单 |
| | | var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); |
| | | if (notice.Status != "0" && notice.Status != "1") |
| | | { |
| | | throw new Exception("-1:入库单状态不是等待执行或执行完成!"); |
| | | } |
| | | if (string.IsNullOrEmpty(model.LotNo)) |
| | | { |
| | |
| | | if (pallet == null) |
| | | { |
| | | throw new Exception("未查询到托盘信息,请核实!"); |
| | | } |
| | | //判断托盘是否在库外 |
| | | var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo); |
| | | if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo)) |
| | | { |
| | | throw new Exception("该托盘未在库外,请核实!"); |
| | | } |
| | | // 验证入库单明细是否存在 |
| | | var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo)); |
| | |
| | | throw new Exception("-1:当前托盘正在执行中,绑定失败,请核实!"); |
| | | } |
| | | bindId = bind.Id; |
| | | bind.Qty += model.SkuQty; |
| | | } |
| | | |
| | | #region 箱码信息 |
| | |
| | | |
| | | // 更改箱支关系表 |
| | | decimal factQty = 0.00m;//托盘总数量 |
| | | //成品组托 |
| | | if (model.SkuQty == 0) |
| | | { |
| | | var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); |
| | |
| | | var sqlString = string.Empty; |
| | | if (factQty == 0) |
| | | { |
| | | sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{bind.Qty}' where id = '{model.AsnDetailId}';"; |
| | | sqlString += $"update BllArrivalNoticeDetail set FactQty = FactQty + '{model.SkuQty}' where id = '{model.AsnDetailId}';"; |
| | | } |
| | | else |
| | | { |
| | |
| | | //验证库存是否拥有该托信息 |
| | | if (stockDetail != null && stockDetail.Count > 0) |
| | | { |
| | | foreach (var item in stockDetail) |
| | | { |
| | | if (!string.IsNullOrEmpty(item.WareHouseNo)) |
| | | { |
| | | throw new Exception("该托盘未在库外,请核查!"); |
| | | } |
| | | } |
| | | iscount = 1; //回流入库 |
| | | } |
| | | #endregion |
| | |
| | | Db.BeginTran();//开启事务 |
| | | if (iscount == 0)//正常入库 |
| | | { |
| | | #region 箱码信息 |
| | | var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList(); |
| | | //验证箱码信息是否存在 |
| | | if (boxInfoList.Count <= 0) |
| | | { |
| | | throw new Exception("箱码信息不存在,请核查!"); |
| | | } |
| | | foreach (var item in boxInfoList) |
| | | { |
| | | item.Status = "2"; // 改变箱支关系表状态:已入库 |
| | | item.UpdateTime = serverTime; |
| | | item.UpdateUser = model.CreateUser; |
| | | } |
| | | Db.Updateable(boxInfoList).ExecuteCommand(); |
| | | #endregion |
| | | |
| | | #region 入库总单信息 |
| | | var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.Status != "3" && a.ASNNo == model.ASNNo); |
| | | //验证入库单总单是否关闭 |
| | |
| | | if (notice.Status == "3") |
| | | { |
| | | throw new Exception("入库单总单已关闭,请核查!"); |
| | | } |
| | | #endregion |
| | | |
| | | #region 箱码信息 |
| | | var boxInfoList = Db.Queryable<BllBoxInfo>().Where(w => w.IsDel == "0" && w.ASNNo == model.ASNNo).ToList(); |
| | | // type 0:成品入库 1:采购入库 2:中间品入库 3:退货入库 4:车间余料退回入库 5:其它入库 6:代储入库 7:寄存入库 |
| | | if (notice.Type == "2" || notice.Type == "6" || notice.Type == "7") |
| | | { |
| | | // 不贴码物料 无需验证箱码信息 |
| | | } |
| | | else |
| | | { |
| | | //验证箱码信息是否存在 |
| | | if (boxInfoList.Count <= 0) |
| | | { |
| | | throw new Exception("箱码信息不存在,请核查!"); |
| | | } |
| | | foreach (var item in boxInfoList) |
| | | { |
| | | item.Status = "2"; // 改变箱支关系表状态:已入库 |
| | | item.UpdateTime = serverTime; |
| | | item.UpdateUser = model.CreateUser; |
| | | } |
| | | Db.Updateable(boxInfoList).ExecuteCommand(); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | ASNDetailNo = (int)bindInfo.ASNDetailNo, |
| | | WareHouseNo = "W02", |
| | | RoadwayNo = "", |
| | | AreaNo = "", |
| | | AreaNo = storageLocat.AreaNo, |
| | | LocatNo = model.LocatNo, |
| | | PalletNo = model.PalletNo, |
| | | PalletNo2 = bindInfo.PalletNo2, |
| | |
| | | { |
| | | stId = detailModel.Id; |
| | | detailModel.LocatNo = model.LocatNo; |
| | | detailModel.AreaNo = storageLocat.AreaNo; |
| | | detailModel.UpdateTime = serverTime; |
| | | detailModel.UpdateUser = (int)model.CreateUser; |
| | | // 变更储位地址 |