| | |
| | | /// <returns></returns> |
| | | public List<BllQualityInspectDto> GetBllQualityList(BllQualityInspect model) |
| | | { |
| | | string str = "select q.Id Id,q.InspectNo InspectNo,q.ASNNo ASNNo,q.LotNo LotNo,q.SupplierLot SupplierLot,q.SkuNo SkuNo,q.SkuName SkuName,q.Standard Standard,q.PassQty PassQty,q.FailQty FailQty,q.Origin Origin,q.InspectTime InspectTime,q.IsOut IsOut,q.Demo Demo,q.IsQualified IsQualified,q.IsDel IsDel,q.CreateTime CreateTime,u.RealName CreateUserName,q.UpdateTime UpdateTime,q.UpdateUser UpdateUserName from BllQualityInspect q left join SysUserInfor u on q.CreateUser = u.id where q.IsDel = @isdel"; |
| | | string str = "select q.Id Id,q.InspectNo InspectNo,q.ASNNo ASNNo,q.LotNo LotNo,q.SupplierLot SupplierLot," + |
| | | "q.SkuNo SkuNo,q.SkuName SkuName,q.Standard Standard,q.PassQty PassQty,q.FailQty FailQty,q.Origin Origin," + |
| | | "q.InspectTime InspectTime,q.IsOut IsOut,q.Demo Demo,q.IsQualified IsQualified,q.IsDel IsDel,q.CreateTime " + |
| | | "CreateTime,u.RealName CreateUserName,q.UpdateTime UpdateTime,q.UpdateUser UpdateUserName " + |
| | | "from BllQualityInspect q " + |
| | | "left join SysUserInfor u on q.CreateUser = u.id where q.IsDel = @isdel"; |
| | | |
| | | ////判断入库单号是否为空 |
| | | //if (!string.IsNullOrEmpty(model.ASNNo)) |
| | |
| | | { |
| | | throw new Exception("批次号不可为空,请核查!"); |
| | | } |
| | | //int isTui = 0; |
| | | //验证入库单号是否为空 |
| | | if (!string.IsNullOrEmpty(model.ASNNo)) |
| | | if (string.IsNullOrEmpty(model.ASNNo)) |
| | | { |
| | | //查询是否为退货入库单据 |
| | | var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.Type == "3"); |
| | | if (Arrival == null) |
| | | { |
| | | throw new Exception("只有入库单据为退货入库单可输入 入库单号,请核查!"); |
| | | } |
| | | throw new Exception("入库单号不可为空!"); |
| | | |
| | | //获取入库单明细 |
| | | var ArrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.LotNo.Contains(model.LotNo) && a.SkuNo == model.SkuNo); |
| | | if (ArrivalDetail == null) |
| | | { |
| | | throw new Exception("输入的批次或物料信息与入库单据不符,请核查!"); |
| | | } |
| | | |
| | | //查询是否为退货入库单据 |
| | | //var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.Type == "3"); |
| | | //if (Arrival == null) |
| | | //{ |
| | | // throw new Exception("只有入库单据为退货入库单可输入 入库单号,请核查!"); |
| | | //} |
| | | |
| | | ////获取入库单明细 |
| | | //var ArrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.LotNo.Contains(model.LotNo) && a.SkuNo == model.SkuNo); |
| | | //if (ArrivalDetail == null) |
| | | //{ |
| | | // throw new Exception("输入的批次或物料信息与入库单据不符,请核查!"); |
| | | //} |
| | | //isTui = 1; |
| | | } |
| | | |
| | |
| | | //} |
| | | |
| | | ////查找同批次 同单据 入库单信息、 |
| | | //BllArrivalNoticeDetail arrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" && m.ASNNo == model.ASNNo && m.LotNo == model.LotNo); |
| | | BllArrivalNoticeDetail arrivalDetail = Db.Queryable<BllArrivalNoticeDetail>().First(m => m.IsDel == "0" |
| | | && m.ASNNo == model.ASNNo && m.LotNo == model.LotNo && m.SkuNo == model.SkuNo); |
| | | if (arrivalDetail == null) |
| | | { |
| | | throw new Exception("未找到入库单信息!"); |
| | | } |
| | | arrivalDetail.InspectStatus = model.IsQualified; |
| | | |
| | | model.Origin = "WMS"; //来源 |
| | | model.CreateTime = Db.GetDate(); //创建日期 |
| | |
| | | model.PassQty += item.Qty; |
| | | //修改库存明细合格状态 |
| | | item.InspectStatus = "1"; //1合格 |
| | | //foreach (var b1 in box) |
| | | //{ |
| | | // b1.InspectMark = "1"; //1合格 |
| | | //} |
| | | } |
| | | else //不合格 |
| | | { |
| | | //不合格 相同批次、入库单库存信息全部改为不合格物料 且不合格数量增加为同批次同单号该物料全部数量之和 |
| | | model.FailQty += item.Qty; |
| | | item.InspectStatus = "2"; //2不合格 |
| | | //foreach (var b1 in box) |
| | | //{ |
| | | // b1.InspectMark = "2"; //2不合格 |
| | | //} |
| | | } |
| | | |
| | | Db.Updateable(box).ExecuteCommand(); |
| | | Db.Updateable(item).ExecuteCommand(); |
| | | } |
| | | |
| | | Db.Updateable(arrivalDetail).ExecuteCommand(); |
| | | var isquality = Db.Insertable(model).ExecuteCommand(); |
| | | |
| | | return isquality; |