From cdd325cf78ca5bac74f941a917d8c90f34fa63e6 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期一, 25 八月 2025 10:03:41 +0800 Subject: [PATCH] 11 --- MES.Service/service/BasicData/MesSupplierManager.cs | 27 +++++++++++++++++++++------ 1 files changed, 21 insertions(+), 6 deletions(-) diff --git a/MES.Service/service/BasicData/MesSupplierManager.cs b/MES.Service/service/BasicData/MesSupplierManager.cs index 57983a5..acb391c 100644 --- a/MES.Service/service/BasicData/MesSupplierManager.cs +++ b/MES.Service/service/BasicData/MesSupplierManager.cs @@ -114,9 +114,11 @@ private MesSupplier GetMesSupplier(ErpSupplier supplier) { - return new MesSupplier + var entity = new MesSupplier { - Id = Convert.ToDecimal(supplier.Id), + Id = string.IsNullOrEmpty(supplier.Id) + ? DateTimeOffset.UtcNow.ToUnixTimeSeconds() + : Convert.ToDecimal(supplier.Id), Type = supplier.Type, SuppNo = supplier.FNumber, SuppSname = supplier.FShortName, @@ -124,17 +126,30 @@ Lxr = supplier.FTContact, Telf1 = supplier.Fmobilephone, Fstaffid = supplier.FStaffId, - FDocumentStatus = supplier.FDocumentStatus, Fforbidstatus = supplier.FForbidStatus, - FSubsidiary = supplier.FUseOrgId, - Fumbrella = supplier.FCreateOrgId, + FSubsidiary = string.IsNullOrEmpty(supplier.FUseOrgId) + ? "1" + : supplier.FUseOrgId, + Fumbrella = string.IsNullOrEmpty(supplier.FCreateOrgId) + ? "1" + : supplier.FCreateOrgId, Remark = supplier.Remark, CreateDate = DateTime.Now, LastupdateDate = DateTime.Now, Company = "1000", Factory = "1000", - }; + + var mesSupplier = Db.Queryable<MesSupplier>() + .Where(s => s.SuppNo == entity.SuppNo) + .First(); + + if (mesSupplier != null) + { + entity.Id = mesSupplier.Id; + } + + return entity; } private bool UpdateSupplierStatusBatch(SqlSugarScope db, -- Gitblit v1.9.3