快乐的昕的电脑
5 天以前 451b0f45516d5c571c3eb15fd567a8f61a78a70e
物料单位编码转ID
已修改1个文件
119 ■■■■■ 文件已修改
MES.Service/service/BasicData/MesItemsManager.cs 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
            {
@@ -180,6 +188,113 @@
            FSubsidiary = string.IsNullOrEmpty(item.FUseOrgId) ? "1" : item.FUseOrgId,
            Fumbrella = string.IsNullOrEmpty(item.FCreateOrgId) ? "1" : item.FCreateOrgId,
        };
        //物料基本单位编码转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.ItemUnit = entityItemUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FBaseUnitId))
        {
            entity.ItemUnit = item.FBaseUnitId;
        }
        else
        {
            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";
        }
        // ERP: 0=未禁用, 1=禁用
        // MES: A=未禁用, B=禁用