快乐的昕的电脑
3 小时以前 cc0c486c83e857c6ee3943ebc5a830c941faa411
MES.Service/service/BasicData/MesItemsManager.cs
@@ -164,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,
@@ -197,10 +197,6 @@
        {
            entity.ItemUnit = entityItemUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FBaseUnitId))
        {
            entity.ItemUnit = item.FBaseUnitId;
        }
        else
        {
            entity.ItemUnit = "0";
@@ -214,10 +210,6 @@
        if (!string.IsNullOrWhiteSpace(entitySaleunit))
        {
            entity.Saleunit = entitySaleunit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FSaleUnitId))
        {
            entity.Saleunit = item.FSaleUnitId;
        }
        else
        {
@@ -233,10 +225,6 @@
        {
            entity.Storeunit = entityStoreunit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FStoreUnitID))
        {
            entity.Storeunit = item.FStoreUnitID;
        }
        else
        {
            entity.Storeunit = "0";
@@ -250,10 +238,6 @@
        if (!string.IsNullOrWhiteSpace(entityFpurchaseunitid))
        {
            entity.Fpurchaseunitid = entityFpurchaseunitid;
        }
        else if (!string.IsNullOrWhiteSpace(item.FPurchaseUnitId))
        {
            entity.Fpurchaseunitid = item.FPurchaseUnitId;
        }
        else
        {
@@ -269,10 +253,6 @@
        {
            entity.ProduceUnit = entityProduceUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FPRODUCEUNITID))
        {
            entity.ProduceUnit = item.FPRODUCEUNITID;
        }
        else
        {
            entity.ProduceUnit = "0";
@@ -286,10 +266,6 @@
        if (!string.IsNullOrWhiteSpace(entitySubconUnit))
        {
            entity.SubconUnit = entitySubconUnit;
        }
        else if (!string.IsNullOrWhiteSpace(item.FSUBCONUNITID))
        {
            entity.SubconUnit = item.FSUBCONUNITID;
        }
        else
        {
@@ -305,27 +281,51 @@
        {
            entity.DepotCode = entityDepotCode;
        }
        else if (!string.IsNullOrWhiteSpace(item.FStockId))
        {
            entity.DepotCode = item.FStockId;
        }
        else
        {
            entity.SubconUnit = "0";
            entity.DepotCode = "0";
        }
        // ERP: Y=未禁用, N=禁用
        // MES: A=未禁用, B=禁用
        if (string.IsNullOrEmpty(item.FForbidStatus))
        //采购员编码转ID,Fpurchaserid = item.FPurchaserId,
        var entityFpurchaserid = Db.Queryable<MesStaff>()
        .Where(x => x.StaffNo == item.FPurchaserId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityFpurchaserid))
        {
            entity.Fforbidstatus = "A";
            entity.Fpurchaserid = entityFpurchaserid;
        }
        else
        {
            //我期望的值是A=启用,B=禁用
            //实际给我的值是Y或N,我希望为我转换从A和B的方式
            entity.Fforbidstatus = item.FForbidStatus == "N" ? "B" : "A";
            entity.Fpurchaserid = "0";
        }
        //工作中心编码转ID,ProductionWorkshop = item.FWorkShopId,
        var entityProductionWorkshop = Db.Queryable<SysDepartment>()
        .Where(x => x.WorkshopCenterCode == item.FWorkShopId)
        .Select(x => x.Id.ToString())
        .First();
        if (!string.IsNullOrWhiteSpace(entityProductionWorkshop))
        {
            entity.ProductionWorkshop = entityProductionWorkshop;
        }
        else
        {
            entity.ProductionWorkshop = "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;
    }
@@ -348,17 +348,8 @@
        return newId;
    }
    /// <summary>
    /// 启用与禁用"Y"、"N" 转换为 "A"、"B"
    /// </summary>
    /// <param name="db"></param>
    /// <param name="itemList"></param>
    /// <param name="inputStatus"></param>
    /// <returns></returns>
    /// <exception cref="NotImplementedException"></exception>
    private bool UpdateItemStatusBatch(SqlSugarScope db,List<MesItems> itemList, string inputStatus)
    private bool UpdateItemStatusBatch(SqlSugarScope db,List<MesItems> itemList, string status)
    {
        var status = (inputStatus == "Y") ? "A" : (inputStatus == "N") ? "B" : inputStatus;
        var ids = itemList.Select(it => it.Id).ToArray();
        var result = db.Updateable<MesItems>()
            .SetColumns(s => s.Fforbidstatus == status)