From cf4c3d36b69b3e13493dce0143994cf9f0a9a989 Mon Sep 17 00:00:00 2001
From: zhou keda <1315948824@qq.com>
Date: Thu, 1 Aug 2024 12:28:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BA=A4=E6=98=93=E7=B1=BB?=
=?UTF-8?q?=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entity/ErpExtendField.cs | 5 +
.../Tnb.WarehouseMgr/WmsInStockService.cs | 7 +-
system/Tnb.Systems/Common/TestService.cs | 127 +++++++-----------
3 files changed, 58 insertions(+), 81 deletions(-)
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpExtendField.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpExtendField.cs
index 6325845d..4093dda0 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpExtendField.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/ErpExtendField.cs
@@ -105,5 +105,10 @@ namespace Tnb.ProductionMgr.Entities.Entity
/// 修改时间
///
public string erp_modify_time { get; set; }
+
+ ///
+ /// 交易类型id
+ ///
+ public string transaction_type_id { get; set; }
}
}
\ No newline at end of file
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index 8d513b5d..46e124ca 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -340,12 +340,15 @@ namespace Tnb.WarehouseMgr
.Select((x, y) => y)
.ToListAsync();
+ DictionaryDataEntity tranType = await _db.Queryable().Where(x=>x.DictionaryTypeId=="25043925951909" && x.EnCode==wmsPurchaseH.transaction_type).FirstAsync();
+ string tranTypeId = tranType?.Id ?? "";
List tableIds = new List();
tableIds.Add(_userManager.UserId);
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
tableIds.Add(instock.warehouse_id);
tableIds.AddRange(materialIds);
tableIds.Add(instock.supplier_id);
+ tableIds.Add(tranTypeId);
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
List erpExtendFields = await _db.Queryable().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
@@ -363,7 +366,7 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("corpvid", erpOrg.corpvid);
erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId);
- erpRequestData.Add("ctrantypeid", wmsPurchaseH?.transaction_type ?? "");
+ erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x => x.table_id == tranTypeId)?.transaction_type_id ?? "");
erpRequestData.Add("cvendorid", erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_id ?? "");
erpRequestData.Add("cvendorvid", erpExtendFields.Find(x => x.table_id == instock.supplier_id)?.supplier_vid ?? "");
erpRequestData.Add("cwarehouseid", erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取
@@ -384,7 +387,7 @@ namespace Tnb.WarehouseMgr
erpRequestDataDetails.Add(new Dictionary()
{
["castunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
- ["cbodytranstypecode"] = wmsPurchaseH?.transaction_type ?? "",
+ ["cbodytranstypecode"] = erpExtendFields.Find(x => x.table_id == tranTypeId)?.transaction_type_id ?? "",
["cbodywarehouseid"] = erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "",
["cgeneralbid"] = "",
["cgeneralhid"] = "",
diff --git a/system/Tnb.Systems/Common/TestService.cs b/system/Tnb.Systems/Common/TestService.cs
index bbe98096..9da961f9 100644
--- a/system/Tnb.Systems/Common/TestService.cs
+++ b/system/Tnb.Systems/Common/TestService.cs
@@ -101,9 +101,8 @@ public class TestService : IDynamicApiController, ITransient
public string test1()
{
var mysqlDb = _sugar.GetConnection("erpdb");
- List list = mysqlDb.Queryable().ToList();
List list2 = _sugar.Queryable().ToList();
- return JsonConvert.SerializeObject(list);
+ return JsonConvert.SerializeObject(list2);
}
[HttpGet]
@@ -247,6 +246,45 @@ public class TestService : IDynamicApiController, ITransient
await _sugar.Insertable(insertErpExtendFields).ExecuteCommandAsync();
return "测试成功";
}
+
+ [HttpGet]
+ [AllowAnonymous]
+ public async Task inserDic()
+ {
+ var erpdb = _sugar.GetConnection("erpdb");
+ List list = await erpdb.Queryable().Where(x=>x.PARENT_CODE=="45").ToListAsync();
+ List insertList = new List();
+ List inserteErpExtendFields = new List();
+ foreach (var item in list)
+ {
+ DictionaryDataEntity dictionaryDataEntity = new DictionaryDataEntity()
+ {
+ Id = SnowflakeIdHelper.NextId(),
+ EnCode = item.CODE,
+ FullName = item.NAME,
+ ParentId = "0",
+ DictionaryTypeId = "25043925951909",
+ EnabledMark = 1,
+ SortCode = 0,
+ };
+
+ insertList.Add(dictionaryDataEntity);
+
+ ErpExtendField extendField = new ErpExtendField()
+ {
+ table_name = "base_dictionarydata",
+ table_id = dictionaryDataEntity.Id,
+ transaction_type_id = item.ID,
+ org_id = "25193668006933",
+ create_time = DateTime.Now,
+ };
+ inserteErpExtendFields.Add(extendField);
+
+ await _sugar.Insertable(insertList).ExecuteCommandAsync();
+ await _sugar.Insertable(inserteErpExtendFields).ExecuteCommandAsync();
+ }
+ return "测试成功";
+ }
[SugarTable("temp_erp_user")]
@@ -256,83 +294,14 @@ public class TestService : IDynamicApiController, ITransient
public string name { get; set; }
}
- [SugarTable("bas_factory_config")]
- public partial class BasFactoryConfig2 : BaseEntity
+ [SugarTable("ERP_BD_BILLTYPE")]
+ public class ErpBdBillType
{
- public BasFactoryConfig2()
- {
- id = SnowflakeIdHelper.NextId();
- }
-
- ///
- /// 名称
- ///
- public string name { get; set; } = string.Empty;
-
- ///
- /// key
- ///
- public string code { get; set; } = string.Empty;
-
- ///
- /// 值
- ///
- public string value { get; set; } = string.Empty;
-
- ///
- /// 是否启用
- ///
- public int enabled { get; set; }
-
- ///
- /// 备注
- ///
- public string? remark { get; set; }
-
- ///
- /// 创建用户
- ///
- public string? create_id { get; set; }
-
- ///
- /// 创建时间
- ///
- public DateTime? create_time { get; set; }
-
- ///
- /// 修改用户
- ///
- public string? modify_id { get; set; }
-
- ///
- /// 修改时间
- ///
- public DateTime? modify_time { get; set; }
-
- ///
- /// 所属组织
- ///
- public string? org_id { get; set; }
-
- ///
- /// 排序
- ///
- public long? ordinal { get; set; }
-
- ///
- /// 是否系统
- ///
- public int? is_system { get; set; }
-
- ///
- /// 流程任务Id
- ///
- public string? f_flowtaskid { get; set; }
-
- ///
- /// 流程引擎Id
- ///
- public string? f_flowid { get; set; }
+ public string ID { get; set; }
+ public string PARENT_CODE { get; set; }
+ public string CODE { get; set; }
+ public string NAME { get; set; }
+ public string SYSTEMCODE { get; set; }
+ public string PK_GROUP { get; set; }
}
-
}