Browse Source

Merge branch 'dev_DY_CC' of http://dev.ccwin-in.com:3000/BoXu.Zheng/WZC2 into dev_DY_CC

dev_DY_CC
lvzb 10 months ago
parent
commit
0222ea1bc7
  1. 20
      be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
  2. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/DeliverNoteEventHandler.cs

20
be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs

@ -76,20 +76,15 @@ public class InjectionMoldingRequestReader : IReader
Stopwatch sw = Stopwatch.StartNew();
Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
var flag = await client.GetMacStaticAsync().ConfigureAwait(false);
if (flag != 1)
{
// 记录错误日志并返回空列表
_logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头");
return new List<IncomingFromExternal>();
}
if (string.IsNullOrEmpty(_options.Value.AutoRemote.AreaIDs))
{
_logger.LogInformation($"没有设置指定区域AutoRemote->AreaIDs");
return new List<IncomingFromExternal>();
}
var ids = _options.Value.AutoRemote.AreaIDs.Split(",");
@ -101,6 +96,8 @@ public class InjectionMoldingRequestReader : IReader
{
var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
Thread.Sleep(500);//设备读取50ms延时,设置延时时间为1000ms保证读取更新到信息
//flag 1-有货 0-空闲
foreach (var respon in idsList.Where(r => r.Flag == 0))
@ -109,11 +106,9 @@ public class InjectionMoldingRequestReader : IReader
response.FromObject(respon);
response.Number = $"第{i.ToString()}次读取";
camralist1.Add(response);
}
}
camralist.AddRange(idsList.Where(r => r.Flag == 0));
}
_logger.LogInformation($"读取标识{guid}读取成功次数{i},耗时 {sw.ElapsedMilliseconds}毫秒");
}
_logger.LogInformation($"标识{guid}读取{invterval}次接口表:{System.Text.Json.JsonSerializer.Serialize(camralist1)}");
@ -150,7 +145,6 @@ public class InjectionMoldingRequestReader : IReader
jobrequestinput.PositionCode = item.CargoID.ToString();
inputdetail.Add(jobrequestinput);
}
var uncompletelist = await _injectionRequest.Getlist(inputdetail).ConfigureAwait(false);//将所有库位物品信息查找未完成记录
var query = from itm in list.Select(r => r.Key).ToList()
@ -160,15 +154,8 @@ public class InjectionMoldingRequestReader : IReader
where tm == null
select itm;
var injectionList = query.ToList();//已经完成的记录
_logger.LogInformation($"标识{guid}同步WMS内容:{System.Text.Json.JsonSerializer.Serialize(injectionList)}");
_logger.LogInformation(MakeGrid($"{guid}同步WMS内容", injectionList));
//_logger.LogInformation($"标识{guid}同步WMS开始");
foreach (var inject in injectionList)
{
List<InjectionRequest> cameraList = new List<InjectionRequest>();
@ -212,7 +199,6 @@ public class InjectionMoldingRequestReader : IReader
}
// 创建新的注塑请求并将数据写入数据库
await _injectionRequest.CreateAsync(input).ConfigureAwait(false);
}
_logger.LogInformation($"标识{guid}同步WMS结束,耗时{sw.ElapsedMilliseconds}毫秒");
}

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/DeliverNoteEventHandler.cs

@ -14,6 +14,7 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges;
public class DeliverNoteEventHandler
: StoreDataExchangeEventHandlerBase<DeliverNote>
, ILocalEventHandler<SfsCreatedEntityEventData<DeliverNote>>
, ILocalEventHandler<SfsCreatedEntityEventData<List<DeliverNote>>>
{
[UnitOfWork]
@ -23,6 +24,13 @@ public class DeliverNoteEventHandler
await AddExchangeDataAsync(entity).ConfigureAwait(false);
}
[UnitOfWork]
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<DeliverNote>> eventData)
{
var entities = eventData.Entity;
await AddExchangeDataAsync(entities).ConfigureAwait(false);
}
protected override async Task AddExchangeDataAsync(List<DeliverNote> entities)
{
var dtos = ObjectMapper.Map<List<DeliverNote>, List<DeliverNoteDTO>>(entities);

Loading…
Cancel
Save