change - 出库逻辑修改

collectionStore
wenjy 1 year ago
parent b6062dc600
commit cdd30af812

Binary file not shown.

@ -93,15 +93,15 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown();
Task.Run(() =>
{
Thread.Sleep(6000);
for (int i = 1; i < 7; i++)
{
//InStore(appConfig.shellStoreCode, "B23600000781101902" + i);
InStore(appConfig.linerStoreCode, "L23600000788101902" + i);
}
});
//Task.Run(() =>
//{
// Thread.Sleep(6000);
// for (int i = 1; i < 7; i++)
// {
// //InStore(appConfig.shellStoreCode, "B23600000781101902" + i);
// InStore(appConfig.linerStoreCode, "L23600000788101902" + i);
// }
//});
}

@ -121,7 +121,6 @@ namespace Aucma.Scada.Business
{
if (planInfo != null)
{
string taskCode = DateTime.Now.ToString("HH:mm:ss");
var shellBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.shellMaterialType);
var linerBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.linerMaterialType);
@ -129,6 +128,7 @@ namespace Aucma.Scada.Business
{
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
{
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0,10);
OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
Thread.Sleep(500);
OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode);
@ -267,14 +267,14 @@ 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;
}
//if (stockFlag)
//{
// spaceInfo.spaceStock = spaceInfo.spaceStock > 0 ? spaceInfo.spaceStock - 1 : 0;
//}
//else
//{
// spaceInfo.spaceStock = spaceInfo.spaceStock + 1;
//}
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
}
@ -510,7 +510,8 @@ namespace Aucma.Scada.Business
{
//读取PLC获取货道信息存放数量、在途数量
//spaceInfo.materialType = taskInfo.materialType;
if(spaceInfo.spaceStock == 0)
spaceInfo.spaceStock -= 1;
if (spaceInfo.spaceStock == 0)
{
spaceInfo.materialType = string.Empty;
}
@ -595,7 +596,31 @@ namespace Aucma.Scada.Business
/// <returns></returns>
public bool DeleteTaskInfoByTaskCode(string taskCode)
{
return _taskInfoService.DeleteTaskInfo(taskCode);
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>

@ -21,6 +21,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
private ObservableCollection<RealTaskInfo> taskItems = new ObservableCollection<RealTaskInfo>();
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
private AppConfig appConfig = AppConfig.Instance;
public InStoreInfoViewModel()
@ -28,6 +29,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
inStoreBusiness.RefreshInStoreTaskEvent += RefreshInStoreTask;
inStoreBusiness.RefreshScanMateriaCodeEvent += RefreshScanInfo;
inStoreBusiness.RefreshLogMessageEvent += PrintMessageToListBox;
outStoreBusiness.RefreshStoreStockEvent += Init;
QueryCommand = new RelayCommand(Query);
@ -289,6 +291,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
App.Current.Dispatcher.Invoke((Action)(() =>
{
Query();
Achievement.Clear();
MaterialNameList = new List<string>()
{
"SC232",

@ -62,6 +62,10 @@ namespace HighWayIot.Repository.service
/// <returns></returns>
List<RealTaskInfo> GetTaskInfosByStoreCode(string[] storeCode, int taskType);
List<RealTaskInfo> GetTaskInfosByTaskCode(string taskCode);
bool DeleteTaskInfoById(int id);
/// <summary>
/// 获取指定状态的任务列表
/// </summary>

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace HighWayIot.Repository.service.Impl
{
@ -207,5 +208,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