sjz
6 天以前 5de35354e8dfcb4933350d0d1b645d400bcf23ab
MES.Service/service/BasicData/MesCustomerManager.cs
@@ -10,7 +10,7 @@
    public bool Save(ErpCustomer customer)
    {
        var entity = GetMesCustomer(customer);
        return UseTransaction(db =>
        {
            switch (customer.Type)
@@ -55,11 +55,13 @@
                switch (customerGroup.Key)
                {
                    case "0":
                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,"A"))
                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,
                                "A"))
                            throw new NotImplementedException("启用失败");
                        break;
                    case "1":
                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,"B"))
                        if (!UpdateCustomerStatusBatch(db, customerGroup.Value,
                                "B"))
                            throw new NotImplementedException("禁用失败");
                        break;
                    case "2":
@@ -90,10 +92,10 @@
    private bool InsertCustomer(SqlSugarScope db, MesCustomer entity)
    {
        var exists = db.Queryable<MesCustomer>().Any(e => e.Id == entity.Id);
        var exists = db.Queryable<MesCustomer>().Any(e => e.Id == entity.Id && e.CustNo==entity.CustNo);
        if (exists)
        {
            var result = db.Updateable<MesCustomer>().ExecuteCommand();
            var result = db.Updateable(entity).Where(e => e.Id == entity.Id && e.CustNo == entity.CustNo).ExecuteCommand();
            return true;
        }
        else
@@ -111,10 +113,10 @@
    }
    private bool InsertOrUpdate(SqlSugarScope db, MesCustomer entity)
    {
        var exists = db.Queryable<MesCustomer>().Any(e => e.Id == entity.Id);
        var exists = db.Queryable<MesCustomer>().Any(e => e.Id == entity.Id && e.CustNo == entity.CustNo);
        if (exists)
        {
            var update = db.Updateable(entity).ExecuteCommand();
            var update = db.Updateable(entity).Where(e => e.Id == entity.Id && e.CustNo == entity.CustNo).ExecuteCommand();
            return true;
        }
        else
@@ -144,8 +146,8 @@
            Fseller = customer.FSeller,
            Fforbidstatus = customer.FForbidStatus,
            CreateDate = DateTime.Now,
            CreateOrg= Convert.ToDecimal(customer.FCreateOrgId),
            UseOrg= Convert.ToDecimal(customer.FUseOrgId),
            CreateOrg = Convert.ToDecimal(customer.FCreateOrgId),
            UseOrg = Convert.ToDecimal(customer.FUseOrgId),
            Company = "1000",
            Factory = "1000"
        };