bug
This commit is contained in:
@@ -115,9 +115,18 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
string Code = await _billRuleService.GetBillNumber("moldRequisition");
|
||||
string moldId = input.data[nameof(ToolMoldRequisition.mold_id)].ToString();
|
||||
ToolMolds toolMolds = await _db.Queryable<ToolMolds>()
|
||||
.SingleAsync(x => x.id == moldId);
|
||||
|
||||
if (toolMolds.mold_status == Tnb.BasicData.DictConst.SCTypeId)
|
||||
{
|
||||
throw Oops.Bah("模具不在库,不可领用");
|
||||
}
|
||||
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
string Code = await _billRuleService.GetBillNumber("moldRequisition");
|
||||
ToolMoldRequisition toolMoldRequisition = new ToolMoldRequisition();
|
||||
toolMoldRequisition.code = Code;
|
||||
toolMoldRequisition.mold_id= input.data[nameof(ToolMoldRequisition.mold_id)].ToString();
|
||||
|
||||
57
ProductionMgr/Tnb.ProductionMgr/Helpers/TimerPoolHelper.cs
Normal file
57
ProductionMgr/Tnb.ProductionMgr/Helpers/TimerPoolHelper.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace Tnb.ProductionMgr.Helpers
|
||||
{
|
||||
public class TimerPoolHelper : ISingleton
|
||||
{
|
||||
private static TimerPoolHelper instance = null;
|
||||
|
||||
public static TimerPoolHelper GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new TimerPoolHelper();
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private readonly Dictionary<string, Timer> _timers = new Dictionary<string, Timer>();
|
||||
private readonly object _lockObject = new object();
|
||||
|
||||
public TimerPoolHelper()
|
||||
{
|
||||
// 初始化代码,如果有必要的话
|
||||
}
|
||||
|
||||
public void StartTimer(TimerCallback timerCallback,object data,TimeSpan dueTime, TimeSpan period)
|
||||
{
|
||||
Timer timer;
|
||||
lock (_lockObject)
|
||||
{
|
||||
string timestamp = DateTime.Now.Ticks.ToString();
|
||||
Dictionary<string, object> dic = new Dictionary<string, object>();
|
||||
dic.Add("key",timestamp);
|
||||
dic.Add("value",data);
|
||||
timerCallback += DisposeTimer;
|
||||
timer = new Timer(timerCallback, dic, dueTime, period);
|
||||
_timers.Add(timestamp,timer);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeTimer(object args)
|
||||
{
|
||||
Dictionary<string, object> dic = (Dictionary<string, object>)args;
|
||||
string key = dic["key"].ToString();
|
||||
if (_timers.ContainsKey(key))
|
||||
{
|
||||
_timers[dic["key"].ToString()].Dispose();
|
||||
_timers[dic["key"].ToString()] = null;
|
||||
_timers.Remove(dic["key"].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,6 +483,7 @@ namespace Tnb.ProductionMgr
|
||||
upmat_location_id = f.upmat_location_id,
|
||||
downmat_location_id = f.as_location_id,
|
||||
instock_warehouse_id = f.as_location_id,
|
||||
mold_location_id = g.location_id,
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
@@ -507,6 +508,12 @@ namespace Tnb.ProductionMgr
|
||||
item.downmat_location_code = basLocation.location_code;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(item.mold_location_id))
|
||||
{
|
||||
ToolLocation basLocation = await _db.Queryable<ToolLocation>().SingleAsync(x => x.id == item.mold_location_id);
|
||||
item.mold_location_code = basLocation.location_code;
|
||||
}
|
||||
|
||||
if (item.schedule_type == 2)
|
||||
{
|
||||
PerProcessStandardsH processStandardsH = await _db.Queryable<PerProcessStandardsH>()
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Senparc.CO2NET.HttpUtility;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.Common.Extension;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Configs;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using HttpClientHelper = Tnb.Common.Utils.HttpClientHelper;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 机台原料设定服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class PrdRawMaterialBarcodeRecordTwoService: IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "36014724856597";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
private readonly IUserManager _userManager;
|
||||
private static Dictionary<string, Tuple<string, string>> _dicWorkLine = new();
|
||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
private readonly IBillRullService _billRuleService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly RedisData _redisData;
|
||||
|
||||
public PrdRawMaterialBarcodeRecordTwoService(ISqlSugarRepository<PrdRawMaterialBarcode> repository,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRuleService,
|
||||
IVisualDevService visualDevService,
|
||||
RedisData redisData,
|
||||
IRunService runService,
|
||||
IDictionaryDataService dictionaryDataService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRuleService;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_redisData = redisData;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string billCode = queryJson.ContainsKey("bill_code") ? queryJson["bill_code"].ToString() : "";
|
||||
string equipTypeId = queryJson.ContainsKey("f_flowid") ? queryJson["f_flowid"].ToString() : "";
|
||||
string isUpdate = queryJson.ContainsKey("is_update") ? queryJson["is_update"].ToString() : "";
|
||||
string equipId = queryJson.ContainsKey("equip_id") ? queryJson["equip_id"].ToString() : "";
|
||||
string stopValue = queryJson.ContainsKey("stop_valve") ? queryJson["stop_valve"].ToString() : "";
|
||||
|
||||
SqlSugarPagedList<PrdRawMaterialBarcodeListDto> result = await _db.Queryable<PrdRawMaterialBarcodeRecord>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<EqpEquipment>((a, b,c) => a.equip_id == c.id)
|
||||
.LeftJoin<EqpEquipType>((a,b,c,d)=>c.equip_type_id==d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(billCode),(a,b,c)=>a.bill_code.Contains(billCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
||||
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
||||
.WhereIF(!string.IsNullOrEmpty(equipId),(a,b,c)=>a.equip_id.ToString()==equipId)
|
||||
.WhereIF(!string.IsNullOrEmpty(stopValue),(a,b,c)=>a.stop_valve.ToString()==stopValue)
|
||||
.Where((a,b,c)=>a.type=="2")
|
||||
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
||||
{
|
||||
id = a.id,
|
||||
bill_code = a.bill_code,
|
||||
equip_id = c.name,
|
||||
material_id = b.name,
|
||||
absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否",
|
||||
is_update = a.is_update==1 ? "是" : "否",
|
||||
piping_status = a.piping_status == 1 ? "开" : "关",
|
||||
start_time = a.start_time!=null ? a.start_time.ToString(DbTimeFormat.SS) : "",
|
||||
end_time = a.end_time!=null ? a.end_time.ToString(DbTimeFormat.SS) : "",
|
||||
remark = a.remark,
|
||||
stop_valve = a.stop_valve,
|
||||
f_flowid = d.name,
|
||||
equip_id_id = c.id,
|
||||
material_id_id = b.id,
|
||||
equip_ids = SqlFunc.Subqueryable<EqpEquipment>().Where(x=>a.equip_ids.Contains(x.id)).SelectStringJoin(x=>x.name,",")
|
||||
}).ToPagedListAsync(input.currentPage, int.MaxValue);
|
||||
return PageResult<PrdRawMaterialBarcodeListDto>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user