change - 出入库逻辑处理

collectionStore
wenjy 1 year ago
parent 0e38cfed10
commit b6062dc600

Binary file not shown.

@ -60,7 +60,7 @@ namespace Aucma.Scada.Business
/// 初始化入库任务 /// 初始化入库任务
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
public delegate void RefreshInStoreTask(RealTaskInfo taskInfos); public delegate void RefreshInStoreTask(RealTaskInfo taskInfos, bool isFinsih = false);
public event RefreshInStoreTask RefreshInStoreTaskEvent; public event RefreshInStoreTask RefreshInStoreTaskEvent;
/// <summary> /// <summary>
@ -93,15 +93,15 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage; grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown(); StartPassDown();
//Task.Run(() => Task.Run(() =>
//{ {
// Thread.Sleep(6000); Thread.Sleep(6000);
// for (int i = 11; i < 12; i++) for (int i = 1; i < 7; i++)
// { {
// InStore(appConfig.shellStoreCode, "B23600000781101900" + i); //InStore(appConfig.shellStoreCode, "B23600000781101902" + i);
// InStore(appConfig.linerStoreCode, "L23600000788101900" + i); InStore(appConfig.linerStoreCode, "L23600000788101902" + i);
// } }
//}); });
} }
@ -124,6 +124,7 @@ namespace Aucma.Scada.Business
var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务 var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务
if (result) if (result)
{ {
spaceInfo.onRouteAmount += 1;
_spaceInfoService.UpdateSpaceInfo(spaceInfo); _spaceInfoService.UpdateSpaceInfo(spaceInfo);
} }
} }
@ -241,7 +242,7 @@ namespace Aucma.Scada.Business
PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};执行完成"); PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};执行完成");
RefreshInStoreTaskEvent?.Invoke(taskInfo); RefreshInStoreTaskEvent?.Invoke(taskInfo,true);
} }
else else
{ {
@ -252,10 +253,8 @@ namespace Aucma.Scada.Business
else else
{ {
PrintLogInfoMessage("未获取到需要下发的箱壳入库任务"); PrintLogInfoMessage("未获取到需要下发的箱壳入库任务");
Thread.Sleep(5000);
} }
Thread.Sleep(3000);
} }
/// <summary> /// <summary>
@ -291,7 +290,7 @@ namespace Aucma.Scada.Business
PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};执行完成"); PrintLogInfoMessage($"内胆入库任务:{taskInfo.taskCode};执行完成");
RefreshInStoreTaskEvent?.Invoke(taskInfo); RefreshInStoreTaskEvent?.Invoke(taskInfo,true);
} }
else else
{ {
@ -302,8 +301,8 @@ namespace Aucma.Scada.Business
{ {
PrintLogInfoMessage("未获取到需要下发的内胆入库任务"); PrintLogInfoMessage("未获取到需要下发的内胆入库任务");
Thread.Sleep(5000);
} }
Thread.Sleep(3000);
} }
/// <summary> /// <summary>

@ -139,7 +139,7 @@ namespace Aucma.Scada.Business
ReadShellFinish_InStore(taskCode); ReadShellFinish_InStore(taskCode);
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -192,7 +192,7 @@ namespace Aucma.Scada.Business
isFlag = false; isFlag = false;
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -294,7 +294,7 @@ namespace Aucma.Scada.Business
ReadLinerFinish_InStore(taskCode); ReadLinerFinish_InStore(taskCode);
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -347,7 +347,7 @@ namespace Aucma.Scada.Business
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else

@ -91,6 +91,9 @@ namespace Aucma.Scada.Business
public delegate void RefreshAssemblyPlanInit(); public delegate void RefreshAssemblyPlanInit();
public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent; public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent;
public delegate void RefreshStoreStock();
public event RefreshStoreStock RefreshStoreStockEvent;
#endregion #endregion
private OutStoreBusiness() private OutStoreBusiness()
@ -289,7 +292,6 @@ namespace Aucma.Scada.Business
{ {
while (true) while (true)
{ {
Thread.Sleep(10000);
PassDownTaskInfo(); PassDownTaskInfo();
Thread.Sleep(1000); Thread.Sleep(1000);
} }
@ -378,14 +380,17 @@ namespace Aucma.Scada.Business
UpdatePlanInfo(executePlanCode); UpdatePlanInfo(executePlanCode);
RefreshStoreStockEvent?.Invoke();
} }
} }
else else
{ {
PrintLogInfoMessage("未获取到需要下发的出库任务"); PrintLogInfoMessage("未获取到需要下发的出库任务");
Thread.Sleep(5000);
} }
Thread.Sleep(3000);
} }

@ -152,7 +152,7 @@ namespace Aucma.Scada.Business
ReadShellFinish_OutStore(taskCode); ReadShellFinish_OutStore(taskCode);
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -205,7 +205,7 @@ namespace Aucma.Scada.Business
isFlag = false; isFlag = false;
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -311,7 +311,7 @@ namespace Aucma.Scada.Business
ReadLinerFinish_OutStore(taskCode); ReadLinerFinish_OutStore(taskCode);
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else
@ -364,7 +364,7 @@ namespace Aucma.Scada.Business
} }
Thread.Sleep(5000); Thread.Sleep(1000);
} while (isFlag); } while (isFlag);
} }
else else

@ -284,46 +284,52 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
/// </summary> /// </summary>
public void Init() public void Init()
{ {
Query();
MaterialNameList = new List<string>()
{
"SC232",
"SA124",
"SC387",
"SC211",
"DQ196",
};
ChartValues<double> achievement = new ChartValues<double>(); ChartValues<double> achievement = new ChartValues<double>();
Random random = new Random();
for (int i = 0; i < 5; i++)
{
achievement.Add(random.Next(60, 100));
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "箱壳";
column.Values = achievement;
ChartValues<double> achievement2 = new ChartValues<double>(); ChartValues<double> achievement2 = new ChartValues<double>();
Random random2 = new Random(); App.Current.Dispatcher.Invoke((Action)(() =>
for (int i = 0; i < 5; i++)
{ {
achievement2.Add(random2.Next(60, 100)); Query();
} MaterialNameList = new List<string>()
{
"SC232",
"SA124",
"SC387",
"SC211",
"DQ196",
};
Random random = new Random();
for (int i = 0; i < 5; i++)
{
achievement.Add(random.Next(60, 100));
}
var column = new ColumnSeries();
column.DataLabels = true;
column.Title = "箱壳";
column.Values = achievement;
Random random2 = new Random();
for (int i = 0; i < 5; i++)
{
achievement2.Add(random2.Next(60, 100));
}
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "内胆";
column2.Values = achievement2;
Achievement.Add(column);
Achievement.Add(column2);
}));
var column2 = new ColumnSeries();
column2.DataLabels = true;
column2.Title = "内胆";
column2.Values = achievement2;
Achievement.Add(column);
Achievement.Add(column2);
} }
/// <summary> /// <summary>
/// 刷新入库任务列表 /// 刷新入库任务列表
/// </summary> /// </summary>
/// <param name="taskInfo"></param> /// <param name="taskInfo"></param>
private void RefreshInStoreTask(RealTaskInfo taskInfo) private void RefreshInStoreTask(RealTaskInfo taskInfo, bool isFinsih = false)
{ {
//try //try
//{ //{
@ -337,7 +343,14 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
//{ //{
// logHelper.Error("入库任务列表刷新异常", ex); // logHelper.Error("入库任务列表刷新异常", ex);
//} //}
Query(); if (isFinsih)
{
Init();
}
else
{
Query();
}
} }
/// <summary> /// <summary>

@ -22,6 +22,8 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance; private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
public LinerInventoryViewModel() public LinerInventoryViewModel()
@ -40,6 +42,9 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
OutOnlyOneCommand = new RelayCommand<object>(obj => OutOnlyOne(obj)); OutOnlyOneCommand = new RelayCommand<object>(obj => OutOnlyOne(obj));
#endregion #endregion
outStoreBusiness.RefreshStoreStockEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
Query(); Query();
@ -89,20 +94,28 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private void Query() private void Query()
{ {
var info = inventoryInfoBusiness.GetSpaceInfos(appConfig.linerStoreCode); App.Current.Dispatcher.Invoke((Action)(() =>
if (info != null)
{ {
if (spaceItems.Count > 0) var info = inventoryInfoBusiness.GetSpaceInfos(appConfig.linerStoreCode);
if (info != null)
{ {
spaceItems.Clear(); if (spaceItems.Count > 0)
{
spaceItems.Clear();
}
foreach (var item in info)
{
spaceItems.Add(item);
}
Shapes = spaceItems;
} }
}));
}
foreach (var item in info) private void RefreshSpaceInfo(object obj = null, bool isFinish = true)
{ {
spaceItems.Add(item); Query();
}
Shapes = spaceItems;
}
} }
/// <summary> /// <summary>

@ -22,6 +22,8 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance; private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
public ShellInventoryViewModel() public ShellInventoryViewModel()
@ -40,6 +42,11 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
OutOnlyOneCommand = new RelayCommand<object>(obj => OutOnlyOne(obj)); OutOnlyOneCommand = new RelayCommand<object>(obj => OutOnlyOne(obj));
#endregion #endregion
outStoreBusiness.RefreshStoreStockEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
Query(); Query();
} }
@ -89,20 +96,29 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private void Query() private void Query()
{ {
var info = inventoryInfoBusiness.GetSpaceInfos(appConfig.shellStoreCode); App.Current.Dispatcher.Invoke((Action)(() =>
if (info != null)
{ {
if (spaceItems.Count > 0) var info = inventoryInfoBusiness.GetSpaceInfos(appConfig.shellStoreCode);
if (info != null)
{ {
spaceItems.Clear(); if (spaceItems.Count > 0)
{
spaceItems.Clear();
}
foreach (var item in info)
{
spaceItems.Add(item);
}
Shapes = spaceItems;
} }
}));
foreach (var item in info) }
{
spaceItems.Add(item); private void RefreshSpaceInfo(object obj = null, bool isFinish = true)
} {
Shapes = spaceItems; Query();
}
} }
/// <summary> /// <summary>

@ -29,7 +29,7 @@ namespace HighWayIot.Repository.service.Impl
try try
{ {
Expression<Func<BaseSpaceInfo, bool>> exp = s1 => true; Expression<Func<BaseSpaceInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.storeCode == store && x.materialType == materialType && x.spaceStatus == 1 && x.spaceCapacity != (x.spaceStock + x.onRouteAmount)); //相同型号、启用状态、库存未满的货道信息 exp = exp.And(x => x.storeCode == store && x.materialType == materialType && x.spaceStatus == 1 && x.spaceCapacity > (x.spaceStock + x.onRouteAmount)); //相同型号、启用状态、库存未满的货道信息
spaceInfos = _mesRepository.GetList(exp); spaceInfos = _mesRepository.GetList(exp);

Loading…
Cancel
Save