chengsc
2024-10-24 716b29fea5945ca7dc4419d9f1f980c379312b32
Wms/WMS.BLL/BllQualityServer/QualityInspectServer.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Model.ModelDto.BllQualityDto;
using Model.ModelVm;
@@ -105,15 +106,15 @@
            {
                throw new Exception("批次号不可为空,请核查!");
            }
            //int isTui = 0;
            int isTui = 0;
            //验证入库单号是否为空
            if (!string.IsNullOrEmpty(model.ASNNo))
            {
                //查询是否为退货入库单据
                var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && a.Type == "3");
                var Arrival = Db.Queryable<BllArrivalNotice>().First(a => a.IsDel == "0" && a.ASNNo == model.ASNNo && (a.Type == "3" || a.Type == "4"));
                if (Arrival == null)
                {
                    throw new Exception("只有入库单据为退货入库单可输入 入库单号,请核查!");
                    throw new Exception("只有入库单据为退货入库单可输入入库单号,请核查!");
                }
                //获取入库单明细
@@ -122,7 +123,7 @@
                {
                    throw new Exception("输入的批次或物料信息与入库单据不符,请核查!");
                }
                //isTui = 1;
                isTui = 1;
            }
            //查找质检信息中是否存在同批次质检录入记录
@@ -155,9 +156,13 @@
            //查找库存明细信息
            List<DataStockDetail> detail = Db.Queryable<DataStockDetail>().Where(m => m.IsDel == "0" && m.SkuNo == model.SkuNo && m.LotNo == model.LotNo).ToList();
            if (isTui == 1)
            {
                detail = detail.Where(m=> m.ASNNo == model.ASNNo).ToList();
            }
            foreach (var item in detail)
            {
                List<BllBoxInfo> box = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
                List<DataBoxInfo> box = Db.Queryable<DataBoxInfo>().Where(a => a.IsDel == "0" && a.StockDetailId == item.Id && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
                //判断合格状态是否合格
                if (model.IsQualified == "1")
                {
@@ -167,7 +172,7 @@
                    item.InspectStatus = "1"; //1合格
                    foreach (var b1 in box)
                    {
                        b1.InspectMark = "1"; //1合格
                        b1.InspectStatus = "1"; //1合格
                    }
                }
                else //不合格
@@ -177,7 +182,7 @@
                    item.InspectStatus = "2"; //2不合格
                    foreach (var b1 in box)
                    {
                        b1.InspectMark = "2"; //2不合格
                        b1.InspectStatus = "2"; //2不合格
                    }
                }
                Db.Updateable(box).ExecuteCommand();