同步交易类型
This commit is contained in:
@@ -105,5 +105,10 @@ namespace Tnb.ProductionMgr.Entities.Entity
|
|||||||
/// 修改时间
|
/// 修改时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string erp_modify_time { get; set; }
|
public string erp_modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 交易类型id
|
||||||
|
/// </summary>
|
||||||
|
public string transaction_type_id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,12 +340,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
.Select((x, y) => y)
|
.Select((x, y) => y)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
DictionaryDataEntity tranType = await _db.Queryable<DictionaryDataEntity>().Where(x=>x.DictionaryTypeId=="25043925951909" && x.EnCode==wmsPurchaseH.transaction_type).FirstAsync();
|
||||||
|
string tranTypeId = tranType?.Id ?? "";
|
||||||
List<string> tableIds = new List<string>();
|
List<string> tableIds = new List<string>();
|
||||||
tableIds.Add(_userManager.UserId);
|
tableIds.Add(_userManager.UserId);
|
||||||
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
tableIds.Add(instock.warehouse_id);
|
tableIds.Add(instock.warehouse_id);
|
||||||
tableIds.AddRange(materialIds);
|
tableIds.AddRange(materialIds);
|
||||||
tableIds.Add(instock.supplier_id);
|
tableIds.Add(instock.supplier_id);
|
||||||
|
tableIds.Add(tranTypeId);
|
||||||
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||||
|
|
||||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x => tableIds.Contains(x.table_id)).ToListAsync();
|
||||||
@@ -363,7 +366,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
||||||
erpRequestData.Add("creationtime", nowStr);
|
erpRequestData.Add("creationtime", nowStr);
|
||||||
erpRequestData.Add("creator", erpCreateId);
|
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("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("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 ?? "");//类型视图里取
|
erpRequestData.Add("cwarehouseid", erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取
|
||||||
@@ -384,7 +387,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
["castunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
["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 ?? "",
|
["cbodywarehouseid"] = erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "",
|
||||||
["cgeneralbid"] = "",
|
["cgeneralbid"] = "",
|
||||||
["cgeneralhid"] = "",
|
["cgeneralhid"] = "",
|
||||||
|
|||||||
@@ -101,9 +101,8 @@ public class TestService : IDynamicApiController, ITransient
|
|||||||
public string test1()
|
public string test1()
|
||||||
{
|
{
|
||||||
var mysqlDb = _sugar.GetConnection("erpdb");
|
var mysqlDb = _sugar.GetConnection("erpdb");
|
||||||
List<BasFactoryConfig2> list = mysqlDb.Queryable<BasFactoryConfig2>().ToList();
|
|
||||||
List<BasMaterial> list2 = _sugar.Queryable<BasMaterial>().ToList();
|
List<BasMaterial> list2 = _sugar.Queryable<BasMaterial>().ToList();
|
||||||
return JsonConvert.SerializeObject(list);
|
return JsonConvert.SerializeObject(list2);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -248,6 +247,45 @@ public class TestService : IDynamicApiController, ITransient
|
|||||||
return "测试成功";
|
return "测试成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<string> inserDic()
|
||||||
|
{
|
||||||
|
var erpdb = _sugar.GetConnection("erpdb");
|
||||||
|
List<ErpBdBillType> list = await erpdb.Queryable<ErpBdBillType>().Where(x=>x.PARENT_CODE=="45").ToListAsync();
|
||||||
|
List<DictionaryDataEntity> insertList = new List<DictionaryDataEntity>();
|
||||||
|
List<ErpExtendField> inserteErpExtendFields = new List<ErpExtendField>();
|
||||||
|
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")]
|
[SugarTable("temp_erp_user")]
|
||||||
public class TempErpUser : BaseEntity<string>
|
public class TempErpUser : BaseEntity<string>
|
||||||
@@ -256,83 +294,14 @@ public class TestService : IDynamicApiController, ITransient
|
|||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[SugarTable("bas_factory_config")]
|
[SugarTable("ERP_BD_BILLTYPE")]
|
||||||
public partial class BasFactoryConfig2 : BaseEntity<string>
|
public class ErpBdBillType
|
||||||
{
|
{
|
||||||
public BasFactoryConfig2()
|
public string ID { get; set; }
|
||||||
{
|
public string PARENT_CODE { get; set; }
|
||||||
id = SnowflakeIdHelper.NextId();
|
public string CODE { get; set; }
|
||||||
}
|
public string NAME { get; set; }
|
||||||
|
public string SYSTEMCODE { get; set; }
|
||||||
/// <summary>
|
public string PK_GROUP { get; set; }
|
||||||
/// 名称
|
|
||||||
/// </summary>
|
|
||||||
public string name { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// key
|
|
||||||
/// </summary>
|
|
||||||
public string code { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 值
|
|
||||||
/// </summary>
|
|
||||||
public string value { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否启用
|
|
||||||
/// </summary>
|
|
||||||
public int enabled { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
public string? remark { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建用户
|
|
||||||
/// </summary>
|
|
||||||
public string? create_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? create_time { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改用户
|
|
||||||
/// </summary>
|
|
||||||
public string? modify_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? modify_time { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属组织
|
|
||||||
/// </summary>
|
|
||||||
public string? org_id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 排序
|
|
||||||
/// </summary>
|
|
||||||
public long? ordinal { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否系统
|
|
||||||
/// </summary>
|
|
||||||
public int? is_system { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 流程任务Id
|
|
||||||
/// </summary>
|
|
||||||
public string? f_flowtaskid { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 流程引擎Id
|
|
||||||
/// </summary>
|
|
||||||
public string? f_flowid { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user