This commit is contained in:
2024-07-18 12:04:52 +08:00
parent 7f7f21c271
commit 5bbd7eb25f
7 changed files with 145 additions and 32 deletions

View File

@@ -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<int>("YTCS", "EmptyNo_CS01");
int cs03Count = await _redisData.TryGetValueByKeyField<int>("YTCS", "EmptyNo_CS03");
Log.Information($"注塑定点配送cs01数量:{cs01Count},cs03数量:{cs03Count}");
List<String> eqpIds = equipments.Select(x => x.id).ToList();
List<EqpDaq> eqpDaqs = await _db.Queryable<EqpDaq>().Where(x => eqpIds.Contains(x.equip_id) && x.label_name.Contains("允许入空箱")).ToListAsync();
@@ -667,6 +671,58 @@ namespace Tnb.ProductionMgr
[AllowAnonymous]
public async Task<String> SyncBaseData()
{
var mysqlDb = _db.AsTenant().GetConnection("erpdb");
List<ErpBdMaterial> list = await mysqlDb.Queryable<ErpBdMaterial>().ToListAsync();
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().ToListAsync();
List<BasMaterial> materials = await _db.Queryable<BasMaterial>().ToListAsync();
List<BasMaterial> insertMaterial = new List<BasMaterial>();
List<ErpExtendField> insertExtendFields = new List<ErpExtendField>();
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";
}
/// <summary>
/// 同步单位
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<String> SyncUnit()
{
// var mysqlDb = _db.AsTenant().GetConnection("erpdb");
// List<ErpBdMeasdoc> list = await mysqlDb.Queryable<ErpBdMeasdoc>().ToListAsync();
// List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().ToListAsync();
// List<DictionaryDataEntity> insertMaterial = new List<DictionaryDataEntity>();
// List<ErpExtendField> insertExtendFields = new List<ErpExtendField>();
// 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";
}