快乐的昕的电脑
8 天以前 f92369eeb7587ce03ae5bb09d74524fe6fb0f3e1
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,
@@ -311,21 +311,57 @@
        }
        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 if (!string.IsNullOrWhiteSpace(item.FPurchaserId))
        {
            entity.Fpurchaserid = item.FPurchaserId;
        }
        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 if (!string.IsNullOrWhiteSpace(item.FWorkShopId))
        {
            entity.ProductionWorkshop = item.FWorkShopId;
        }
        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,8 +384,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>()