| | |
| | | using MES.Service.DB; |
| | | using Masuit.Tools; |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.webApi; |
| | | using MES.Service.Modes; |
| | | using SqlSugar; |
| | |
| | | private MesCustomer GetSysDepartment(ErpCustomer customer) |
| | | { |
| | | //ERP傳輸的接口數據轉換為MES數據庫字段 |
| | | var fForbidStatus = customer.FForbidStatus; |
| | | if (customer.FForbidStatus == "0") |
| | | { |
| | | fForbidStatus = "A"; |
| | | } |
| | | else if (customer.FForbidStatus == "1") |
| | | { |
| | | fForbidStatus = "B"; |
| | | } |
| | | |
| | | var entity = new MesCustomer |
| | | { |
| | | CustNo = customer.FNumber, |
| | |
| | | Anred = customer.FTContact, |
| | | Telf1 = customer.Fmobilephone, |
| | | Fseller = customer.Fseller, |
| | | Fforbidstatus = fForbidStatus, |
| | | FSubsidiary = string.IsNullOrEmpty(customer.FUseOrgId) |
| | | ? "1" |
| | | : customer.FUseOrgId, |
| | | Fumbrella = string.IsNullOrEmpty(customer.FCreateOrgId) |
| | | ? "1" |
| | | : customer.FCreateOrgId, |
| | | // FSubsidiary = string.IsNullOrEmpty(customer.FUseOrgId) |
| | | // ? "1" |
| | | // : customer.FUseOrgId, |
| | | // Fumbrella = string.IsNullOrEmpty(customer.FCreateOrgId) |
| | | // ? "1" |
| | | // : customer.FCreateOrgId, |
| | | FSubsidiary = "1", |
| | | Fumbrella = "1", |
| | | CreateDate = DateTime.Now, |
| | | LastupdateDate = DateTime.Now, |
| | | Company = "1000", |
| | |
| | | Type = customer.Type, |
| | | }; |
| | | |
| | | if (customer.FForbidStatus.IsNullOrEmpty()) |
| | | { |
| | | entity.Fforbidstatus = "A"; |
| | | } |
| | | else |
| | | { |
| | | //我期望的值是A=否,B=是 |
| | | //实际给我的值是0或1,我希望为我转换从A和B的方式 |
| | | entity.Fforbidstatus = customer.FForbidStatus == "1" ? "B" : "A"; |
| | | } |
| | | |
| | | // 查找是否已存在相同客户编码的记录 |
| | | var existingCustomer = Db.Queryable<MesCustomer>() |
| | | .Where(s => s.CustNo == entity.CustNo) |