change - 出库逻辑处理

foamRearStore
wenjy 1 year ago
parent b9bcf60801
commit 0dbf1fa4b4

Binary file not shown.

@ -96,14 +96,14 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown();
//Task.Run(() =>
//{
// Thread.Sleep(6000);
// for (int i = 1; i < 3; i++)
// {
// InStore("F23406001225101900" + i);
// }
//});
Task.Run(() =>
{
Thread.Sleep(6000);
for (int i = 1; i < 3; i++)
{
InStore("F23406001225101900" + i);
}
});
}
/// <summary>

@ -258,16 +258,16 @@ namespace Aucma.Scada.Business
spaceDetail.isFlag = detailIsFlag;
var result = _spaceDetailService.UpdateSpaceDetail(spaceDetail);
if (stockFlag)
{
spaceInfo.spaceStock = spaceInfo.spaceStock > 0 ? spaceInfo.spaceStock - 1 : 0;
}
else
{
spaceInfo.spaceStock = spaceInfo.spaceStock + 1;
}
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
//if (stockFlag)
//{
// spaceInfo.spaceStock = spaceInfo.spaceStock > 0 ? spaceInfo.spaceStock - 1 : 0;
//}
//else
//{
// spaceInfo.spaceStock = spaceInfo.spaceStock + 1;
//}
//_spaceInfoService.UpdateSpaceInfo(spaceInfo);
}
#region 轮询获取出库任务下发至PLC等待PLC执行反馈完成后再次下发
@ -441,6 +441,7 @@ namespace Aucma.Scada.Business
{
//读取PLC获取货道信息存放数量、在途数量
//spaceInfo.materialType = taskInfo.materialType;
spaceInfo.spaceStock -= 1;
if (spaceInfo.spaceStock == 0)
{
spaceInfo.materialType = string.Empty;
@ -527,7 +528,31 @@ namespace Aucma.Scada.Business
/// <returns></returns>
public bool DeleteTaskInfoByTaskCode(string taskCode)
{
return _taskInfoService.DeleteTaskInfo(taskCode,appConfig.foamStoreCode);
bool result = false;
var info = _taskInfoService.GetTaskInfosByTaskCode(taskCode);
if (info != null)
{
foreach (var taskInfo in info)
{
if (taskInfo.taskStatus == 2)
{
PrintLogInfoMessage("任务正在执行中不运行删除");
continue;
}
result = _taskInfoService.DeleteTaskInfoById(taskInfo.objId);
if (result)
{
var spaceDetailInfo = _spaceDetailService.GetSpaceDetailByMaterialCode(taskInfo.materialCode);
if (spaceDetailInfo != null)
{
spaceDetailInfo.isFlag = 0;
_spaceDetailService.UpdateSpaceDetail(spaceDetailInfo);
}
}
}
}
return result;
}
/// <summary>

@ -71,5 +71,9 @@ namespace HighWayIot.Repository.service
/// <returns></returns>
List<RealTaskInfo> GetTaskInfosByTaskStatus(string[] storeCode, int taskType, int taskStatus);
List<RealTaskInfo> GetTaskInfosByTaskCode(string taskCode);
bool DeleteTaskInfoById(int id);
}
}

@ -207,5 +207,26 @@ namespace HighWayIot.Repository.service.Impl
}
return taskInfos;
}
public List<RealTaskInfo> GetTaskInfosByTaskCode(string taskCode)
{
List<RealTaskInfo> taskInfos = null;
try
{
Expression<Func<RealTaskInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.taskCode == taskCode);
taskInfos = _mesRepository.GetList(exp);
}
catch (Exception ex)
{
logHelper.Error("获取指定状态的任务信息异常", ex);
}
return taskInfos;
}
public bool DeleteTaskInfoById(int id)
{
return _mesRepository.DeleteById(id);
}
}
}

Loading…
Cancel
Save