已修改5个文件
300 ■■■■■ 文件已修改
MES.Service/Dto/webApi/ErpSupplier.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/Modes/MesRohInData.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/service/BasicData/MesItemsManager.cs 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/service/BasicData/MesRohInManager.cs 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/service/BasicData/MesSupplierManager.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/Dto/webApi/ErpSupplier.cs
@@ -7,8 +7,8 @@
    public string FNumber { get; set; }
    public string? FShortName { get; set; }
    public string? FName { get; set; }
    public string? FTContact { get; set; }
    public string? Fmobilephone { get; set; }
    public string? F_UNW_LXR { get; set; }
    public string? F_UNW_LXRDH { get; set; }
    public string? FStaffId { get; set; }
    public string? FForbidStatus { get; set; }//禁用状态
    public string? FUseOrgId { get; set; }
MES.Service/Modes/MesRohInData.cs
@@ -33,7 +33,7 @@
    public string? OrderLineId { get; set; }
    /// <summary>
    ///     物料编码
    ///     物料ID
    /// </summary>
    [SugarColumn(ColumnName = "ITEM_ID")]
    public string? ItemId { get; set; }
MES.Service/service/BasicData/MesItemsManager.cs
@@ -133,7 +133,7 @@
            ItemNo = item.FNumber,
            ItemName = item.FName,
            ItemModel = item.FSpecification,
            ItemUnit = item.FBaseUnitId,
            ItemUnit = item.FBaseUnitId,//物料基本单位编码转ID
            Lowlimit = Convert.ToDouble(item.FSafeStock),
            Highlimit = Convert.ToDouble(item.FMaxStock),
            PrdPack = Convert.ToDouble(item.FMinPackCount),
@@ -142,7 +142,15 @@
            Remarks = item.FDescription,
            Ffinishreceiptoverrate =
                Convert.ToDecimal(item.FFinishReceiptOverRate),
            Fissuetype = item.FIssueType,
            //发料方式
            Fissuetype = item.FIssueType switch
            {
                "1" => "逐批领料",
                "2" => "自动扣料",
                _ => item.FIssueType
            },
            //Fissuetype = item.FIssueType,
            //批号管理
            Fisbatchmanage = item.FIsBatchManage switch
            {
@@ -156,7 +164,7 @@
            Fpurchaseunitid = item.FPurchaseUnitId,
            Storeunit = item.FStoreUnitID,
            Saleunit = item.FSaleUnitId,
            //Fforbidstatus = item.FForbidStatus,
            Fforbidstatus = item.FForbidStatus,//启用与禁用
            MaterialProperti = item.FErpClsID,
            ProductionWorkshop = item.FWorkShopId,
            ProduceUnit = item.FPRODUCEUNITID,
@@ -180,19 +188,144 @@
            FSubsidiary = string.IsNullOrEmpty(item.FUseOrgId) ? "1" : item.FUseOrgId,
            Fumbrella = string.IsNullOrEmpty(item.FCreateOrgId) ? "1" : item.FCreateOrgId,
        };
        // ERP: 0=未禁用, 1=禁用
        // MES: A=未禁用, B=禁用
        if (string.IsNullOrEmpty(item.FForbidStatus))
        //物料基本单位编码转ID,ItemUnit = item.FBaseUnitId
        var entityItemUnit = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FBaseUnitId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityItemUnit))
        {
            entity.Fforbidstatus = "A";
            entity.ItemUnit = entityItemUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FBaseUnitId))
        {
            entity.ItemUnit = item.FBaseUnitId;
        }
        else
        {
            //我期望的值是A=否,B=是
            //实际给我的值是0或1,我希望为我转换从A和B的方式
            entity.Fforbidstatus = item.FForbidStatus == "1" ? "B" : "A";
            entity.ItemUnit = "0";
        }
        //物料销售单位编码转ID,Saleunit = item.FSaleUnitId
        var entitySaleunit = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FSaleUnitId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entitySaleunit))
        {
            entity.Saleunit = entitySaleunit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FSaleUnitId))
        {
            entity.Saleunit = item.FSaleUnitId;
        }
        else
        {
            entity.Saleunit = "0";
        }
        //物料库房单位编码转ID,Storeunit = item.FStoreUnitID
        var entityStoreunit = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FStoreUnitID)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityStoreunit))
        {
            entity.Storeunit = entityStoreunit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FStoreUnitID))
        {
            entity.Storeunit = item.FStoreUnitID;
        }
        else
        {
            entity.Storeunit = "0";
        }
        //物料采购单位编码转ID,Fpurchaseunitid = item.FPurchaseUnitId
        var entityFpurchaseunitid = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FPurchaseUnitId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityFpurchaseunitid))
        {
            entity.Fpurchaseunitid = entityFpurchaseunitid;
        }
        else if (!string.IsNullOrWhiteSpace(item.FPurchaseUnitId))
        {
            entity.Fpurchaseunitid = item.FPurchaseUnitId;
        }
        else
        {
            entity.Fpurchaseunitid = "0";
        }
        //物料生产单位编码转ID,ProduceUnit = item.FPRODUCEUNITID
        var entityProduceUnit = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FPRODUCEUNITID)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityProduceUnit))
        {
            entity.ProduceUnit = entityProduceUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FPRODUCEUNITID))
        {
            entity.ProduceUnit = item.FPRODUCEUNITID;
        }
        else
        {
            entity.ProduceUnit = "0";
        }
        //物料委外单位编码转ID,SubconUnit = item.FSUBCONUNITID
        var entitySubconUnit = Db.Queryable<MesUnit>()
        .Where(x => x.Fnumber == item.FSUBCONUNITID)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entitySubconUnit))
        {
            entity.SubconUnit = entitySubconUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FSUBCONUNITID))
        {
            entity.SubconUnit = item.FSUBCONUNITID;
        }
        else
        {
            entity.SubconUnit = "0";
        }
        //默认仓库编码转ID,DepotCode = item.FStockId,
        var entityDepotCode = Db.Queryable<MesDepots>()
        .Where(x => x.DepotCode == item.FStockId)
        .Select(x => x.DepotId.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityDepotCode))
        {
            entity.DepotCode = entityDepotCode;
        }
        else if (!string.IsNullOrWhiteSpace(item.FStockId))
        {
            entity.DepotCode = item.FStockId;
        }
        else
        {
            entity.SubconUnit = "0";
        }
        //// ERP: Y=未禁用, N=禁用
        //// MES: A=未禁用, B=禁用
        //if (string.IsNullOrEmpty(item.FForbidStatus))
        //{
        //    entity.Fforbidstatus = "A";
        //}
        //else
        //{
        //    //我期望的值是A=启用,B=禁用
        //    //实际给我的值是Y或N,我希望为我转换从A和B的方式
        //    entity.Fforbidstatus = item.FForbidStatus == "N" ? "B" : "A";
        //}
        return entity;
    }
@@ -215,8 +348,7 @@
        return newId;
    }
    private bool UpdateItemStatusBatch(SqlSugarScope db,
        List<MesItems> itemList, string status)
    private bool UpdateItemStatusBatch(SqlSugarScope db,List<MesItems> itemList, string status)
    {
        var ids = itemList.Select(it => it.Id).ToArray();
        var result = db.Updateable<MesItems>()
MES.Service/service/BasicData/MesRohInManager.cs
@@ -8,7 +8,9 @@
using System.Security.AccessControl;
namespace MES.Service.service.BasicData;
/// <summary>
/// 采购订单
/// </summary>
public class MesRohInManager : Repository<MesRohIn>
{
    private readonly MesRohInDataManager rohInDataManager = new();
@@ -68,10 +70,16 @@
    // 插入或更新数据的方法
    private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn,List<MesRohInData> mesRohInDatas, string type)
    {
        ////传什么,c就改成什么
        //if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))//C表示已审核状态
        //{
        //    mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
        //}
        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))
        //传什么,c就改成什么
        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "Y"))//Y表示已审核状态
        {
            mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
            mesRohIn.BillNo = mesRohIn.BillNo + "Y" + mesRohIn.EbelnK3id.ToString();
        }
        if (mesRohIn.Guid != null)
@@ -138,10 +146,48 @@
            mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate,
                "yyyy-MM-dd HH:mm:ss", null);
        mesRohIn.Supplier = rohIn.FSupplierId;
        //供应商编码转ID
        var mesRohInSupplier = Db.Queryable<MesSupplier>()
            .Where(x => x.SuppNo == rohIn.FSupplierId)
            .Select(x => x.Id.ToString())
            .First();
        if (!string.IsNullOrWhiteSpace(mesRohInSupplier))
        {
            mesRohIn.Supplier = mesRohInSupplier;
        }
        else if (!string.IsNullOrWhiteSpace(rohIn.FSupplierId))
        {
            mesRohIn.Supplier = rohIn.FSupplierId;
        }
        else
        {
            mesRohIn.Supplier = "0";
        }
        //mesRohIn.Supplier = rohIn.FSupplierId;
        mesRohIn.CloseStatus = rohIn.FCloseStatus;
        mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
        mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        //mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
        mesRohIn.PurchaseOrg = string.IsNullOrEmpty(rohIn.FPurchaseOrgId) ? "1" : rohIn.FPurchaseOrgId;//采购组织
        //采购部门编码转ID
        var mesRohInPurchaseDept = Db.Queryable<SysDepartment>()
            .Where(x => x.Departmentcode == rohIn.FPurchaseDeptId)
            .Select(x => x.Departmentid.ToString())
            .First();
        if (!string.IsNullOrWhiteSpace(mesRohInPurchaseDept))
        {
            mesRohIn.PurchaseDept = mesRohInPurchaseDept;
        }
        else if (!string.IsNullOrWhiteSpace(rohIn.FPurchaseDeptId))
        {
            mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        }
        else
        {
            mesRohIn.PurchaseDept = "0";
        }
        //mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        mesRohIn.PurchaseGroup = rohIn.FPurchaserGroupId;
        mesRohIn.Purchaser = rohIn.FPurchaserId;
        mesRohIn.SettlementParty = rohIn.FSettleId;
@@ -269,7 +315,7 @@
                ChangeFlag = s.FChangeFlag,
                DemandSource = s.FDEMANDTYPE,
                DemandDocumentId = s.FDEMANDBILLNO,
                DemandDocumentLineId = s.FDEMANDBILLENTRYSEQ,
                OrderLineId = s.FDEMANDBILLENTRYSEQ,
                DemandOrg = s.FRequireOrgId,
                ReceivingOrg = s.FReceiveOrgId,
                SettlementOrg = s.FEntrySettleOrgId,
@@ -284,6 +330,60 @@
                SalesOrderId = s.F_UNW_Text_xsddh
            };
            //采购单位编码转ID
            var entityPurchaseUnit = Db.Queryable<MesUnit>()
                .Where(x => x.Fnumber == s.FUnitId)
                .Select(x => x.Id.ToString())
                .First();
            if (!string.IsNullOrWhiteSpace(entityPurchaseUnit))
            {
                entity.PurchaseUnit = entityPurchaseUnit;
            }
            else if (!string.IsNullOrWhiteSpace(s.FUnitId))
            {
                entity.PurchaseUnit = s.FUnitId;
            }
            else
            {
                entity.PurchaseUnit = "0";
            }
            //计价单位编码转ID
            var entityPricingUnit = Db.Queryable<MesUnit>()
                .Where(x => x.Fnumber == s.FPriceUnitId)
                .Select(x => x.Id.ToString())
                .First();
            if (!string.IsNullOrWhiteSpace(entityPricingUnit))
            {
                entity.PricingUnit = entityPricingUnit;
            }
            else if (!string.IsNullOrWhiteSpace(s.FPriceUnitId))
            {
                entity.PricingUnit = s.FPriceUnitId;
            }
            else
            {
                entity.PricingUnit = "0";
            }
            //物料编码转ID
            var entityItemId = Db.Queryable<MesItems>()
                .Where(x => x.ItemNo == s.FMaterialId)
                .Select(x => x.Id.ToString())
                .First();
            if (!string.IsNullOrWhiteSpace(entityItemId))
            {
                entity.ItemId = entityItemId;
            }
            else if (!string.IsNullOrWhiteSpace(s.FMaterialId))
            {
                entity.ItemId = s.FMaterialId;
            }
            else
            {
                entity.ItemId = "0";
            }
            if (s.FFreezeDate != null)
                if (!s.FFreezerId.IsNullOrEmpty())
                    entity.FreezeTime =
MES.Service/service/BasicData/MesSupplierManager.cs
@@ -132,8 +132,8 @@
            SuppNo = supplier.FNumber,
            SuppSname = supplier.FShortName,
            SuppName = supplier.FName,
            Lxr = supplier.FTContact,
            Telf1 = supplier.Fmobilephone,
            Lxr = supplier.F_UNW_LXR,
            Telf1 = supplier.F_UNW_LXRDH,
            Fstaffid = supplier.FStaffId,
            //Fforbidstatus = supplier.FForbidStatus,
            Type = supplier.Type,
@@ -150,6 +150,24 @@
            Fumbrella = string.IsNullOrEmpty(supplier.FCreateOrgId) ? "1" : supplier.FCreateOrgId,
        };
        //负责人名称编码转ID,Fstaffid = supplier.FStaffId
        var entitySubconUnit = Db.Queryable<MesStaff>()
        .Where(x => x.StaffNo == supplier.FStaffId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entitySubconUnit))
        {
            entity.Fstaffid = entitySubconUnit;
        }
        else if (!string.IsNullOrWhiteSpace(supplier.FStaffId))
        {
            entity.Fstaffid = supplier.FStaffId;
        }
        else
        {
            entity.Fstaffid = "0";
        }
        // ERP: 0=未禁用, 1=禁用
        // MES: A=未禁用, B=禁用
        if (supplier.FForbidStatus.IsNullOrEmpty())