From 5bbd7eb25fa5cf13ba2e867bb1d4b89c6360592d Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Thu, 18 Jul 2024 12:04:52 +0800 Subject: [PATCH] bug --- .../Entity/BasMaterial.cs | 12 ++-- .../Entity/ErpBdMaterial.cs | 22 -------- .../Entity/ErpEntity/ErpBdMaterial.cs | 56 +++++++++++++++++++ .../Entity/ErpEntity/ErpBdMeasdoc.cs | 13 +++++ .../Tnb.ProductionMgr/TimeWorkService.cs | 56 +++++++++++++++++++ .../WmsMaterialTransferService.cs | 9 ++- .../Configurations/ConnectionStrings.json | 9 ++- 7 files changed, 145 insertions(+), 32 deletions(-) delete mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpBdMaterial.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMeasdoc.cs diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs index 43b5a8a5..72b051b5 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs @@ -109,11 +109,6 @@ public partial class BasMaterial : BaseEntity /// public int? fifo_interval_days { get; set; } - /// - /// 物料规格型号 - /// - // public string? material_standard { get; set; } - /// /// 海关编码 /// @@ -275,7 +270,12 @@ public partial class BasMaterial : BaseEntity public string container_no { get; set; } /// - /// 规格型号 + /// 物料规格 /// public string? material_specification { get; set; } + + /// + /// 物料型号 + /// + public string? material_standard { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpBdMaterial.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpBdMaterial.cs deleted file mode 100644 index 04eb9407..00000000 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpBdMaterial.cs +++ /dev/null @@ -1,22 +0,0 @@ -using JNPF.Common.Contracts; -using SqlSugar; - -namespace Tnb.ProductionMgr.Entities.Entity -{ - [SugarTable("ERP_BD_MATERIAL")] - public class ErpBdMaterial: BaseEntity - { - public string CODE { get; set; } - public string PK_ORG { get; set; } - public string NAME { get; set; } - public string MATERIALSPEC { get; set; } - public string MATERIALTYPE { get; set; } - public string PK_MEASDOC { get; set; } - public string MEASRATE { get; set; } - public string FMEASDOC { get; set; } - public string VID { get; set; } - public string MEANAME { get; set; } - public string FMEANAME { get; set; } - public string AID { get; set; } - } -} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs new file mode 100644 index 00000000..ac90fc09 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMaterial.cs @@ -0,0 +1,56 @@ +using JNPF.Common.Contracts; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities.Entity.ErpEntity +{ + [SugarTable("ERP_BD_MATERIAL")] + public class ErpBdMaterial + { + public string ID { get; set; } + /// + /// 物料编码 + /// + public string CODE { get; set; } + /// + /// 组织id + /// + public string PK_ORG { get; set; } + /// + /// 物料名称 + /// + public string NAME { get; set; } + /// + /// 物料规格 + /// + public string MATERIALSPEC { get; set; } + /// + /// 物料型号 + /// + public string MATERIALTYPE { get; set; } + /// + /// 主单位 + /// + public string PK_MEASDOC { get; set; } + /// + /// 换算率 + /// + public string MEASRATE { get; set; } + /// + /// 副单位 + /// + public string FMEASDOC { get; set; } + public string VID { get; set; } + /// + /// 主单位中文 + /// + public string MEANAME { get; set; } + /// + /// 副单位中文 + /// + public string FMEANAME { get; set; } + /// + /// 物料主键+物料主单位 + /// + public string AID { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMeasdoc.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMeasdoc.cs new file mode 100644 index 00000000..af7f2024 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpEntity/ErpBdMeasdoc.cs @@ -0,0 +1,13 @@ +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities.Entity.ErpEntity +{ + + [SugarTable("ERP_BD_MEASDOC")] + public class ErpBdMeasdoc + { + public string ID { get; set; } + public string CODE { get; set; } + public string NAME { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs index 8956602b..48e21453 100644 --- a/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/TimeWorkService.cs @@ -11,6 +11,7 @@ using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; using JNPF.FriendlyException; using JNPF.Logging; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using Microsoft.AspNetCore.Authorization; @@ -32,6 +33,8 @@ using Tnb.WarehouseMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Interfaces; using Tnb.ProductionMgr.Entities.Dto.PrdManage; +using Tnb.ProductionMgr.Entities.Entity; +using Tnb.ProductionMgr.Entities.Entity.ErpEntity; namespace Tnb.ProductionMgr { @@ -408,6 +411,7 @@ namespace Tnb.ProductionMgr int cs01Count = await _redisData.TryGetValueByKeyField("YTCS", "EmptyNo_CS01"); int cs03Count = await _redisData.TryGetValueByKeyField("YTCS", "EmptyNo_CS03"); + Log.Information($"注塑定点配送cs01数量:{cs01Count},cs03数量:{cs03Count}"); List eqpIds = equipments.Select(x => x.id).ToList(); List eqpDaqs = await _db.Queryable().Where(x => eqpIds.Contains(x.equip_id) && x.label_name.Contains("允许入空箱")).ToListAsync(); @@ -667,6 +671,58 @@ namespace Tnb.ProductionMgr [AllowAnonymous] public async Task SyncBaseData() { + var mysqlDb = _db.AsTenant().GetConnection("erpdb"); + List list = await mysqlDb.Queryable().ToListAsync(); + List erpExtendFields = await _db.Queryable().ToListAsync(); + List materials = await _db.Queryable().ToListAsync(); + List insertMaterial = new List(); + List insertExtendFields = new List(); + foreach (ErpBdMaterial erpBdMaterial in list) + { + if (erpExtendFields.All(x => x.cmaterialoid != erpBdMaterial.ID)) + { + insertMaterial.Add(new BasMaterial() + { + id = SnowflakeIdHelper.NextId(), + name = erpBdMaterial.NAME, + code = erpBdMaterial.CODE, + org_id = WmsWareHouseConst.AdministratorOrgId, + material_specification = erpBdMaterial.MATERIALSPEC, + material_standard = erpBdMaterial.MATERIALTYPE + }); + } + } + return "true"; + } + + /// + /// 同步单位 + /// + /// + [HttpGet] + [AllowAnonymous] + public async Task SyncUnit() + { + // var mysqlDb = _db.AsTenant().GetConnection("erpdb"); + // List list = await mysqlDb.Queryable().ToListAsync(); + // List erpExtendFields = await _db.Queryable().ToListAsync(); + // List insertMaterial = new List(); + // List insertExtendFields = new List(); + // foreach (ErpBdMaterial erpBdMaterial in list) + // { + // if (erpExtendFields.All(x => x.cmaterialoid != erpBdMaterial.ID)) + // { + // insertMaterial.Add(new BasMaterial() + // { + // id = SnowflakeIdHelper.NextId(), + // name = erpBdMaterial.NAME, + // code = erpBdMaterial.CODE, + // org_id = WmsWareHouseConst.AdministratorOrgId, + // material_specification = erpBdMaterial.MATERIALSPEC, + // material_standard = erpBdMaterial.MATERIALTYPE + // }); + // } + // } return "true"; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs index 225c9fbb..173daa44 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialTransferService.cs @@ -828,7 +828,10 @@ namespace Tnb.WarehouseMgr ids.Add(wmsMaterialTransfer.warehouse_outstock); ids.Add(wmsMaterialTransfer.warehouse_instock); ids.Add(wmsMaterialTransferd.material_id); - ids.Add(unitData.Id); + if (unitData != null) + { + ids.Add(unitData.Id); + } List erpExtendFields = await _db.Queryable().Where(x=>ids.Contains(x.table_id)).ToListAsync(); ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (wmsMaterialTransfer.org_id ?? WmsWareHouseConst.AdministratorOrgId)); @@ -838,7 +841,7 @@ namespace Tnb.WarehouseMgr Dictionary erpRequestData = new Dictionary(); string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); erpRequestData.Add("billmaker",erpCreateId); - erpRequestData.Add("cdptid","1001A1100000000JRLI1A100");// 先写死 + erpRequestData.Add("cdptid","1001A1100000000JRLI1");// 先写死 erpRequestData.Add("cdptvid","0001A11000000007GGO8");// 先写死 erpRequestData.Add("corpoid",erpOrg.corpoid); erpRequestData.Add("corpvid",erpOrg.corpoid); @@ -865,7 +868,7 @@ namespace Tnb.WarehouseMgr ["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransferd.material_id)?.cmaterialvid ?? "", ["corpoid"] = erpOrg.corpoid, ["corpvid"] = erpOrg.corpvid, - ["crowno"] = (dList.FindIndex(x=>x.id==wmsMaterialTransferd.id)+1) * 10, + ["crowno"] = wmsMaterialTransferd.lineno, ["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk, ["csourcebillhid"] = wmsMaterialTransfer.erp_pk, ["cunitid"] = erpExtendFields.Find(x=>x.table_id==unitData.Id)?.cunitid ?? "", diff --git a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json index 5314dd45..bf419449 100644 --- a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json +++ b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json @@ -20,8 +20,15 @@ //Oracle //"DefaultConnection": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4}" //PostgreSQL - "DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;KeepAlive=60;ConnectionLifetime=300;MaxPoolSize=320;" + "DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;KeepAlive=60;ConnectionLifetime=300;MaxPoolSize=320;", //MySql //"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};sslmode=none;pooling=true;charset=utf8mb4;allowLoadLocalInfile=true;allowPublicKeyRetrieval=true" + "ConfigList": [ + { + "ServiceName":"erpdb", + "dbType":"Oracle", + "connectionStr":"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.11)(PORT=1521))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME=orcl)));User Id=BIP0201;Password=BIP0201" + } + ] } } \ No newline at end of file