admin
3 天以前 f3bdc703bebd49d6149c5fd053cd8f57d50efc44
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 System.Threading.Tasks;
using Model.InterFaceModel;
@@ -80,9 +81,33 @@
                skuname = "%" + model.SkuName + "%", //物料名称
                lotno = model.LotNo, //批次号
                isqualified = model.IsQualified, //是否合格
                origin=model.Origin//来源
                origin = model.Origin//来源
            });
            return qualityList;
        }
        /// <summary>
        /// 获取需要质检的批次号
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        public IEnumerable<string> GetInspectLotNoList(int pageIndex, int pageSize)
        {
            int index = (pageIndex <= 1) ? 1 : pageIndex;
            int size = (pageSize <= 100) ? 100 : pageSize;
            string lotnoSql = $@"select LotNo
   from DataStockDetail
   where isnull(InspectStatus,'')='0' and isnull(ASNNo,'')!='' and isnull(SkuNo,'')!=''
   group by LotNo
   order by LotNo
   offset {(index - 1) * size} rows fetch next {size} rows only";
            DataTable lotnoDt = Db.Ado.GetDataTable(lotnoSql);
            var result = lotnoDt.Rows.Cast<DataRow>().Select(e => e["LotNo"] + "");
            return result;
        }
@@ -166,7 +191,7 @@
            {
                sqlStr += $" and LotNo='{model.LotNo}' ";
            }
            BllArrivalNoticeDetail arrivalDetail = Db.SqlQueryable<BllArrivalNoticeDetail>(sqlStr).First();
            BllArrivalNoticeDetail arrivalDetail = Db.SqlQueryable<BllArrivalNoticeDetail>(sqlStr).First();
            if (arrivalDetail == null)
            {
                throw new Exception("未找到入库单信息!");
@@ -195,7 +220,7 @@
            List<DataStockDetail> detail = Db.SqlQueryable<DataStockDetail>(sqlStr2).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<BllBoxInfo> box = Db.Queryable<BllBoxInfo>().Where(a => a.IsDel == "0" && a.SkuNo == model.SkuNo && a.LotNo == model.LotNo).ToList();
                //判断合格状态是否合格
                if (model.IsQualified == "1")
                {
@@ -211,13 +236,18 @@
                    item.InspectStatus = "2"; //2不合格
                }
                Db.Updateable(box).ExecuteCommand();
                //Db.Updateable(box).ExecuteCommand();
                Db.Updateable(item).ExecuteCommand();
            }
            Db.Updateable(arrivalDetail).ExecuteCommand();
            var isquality = Db.Insertable(model).ExecuteCommand();
            //修改库存箱码质检状态
            string uptDataBoxStatusSql = $@"update DataBoxInfo set InspectStatus='1' where IsDel='0' and SkuNo='{model.SkuNo}' and LotNo='{model.LotNo}' and StockDetailId in (select Id from DataStockDetail where IsDel='0' and SkuNo='{model.SkuNo}' and LotNo='{model.LotNo}' and InspectStatus='1') ";
            int uptDataBoxStatus = Db.Ado.ExecuteCommand(uptDataBoxStatusSql);
            return isquality;
        }
        /// <summary>