南骏 池
2025-04-02 5bc70ea9041912fd6239822b32748d55d6fb6f4b
1.采购入库返回值调整,优化效率
2.新增货主类型通用类。
已重命名1个文件
已修改14个文件
已添加1个文件
374 ■■■■■ 文件已修改
Controllers/Warehouse/MesInvItemInCDetailsController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Dto/service/ProductionPickDto.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Dto/service/PurchaseInventory.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
NewPdaSqlServer.csproj 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
entity/Base/ItemDetailModel.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
entity/Base/ItemInBaseModel.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesDepotSectionsManager.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesInvItemInCDetailsManager.cs 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesItemTblManager.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesStrkManager.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesSttlManager.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesXsckManager.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/MesXsthManager.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Warehouse/TransferOutManager.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/Wom/WomdaaManager.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/base/WmsBaseMangeer.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Controllers/Warehouse/MesInvItemInCDetailsController.cs
@@ -109,7 +109,7 @@
            return new ResponseResult
            {
                status = 0,
                message = "OK",
                message = resultInfos.tbBillList.Message,
                data = resultInfos
            };
        }
Dto/service/ProductionPickDto.cs
@@ -1,5 +1,5 @@
using MES.Service.Modes;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
namespace NewPdaSqlServer.Dto.service;
Dto/service/PurchaseInventory.cs
@@ -9,11 +9,15 @@
    public decimal? SumQuantity { get; set; }
    public MesInvItemIns? ItemIns { get; set; }
    public List<MesInvItemInCDetails>? InvItemInCDetails { get; set; }
    public List<MesInvItemInCItems>? ItemInDetails { get; set; }
    //条码明细
    public List<dynamic>? InvItemInCDetails { get; set; }
    public List<MesInvItemStocks>? ItemStocks { get; set; }
    //物料明细
    public List<dynamic>? ItemInDetails { get; set; }
    //
    public List<dynamic>? ItemStocks { get; set; }
    public string? Message { get; set; }
}
NewPdaSqlServer.csproj
@@ -7,12 +7,12 @@
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Masuit.Tools.Core" Version="2024.5.8"/>
        <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8"/>
        <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10"/>
        <PackageReference Include="SqlSugarCore" Version="5.1.4.169"/>
        <PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0"/>
        <PackageReference Include="System.Data.SqlClient" Version="4.8.6"/>
        <PackageReference Include="Masuit.Tools.Core" Version="2024.5.8" />
        <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
        <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
        <PackageReference Include="SqlSugarCore" Version="5.1.4.169" />
        <PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
        <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
    </ItemGroup>
</Project>
entity/Base/ItemDetailModel.cs
ÎļþÃû´Ó entity/ItemDetailModel.cs ÐÞ¸Ä
@@ -1,6 +1,6 @@
using SqlSugar;
namespace MES.Service.Modes;
namespace NewPdaSqlServer.entity.Base;
//调拨出入库单通用类
public class ItemDetailModel
entity/Base/ItemInBaseModel.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
using SqlSugar;
namespace NewPdaSqlServer.entity.Base;
//调拨出入库单通用类
public class ItemInBaseModel
{
    //物料信息
    public MesItems itemDetail { get; set; }
    //条码明细
    public List<dynamic>? ItemBarCDetails { get; set; }
    //物料汇总明细
    public List<dynamic>? ItemInDetails { get; set; }
    //出/入库单信息
    public List<dynamic>? MesInvItem { get; set; }
    //返回信息
    public string? Message { get; set; }
    //入库总数
    public decimal? SumQuantity { get; set; }
}
service/Warehouse/MesDepotSectionsManager.cs
@@ -7,14 +7,19 @@
public class MesDepotSectionsManager : Repository<MesDepotSections>
{
    public string GetSectionName(WarehouseQuery query)
    public dynamic GetSectionName(WarehouseQuery query)
    {
        var sectionName = Db.Queryable<MesDepotSections, MesDepots>(
                (a, b) =>
                    new JoinQueryInfos(JoinType.Inner,
                        a.DepotGuid == b.Guid))
                        a.DepotGuid == b.Guid))  // ç¡®ä¿Guid类型正确比较
            .Where((a, b) => a.DepotSectionCode == query.sectionCode)
            .Select((a, b) => a.DepotSectionName).Single();
            .Select((a, b) => new  // æ”¹ç”¨åŒ¿åç±»åž‹æ›¿ä»£dynamic
            {
                a.DepotSectionName,
                DepotName = b.DepotName,  // æ˜¾å¼æŒ‡å®šå­—段别名
                DepotCode = b.DepotCode
            }).Single();
        if (sectionName == null)
            throw new Exception("库位编码 " + query.sectionCode + " ä¸å­˜åœ¨ï¼Œè¯·ç¡®è®¤ï¼");
service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -2,9 +2,12 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.util;
using Newtonsoft.Json;
using SqlSugar;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Warehouse;
@@ -12,7 +15,7 @@
{
    //当前类已经继承了 Repository å¢žã€åˆ ã€æŸ¥ã€æ”¹çš„æ–¹æ³•
    public PurchaseInventory SaveBarCodes(WarehouseQuery entity)
    public ItemInBaseModel SaveBarCodes(WarehouseQuery entity)
    {
        string functionName = "采购入库", fieldName = null, inFieldVal = null;
        string user = entity.userName,
@@ -23,17 +26,17 @@
        var freeze = 0;
        decimal cSyQty = 0;
        if (string.IsNullOrEmpty(sectionCode))
            throw new Exception("请扫库位条码!");
        //if (string.IsNullOrEmpty(sectionCode))
        //    throw new Exception("请扫库位条码!");
        var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
            .Where(it => it.ItemBarcode == itemBarcode)
            .First();
        if (itemBarcodeDetails == null)
            throw new Exception("条码不存在,请核对!");
        //if (itemBarcodeDetails == null)
        //    throw new Exception("条码不存在,请核对!");
        if (itemBarcodeDetails.ComeFlg == 0)
        if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "采购入库")
            throw new Exception("此条码不属于到货条码,无法用采购入库!");
        var inventory = Db.Queryable<MesInvItemArn>()
@@ -60,6 +63,11 @@
        if (inventoryDetails == null)
            throw new Exception("此条码找不到对应收货单明细!");
        if (string.IsNullOrEmpty(inventoryDetails.CheckRes) || inventoryDetails.CheckRes != "合格")
        {
            throw new Exception("该条码对应的收料单检验不合格或未检验!");
        }
        var depotCode = Db.Queryable<MesDepotSections>()
            .Where(it => it.DepotSectionCode == sectionCode)
@@ -88,90 +96,111 @@
        }
        num = Db.Queryable<MesInvItemInCDetails>()
            .Where(it => it.ItemBarcode == itemBarcode)
            .Count();
        //num = Db.Queryable<MesInvItemInCDetails>()
        //    .Where(it => it.ItemBarcode == itemBarcode)
        //    .Count();
        if (num > 0)
            throw new Exception("此条码已扫码入库完成,请核对!");
        //if (num > 0)
        //    throw new Exception("此条码已扫码入库完成,请核对!");
        num = Db.Queryable<MesInvItemStocks>()
            .Where(it => it.ItemBarcode == itemBarcode)
            .Count();
        //num = Db.Queryable<MesInvItemStocks>()
        //    .Where(it => it.ItemBarcode == itemBarcode)
        //    .Count();
        if (num > 0)
            throw new Exception("此条码已扫码入库,请核对!");
        //if (num > 0)
        //    throw new Exception("此条码已扫码入库,请核对!");
        num = Db.Queryable<MesInvItemArn>()
            .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
            .InnerJoin<MesInvItemArnDetail>((a, b) =>
                b.ParentGuid == a.Guid &&
                b.ItemId == itemBarcodeDetails.ItemId && b.Ischeck == 1)
            .Count();
        var wmsManager = new WmsBaseMangeer();
        // æ–°å¢žå…¥åº“校验(调用存储过程)
        var checkResult = wmsManager.pdaInvJY(
            db: Db,
            edtUserNo: entity.userName,
            barcode: entity.barcode,
            sectionCode: sectionCode,
            stockId: mesDepost.DepotId.ToString(),
            stockOrgId: mesDepost.FSubsidiary,
            billNo: "", // æ ¹æ®å®žé™…单据号传值
            transactionNo: "101" // äº‹åŠ¡ç±»åž‹ä¸Žå­˜å‚¨è¿‡ç¨‹åŒ¹é…
        );
        num2 = Db.Queryable<MesInvItemArn>()
            .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
            .InnerJoin<MesInvItemArnDetail>((a, b) => b.ParentGuid == a.Guid
                && b.ItemId == itemBarcodeDetails.ItemId
                && (b.CheckRes == "合格" || b.CheckStates == "特采直接使用"))
            .Count();
        if (Convert.ToInt32(checkResult.result) < 1)
            throw new Exception($"入库校验失败:{checkResult.strMsg}");
        switch (num)
        {
            case 0 when num2 == 0:
            case > 0 when num2 == 0:
                freeze = 1;
                break;
            case 0 when num2 > 0:
                throw new Exception("入库失败,到货单据有问题!");
        }
        var owner_type = "";
        if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.DemandOrg))
        {
            owner_type = "BD_OwnerOrg";
        }
        else
        {
            // ç¬¬äºŒå±‚判断:检查 MES_CUSTOMER
            if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
            {
                owner_type = "BD_Customer";
            }
            else
            {
                // ç¬¬ä¸‰å±‚判断:检查 MES_SUPPLIER
                if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
                {
                    owner_type = "BD_Supplier";
                }
                else
                {
                    // ç¬¬å››å±‚判断:再次检查 SYS_ORGANIZATION
                    if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.ReceivingOrg))
                    {
                        owner_type = "BD_OwnerOrg";
                    }
                    else
                    {
                        throw new Exception("入库失败,到货单据对应的需求组织有问题!");
                    }
                }
            }
        }
        //num = Db.Queryable<MesInvItemArn>()
        //    .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
        //    .InnerJoin<MesInvItemArnDetail>((a, b) =>
        //        b.ParentGuid == a.Guid &&
        //        b.ItemId == itemBarcodeDetails.ItemId && b.Ischeck == 1)
        //    .Count();
        var result = new PurchaseInventory();
        //num2 = Db.Queryable<MesInvItemArn>()
        //    .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
        //    .InnerJoin<MesInvItemArnDetail>((a, b) => b.ParentGuid == a.Guid
        //        && b.ItemId == itemBarcodeDetails.ItemId
        //        && (b.CheckRes == "合格" || b.CheckStates == "特采直接使用"))
        //    .Count();
        //switch (num)
        //{
        //    case 0 when num2 == 0:
        //    case > 0 when num2 == 0:
        //        freeze = 1;
        //        break;
        //    case 0 when num2 > 0:
        //        throw new Exception("入库失败,到货单据有问题!");
        //}
        // åˆ¤æ–­è´§ä¸»ç±»åž‹
        var owner_type = wmsManager.GetOwnerType(cgddDetails.DemandOrg);
        // if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.DemandOrg))
        // {
        //     owner_type = "BD_OwnerOrg";
        // }
        // else
        // {
        //     // ç¬¬äºŒå±‚判断:检查 MES_CUSTOMER
        //     if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
        //     {
        //         owner_type = "BD_Customer";
        //     }
        //     else
        //     {
        //         // ç¬¬ä¸‰å±‚判断:检查 MES_SUPPLIER
        //         if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
        //         {
        //             owner_type = "BD_Supplier";
        //         }
        //         else
        //         {
        //             // ç¬¬å››å±‚判断:再次检查 SYS_ORGANIZATION
        //             if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.ReceivingOrg))
        //             {
        //                 owner_type = "BD_OwnerOrg";
        //             }
        //             else
        //             {
        //                 throw new Exception("入库失败,到货单据对应的需求组织有问题!");
        //             }
        //         }
        //     }
        //}
        var result = new ItemInBaseModel();
        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.TaskNo == itemBarcodeDetails.BillNo
                             && it.DepotsCode == mesDepost.DepotCode)
                             && it.DepotsId == mesDepost.DepotId)
                .Select(it => new
                {
                    it.Guid,
@@ -488,8 +517,7 @@
                    it.ItemInId == cId &&
                                    it.ItemId == detailone.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.EbelnK3id == detailone.EbelnK3id &&
                                    it.LineK3id == detailone.LineK3id)
                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                    .Count();
                if (existingCount == 0)
@@ -527,11 +555,10 @@
                            Quantity = SqlFunc.IsNull(it.Quantity, 0) + itemBarcodeDetails.Quantity // ç¡®ä¿ Quantity ä¸ä¸º null
                        })
                        .Where(it =>
                                it.ItemInId == cId &&
                                it.ItemId == detailone.ItemId &&
                                it.DepotId == depotCode2 &&
                                it.EbelnK3id == detailone.EbelnK3id &&
                                it.LineK3id == detailone.LineK3id)
                                    it.ItemInId == cId &&
                                    it.ItemId == detailone.ItemId &&
                                    it.DepotId == depotCode2 &&
                                    it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                        //.IgnoreColumns(true) // ä¿ç•™ IgnoreColumns
                        .ExecuteCommand();
@@ -646,18 +673,19 @@
            if (itemBarcodeDetails.Hbdy != 1)
            {
                //更新收料单明细
                db.Updateable<MesInvItemArnDetail>()
                    .SetColumns(d => new MesInvItemArnDetail
                    {
                        OkRkqty = (int)((d.OkRkqty ?? 0) + cSyQty)
                    })
                    .Where(d => d.Guid == inventoryDetails.Guid)
                    .Where(d => d.Guid == itemBarcodeDetails.AboutGuid)
                    .ExecuteCommand();
                var first = db
                    .Queryable<MesInvItemArnDetail>()
                    .Where(b =>
                        b.Guid == inventoryDetails.Guid)
                        b.Guid == itemBarcodeDetails.AboutGuid)
                    .Select(b => new
                    {
                        TotalQuantity =
@@ -672,7 +700,7 @@
                if (TotalQuantity == TotalOkRkQty)
                    db.Updateable<MesInvItemArnDetail>()
                        .SetColumns(s => s.IsdepsIn == true)
                        .Where(s => s.Guid == inventoryDetails.Guid)
                        .Where(s => s.Guid == itemBarcodeDetails.AboutGuid)
                        .ExecuteCommand();
@@ -695,9 +723,9 @@
                        .ExecuteCommand();
                var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
                    .Where(it => it.WorkLine == itemBarcodeDetails.WorkLine &&
                    .Where(it => it.ItemId == itemBarcodeDetails.ItemId &&
                                 it.WorkNo == itemBarcodeDetails.WorkNo &&
                                 it.CbillNo == itemBarcodeDetails.BillNo)
                                 it.ItemInId == cId)
                    .Sum(it => it.Quantity);
                var detailSummary = db.Queryable<MesInvItemArnDetail>()
@@ -719,12 +747,50 @@
                var mesItems = db.Queryable<MesItems>()
                    .Where(s => s.Id == itemBarcodeDetails.ItemId).First();
                result.Message =
                    $"条码数量 {itemBarcodeDetails.Quantity},采购订单 {itemBarcodeDetails.WorkNo} é¡¹æ¬¡ {itemBarcodeDetails.WorkLine} ç‰©æ–™ {mesItems.ItemNo} æœ¬æ¬¡å…¥åº“总数:{totalCDetailsQuantity} æ€»åˆ° {comeQty} å·²å…¥ {invQty} æ¬  {diffQty}";
                //result.Message =
                //    $"条码数量 {itemBarcodeDetails.Quantity},采购订单 {itemBarcodeDetails.WorkNo} é¡¹æ¬¡ {itemBarcodeDetails.WorkLine} ç‰©æ–™ {mesItems.ItemNo} æœ¬æ¬¡å…¥åº“总数:{totalCDetailsQuantity} æ€»åˆ° {comeQty} å·²å…¥ {invQty} æ¬  {diffQty}";
                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)
                    )
                    .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
                    .Select<dynamic>((a, b) => new
                    {
                        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)
                    )
                    .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
                    .Select<dynamic>((a, b) => new
                    {
                        ItemNo = b.ItemNo,
                        ItemName = b.ItemName,
                        ItemModel = b.ItemModel,
                        FQty = a.Quantity, // ç”³è¯·æ•°é‡
                        FMaterialId = b.ItemId,
                        Id = a.Guid.ToString(),
                        kw = a.DepotSectionCode
                    })
                    .ToList();
                result.ItemNo = mesItems.ItemNo;
                result.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity);
                //result.ItemNo = mesItems.ItemNo;
                result.SumQuantity = Convert.ToDecimal(invQty);
                return 1;
            }
@@ -751,14 +817,12 @@
                // Step 2: Calculate total sum from `mes_inv_item_in_c_details`
                var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
                    .Where(it => it.CbillNo == itemBarcodeDetails.BillNo &&
                                 it.ItemId == itemBarcodeDetails.ItemId)
                    .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
                    .Sum(it => it.Quantity);
                // Step 3: Calculate comeQty and invQty from `mes_inv_item_arn_detail`
                var detailSummary = db.Queryable<MesInvItemArnDetail>()
                    .Where(it => it.CbillNo == itemBarcodeDetails.BillNo &&
                                 it.ItemId == itemBarcodeDetails.ItemId)
                    .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
                    .Select(it => new
                    {
                        TotalComeQty = SqlFunc.AggregateSum(it.Quantity),
@@ -781,7 +845,7 @@
                    $" æ¡ç æ•°é‡:{itemBarcodeDetails.Quantity},物料 {mesItems.ItemNo} æœ¬æ¬¡å…¥åº“总数:{totalCDetailsQuantity} æ€»åˆ° {comeQty} å·²å…¥ {invQty} æ¬  {diffQty}";
                result.ItemNo = mesItems.ItemNo;
                //result.ItemNo = mesItems.ItemNo;
                result.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity);
            }
@@ -796,20 +860,20 @@
        var purchaseInventory = getPurchaseInventory(entity);
        result.ItemIns = purchaseInventory.ItemIns;
        result.ItemInDetails = purchaseInventory.ItemInDetails;
        result.InvItemInCDetails = purchaseInventory.InvItemInCDetails;
        //result.ItemInDetails = purchaseInventory.ItemInDetails;
        //result.InvItemInCDetails = purchaseInventory.InvItemInCDetails;
        return result;
    }
    public PurchaseInventory getPurchaseInventory(WarehouseQuery query)
    public ItemInBaseModel getPurchaseInventory(WarehouseQuery query)
    {
        return new PurchaseInventory
        return new ItemInBaseModel
        {
            ItemIns = GetInvItemInsList(query).Items[0],
            ItemInDetails = GetItemInDetails(query.id),
            InvItemInCDetails = GetInvItemInCDetails(query.id)
            //ItemIns = GetInvItemInsList(query).Items[0],
            //ItemInDetails = GetItemInDetails(query.id),
            //InvItemInCDetails = GetInvItemInCDetails(query.id)
        };
    }
service/Warehouse/MesItemTblManager.cs
@@ -1,8 +1,8 @@
using Masuit.Tools;
using MES.Service.Modes;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using SqlSugar;
using System.Security.Cryptography;
service/Warehouse/MesStrkManager.cs
@@ -4,6 +4,7 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using OracleInternal.Sharding;
using SqlSugar;
service/Warehouse/MesSttlManager.cs
@@ -1,9 +1,9 @@
using Masuit.Tools;
using MES.Service.Models;
using MES.Service.Modes;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using OracleInternal.Sharding;
using SqlSugar;
service/Warehouse/MesXsckManager.cs
@@ -3,6 +3,7 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using SqlSugar;
using SqlSugar.Extensions;
service/Warehouse/MesXsthManager.cs
@@ -3,6 +3,7 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using OracleInternal.Sharding;
using SqlSugar;
service/Warehouse/TransferOutManager.cs
@@ -4,6 +4,7 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using SqlSugar;
namespace NewPdaSqlServer.service.Warehouse;
service/Wom/WomdaaManager.cs
@@ -1,11 +1,11 @@
using System.Data;
using System.Data.SqlClient;
using Masuit.Tools;
using MES.Service.Modes;
using Microsoft.SqlServer.Server;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using SqlSugar;
namespace NewPdaSqlServer.service.Wom;
service/base/WmsBaseMangeer.cs
@@ -113,5 +113,38 @@
            return itemInfo;
        }
        /// <summary>
        /// èŽ·å–è´§ä¸»ç±»åž‹
        /// </summary>
        /// <param name="ownerId">货主ID</param>
        /// <returns>货主类型(BD_OwnerOrg/BD_Customer/BD_Supplier)</returns>
        public string GetOwnerType(string ownerId)
        {
            if (string.IsNullOrEmpty(ownerId))
                throw new ArgumentNullException(nameof(ownerId));
            if (Db.Queryable<SysOrganization>().Any(x => x.Fid == ownerId))
            {
                return "BD_OwnerOrg";
            }
            else if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(ownerId)))
            {
                return "BD_Customer";
            }
            else if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(ownerId)))
            {
                return "BD_Supplier";
            }
            else if (Db.Queryable<SysOrganization>().Any(x => x.Fid == ownerId))
            {
                return "BD_OwnerOrg";
            }
            throw new Exception("无法确定货主类型,请检查货主ID是否正确!");
        }
    }
}