快乐的昕的电脑
7 天以前 4a7b0fda2e0659982239020c005615758a3acbee
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,
@@ -296,18 +296,54 @@
            entity.SubconUnit = "0";
        }
        // ERP: 0=未禁用, 1=禁用
        // MES: A=未禁用, B=禁用
        if (string.IsNullOrEmpty(item.FForbidStatus))
        //默认仓库编码转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.Fforbidstatus = "A";
            entity.DepotCode = entityDepotCode;
        }
        else if (!string.IsNullOrWhiteSpace(item.FStockId))
        {
            entity.DepotCode = item.FStockId;
        }
        else
        {
            //我期望的值是A=否,B=是
            //实际给我的值是0或1,我希望为我转换从A和B的方式
            entity.Fforbidstatus = item.FForbidStatus == "1" ? "B" : "A";
            entity.SubconUnit = "0";
        }
        //采购员编码转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.Fpurchaserid = entityFpurchaserid;
        }
        else if (!string.IsNullOrWhiteSpace(item.FPurchaserId))
        {
            entity.Fpurchaserid = item.FPurchaserId;
        }
        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;
    }
@@ -330,8 +366,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>()