| | |
| | | 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", |
| | |
| | | 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}箱内物料及批次与单据不一致,请核实!"); |
| | | } |