From fd8a1399090dd3a57b557a7c8d270362397bc21f Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期六, 20 九月 2025 16:45:04 +0800
Subject: [PATCH] 报工修改

---
 service/Warehouse/MesInvItemInCDetailsManager.cs |  341 ++++++++++++++++++++++++++++++++------------------------
 1 files changed, 195 insertions(+), 146 deletions(-)

diff --git a/service/Warehouse/MesInvItemInCDetailsManager.cs b/service/Warehouse/MesInvItemInCDetailsManager.cs
index 065d517..0fd977c 100644
--- a/service/Warehouse/MesInvItemInCDetailsManager.cs
+++ b/service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -1,4 +1,5 @@
-锘縰sing NewPdaSqlServer.DB;
+锘縰sing Masuit.Tools.Models;
+using NewPdaSqlServer.DB;
 using NewPdaSqlServer.Dto.service;
 using NewPdaSqlServer.entity;
 using NewPdaSqlServer.entity.Base;
@@ -6,6 +7,7 @@
 using NewPdaSqlServer.util;
 using Newtonsoft.Json;
 using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
 
 namespace NewPdaSqlServer.service.Warehouse;
 
@@ -15,6 +17,16 @@
 
     public ItemInBaseModel SaveBarCodes(WarehouseQuery entity)
     {
+        // 鍙傛暟楠岃瘉
+        if (entity == null)
+            throw new ArgumentNullException(nameof(entity), "鍙傛暟瀵硅薄涓嶈兘涓虹┖");
+
+        if (string.IsNullOrEmpty(entity.userName))
+            throw new ArgumentException("鐢ㄦ埛鍚嶄笉鑳戒负绌�", nameof(entity.userName));
+
+        if (string.IsNullOrEmpty(entity.barcode))
+            throw new ArgumentException("鏉$爜涓嶈兘涓虹┖", nameof(entity.barcode));
+
         string functionName = "閲囪喘鍏ュ簱", fieldName = null, inFieldVal = null;
         string user = entity.userName,
             sectionCode = entity.sectionCode,
@@ -27,24 +39,32 @@
         if (string.IsNullOrEmpty(sectionCode))
             throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
 
-        var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
-            .Where(it => it.ItemBarcode == itemBarcode)
-            .First();
-
-        if (itemBarcodeDetails == null)
+        MesInvItemBarcodes itemBarcodeDetails;
+        try
+        {
+            itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
+                .Where(it => it.ItemBarcode == itemBarcode)
+                .First();
+        }
+        catch
+        {
             throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
+        }
 
-        if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) ||
-            itemBarcodeDetails.Memo != "閲囪喘鍏ュ簱")
+        if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "閲囪喘鍏ュ簱")
             throw new Exception("姝ゆ潯鐮佷笉灞炰簬鍒拌揣鏉$爜锛屾棤娉曠敤閲囪喘鍏ュ簱锛�");
 
-        var inventory = Db.Queryable<MesInvItemArn>()
-            .Where(it =>
-                it.BillNo == itemBarcodeDetails.BillNo && it.Fstatus == true)
-            .First();
-
-        if (inventory == null)
+        MesInvItemArn inventory;
+        try
+        {
+            inventory = Db.Queryable<MesInvItemArn>()
+                .Where(it => it.BillNo == itemBarcodeDetails.BillNo && it.Fstatus == true )
+                .First();
+        }
+        catch
+        {
             throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟垨鏈鏍革紒");
+        }
 
         // var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
         //     .Where(it => it.ParentGuid == inventory.Guid
@@ -53,50 +73,84 @@
         //                  && it.Ebeln == itemBarcodeDetails.WorkNo)
         //     .First();
 
-        var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
-            .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
-            .First();
-
-        var cgddDetails = Db.Queryable<MesRohInData>()
-            .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
-            .First();
-
-        if (cgddDetails == null)
-            throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲閲囪喘璁㈠崟鏄庣粏锛�");
-
-        if (inventoryDetails == null)
+        MesInvItemArnDetail inventoryDetails;
+        try
+        {
+            inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
+                .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
+                .First();
+        }
+        catch
+        {
             throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
+        }
+
+        MesRohInData cgddDetails;
+        try
+        {
+            cgddDetails = Db.Queryable<MesRohInData>()
+                .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
+                .First();
+        }
+        catch
+        {
+            throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲閲囪喘璁㈠崟鏄庣粏锛�");
+        }
 
         //鑾峰彇鍒拌揣妫�楠屾槑缁�
-        var sqlParams = new List<SugarParameter>
-            { new("@dhmxGuid", itemBarcodeDetails.AboutGuid) };
+        var sqlParams = new List<SugarParameter> { new("@dhmxGuid", itemBarcodeDetails.AboutGuid) };
         var sql1 = @"SELECT *FROM v_dhmx WHERE dhmxGuid = @dhmxGuid ";
-        var dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
+        vDhmx dhjymx;
+        try
+        {
+            dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
+        }
+        catch
+        {
+            throw new Exception("璇ユ潯鐮佹壘涓嶅埌瀵瑰簲鐨勬楠屾槑缁嗭紒");
+        }
+
         //鍒ゅ畾妫�楠岃兘鍚﹀叆搴�
-        if (dhjymx.CanStore != 1)
-            throw new Exception(
-                $"璇ユ潯鐮佸搴旂殑鏀舵枡鍗曟楠岀粨鏋�:銆恵dhjymx.InspectionResult}銆�,鍒ゅ畾缁撴灉锛氥�恵dhjymx.JudgmentResult}銆戯紝澶勭悊鎰忚锛氥�恵dhjymx.HandlingSuggestion}銆�,鏃犳硶鍏ュ簱");
+        if (dhjymx.CanStore!= 1)
+        {
+            throw new Exception($"璇ユ潯鐮佸搴旂殑鏀舵枡鍗曟楠岀粨鏋�:銆恵dhjymx.InspectionResult}銆�,鍒ゅ畾缁撴灉锛氥�恵dhjymx.JudgmentResult}銆戯紝澶勭悊鎰忚锛氥�恵dhjymx.HandlingSuggestion}銆�,鏃犳硶鍏ュ簱");
+        }
 
-        var depotCode = Db.Queryable<MesDepotSections>()
-            .Where(it => it.DepotSectionCode == sectionCode)
-            .Select(it => it.DepotGuid)
-            .First();
-
-        var depotCode2 = Db.Queryable<MesInvItemArn>()
-            .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
-            .Select(it => it.DepotsId)
-            .First();
+        string depotCode;
+        try
+        {
+            depotCode = Db.Queryable<MesDepotSections>()
+                .Where(it => it.DepotSectionCode == sectionCode)
+                .Select(it => it.DepotGuid)
+                .First();
+        }
+        catch
+        {
+            throw new Exception("搴撲綅缂栫爜 " + sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
+        }
 
         MesDepots mesDepost = null;
 
         var checkGuid = UtilityHelper.CheckGuid(depotCode);
         if (checkGuid && depotCode != null)
-            mesDepost = Db.Queryable<MesDepots>()
-                .Where(s => s.DepotId.ToString() == depotCode).First();
-        // if (depotCode != mesDepost.Guid)
-        //     throw new Exception("鎵弿搴撲綅涓庨噰璐叆搴撳簱浣嶄笉涓�鑷达紒");
+        {
+            try
+            {
+                mesDepost = Db.Queryable<MesDepots>()
+                    .Where(s => s.Guid == depotCode).First();
+            }
+            catch
+            {
+                throw new Exception("搴撲綅缂栫爜 " + sectionCode + " 瀵瑰簲鐨勪粨搴撲笉瀛樺湪锛岃纭锛�");
+            }
+
+            // if (depotCode != mesDepost.Guid)
+            //     throw new Exception("鎵弿搴撲綅涓庨噰璐叆搴撳簱浣嶄笉涓�鑷达紒");
+        }
         else
+        {
             throw new Exception("搴撲綅缂栫爜 " + sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
+        }
 
 
         //num = Db.Queryable<MesInvItemInCDetails>()
@@ -116,18 +170,22 @@
         var wmsManager = new WmsBaseMangeer();
         // 鏂板鍏ュ簱鏍¢獙锛堣皟鐢ㄥ瓨鍌ㄨ繃绋嬶級
         var checkResult = wmsManager.pdaInvJY(
-            Db,
-            entity.userName,
-            entity.barcode,
-            sectionCode,
-            mesDepost.DepotId.ToString(),
-            mesDepost.FSubsidiary,
-            "", // 鏍规嵁瀹為檯鍗曟嵁鍙蜂紶鍊�
-            "101" // 浜嬪姟绫诲瀷涓庡瓨鍌ㄨ繃绋嬪尮閰�
+            db: Db,
+            edtUserNo: entity.userName,
+            barcode: entity.barcode,
+            sectionCode: sectionCode,
+            stockId: mesDepost.DepotId.ToString(),
+            stockOrgId: mesDepost.FSubsidiary,
+            billNo: "", // 鏍规嵁瀹為檯鍗曟嵁鍙蜂紶鍊�
+            transactionNo: "101" // 浜嬪姟绫诲瀷涓庡瓨鍌ㄨ繃绋嬪尮閰�
         );
+
+        if (checkResult == null)
+            throw new Exception("鍏ュ簱鏍¢獙澶辫触锛氳繑鍥炵粨鏋滀负绌�");
 
         if (Convert.ToInt32(checkResult.result) < 1)
             throw new Exception($"鍏ュ簱鏍¢獙澶辫触锛歿checkResult.strMsg}");
+
 
 
         //num = Db.Queryable<MesInvItemArn>()
@@ -196,21 +254,20 @@
         UseTransaction(db =>
         {
             var existingRecord = db.Queryable<MesInvItemIns>()
-                .Where(it =>
-                    it.InsDate.Value.ToString("yyyy-MM-dd") ==
-                    DateTime.Now.ToString("yyyy-MM-dd")
-                    && it.TaskNo == itemBarcodeDetails.BillNo
-                    && it.Status == 0
-                    && it.TransctionNo == transactionNo
-                    && it.CreateBy == entity.userName
-                    && it.BillTypeId == billTypeId
-                    && it.DepotsId == mesDepost.DepotId)
+                .Where(it => it.InsDate.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")
+                             && it.TaskNo == itemBarcodeDetails.BillNo
+                             && it.Status == 0
+                             && it.TransctionNo == transactionNo
+                             && it.CreateBy == entity.userName
+                             && it.BillTypeId == billTypeId
+                             && it.DepotsId == mesDepost.DepotId)
                 .Select(it => new
                 {
                     it.Guid,
                     it.BillNo
                 })
-                .First();
+                .ToList()
+                .FirstOrDefault();
 
             var cId = Guid.Empty;
             string cBillNo = null;
@@ -226,8 +283,16 @@
                 cId = Guid.NewGuid();
                 cBillNo = BillNo.GetBillNo("CGRK(閲囪喘鍏ュ簱)");
 
-                var suppNo = db.Queryable<MesSupplier>()
-                    .Where(s => s.Id.ToString() == inventory.SuppId).First();
+                MesSupplier suppNo;
+                try
+                {
+                    suppNo = db.Queryable<MesSupplier>()
+                        .Where(s => s.Id.ToString() == inventory.SuppId).First();
+                }
+                catch
+                {
+                    throw new Exception("鎵句笉鍒板搴旂殑渚涘簲鍟嗕俊鎭紒");
+                }
 
                 db.Insertable(new MesInvItemIns
                 {
@@ -244,10 +309,7 @@
                     CreateDate = DateTime.Now,
                     LastupdateBy = user,
                     LastupdateDate = DateTime.Now,
-                    UrgentFlag =
-                        itemBarcodeDetails.UrgentFlag.GetValueOrDefault()
-                            ? "1"
-                            : "0",
+                    UrgentFlag = itemBarcodeDetails.UrgentFlag.GetValueOrDefault() ? "1" : "0",
                     CbillNo = itemBarcodeDetails.BillNo,
                     Fstatus = 0,
                     Status = 0,
@@ -258,7 +320,10 @@
                 }).IgnoreColumns(true).ExecuteCommand();
             }
 
-            cSyQty = itemBarcodeDetails.Quantity.Value;
+            cSyQty = itemBarcodeDetails.Quantity ?? 0;
+
+            if (cSyQty <= 0)
+                throw new Exception("鏉$爜鏁伴噺鏃犳晥锛岃妫�鏌ユ潯鐮佷俊鎭紒");
 
             entity.id = cId.ToString();
             entity.PageIndex = 1;
@@ -297,10 +362,10 @@
                         var count = db.Queryable<MesInvItemInCItems>()
                             .Where(it =>
                                 it.ItemInId == cId &&
-                                it.ItemId == detail.ItemId &&
-                                it.DepotId == mesDepost.DepotId.ToString() &&
-                                it.EbelnK3id == detail.EbelnK3id &&
-                                it.LineK3id == detail.LineK3id)
+                                    it.ItemId == detail.ItemId &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
+                                    it.EbelnK3id == detail.EbelnK3id &&
+                                    it.LineK3id == detail.LineK3id)
                             .Count();
 
                         cSyQty -= remainingQty.Value;
@@ -328,8 +393,7 @@
                                 EbelnK3id = detail.EbelnK3id,
                                 LineK3id = detail.LineK3id,
                                 DepotId = mesDepost.DepotId.ToString(),
-                                itemDabid = itemBarcodeDetails.AboutGuid
-                                    .ToString()
+                                itemDabid = itemBarcodeDetails.AboutGuid.ToString()
                             }).IgnoreColumns(true).ExecuteCommand();
                         else
                             db.Updateable<MesInvItemInCItems>()
@@ -338,8 +402,7 @@
                                 .Where(it =>
                                     it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId ==
-                                    mesDepost.DepotId.ToString() &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                                 .IgnoreColumns(true)
@@ -396,10 +459,10 @@
                         var count = db.Queryable<MesInvItemInCItems>()
                             .Where(it =>
                                 it.ItemInId == cId &&
-                                it.ItemId == detail.ItemId &&
-                                it.DepotId == mesDepost.DepotId.ToString() &&
-                                it.EbelnK3id == detail.EbelnK3id &&
-                                it.LineK3id == detail.LineK3id)
+                                    it.ItemId == detail.ItemId &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
+                                    it.EbelnK3id == detail.EbelnK3id &&
+                                    it.LineK3id == detail.LineK3id)
                             .Count();
 
                         if (count == 0)
@@ -434,8 +497,7 @@
                                 .Where(it =>
                                     it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId ==
-                                    mesDepost.DepotId.ToString() &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                                 .IgnoreColumns(true)
@@ -522,10 +584,10 @@
                 // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ簬 MES_INV_ITEM_IN_C_ITEMS 琛�
                 var existingCount = db.Queryable<MesInvItemInCItems>()
                     .Where(it =>
-                        it.ItemInId == cId &&
-                        it.ItemId == detailone.ItemId &&
-                        it.DepotId == mesDepost.DepotId.ToString() &&
-                        it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
+                    it.ItemInId == cId &&
+                                    it.ItemId == detailone.ItemId &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
+                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                     .Count();
 
                 if (existingCount == 0)
@@ -560,16 +622,13 @@
                     db.Updateable<MesInvItemInCItems>()
                         .SetColumns(it => new MesInvItemInCItems
                         {
-                            Quantity = SqlFunc.IsNull(it.Quantity, 0) +
-                                       itemBarcodeDetails
-                                           .Quantity // 纭繚 Quantity 涓嶄负 null
+                            Quantity = SqlFunc.IsNull(it.Quantity, 0) + itemBarcodeDetails.Quantity // 纭繚 Quantity 涓嶄负 null
                         })
                         .Where(it =>
-                            it.ItemInId == cId &&
-                            it.ItemId == detailone.ItemId &&
-                            it.DepotId == mesDepost.DepotId.ToString() &&
-                            it.itemDabid ==
-                            itemBarcodeDetails.AboutGuid.ToString())
+                                    it.ItemInId == cId &&
+                                    it.ItemId == detailone.ItemId &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
+                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                         //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
                         .ExecuteCommand();
 
@@ -649,6 +708,7 @@
 
                 // 鎻掑叆 mes_inv_item_stocks 琛�
             }
+
 
 
             db.Insertable(new MesInvItemStocks
@@ -759,45 +819,38 @@
 
                 //result.Message =
                 //    $"鏉$爜鏁伴噺 {itemBarcodeDetails.Quantity},閲囪喘璁㈠崟 {itemBarcodeDetails.WorkNo} 椤规 {itemBarcodeDetails.WorkLine} 鐗╂枡 {mesItems.ItemNo} 鏈鍏ュ簱鎬绘暟锛歿totalCDetailsQuantity} 鎬诲埌 {comeQty} 宸插叆 {invQty} 娆� {diffQty}";
-                result.Message =
-                    $"鐗╂枡{mesItems.ItemNo}鍏ュ簱鎴愬姛鏁伴噺{itemBarcodeDetails.Quantity.ToString()}";
+                result.Message = $"鐗╂枡{mesItems.ItemNo}鍏ュ簱鎴愬姛鏁伴噺{itemBarcodeDetails.Quantity.ToString()}";
 
                 result.itemDetail = mesItems;
 
-                result.ItemInDetails = db
-                    .Queryable<MesInvItemInCItems, MesItems>((a, b) =>
-                        new JoinQueryInfos(
-                            JoinType.Left,
-                            a.ItemId == b.ItemId)
+                result.ItemInDetails = db.Queryable<MesInvItemInCItems,MesItems>(
+                    (a, b) => new JoinQueryInfos(
+                    JoinType.Left,
+                    a.ItemId == b.ItemId)
                     )
-                    .Where(a =>
-                        a.ItemInId == cId &&
-                        a.ItemId == itemBarcodeDetails.ItemId)
-                    .Select<dynamic>((a, b) => new
+                    .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
+                    .Select<dynamic>((a, b) => new 
                     {
-                        b.ItemNo,
-                        b.ItemName,
-                        b.ItemModel,
+                        ItemNo = b.ItemNo,
+                        ItemName = b.ItemName,
+                        ItemModel = b.ItemModel,
                         FQty = a.Quantity, // 鐢宠鏁伴噺
                         FMaterialId = b.ItemId,
                         Id = b.Guid.ToString()
                     })
                     .ToList();
 
-                result.ItemBarCDetails = db
-                    .Queryable<MesInvItemInCDetails, MesItems>((a, b) =>
-                        new JoinQueryInfos(
-                            JoinType.Left,
-                            a.ItemId == b.ItemId)
+                result.ItemBarCDetails = db.Queryable<MesInvItemInCDetails, MesItems>(
+                    (a, b) => new JoinQueryInfos(
+                    JoinType.Left,
+                    a.ItemId == b.ItemId)
                     )
-                    .Where(a =>
-                        a.ItemInId == cId &&
-                        a.ItemId == itemBarcodeDetails.ItemId)
+                    .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
                     .Select<dynamic>((a, b) => new
                     {
-                        b.ItemNo,
-                        b.ItemName,
-                        b.ItemModel,
+                        ItemNo = b.ItemNo,
+                        ItemName = b.ItemName,
+                        ItemModel = b.ItemModel,
                         FQty = a.Quantity, // 鐢宠鏁伴噺
                         FMaterialId = b.ItemId,
                         Id = a.Guid.ToString(),
@@ -875,17 +928,15 @@
 
             // 鍒涘缓 鎻掑叆鏃ュ織
             var logService = new LogService();
-            var LogMsg = "銆怭DA銆戦噰璐叆搴撱�傛潯鐮併��" + entity.barcode + "銆� 鍏ュ簱鍗曞彿銆�" +
-                         cBillNo + "銆�";
-            logService.CreateLog(db, entity.userName, inventory.Guid.ToString(),
-                "MES_INV_ITEM_ARN", LogMsg, inventory.BillNo);
+            var LogMsg = "銆怭DA銆戦噰璐叆搴撱�傛潯鐮併��" + entity.barcode + "銆� 鍏ュ簱鍗曞彿銆�" + cBillNo + "銆�";
+            logService.CreateLog(db, entity.userName, inventory.Guid.ToString(), "MES_INV_ITEM_ARN", LogMsg, inventory.BillNo);
 
             return 1;
         });
 
         var purchaseInventory = getPurchaseInventory(entity);
 
-
+        
         //result.ItemInDetails = purchaseInventory.ItemInDetails;
         //result.InvItemInCDetails = purchaseInventory.InvItemInCDetails;
 
@@ -914,11 +965,11 @@
         }
 
         var totalCount = 0;
-        var result = Db
-            .Queryable<MesInvItemIns, MesDepots, MesSupplier>((a, b, c) =>
-                new JoinQueryInfos(JoinType.Left,
-                    a.DepotsId == b.DepotId,
-                    JoinType.Left, a.SuppId == c.Id.ToString()))
+        var result = Db.Queryable<MesInvItemIns, MesDepots, MesSupplier>(
+                (a, b, c) =>
+                    new JoinQueryInfos(JoinType.Left,
+                        a.DepotsId == b.DepotId,
+                        JoinType.Left, a.SuppId == c.Id.ToString()))
             .WhereIF(UtilityHelper.CheckGuid(parsedGuid),
                 (a, b, c) => a.Guid == parsedGuid)
             .Select((a, b, c) => new MesInvItemIns
@@ -950,9 +1001,8 @@
         if (!isValid)
             throw new ApplicationException("GUID杞崲閿欒");
 
-        var result = Db
-            .Queryable<MesInvItemInCDetails, MesItems, MesUnit>((g, c, d) =>
-                new JoinQueryInfos(
+        var result = Db.Queryable<MesInvItemInCDetails, MesItems, MesUnit>(
+                (g, c, d) => new JoinQueryInfos(
                     JoinType.Left, g.ItemId == c.Id,
                     JoinType.Inner, d.Id == Convert.ToDecimal(g.Unit)
                 )
@@ -982,9 +1032,8 @@
         if (!isValid)
             throw new ApplicationException("GUID杞崲閿欒");
 
-        var result = Db
-            .Queryable<MesInvItemInCDetails, MesItems, MesUnit>((g, c, d) =>
-                new JoinQueryInfos(
+        var result = Db.Queryable<MesInvItemInCDetails, MesItems, MesUnit>(
+                (g, c, d) => new JoinQueryInfos(
                     JoinType.Left,
                     g.ItemId == c.Id, JoinType.Inner,
                     d.Id.ToString() == c.Fpurchaseunitid
@@ -1101,15 +1150,15 @@
         if (invItemIns.Status == 1) throw new Exception("鍏ュ簱鍗曞凡瀹℃牳锛屼笉鑳介噸澶嶆帹閫�");
 
         var materials = Db.Queryable<MesInvItemInCItems, MesItems, MesUnit,
-                MesInvItemArnDetail>((g, c, d, a) => new JoinQueryInfos(
-                    JoinType.Left,
-                    g.ItemId == c.Id, JoinType.Inner,
-                    d.Id.ToString() == c.Fpurchaseunitid,
-                    JoinType.Inner,
-                    a.Ebeln == g.WorkNo && g.CbillNo == a.CbillNo
-                )
-            ).Where((g, c, d, a) => g.BillNo == billNo)
-            .Select<Material>((g, c, d, a) => new Material
+            MesInvItemArnDetail>(
+            (g, c, d, a) => new JoinQueryInfos(
+                JoinType.Left,
+                g.ItemId == c.Id, JoinType.Inner,
+                d.Id.ToString() == c.Fpurchaseunitid,
+                JoinType.Inner, a.Ebeln == g.WorkNo && g.CbillNo == a.CbillNo
+            )
+        ).Where((g, c, d, a) => g.BillNo == billNo).Select<Material>(
+            (g, c, d, a) => new Material
             {
                 FMaterialId = c.ItemNo,
                 FRealQty = g.Quantity.ToString(),

--
Gitblit v1.9.3