| | |
| | | using Model.ModelDto.PdaDto; |
| | | using Dm; |
| | | using Model.InterFaceModel; |
| | | using WMS.Entity.BllQualityEntity; |
| | | |
| | | namespace WMS.BLL.BllPdaServer |
| | | { |
| | |
| | | sqlString = $"select * from BllArrivalNoticeDetail where ASNNo = '{model.ASNNo}' and isdel='0' order by CreateTime;"; |
| | | var modelList = Db.Ado.SqlQuery<ArrivalNoticeDetailDto>(sqlString); |
| | | |
| | | return modelList; |
| | | List<ArrivalNoticeDetailDto> list = new List<ArrivalNoticeDetailDto>(); |
| | | foreach (var item in modelList) |
| | | { |
| | | string str = BySkuNoGetPackInfo(item.SkuNo); |
| | | if (str == "不存在") |
| | | { |
| | | list.Add(item); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | //获取任务信息 |
| | | var logtask = Db.Queryable<LogTask>().First(a => a.PalletNo == upBindPalletNo && a.IsDel == "0" && a.Status == "1"); |
| | | if (logtask == null) |
| | | if (logtask != null) |
| | | { |
| | | strMsg = "该托盘任务已完成 或未成功创建任务 请核实!"; |
| | | return strMsg; |
| | | } |
| | | string bindstr = "select * from BllPalletBind Where IsDel = @isdel and PalletNo = @palletno and ASNDetailNo = 0 and ASNNo = ''"; |
| | | string bindstr = "select * from BllPalletBind Where IsDel = @isdel and PalletNo = @palletno and ASNDetailNo = 0 and ASNNo = '' "; |
| | | //获取绑定托盘表信息 |
| | | List<PalletBindVm> bindVms = Db.Ado.SqlQuery<PalletBindVm>(bindstr, new |
| | | { |
| | |
| | | return strMsg; |
| | | } |
| | | //删除绑定托盘表信息 |
| | | string delstr = "delete from BllPalletBind Where PalletNo = @palletno"; |
| | | string delstr = "update BllPalletBind set IsDel = 1,UpdateUser = @UpdateUser,UpdateTime = @UpdateTime Where PalletNo = @palletno and Id =@Id "; |
| | | int i = Db.Ado.ExecuteCommand(delstr, new |
| | | { |
| | | palletno = upBindPalletNo |
| | | UpdateUser = createUser, |
| | | UpdateTime = DateTime.Now, |
| | | palletno = upBindPalletNo, |
| | | Id = bindVms[0].Id |
| | | }); |
| | | //修改托盘状态 |
| | | Db.BeginTran(); |
| | |
| | | box.IsDel = "1"; |
| | | Db.Updateable(box).ExecuteCommand(); |
| | | |
| | | //修改任务状态 |
| | | logtask.IsDel = "1"; |
| | | logtask.Status = "4"; //3 已取消 |
| | | logtask.UpdateUser = createUser; //取消人 |
| | | logtask.UpdateTime = DateTime.Now; //取消时间 |
| | | Db.Updateable(logtask).ExecuteCommand(); |
| | | ////修改任务状态 |
| | | //logtask.IsDel = "1"; |
| | | //logtask.Status = "4"; //3 已取消 |
| | | //logtask.UpdateUser = createUser; //取消人 |
| | | //logtask.UpdateTime = DateTime.Now; //取消时间 |
| | | //Db.Updateable(logtask).ExecuteCommand(); |
| | | //更改库存数量 |
| | | //string str = $"update DataStock set Qty = Qty - {(int)bindVms[0].Qty} Where SkuNo = '100099'"; |
| | | // 更改托盘使用状态 |
| | |
| | | } |
| | | } |
| | | } |
| | | return noticeList; |
| | | List<ArrivalNoticeDetailDto> list = new List<ArrivalNoticeDetailDto>(); |
| | | foreach (var item in noticeList) |
| | | { |
| | | string str = BySkuNoGetPackInfo(item.SkuNo); |
| | | if (str == "存在") |
| | | { |
| | | list.Add(item); |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | } |
| | | |
| | | //根据物料获取是否存在包装信息 |
| | | public string BySkuNoGetPackInfo(string skuNo) |
| | | { |
| | | try |
| | | { |
| | | //获取物料信息 |
| | | var sku = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.SkuNo == skuNo); |
| | | //判断物料信息是否为空 |
| | | if (!string.IsNullOrWhiteSpace(sku.PackagNo)) |
| | | { |
| | | return "存在"; |
| | | } |
| | | else |
| | | { |
| | | return "不存在"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ex.Message; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | //根据单据号获取入库单总单 |
| | | var notice = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.AsnNo); |
| | | if (notice.Status != "0" && notice.Status != "1") |
| | | if (notice.Status != "0" && notice.Status != "1" && notice.Status != "2") |
| | | { |
| | | throw new Exception("-1:入库单状态不是等待执行或执行完成!"); |
| | | throw new Exception("-1:该单据已关单!"); |
| | | } |
| | | if (string.IsNullOrEmpty(model.LotNo)) |
| | | { |
| | |
| | | } |
| | | } |
| | | //判断物料数量是否为0 为0判断箱码信息 不为0继续 |
| | | if (model.SkuQty == 0) |
| | | if (model.TableType == 0) |
| | | { |
| | | if (string.IsNullOrEmpty(model.BoxNo)) |
| | | { |
| | |
| | | |
| | | } |
| | | } |
| | | int isTextTable = model.TableType; |
| | | int isDeposit = 0; |
| | | //判断总单单据是否为寄存单据 |
| | | if (notice.Type == "7") |
| | |
| | | } |
| | | //判断托盘是否在库外 |
| | | var stockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == model.PalletNo); |
| | | if (stockDetail != null && !string.IsNullOrEmpty(stockDetail.WareHouseNo)) |
| | | if (stockDetail != null)// && !string.IsNullOrEmpty(stockDetail.WareHouseNo) |
| | | { |
| | | throw new Exception("该托盘未在库外,请核实!"); |
| | | 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)); |
| | |
| | | var bNum = 0;//箱码物品数量 |
| | | |
| | | //判断是否为寄存物料 |
| | | if (isDeposit == 0) |
| | | if (isDeposit == 0 && isTextTable == 0) |
| | | { |
| | | if (pack == null) |
| | | { |
| | |
| | | Demo = model.Demo, |
| | | |
| | | }; |
| | | if (model.SkuQty > pNum && isDeposit == 0) |
| | | { |
| | | throw new Exception($"绑定失败,{model.PalletNo}托盘绑定数量大于该物品托盘包装数量!"); |
| | | } |
| | | //if (model.TableType == 0 && isDeposit == 0 && isTextTable == 0) 不太理解这段代码的含义 |
| | | //{ |
| | | // throw new Exception($"绑定失败,{model.PalletNo}托盘绑定数量大于该物品托盘包装数量!"); |
| | | //} |
| | | // 插入托盘绑定表 |
| | | bindId = Db.Insertable(bind).ExecuteReturnIdentity(); |
| | | } |
| | |
| | | // 更改箱支关系表 |
| | | decimal factQty = 0.00m;//托盘总数量 |
| | | //成品组托 |
| | | if (model.SkuQty == 0) |
| | | if (isTextTable == 0) |
| | | { |
| | | var boxGroup = boxInfoList.GroupBy(m => m.BoxNo).ToList(); |
| | | foreach (var g in boxGroup) |
| | |
| | | // 更新托盘绑定表 |
| | | bind.Qty += factQty; |
| | | } |
| | | if (bind.FullQty < bind.Qty && isDeposit == 0) |
| | | if (bind.FullQty < bind.Qty && isDeposit == 0 && isTextTable == 0) |
| | | { |
| | | throw new Exception("托盘绑定数量已超出该物料包装数量"); |
| | | } |
| | |
| | | { |
| | | bind.BitPalletMark = "0"; |
| | | } |
| | | if (bind.Qty > pNum && isDeposit == 0) |
| | | if (bind.Qty > pNum && isDeposit == 0 && isTextTable == 0) |
| | | { |
| | | throw new Exception($"绑定失败,{bind.PalletNo}托盘绑定数量大于该物品托盘包装数量!"); |
| | | } |
| | |
| | | detailModel.SupplierNo = notice.CustomerNo;//供应商编码 |
| | | detailModel.SupplierName = notice.CustomerName;//供应商名称 |
| | | } |
| | | #region 维护质检结果 |
| | | //获取该批次最终质检结果 |
| | | var quality = Db.Queryable<BllQualityInspect>().Where(a => a.LotNo == noticeDetail.LotNo && a.IsDel == "0").OrderByDescending(a => a.CreateTime).First(); |
| | | if (quality != null) |
| | | { |
| | | //修改合格不合格数量 |
| | | if (quality.IsQualified == "1") //合格 |
| | | { |
| | | //增加合格数量 |
| | | quality.PassQty += detailModel.Qty; |
| | | detailModel.InspectStatus = "1"; |
| | | } |
| | | else if (quality.IsQualified == "0") //不合格 |
| | | { |
| | | //增加不合格数量 |
| | | quality.FailQty += detailModel.Qty; |
| | | detailModel.InspectStatus = "2"; |
| | | } |
| | | Db.Updateable(quality).ExecuteCommand(); //修改质检信息 |
| | | } |
| | | #endregion |
| | | stId = Db.Insertable<DataStockDetail>(detailModel).ExecuteReturnIdentity(); |
| | | |
| | | } |
| | | else |
| | | { |