同步单位
This commit is contained in:
@@ -17,6 +17,7 @@ using JNPF.Systems.Interfaces.System;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using SQLitePCL;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using SqlSugar.Extensions;
|
using SqlSugar.Extensions;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -703,26 +704,48 @@ namespace Tnb.ProductionMgr
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<String> SyncUnit()
|
public async Task<String> SyncUnit()
|
||||||
{
|
{
|
||||||
// var mysqlDb = _db.AsTenant().GetConnection("erpdb");
|
var mysqlDb = _db.AsTenant().GetConnection("erpdb");
|
||||||
// List<ErpBdMeasdoc> list = await mysqlDb.Queryable<ErpBdMeasdoc>().ToListAsync();
|
List<ErpBdMeasdoc> list = await mysqlDb.Queryable<ErpBdMeasdoc>().ToListAsync();
|
||||||
// List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().ToListAsync();
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().ToListAsync();
|
||||||
// List<DictionaryDataEntity> insertMaterial = new List<DictionaryDataEntity>();
|
List<DictionaryDataEntity> insertUnit = new List<DictionaryDataEntity>();
|
||||||
// List<ErpExtendField> insertExtendFields = new List<ErpExtendField>();
|
List<ErpExtendField> insertExtendFields = new List<ErpExtendField>();
|
||||||
// foreach (ErpBdMaterial erpBdMaterial in list)
|
foreach (ErpBdMeasdoc erpBdMeasdoc in list)
|
||||||
// {
|
{
|
||||||
// if (erpExtendFields.All(x => x.cmaterialoid != erpBdMaterial.ID))
|
if (erpExtendFields.All(x => x.cunitid != erpBdMeasdoc.ID))
|
||||||
// {
|
{
|
||||||
// insertMaterial.Add(new BasMaterial()
|
DictionaryDataEntity dictionaryDataEntity = new DictionaryDataEntity()
|
||||||
// {
|
{
|
||||||
// id = SnowflakeIdHelper.NextId(),
|
Id = SnowflakeIdHelper.NextId(),
|
||||||
// name = erpBdMaterial.NAME,
|
FullName = erpBdMeasdoc.NAME,
|
||||||
// code = erpBdMaterial.CODE,
|
EnCode = erpBdMeasdoc.CODE,
|
||||||
// org_id = WmsWareHouseConst.AdministratorOrgId,
|
ParentId = "0",
|
||||||
// material_specification = erpBdMaterial.MATERIALSPEC,
|
SortCode = 0,
|
||||||
// material_standard = erpBdMaterial.MATERIALTYPE
|
EnabledMark = 1,
|
||||||
// });
|
CreatorTime = DateTime.Now,
|
||||||
// }
|
DictionaryTypeId = WmsWareHouseConst.UNITTYPEID,
|
||||||
// }
|
};
|
||||||
|
ErpExtendField erpExtendField = new ErpExtendField()
|
||||||
|
{
|
||||||
|
table_id = dictionaryDataEntity.Id,
|
||||||
|
table_name = "base_dictionarydata",
|
||||||
|
cunitid = erpBdMeasdoc.ID,
|
||||||
|
create_time = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
insertUnit.Add(dictionaryDataEntity);
|
||||||
|
insertExtendFields.Add(erpExtendField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!insertUnit.IsEmpty() && !insertExtendFields.IsEmpty())
|
||||||
|
{
|
||||||
|
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
await _db.Insertable(insertUnit).ExecuteCommandAsync();
|
||||||
|
await _db.Insertable(insertExtendFields).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return "true";
|
return "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -485,5 +485,10 @@
|
|||||||
/// 第三方 bip
|
/// 第三方 bip
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BIP_DOMAIN = "http://192.168.1.11:8087/";
|
public const string BIP_DOMAIN = "http://192.168.1.11:8087/";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位类型id
|
||||||
|
/// </summary>
|
||||||
|
public const string UNITTYPEID = "24906054811669";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user