|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using Aucma.Scada.Model.domain;
|
|
|
|
|
using Aucma.Core.Scanner;
|
|
|
|
|
using Aucma.Scada.Model.domain;
|
|
|
|
|
using HighWayIot.Config;
|
|
|
|
|
using HighWayIot.Log4net;
|
|
|
|
|
using HighWayIot.Repository.service;
|
|
|
|
@ -39,6 +40,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
private OutStoreTaskHandle taskHandleBusiness = OutStoreTaskHandle.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -70,6 +72,11 @@ namespace Aucma.Scada.Business
|
|
|
|
|
private IRecordOutStoreService _recordOutStoreService;
|
|
|
|
|
|
|
|
|
|
private IRecordProductfinishService _recordProductfinishService;
|
|
|
|
|
|
|
|
|
|
private IPrintBarCodeServices _printBarCodeServices;
|
|
|
|
|
|
|
|
|
|
// 过点数据表
|
|
|
|
|
private IMaterialCompletionServices _iMaterialCompletionServices;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 委托事件
|
|
|
|
@ -77,7 +84,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
/// 初始化出库任务
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
public delegate void RefreshOutStoreTask(RealTaskInfo taskInfos);
|
|
|
|
|
public delegate void RefreshOutStoreTask();
|
|
|
|
|
public event RefreshOutStoreTask RefreshOutStoreTaskEvent;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -106,6 +113,8 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
private OutStoreBusiness()
|
|
|
|
|
{
|
|
|
|
|
_iMaterialCompletionServices = registerServices.GetService<IMaterialCompletionServices>();
|
|
|
|
|
_printBarCodeServices = registerServices.GetService<IPrintBarCodeServices>();
|
|
|
|
|
_spaceInfoService = registerServices.GetService<IBaseSpaceInfoService>();
|
|
|
|
|
_taskInfoService = registerServices.GetService<IRealTaskInfoService>();
|
|
|
|
|
_bomInfoService = registerServices.GetService<IBaseBomInfoService>();
|
|
|
|
@ -115,12 +124,23 @@ namespace Aucma.Scada.Business
|
|
|
|
|
_recordOutStoreService = registerServices.GetService<IRecordOutStoreService>();
|
|
|
|
|
_recordProductfinishService = registerServices.GetService<IRecordProductfinishService>();
|
|
|
|
|
assemblyPlanBusiness.NextPassExecutePlanInfoEvent += PlanHandle;
|
|
|
|
|
MvCodeHelper.OutMaterialCodeStrEvent += OutStoreFinishHandle;
|
|
|
|
|
//assemblyPlanBusiness.PrintLogAndRefreshEvent += PrintLogInfoMessage;
|
|
|
|
|
assemblyPlanBusiness.GetSpaceInfoByMaterialTypeEvent += GetSpaceInfoByMaterialType;
|
|
|
|
|
taskHandleBusiness.OutStoreAnswerEvent += OutStoreAnswer;
|
|
|
|
|
taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish;
|
|
|
|
|
|
|
|
|
|
// taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish;
|
|
|
|
|
|
|
|
|
|
// test();
|
|
|
|
|
StartPassDown();
|
|
|
|
|
}
|
|
|
|
|
public void test()
|
|
|
|
|
{
|
|
|
|
|
//var productInfo = _productPlanInfoService.GetProductPlanByPlanCode("2402290019");
|
|
|
|
|
//productInfo.beginTime = DateTime.Now;
|
|
|
|
|
//productInfo.completeAmount = productInfo.completeAmount + 1;
|
|
|
|
|
//_productPlanInfoService.UpdateProductPlanInfo(productInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 接收下达的组装计划,根据BOM获取需要出库的泡后、内胆物料信息
|
|
|
|
@ -134,19 +154,41 @@ namespace Aucma.Scada.Business
|
|
|
|
|
{
|
|
|
|
|
if (planInfo != null)
|
|
|
|
|
{
|
|
|
|
|
// var bomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.foamMaterialType);
|
|
|
|
|
|
|
|
|
|
var bomInfo = _bomInfoService.GetBomInfoByMaterialCode(planInfo.materialCode);
|
|
|
|
|
if (bomInfo==null)
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"物料:{planInfo.materialCode};获取Bom信息为空");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 组装计划出库
|
|
|
|
|
//if (spaceInfo == null)
|
|
|
|
|
//{
|
|
|
|
|
// //筛选后的货道
|
|
|
|
|
// spaceInfo = GetSpaceInfoByMaterialType(appConfig.foamStoreCode, bomInfo.materialCode);
|
|
|
|
|
// if (spaceInfo == null)
|
|
|
|
|
// {
|
|
|
|
|
// PrintLogInfoMessage($"物料:{planInfo.materialCode};未匹配到货道");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// for (int i = 0; i < spaceInfo.spaceStock; i++)
|
|
|
|
|
// {
|
|
|
|
|
// string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 7);
|
|
|
|
|
// OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode, spaceInfo);
|
|
|
|
|
// Thread.Sleep(500);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
// else // 指定货道出一个或者整道出
|
|
|
|
|
// {
|
|
|
|
|
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
|
|
|
|
|
{
|
|
|
|
|
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 10);
|
|
|
|
|
OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode,spaceInfo);
|
|
|
|
|
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 7);
|
|
|
|
|
OutStore(appConfig.foamStoreCode, bomInfo, planInfo.executePlanCode, taskCode, spaceInfo);
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -163,13 +205,8 @@ namespace Aucma.Scada.Business
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"收到出库计划,物料码:{bomInfo.materialCode}");
|
|
|
|
|
#region Delete By wenjy 2023-10-30 11:41:00 取消通过数据库获取货道数量、在途量,改为通过PLC获取货道信息
|
|
|
|
|
//BaseSpaceInfo spaceInfo = _spaceInfoService.OutStoreGetSpaceInfoByMaterialCode(storeCode, bomInfo.materialCode);
|
|
|
|
|
#endregion
|
|
|
|
|
if(spaceInfo == null)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo = GetSpaceInfoByMaterialType(storeCode, bomInfo.materialCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}");
|
|
|
|
@ -208,10 +245,6 @@ namespace Aucma.Scada.Business
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//获取出库的货道明细物料信息
|
|
|
|
|
BaseSpaceDetail spaceDetail = GetSpaceDetailFirstOrderByCreatTime(spaceInfo);
|
|
|
|
|
if (spaceDetail != null)
|
|
|
|
|
{
|
|
|
|
|
#region 出库任务赋值
|
|
|
|
|
RealTaskInfo realTaskInfo = new RealTaskInfo();
|
|
|
|
@ -223,32 +256,30 @@ namespace Aucma.Scada.Business
|
|
|
|
|
realTaskInfo.storeCode = spaceInfo.storeCode;
|
|
|
|
|
realTaskInfo.spaceCode = spaceInfo.spaceCode;
|
|
|
|
|
realTaskInfo.spaceName = spaceInfo.spaceName;
|
|
|
|
|
realTaskInfo.materialType = spaceDetail.materialType;
|
|
|
|
|
realTaskInfo.materialCode = spaceDetail.materialCode;
|
|
|
|
|
realTaskInfo.materialType = spaceInfo.materialType;
|
|
|
|
|
realTaskInfo.planAmount = 1;
|
|
|
|
|
realTaskInfo.taskStatus = 1;
|
|
|
|
|
realTaskInfo.createTime = DateTime.Now;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
result = _taskInfoService.AddTaskInfo(realTaskInfo);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
// 禁止入库
|
|
|
|
|
spaceInfo.inStoreFlag = 2;
|
|
|
|
|
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
PrintLogInfoMessage("出库任务创建成功");
|
|
|
|
|
|
|
|
|
|
RefreshOutStoreTaskEvent?.Invoke(realTaskInfo);
|
|
|
|
|
RefreshOutStoreTaskEvent?.Invoke();
|
|
|
|
|
|
|
|
|
|
UpdateSpaceAndDetial(spaceInfo, spaceDetail);
|
|
|
|
|
// UpdateSpaceAndDetial(spaceInfo, spaceDetail);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage("出库任务创建失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage("出库任务创建失败,货道明细为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -324,7 +355,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
PassDownTaskInfo();
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -357,7 +388,9 @@ namespace Aucma.Scada.Business
|
|
|
|
|
|
|
|
|
|
taskInfo.taskStatus = 2;
|
|
|
|
|
_taskInfoService.UpdateTaskInfo(taskInfo);
|
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(taskInfo.materialCode, taskInfo.materialType, taskInfo.spaceName, taskInfo.storeCode);
|
|
|
|
|
//刷新出库任务界面
|
|
|
|
|
RefreshOutStoreTaskEvent?.Invoke();
|
|
|
|
|
// RefreshScanMateriaCodeEvent?.Invoke(taskInfo.materialCode, taskInfo.materialType, taskInfo.spaceName, taskInfo.storeCode);
|
|
|
|
|
}
|
|
|
|
|
else if (result == 2)
|
|
|
|
|
{
|
|
|
|
@ -411,20 +444,21 @@ namespace Aucma.Scada.Business
|
|
|
|
|
PrintLogInfoMessage("出库应答成功,自动释放信号量,进行下发新任务");
|
|
|
|
|
semaphore.Release();
|
|
|
|
|
// 视为出库完成,后续改为监测在库数
|
|
|
|
|
OutStoreFinish(storeCode, taskCode);
|
|
|
|
|
// OutStoreFinish(storeCode, taskCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 出库完成
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="taskCode"></param>
|
|
|
|
|
private void OutStoreFinish(string storeCode, string taskCode)
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage($"出库任务:{taskCode};执行完成");
|
|
|
|
|
|
|
|
|
|
OutStoreFinishHandle(taskCode, appConfig.foamStoreCode);
|
|
|
|
|
}
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 出库完成
|
|
|
|
|
///// </summary>
|
|
|
|
|
///// <param name="storeCode"></param>
|
|
|
|
|
///// <param name="taskCode"></param>
|
|
|
|
|
//private void OutStoreFinish(string storeCode, string taskCode)
|
|
|
|
|
//{
|
|
|
|
|
// PrintLogInfoMessage($"出库任务:{taskCode};执行完成");
|
|
|
|
|
|
|
|
|
|
// OutStoreFinishHandle(taskCode, appConfig.foamStoreCode);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 信号量释放,根据任务完成数量,执行完成后进行释放
|
|
|
|
@ -447,66 +481,104 @@ namespace Aucma.Scada.Business
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
private void OutStoreFinishHandle(string taskCode, string storeCode)
|
|
|
|
|
private void OutStoreFinishHandle(string code)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var taskInfo = _taskInfoService.GetTaskInfoByTaskCode(taskCode, storeCode);
|
|
|
|
|
|
|
|
|
|
// 插入出库记录
|
|
|
|
|
PrintLogInfoMessage($"{code}:出库完成");
|
|
|
|
|
RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByTaskCode(SubStringMaterialCode(code), appConfig.foamStoreCode, 2);
|
|
|
|
|
if (taskInfo != null)
|
|
|
|
|
{
|
|
|
|
|
var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode);
|
|
|
|
|
//更新计划信息
|
|
|
|
|
UpdatePlanInfo(taskInfo.planCode);
|
|
|
|
|
|
|
|
|
|
//刷新界面
|
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(code, code.Substring(7, 10), taskInfo.spaceName, appConfig.foamStoreCode); //刷新界面扫码信息
|
|
|
|
|
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
// taskHandleBusiness.WritePlc(spaceInfo.storeCode, spaceInfo.spaceCode);
|
|
|
|
|
//读取PLC获取货道信息:存放数量、在途数量
|
|
|
|
|
|
|
|
|
|
#region Add By wenjy 2023-10-30 13:44:00 通过PLC获取货道信息
|
|
|
|
|
var item = taskHandleBusiness.ReadSpaceInfoByPlc(spaceInfo);
|
|
|
|
|
spaceInfo.spaceStock = item.spaceStock;
|
|
|
|
|
spaceInfo.onRouteAmount = item.onRouteAmount;
|
|
|
|
|
//spaceInfo.spaceStatus = item.spaceStatus;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (spaceInfo.spaceStock == 0)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.materialType = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//刷新界面
|
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(code, code.Substring(7, 10), "", appConfig.foamStoreCode); //刷新界面扫码信息
|
|
|
|
|
|
|
|
|
|
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
|
|
|
|
|
#region 根据创建时间删除没有型号的任务
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
// _taskInfoService.DeleteTaskInfoByCode(taskInfo);
|
|
|
|
|
// 查询该型号的类型任务按照时间排序删除第一条, 清除任务信息
|
|
|
|
|
_taskInfoService.DeleteFirstTaskByStoreCode(appConfig.foamStoreCode, 2);
|
|
|
|
|
#region 添加出库记录
|
|
|
|
|
RecordOutstore recordOutstore = new RecordOutstore();
|
|
|
|
|
recordOutstore.storeCode = taskInfo.storeCode;
|
|
|
|
|
recordOutstore.storeCode = appConfig.foamStoreCode;
|
|
|
|
|
if (taskInfo != null)
|
|
|
|
|
{
|
|
|
|
|
recordOutstore.spaceCode = taskInfo.spaceCode;
|
|
|
|
|
recordOutstore.materialCode = taskInfo.materialCode;
|
|
|
|
|
recordOutstore.materialType = taskInfo.materialType;
|
|
|
|
|
recordOutstore.materialName = GetMaterialName(taskInfo.materialType);
|
|
|
|
|
}
|
|
|
|
|
recordOutstore.materialCode = code;
|
|
|
|
|
recordOutstore.materialType = code.Substring(7, 10);
|
|
|
|
|
recordOutstore.materialName = GetMaterialName(recordOutstore.materialType);
|
|
|
|
|
recordOutstore.outStoreAmount = 1;
|
|
|
|
|
recordOutstore.outStoreTime = DateTime.Now;
|
|
|
|
|
_recordOutStoreService.InsertReocrdOutStoreService(recordOutstore);
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新计划信息
|
|
|
|
|
UpdatePlanInfo(taskInfo.planCode);
|
|
|
|
|
|
|
|
|
|
RefreshStoreStockEvent?.Invoke();
|
|
|
|
|
// 根据条码查询明细并删除
|
|
|
|
|
_spaceDetailService.DeleteSpaceDetailByMaterialCode(code);
|
|
|
|
|
|
|
|
|
|
//清除任务信息
|
|
|
|
|
_taskInfoService.DeleteTaskInfo(taskCode, storeCode);
|
|
|
|
|
|
|
|
|
|
_spaceDetailService.DeleteSpaceDetailByMaterialCode(taskInfo.materialCode);
|
|
|
|
|
// 刷新任务页面
|
|
|
|
|
RefreshOutStoreTaskEvent?.Invoke();
|
|
|
|
|
|
|
|
|
|
//刷新界面
|
|
|
|
|
RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode);
|
|
|
|
|
#region 出库更新过点数据,插入记录到MATERIAL_COMPLETION表
|
|
|
|
|
if (!string.IsNullOrEmpty(code))
|
|
|
|
|
{
|
|
|
|
|
PrintBarCode print = _printBarCodeServices.query(code);
|
|
|
|
|
if (print != null)
|
|
|
|
|
{
|
|
|
|
|
// string planCode = _productPlanInfoServices.GetPlanCode(print.OrderCode, appConfig.stationCode);
|
|
|
|
|
MaterialCompletion completion = new MaterialCompletion();
|
|
|
|
|
completion.OrderCode = print.OrderCode;
|
|
|
|
|
completion.MaterialBarcode = code;
|
|
|
|
|
completion.MaterialCode = print.MaterialCode;
|
|
|
|
|
completion.MaterialName = print.MaterialName;
|
|
|
|
|
completion.StationName = appConfig.outstationCode;
|
|
|
|
|
completion.CompleteDate = DateTime.Now;
|
|
|
|
|
// completion.planCode = planCode;
|
|
|
|
|
_iMaterialCompletionServices.Add(completion);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
PrintLogErrorMessage("出库完成逻辑处理异常", ex);
|
|
|
|
|
PrintLogErrorMessage("出库完成逻辑处理异常:"+ ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 截条码类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="materialCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string SubStringMaterialCode(string materialCode)
|
|
|
|
|
{
|
|
|
|
|
string result = string.Empty;
|
|
|
|
|
if (!string.IsNullOrEmpty(materialCode))
|
|
|
|
|
{
|
|
|
|
|
result = materialCode.Substring(7, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -518,9 +590,11 @@ namespace Aucma.Scada.Business
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var executeInfo = _executePlanInfoService.GetExecutePlanInfoByPlanCode(planCode);
|
|
|
|
|
if (executeInfo != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
executeInfo.completeAmount += 1;
|
|
|
|
|
|
|
|
|
|
if (executeInfo.completeAmount == executeInfo.planAmount)
|
|
|
|
@ -533,8 +607,12 @@ namespace Aucma.Scada.Business
|
|
|
|
|
var productInfo = _productPlanInfoService.GetProductPlanByPlanCode(executeInfo.productPlanCode);
|
|
|
|
|
if (productInfo != null)
|
|
|
|
|
{
|
|
|
|
|
if(productInfo.completeAmount==0)
|
|
|
|
|
{
|
|
|
|
|
productInfo.beginTime = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
productInfo.completeAmount += 1;
|
|
|
|
|
if (productInfo.completeAmount == productInfo.planAmount)
|
|
|
|
|
if (productInfo.completeAmount >= productInfo.planAmount)
|
|
|
|
|
{
|
|
|
|
|
productInfo.endTime = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
@ -613,6 +691,16 @@ namespace Aucma.Scada.Business
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 泡后库出库删除所有任务信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="taskInfo"></param>
|
|
|
|
|
/// <summary>
|
|
|
|
|
public bool DeleteAllTaskByStoreCode(string storeCode, int taskType)
|
|
|
|
|
{
|
|
|
|
|
return _taskInfoService.DeleteAllTaskByStoreCode(storeCode, taskType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据货道手动出一个
|
|
|
|
|
/// </summary>
|
|
|
|
@ -637,7 +725,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 不关联生产计划
|
|
|
|
|
result = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N").Substring(0, 10), System.Guid.NewGuid().ToString("N").Substring(0, 10), 1);
|
|
|
|
|
result = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N").Substring(0, 7), System.Guid.NewGuid().ToString("N").Substring(0, 10), 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -677,9 +765,9 @@ namespace Aucma.Scada.Business
|
|
|
|
|
#endregion
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for(int i = 1; i < spaceInfo.spaceStock; i++)
|
|
|
|
|
for(int i = 1; i <= spaceInfo.spaceStock; i++)
|
|
|
|
|
{
|
|
|
|
|
result = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N").Substring(0, 10), System.Guid.NewGuid().ToString("N").Substring(0, 10), 1);
|
|
|
|
|
result = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N").Substring(0, 7), System.Guid.NewGuid().ToString("N").Substring(0, 10), 1);
|
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
@ -707,7 +795,7 @@ namespace Aucma.Scada.Business
|
|
|
|
|
/// 日志输出,界面刷新同时记录文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message"></param>
|
|
|
|
|
private void PrintLogInfoMessage(string message)
|
|
|
|
|
public void PrintLogInfoMessage(string message)
|
|
|
|
|
{
|
|
|
|
|
RefreshLogMessageEvent?.Invoke(message);
|
|
|
|
|
logHelper.Info(message);
|
|
|
|
@ -754,12 +842,12 @@ namespace Aucma.Scada.Business
|
|
|
|
|
return materialName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 通过PLC读取货道信息(在库数量、货道状态)
|
|
|
|
|
/// 出库找货道
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="materialType"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private BaseSpaceInfo GetSpaceInfoByMaterialType(string storeCode, string materialType)
|
|
|
|
|
public BaseSpaceInfo GetSpaceInfoByMaterialType(string storeCode, string materialType)
|
|
|
|
|
{
|
|
|
|
|
BaseSpaceInfo result = null;
|
|
|
|
|
|
|
|
|
@ -767,33 +855,23 @@ namespace Aucma.Scada.Business
|
|
|
|
|
{
|
|
|
|
|
List<BaseSpaceInfo> info = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType,2);
|
|
|
|
|
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
|
if (info.Count > 0)
|
|
|
|
|
if (info != null && info.Count>0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (BaseSpaceInfo item in info)
|
|
|
|
|
{
|
|
|
|
|
var spaceInfo = taskHandleBusiness.ReadSpaceInfoByPlc(item);
|
|
|
|
|
item.spaceStock = spaceInfo.spaceStock;
|
|
|
|
|
item.onRouteAmount = spaceInfo.onRouteAmount;
|
|
|
|
|
// item.spaceStatus = spaceInfo.spaceStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//result = info.Where(x => x.spaceStatus == 1 && x.spaceStock > 0).OrderBy(x => x.spaceStock).OrderBy(x => x.spaceCode).First();
|
|
|
|
|
|
|
|
|
|
var list = info.Where(x => x.spaceStatus == 1 && x.spaceStock > 0).ToList();
|
|
|
|
|
result = info.OrderByDescending(x => x.spaceStock).First();
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result = info.OrderBy(x => x.spaceStock).First();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintLogInfoMessage("未获取到匹配的货道,请排查货道库存及货道状态是否可用");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|