diff --git a/Aucma.Scada.Business/OutStoreBusiness.cs b/Aucma.Scada.Business/OutStoreBusiness.cs
index 1898301f..bcbf9716 100644
--- a/Aucma.Scada.Business/OutStoreBusiness.cs
+++ b/Aucma.Scada.Business/OutStoreBusiness.cs
@@ -629,7 +629,7 @@ namespace Aucma.Scada.Business
if (spaceInfo != null)
{
- taskHandleBusiness.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode);
+ // taskHandleBusiness.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode);
//读取PLC获取货道信息:存放数量、在途数量
spaceInfo.spaceStock -= 1;
@@ -752,7 +752,7 @@ namespace Aucma.Scada.Business
///
///
///
- public bool DeleteTaskInfoByTaskCode(string taskCode)
+ public bool DeleteTaskInfoByTaskCode(string taskCode,bool isFlag)
{
bool result = false;
var info = _taskInfoService.GetTaskInfosByTaskCode(taskCode);
@@ -760,20 +760,28 @@ namespace Aucma.Scada.Business
{
foreach(var taskInfo in info)
{
- if(taskInfo.taskStatus == 2)
- {
- PrintLogInfoMessage("任务正在执行中不运行删除");
+ //if(taskInfo.taskStatus == 2)
+ //{
+ // PrintLogInfoMessage("任务正在执行中不运行删除");
- continue;
- }
+ // continue;
+ //}
result = _taskInfoService.DeleteTaskInfoById(taskInfo.objId);
if (result)
{
var spaceDetailInfo =_spaceDetailService.GetSpaceDetailByMaterialCode(taskInfo.materialCode);
if(spaceDetailInfo != null)
{
- spaceDetailInfo.isFlag = 0;
- _spaceDetailService.UpdateSpaceDetail(spaceDetailInfo);
+ if (!isFlag)
+ {
+ spaceDetailInfo.isFlag = 0;
+ _spaceDetailService.UpdateSpaceDetail(spaceDetailInfo);
+ }
+ else
+ {
+ _spaceDetailService.DeleteSpaceDetailByMaterialCode(spaceDetailInfo.materialCode);
+ }
+
}
}
}
diff --git a/Aucma.Scada.Business/OutStoreTaskHandle.cs b/Aucma.Scada.Business/OutStoreTaskHandle.cs
index 2bf82528..e8f1cf1f 100644
--- a/Aucma.Scada.Business/OutStoreTaskHandle.cs
+++ b/Aucma.Scada.Business/OutStoreTaskHandle.cs
@@ -38,8 +38,10 @@ namespace Aucma.Scada.Business
private PlcPool _pool = PlcPool.Instance;
private PlcSpaceConfig spaceConfig = PlcSpaceConfig.Instance;
+
private RegisterServices registerServices = RegisterServices.Instance;
- private ICodeBindingRecordServices _codeBindingRecordServices;
+
+ private IRealTaskInfoService _taskInfoService;
#endregion
#region 私有变量
@@ -86,8 +88,8 @@ namespace Aucma.Scada.Business
private OutStoreTaskHandle()
{
- _codeBindingRecordServices = registerServices.GetService();
_plcDictionary = _pool.GetAll();
+ _taskInfoService = registerServices.GetService();
RealReadShellFinish();
@@ -178,7 +180,7 @@ namespace Aucma.Scada.Business
OutStoreAnswerEvent?.Invoke(appConfig.shellStoreCode, taskInfo.taskCode);
- shellTaskInfos.Add(taskInfo);
+ //shellTaskInfos.Add(taskInfo);
}
Thread.Sleep(1000);
@@ -335,7 +337,7 @@ namespace Aucma.Scada.Business
//ReadLinerFinish_OutStore(taskCode);
OutStoreAnswerEvent?.Invoke(appConfig.linerStoreCode, taskInfo.taskCode);
- linerTaskInfos.Add(taskInfo);
+ //linerTaskInfos.Add(taskInfo);
}
Thread.Sleep(1000);
@@ -420,13 +422,15 @@ namespace Aucma.Scada.Business
{
while (true)
{
- var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList();
+ //var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList();
+ var info = GetTaskInfoByTaskStatus(appConfig.shellStoreCode);
for (int i = 0; i < info.Count; i++)
{
var item = info[i];
ReadShellFinish_OutStore(item);
Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
+ shellTaskInfos.Add(item);
}
Thread.Sleep(1000);
@@ -443,13 +447,15 @@ namespace Aucma.Scada.Business
{
while (true)
{
- var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList();
+ //var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList();
+ var info = GetTaskInfoByTaskStatus(appConfig.linerStoreCode);
for (int i = 0; i < info.Count; i++)
{
var item = info[i];
ReadLinerFinish_OutStore(item);
Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成");
item.taskStatus = 3;
+ linerTaskInfos.Add(item);
}
Thread.Sleep(1000);
@@ -485,9 +491,7 @@ namespace Aucma.Scada.Business
if (shellTask != null && linerTask != null)
{
- logHelper.Info($"绑定条码:箱壳:{shellTask.materialCode};内胆:{linerTask.materialCode}");
- // 条码绑定表,绑定箱壳和内胆码 shellTask.materialCode,linerTask.materialCode
- _codeBindingRecordServices.BindingCode(shellTask.materialCode, linerTask.materialCode);
+ Console.WriteLine($"绑定箱壳:{shellTask.materialCode};内胆:{linerTask.materialCode};条码");
shellTaskInfos.Remove(shellTask);
linerTaskInfos.Remove(linerTask);
@@ -500,6 +504,26 @@ namespace Aucma.Scada.Business
}
#endregion
+ ///
+ /// 根据任务状态获取执行中的任务
+ ///
+ ///
+ ///
+ private List GetTaskInfoByTaskStatus(string storeCode, int taskStatus = 2)
+ {
+ List result = null;
+ try
+ {
+ result = _taskInfoService.GetTaskInfosByTaskStatus(new string[] { storeCode }, appConfig.outstoreTaskType, taskStatus);
+ }
+ catch (Exception ex)
+ {
+ logHelper.Error("根据任务状态获取执行中的任务异常", ex);
+ }
+ return result;
+
+ }
+
///
/// 通过PLC获取货道信息
diff --git a/Aucma.Scada.UI/viewModel/OutStoreInfo/OutStoreInfoViewModel.cs b/Aucma.Scada.UI/viewModel/OutStoreInfo/OutStoreInfoViewModel.cs
index 8d9ca9a7..3bde918f 100644
--- a/Aucma.Scada.UI/viewModel/OutStoreInfo/OutStoreInfoViewModel.cs
+++ b/Aucma.Scada.UI/viewModel/OutStoreInfo/OutStoreInfoViewModel.cs
@@ -299,8 +299,16 @@ namespace Aucma.Scada.UI.viewModel.OutStoreInfo
private void DeleteTaskInfo(object obj)
{
string taskCode = obj as string;
-
- if (outStoreBusiness.DeleteTaskInfoByTaskCode(taskCode))
+ MessageBoxResult result = MessageBox.Show("货物是否已出库?", "出库确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
+ if(result == MessageBoxResult.Yes)
+ {
+ if(outStoreBusiness.DeleteTaskInfoByTaskCode(taskCode,true))
+ {
+ MessageBox.Show("任务删除成功","提示",MessageBoxButton.OK,MessageBoxImage.Information,MessageBoxResult.OK,MessageBoxOptions.DefaultDesktopOnly);
+ Query();
+ }
+ }
+ if (outStoreBusiness.DeleteTaskInfoByTaskCode(taskCode, false))
{
MessageBox.Show("任务删除成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
Query();