啊鑫
20 小时以前 ed05efdc17aab076146b134ebe105b6382f221d7
MES.Service/service/QC/RKJService.cs
@@ -1,6 +1,4 @@
using System.Net.NetworkInformation;
using Masuit.Tools.Models;
using MES.Service.DB;
using MES.Service.DB;
using MES.Service.Dto.service;
using MES.Service.Modes;
using MES.Service.util;
@@ -75,29 +73,28 @@
        var qsItemOqcItems = db
            .Queryable<MesQualityStandard>()
            .Where(b => b.QsType == "3"
                        && b.ItemNo == itemNo).Select(
                b => new QsItemOqcItem
                {
                    ProjName = b.ProjName,
                    ItemMod = b.ItemMod,
                    InspectionMethod = b.InspectionMethod,
                    UsingInstruments = b.UsingInstruments,
                    LevelNum = SqlFunc.IsNull(
                        SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1),
                        b.InspectionLevel),
                    MaxValue = b.MaxValue,
                    StandardValue = b.StandardValue,
                    MinValue = b.MinValue,
                    Notes = b.Notes,
                    FcheckLevel = b.FcheckLevel,
                    FacLevel = b.FacLevel,
                    QsCode = b.QsCode,
                    QsName = b.QsName,
                    Result = "未检测",
                    isCheck = 0,
                    Picture = b.Picture,
                    Picturename = b.Picturename
                }).ToList();
                        && b.ItemNo == itemNo).Select(b => new QsItemOqcItem
            {
                ProjName = b.ProjName,
                ItemMod = b.ItemMod,
                InspectionMethod = b.InspectionMethod,
                UsingInstruments = b.UsingInstruments,
                LevelNum = SqlFunc.IsNull(
                    SqlFunc.IsNull(b.LevelNum * b.InspectionLevel, 1),
                    b.InspectionLevel),
                MaxValue = b.MaxValue,
                StandardValue = b.StandardValue,
                MinValue = b.MinValue,
                Notes = b.Notes,
                FcheckLevel = b.FcheckLevel,
                FacLevel = b.FacLevel,
                QsCode = b.QsCode,
                QsName = b.QsName,
                Result = "未检测",
                isCheck = 0,
                Picture = b.Picture,
                Picturename = b.Picturename
            }).ToList();
        qsItemOqcItems.ForEach(item =>
        {
@@ -236,7 +233,9 @@
                .First();
            decimal? pid = 0;
            pid = qsItemOqcReq == null ? db.Insertable(xj).ExecuteReturnIdentity() : qsItemOqcReq.Id;
            pid = qsItemOqcReq == null
                ? db.Insertable(xj).ExecuteReturnIdentity()
                : qsItemOqcReq.Id;
            xj.Id = pid;
@@ -358,8 +357,8 @@
            result = 1;
        else if (count - passCount < QsItemOqcItem.FreQty) result = 1;
        var useTransactionWithOracle = SqlSugarHelper.UseTransactionWithOracle(
            db =>
        var useTransactionWithOracle =
            SqlSugarHelper.UseTransactionWithOracle(db =>
            {
                var commit = 0;
                commit += db.Updateable<QsItemOqcItem>()
@@ -410,21 +409,19 @@
        //    saveDetect02(detail.Gid, detail.CreateBy);
       var oqcReq = db.Queryable<QsItemOqcReq>()
                .Where(s => s.Id == detail.Gid)
                .Select<string?>(s=>s.BillNo)
                .First();
        var oqcReq = db.Queryable<QsItemOqcReq>()
            .Where(s => s.Id == detail.Gid)
            .Select<string?>(s => s.BillNo)
            .First();
        if (oqcReq != null)
        {
            //FSTATUS
            //CHECK_RES
            db.Updateable<MesInvItemIns>()
                .SetColumns(s => s.Fstatus == 1)
                .SetColumns(s=>s.CheckRes == FcheckResu)
                .SetColumns(s => s.CheckRes == FcheckResu)
                .Where(s => s.BillNo == oqcReq)
                .ExecuteCommand();
        }
        return useTransactionWithOracle;
    }
@@ -474,59 +471,66 @@
    }
    public (List<QsItemOqcReq> items, int TotalCount) getPage(XJPageResult queryObj)
    public (List<QsItemOqcReq> items, int TotalCount) getPage(
        XJPageResult queryObj)
    {
        var db = SqlSugarHelper.GetInstance();
        var totalCount = 0;
        var qsItemOqcReqs = db.Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa, MesInvTransaction, RKJDaa001, MesLine>(
                 (a, b, c, da, ca, m, l) => new JoinQueryInfos(
                     JoinType.Left, a.ItemNo == b.Id.ToString(),
                     JoinType.Left, a.BillNo == c.BillNo,
                     JoinType.Left, da.Daa001 == c.RbillNo,
                     JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString()
                                   && c.Company == ca.Company
                                   && c.Factory == ca.Factory,
                     JoinType.Left, m.ItemInId == c.Id,
                     JoinType.Left, l.LineNo == da.Daa015
                 ))
             //.WhereIF(!"PL017".Equals(queryObj.createUser),
             //    (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015))
             .WhereIF(!string.IsNullOrEmpty(queryObj.id), (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id)
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.result) && "未完成".Equals(queryObj.result),
                 (a, b, c, da, ca, m, l) => a.FcheckResu == null)
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.result) && !"未完成".Equals(queryObj.result),
                 (a, b, c, da, ca, m, l) => a.FcheckResu != null)
             .WhereIF(
                 StringUtil.IsNotNullOrEmpty(queryObj.SearchValue),
                 (a, b, c, da, ca, m, l) => a.ReleaseNo.Contains(queryObj.SearchValue)
                 || b.ItemNo.Contains(queryObj.SearchValue)
                 )
             .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq
             {
                 BillNo = a.BillNo,
                 Remarks = a.Remarks,
                 Id = a.Id,
                 CreateDate = a.CreateDate,
                 CreateBy = a.CreateBy,
                 FcheckResu = a.FcheckResu,
                 ItemNo = b.ItemNo,
                 FcheckBy = a.FcheckBy,
                 FcheckDate = a.FcheckDate,
                 ReleaseNo = a.ReleaseNo,
                 ItemName = b.ItemName,
                 ItemModel = b.ItemModel,
                 TaskNo = c.RbillNo,
                 //CbillNo = c.CbillNo,
                 //LineNo = da.Daa015,
                 LineNo = l.LineName,
                 Quantity = m.Quantity
             })
             .OrderBy(a => a.CreateDate, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
        var qsItemOqcReqs = db
            .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa,
                MesInvTransaction, RKJDaa001,
                MesLine>((a, b, c, da, ca, m, l) => new JoinQueryInfos(
                JoinType.Left, a.ItemNo == b.Id.ToString(),
                JoinType.Left, a.BillNo == c.BillNo,
                JoinType.Left, da.Daa001 == c.RbillNo,
                JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString()
                               && c.Company == ca.Company
                               && c.Factory == ca.Factory,
                JoinType.Left, m.ItemInId == c.Id,
                JoinType.Left, l.LineNo == da.Daa015
            ))
            //.WhereIF(!"PL017".Equals(queryObj.createUser),
            //    (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015))
            .WhereIF(!string.IsNullOrEmpty(queryObj.id),
                (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id)
            .WhereIF(
                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
                "未完成".Equals(queryObj.result),
                (a, b, c, da, ca, m, l) => a.FcheckResu == null)
            .WhereIF(
                StringUtil.IsNotNullOrEmpty(queryObj.result) &&
                !"未完成".Equals(queryObj.result),
                (a, b, c, da, ca, m, l) => a.FcheckResu != null)
            .WhereIF(
                StringUtil.IsNotNullOrEmpty(queryObj.SearchValue),
                (a, b, c, da, ca, m, l) =>
                    a.ReleaseNo.Contains(queryObj.SearchValue)
                    || b.ItemNo.Contains(queryObj.SearchValue)
            )
            .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq
            {
                BillNo = a.BillNo,
                Remarks = a.Remarks,
                Id = a.Id,
                CreateDate = a.CreateDate,
                CreateBy = a.CreateBy,
                FcheckResu = a.FcheckResu,
                ItemNo = b.ItemNo,
                FcheckBy = a.FcheckBy,
                FcheckDate = a.FcheckDate,
                ReleaseNo = a.ReleaseNo,
                ItemName = b.ItemName,
                ItemModel = b.ItemModel,
                TaskNo = c.RbillNo,
                //CbillNo = c.CbillNo,
                //LineNo = da.Daa015,
                LineNo = l.LineName,
                Quantity = m.Quantity
            })
            .OrderBy(a => a.CreateDate, OrderByType.Desc)
            .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
        return (qsItemOqcReqs, totalCount);
    }
@@ -688,19 +692,19 @@
        var db = SqlSugarHelper.GetInstance();
        var oqcReq = db.Queryable<QsItemOqcReq>()
                .Where(s => s.Id == rkjDto.gid)
                .Select<string?>(s => s.BillNo)
                .First();
            .Where(s => s.Id == rkjDto.gid)
            .Select<string?>(s => s.BillNo)
            .First();
        if (oqcReq != null)
        {
            //FSTATUS
            //CHECK_RES
           var mesInvItemIns = db.Queryable<MesInvItemIns>()
            var mesInvItemIns = db.Queryable<MesInvItemIns>()
                .Where(s => s.BillNo == oqcReq).First();
           return db.Queryable<MesInvItemInCDetails2>()
                .Where(a=>a.ItemInId == mesInvItemIns.Id).ToList();
            return db.Queryable<MesInvItemInCDetails2>()
                .Where(a => a.ItemInId == mesInvItemIns.Id).ToList();
        }
        return new List<MesInvItemInCDetails2>();