| | |
| | | #endregion |
| | | |
| | | #region 地码信息(储位信息) |
| | | var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0"); |
| | | var storageLocat = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LocatNo && w.Status == "0" && w.WareHouseNo == "W02"); |
| | | if (storageLocat == null) |
| | | { |
| | | strMsg = "-1:储位信息不存在或非空闲状态,请核查!"; |
| | |
| | | |
| | | //修改组托状态 |
| | | palletbindInfo.Status = "2"; //2 入库完成 |
| | | palletbindInfo.WareHouseNo = "W02";//所属仓库 |
| | | palletbindInfo.LocatNo = model.LocatNo;//储位地址 |
| | | palletbindInfo.UpdateTime = serverTime; |
| | | palletbindInfo.UpdateUser = model.CreateUser; |
| | | palletbindInfo.CompleteTime = serverTime; //完成时间 |
| | |
| | | #endregion |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | storageLocat.Status = "1"; |
| | | storageLocat.UpdateTime= serverTime; //修改时间 |
| | | storageLocat.UpdateUser = model.CreateUser; //修改人 |
| | | //修改储位状态 |
| | | Db.Updateable(storageLocat).ExecuteCommand(); |
| | | |
| | | new OperationASNServer().AddLogOperationAsn("PDA模块", "平库入库", model.PalletNo, "完成", $"在PDA上完成单据号为:{model.ASNNo}的托盘码为:{model.PalletNo}的平库入库操作", (int)model.CreateUser); |
| | | |
| | |
| | | throw ex; |
| | | } |
| | | } |
| | | // 根据单据号获取单据明细列表 |
| | | public List<ArrivalNoticeDetailDto> GetBindArrivalNoticeDetails(ArrivalNoticeVm model) |
| | | { |
| | | string sqlString = string.Empty; |
| | | try |
| | | { |
| | | sqlString = $"select * from BllArrivalNoticeDetail where ASNNo = '{model.ASNNo}' and isdel='0' order by CreateTime;"; |
| | | var modelList = Db.Ado.SqlQuery<ArrivalNoticeDetailDto>(sqlString); |
| | | List<ArrivalNoticeDetailDto> noticeList = new List<ArrivalNoticeDetailDto>(); |
| | | foreach (var item in modelList) |
| | | { |
| | | if (string.IsNullOrEmpty(item.LotNo)) |
| | | { |
| | | noticeList.Add(item); |
| | | } |
| | | else |
| | | { |
| | | string[] LotNoList = item.LotNo.Split(';'); |
| | | foreach (var item2 in LotNoList) |
| | | { |
| | | ArrivalNoticeDetailDto entry = new ArrivalNoticeDetailDto(); |
| | | entry = item; |
| | | entry.LotNo = item2; |
| | | |
| | | noticeList.Add(entry); |
| | | } |
| | | } |
| | | } |
| | | return noticeList; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定托盘 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="userId"></param> |
| | | /// <param name="origin"></param> |
| | | public void BindPallet(PdaPalletBindVm model, int userId, string origin) |
| | | { |
| | | try |
| | |
| | | if (string.IsNullOrEmpty(model.PalletNo)) |
| | | { |
| | | throw new Exception("-1:托盘号不可为空!"); |
| | | } |
| | | if (string.IsNullOrEmpty(model.LotNo)) |
| | | { |
| | | throw new Exception("-1:物料批次不可为空!"); |
| | | } |
| | | else |
| | | { |
| | | //从物料名称-批次中取出批次 |
| | | int indexOfDash = model.LotNo.IndexOf("-"); |
| | | if (indexOfDash != -1) |
| | | { |
| | | model.LotNo = model.LotNo.Substring(indexOfDash + 1); |
| | | } |
| | | } |
| | | //判断物料数量是否为0 为0判断箱码信息 不为0继续 |
| | | if (model.SkuQty == 0) |
| | |
| | | throw new Exception("未查询到托盘信息,请核实!"); |
| | | } |
| | | // 验证入库单明细是否存在 |
| | | var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo); |
| | | var detail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.Id == model.AsnDetailId && m.ASNNo == model.AsnNo && m.LotNo.Contains(model.LotNo)); |
| | | if (detail == null) |
| | | { |
| | | throw new Exception("-1:当前物料及批次与单据无关联,请核实!"); |
| | |
| | | FullQty = pNum, |
| | | Status = "0", |
| | | Type = "0", |
| | | LotNo = detail.LotNo, |
| | | LotNo = model.LotNo, |
| | | LotText = detail.LotText, |
| | | SupplierLot = "", |
| | | InspectMark = "0", |
| | |
| | | IsBelt = "0", |
| | | CreateUser = userId |
| | | }; |
| | | if (model.SkuQty > pNum) |
| | | { |
| | | throw new Exception($"绑定失败,{model.PalletNo}托盘绑定数量大于该物品托盘包装数量!"); |
| | | } |
| | | // 插入托盘绑定表 |
| | | bindId = Db.Insertable(bind).ExecuteReturnIdentity(); |
| | | } |
| | |
| | | continue; |
| | | } |
| | | //箱内物料批次与单据明细不符合 |
| | | if (box.SkuNo != detail.SkuNo || box.LotNo != detail.LotNo) |
| | | if (box.SkuNo != detail.SkuNo || box.LotNo != model.LotNo) |
| | | { |
| | | throw new Exception($"-1:{box.BoxNo}箱内物料及批次与单据不一致,请核实!"); |
| | | } |
| | |
| | | { |
| | | bind.BitPalletMark = "0"; |
| | | } |
| | | if (bind.Qty > pNum) |
| | | { |
| | | throw new Exception($"绑定失败,{bind.PalletNo}托盘绑定数量大于该物品托盘包装数量!"); |
| | | } |
| | | Db.Updateable(bind).Where(m => m.Id == bindId).ExecuteCommand(); |
| | | |
| | | // 更改入库单明细已组数量 |
| | |
| | | //添加托盘记录表数据 |
| | | sqlStr += $"insert into LogPalletTrack values('{model.PalletNo}','{model.AsnNo}','组盘','0',getDate(),{userId},NULL,NULL);"; |
| | | Db.Ado.ExecuteCommand(sqlStr); |
| | | new OperationASNServer().AddLogOperationAsn("PDA模块", "托盘绑定1", model.AsnNo, "添加", $"添加了托盘码为:{model.PalletNo}、{msgStr}的组盘信息", userId); |
| | | new OperationASNServer().AddLogOperationAsn("PDA模块", "托盘绑定", model.AsnNo, "添加", $"添加了托盘码为:{model.PalletNo}、{msgStr}的组盘信息", userId); |
| | | |
| | | Db.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.RollbackTran(); |
| | | throw ex; |
| | | } |
| | | } |