change - 出入库列表刷新

collectionStore
wenjy 1 year ago
parent f083b5d314
commit 47699ccaaf

Binary file not shown.

@ -77,6 +77,7 @@ namespace Aucma.Scada.Business
/// <param name="message"></param> /// <param name="message"></param>
public delegate void RefreshLogMessage(string message); public delegate void RefreshLogMessage(string message);
public event RefreshLogMessage RefreshLogMessageEvent; public event RefreshLogMessage RefreshLogMessageEvent;
#endregion #endregion
private InStoreBusiness() private InStoreBusiness()
@ -89,8 +90,8 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage; grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown(); StartPassDown();
InStore(appConfig.shellStoreCode, "B236000007811019001"); //InStore(appConfig.shellStoreCode, "B236000007811019001");
InStore(appConfig.linerStoreCode, "L236000007881019001"); //InStore(appConfig.linerStoreCode, "L236000007881019001");
} }
/// <summary> /// <summary>
@ -213,6 +214,8 @@ namespace Aucma.Scada.Business
_taskInfoService.UpdateTaskInfo(taskInfo); _taskInfoService.UpdateTaskInfo(taskInfo);
RefreshInStoreTaskEvent?.Invoke(taskInfo);
//if (shellSemaphore.Wait(TimeSpan.FromSeconds(20))) //if (shellSemaphore.Wait(TimeSpan.FromSeconds(20)))
//{ //{
// // 收到反馈 // // 收到反馈
@ -226,6 +229,8 @@ namespace Aucma.Scada.Business
shellSemaphore.Wait(); //一直堵塞直到信号量释放 shellSemaphore.Wait(); //一直堵塞直到信号量释放
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};执行完成"); PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};执行完成");
RefreshInStoreTaskEvent?.Invoke(taskInfo);
} }
else else
{ {
@ -259,6 +264,8 @@ namespace Aucma.Scada.Business
_taskInfoService.UpdateTaskInfo(taskInfo); _taskInfoService.UpdateTaskInfo(taskInfo);
RefreshInStoreTaskEvent?.Invoke(taskInfo);
//if (shellSemaphore.Wait(TimeSpan.FromSeconds(20))) //if (shellSemaphore.Wait(TimeSpan.FromSeconds(20)))
//{ //{
// // 收到反馈 // // 收到反馈
@ -272,6 +279,8 @@ namespace Aucma.Scada.Business
linerSemaphore.Wait(); //一直堵塞直到信号量释放 linerSemaphore.Wait(); //一直堵塞直到信号量释放
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};执行完成"); PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};执行完成");
RefreshInStoreTaskEvent?.Invoke(taskInfo);
} }
else else
{ {

@ -281,6 +281,7 @@ namespace Aucma.Scada.Business
{ {
while (true) while (true)
{ {
Thread.Sleep(10000);
PassDownTaskInfo(); PassDownTaskInfo();
Thread.Sleep(1000); Thread.Sleep(1000);
} }
@ -342,13 +343,13 @@ namespace Aucma.Scada.Business
linerCode = item.materialCode; linerCode = item.materialCode;
} }
_taskInfoService.UpdateTaskInfo(item);
RefreshScanMateriaCodeEvent?.Invoke(item.materialCode, item.materialType, item.spaceName, item.storeCode); RefreshScanMateriaCodeEvent?.Invoke(item.materialCode, item.materialType, item.spaceName, item.storeCode);
} }
if (iFlag == taskInfoList.Count) if (iFlag == taskInfoList.Count)
{ {
_taskInfoService.UpdateRangeTaskInfo(taskInfoList);
//if (semaphore.Wait(TimeSpan.FromSeconds(20))) //if (semaphore.Wait(TimeSpan.FromSeconds(20)))
//{ //{
@ -485,9 +486,6 @@ namespace Aucma.Scada.Business
var taskInfo = _taskInfoService.GetTaskInfoByTaskCode(taskCode, storeCode); var taskInfo = _taskInfoService.GetTaskInfoByTaskCode(taskCode, storeCode);
if (taskInfo != null) if (taskInfo != null)
{ {
//刷新界面
RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode);
var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode); var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode);
if (spaceInfo != null) if (spaceInfo != null)
@ -504,6 +502,9 @@ namespace Aucma.Scada.Business
} }
//清除任务信息 //清除任务信息
_taskInfoService.DeleteTaskInfo(taskCode, storeCode); _taskInfoService.DeleteTaskInfo(taskCode, storeCode);
//刷新界面
RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode);
} }
} }

@ -222,11 +222,33 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
/// </summary> /// </summary>
public void Query() public void Query()
{ {
#region 通过数据库获取数据进行刷新
var info = inStoreBusiness.GetInStoreTask(); var info = inStoreBusiness.GetInStoreTask();
if (info != null) if (info != null)
{ {
info.ForEach(x => RefreshInStoreTask(x)); taskItems = new ObservableCollection<RealTaskInfo>();
//info.ForEach(x => RefreshInStoreTask(x));
try
{
foreach (var item in info)
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
taskItems.Add(item);
InstoreTask = taskItems;
}));
}
}
catch (Exception ex)
{
logHelper.Error("入库任务列表刷新异常", ex);
}
} }
#endregion
if (materialTypeCombox == "箱壳") if (materialTypeCombox == "箱壳")
{ {
materialTypeCombox = "X-001"; materialTypeCombox = "X-001";
@ -300,18 +322,19 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
/// <param name="taskInfo"></param> /// <param name="taskInfo"></param>
private void RefreshInStoreTask(RealTaskInfo taskInfo) private void RefreshInStoreTask(RealTaskInfo taskInfo)
{ {
try //try
{ //{
App.Current.Dispatcher.Invoke((Action)(() => // App.Current.Dispatcher.Invoke((Action)(() =>
{ // {
taskItems.Add(taskInfo); // taskItems.Add(taskInfo);
InstoreTask = taskItems; // InstoreTask = taskItems;
})); // }));
} //}
catch (Exception ex) //catch (Exception ex)
{ //{
logHelper.Error("入库任务列表刷新异常", ex); // logHelper.Error("入库任务列表刷新异常", ex);
} //}
Query();
} }
/// <summary> /// <summary>

Loading…
Cancel
Save