change - 出入库逻辑优化

collectionStore
wenjy 1 year ago
parent 47699ccaaf
commit 79748bbb8e

Binary file not shown.

@ -105,7 +105,7 @@ namespace Aucma.Scada.Business
//}
//_executePlanInfoService.UpdateRangeExecutePlanInfo(planInfos);
RefreshExecutePlanInfoEvent?.Invoke(planInfos);
RefreshExecutePlanInfoEvent?.Invoke(planInfos.Where(x=>x.executeStatus != 3).ToList());
}
}
catch (Exception ex)

@ -90,8 +90,15 @@ namespace Aucma.Scada.Business
grabImage.RefreshLogMessageEvent += PrintLogInfoMessage;
StartPassDown();
//InStore(appConfig.shellStoreCode, "B236000007811019001");
//InStore(appConfig.linerStoreCode, "L236000007881019001");
//Task.Run(() =>
//{
// Thread.Sleep(6000);
// for(int i = 2;i<10;i++)
// {
// InStore(appConfig.shellStoreCode, "B23600000781101900"+i);
// InStore(appConfig.linerStoreCode, "L23600000788101900"+i);
// }
//});
}
/// <summary>
@ -308,12 +315,6 @@ namespace Aucma.Scada.Business
{
taskInfo = _taskInfoService.GetTaskInfoByStoreCode(storeCode, 1);
if (taskInfo != null)
{
taskInfo.taskStatus = 2;
_taskInfoService.UpdateTaskInfo(taskInfo);
}
}
catch (Exception ex)
{

@ -58,6 +58,10 @@ namespace Aucma.Scada.Business
/// 货道明细
/// </summary>
private IBaseSpaceDetailService _spaceDetailService;
private IExecutePlanInfoService _executePlanInfoService;
private IProductPlanInfoService _productPlanInfoService;
#endregion
#region 委托事件
@ -84,6 +88,9 @@ namespace Aucma.Scada.Business
/// <param name="message"></param>
public delegate void RefreshLogMessage(string message);
public event RefreshLogMessage RefreshLogMessageEvent;
public delegate void RefreshAssemblyPlanInit();
public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent;
#endregion
private OutStoreBusiness()
@ -92,7 +99,8 @@ namespace Aucma.Scada.Business
_taskInfoService = registerServices.GetService<IRealTaskInfoService>();
_bomInfoService = registerServices.GetService<IBaseBomInfoService>();
_spaceDetailService = registerServices.GetService<IBaseSpaceDetailService>();
_executePlanInfoService = registerServices.GetService<IExecutePlanInfoService>();
_productPlanInfoService = registerServices.GetService<IProductPlanInfoService>();
assemblyPlanBusiness.NextPassExecutePlanInfoEvent += PlanHandle;
taskHandleBusiness.OutStoreFinsihEvent += TaskFeedback;
StartPassDown();
@ -299,6 +307,7 @@ namespace Aucma.Scada.Business
string shellCode = string.Empty;
string linerCode = string.Empty;
string taskCode = string.Empty;
string executePlanCode = string.Empty;
int iFlag = 0;
completedTasks = 0;
@ -312,6 +321,7 @@ namespace Aucma.Scada.Business
foreach (var item in taskInfoList)
{
taskCode = item.taskCode;
executePlanCode = item.planCode;
if (item.storeCode == appConfig.shellStoreCode)
{
if (taskHandleBusiness.SendShellTask_OutStore(item))
@ -365,6 +375,9 @@ namespace Aucma.Scada.Business
PrintLogInfoMessage($"出库任务:{taskCode};执行完成,绑定箱壳条码:{shellCode};内胆条码:{linerCode}");
UpdatePlanInfo(executePlanCode);
}
}
else
@ -498,11 +511,12 @@ namespace Aucma.Scada.Business
}
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
//读取PLC获取物料类型进行绑定
}
//清除任务信息
_taskInfoService.DeleteTaskInfo(taskCode, storeCode);
_spaceDetailService.DeleteSpaceDetailByMaterialCode(taskInfo.materialCode);
//刷新界面
RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode);
}
@ -514,6 +528,48 @@ namespace Aucma.Scada.Business
}
}
/// <summary>
/// 更新计划信息
/// </summary>
/// <param name="planCode"></param>
private void UpdatePlanInfo(string planCode)
{
try
{
var executeInfo = _executePlanInfoService.GetExecutePlanInfoByPlanCode(planCode);
if (executeInfo != null)
{
executeInfo.completeAmount += 1;
if (executeInfo.completeAmount == executeInfo.planAmount)
{
executeInfo.executeStatus = 3;
}
_executePlanInfoService.UpdateExecutePlanInfo(executeInfo);
var productInfo = _productPlanInfoService.GetProductPlanByPlanCode(executeInfo.productPlanCode);
if(productInfo != null)
{
productInfo.completeAmount += 1;
if (productInfo.completeAmount == productInfo.planAmount)
{
productInfo.endTime = DateTime.Now;
}
_productPlanInfoService.UpdateProductPlanInfo(productInfo);
}
}
RefreshAssemblyPlanInitEvent?.Invoke();
}
catch(Exception ex)
{
PrintLogErrorMessage("计划信息更新异常", ex);
}
}
/// <summary>
/// 获取出库任务
/// </summary>

@ -21,6 +21,8 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
private AppConfig appConfig = AppConfig.Instance;
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
public AssemblyPlanViewModel()
{
MoveUpCommand = new RelayCommand<object>(obj => MoveUp(obj));
@ -31,6 +33,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
PlanInfoEditCommand = new RelayCommand(PlanInfoEdit);
assemblyPlanBusiness.RefreshExecutePlanInfoEvent += RefreshDataGrid;
outStoreBusiness.RefreshAssemblyPlanInitEvent += RefreshPlanInfoDataGrid;
Init();
}
@ -254,10 +257,29 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
}
private void RefreshPlanInfoDataGrid()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
var planInfos = assemblyPlanBusiness.GetEexecutePlanInfosByProductLineCode();
RefreshDataGrid(planInfos);
//加载正在执行的计划
planInfos = planInfos.Where(x => x.executeStatus == 2).ToList();
if (planInfos.Count > 0)
{
ExecutePlanInfo planInfo = planInfos.OrderBy(x => x.executeOrder).First();
RefreshPlanExecute(planInfo);
}
}));
}
/// <summary>
/// 柱状体加载
/// </summary>
public void Init()
{
App.Current.Dispatcher.Invoke((Action)(() =>
{
var planInfos = assemblyPlanBusiness.GetEexecutePlanInfosByProductLineCode();
RefreshDataGrid(planInfos);
@ -314,6 +336,8 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
Achievement.Add(column2);
}));
}
/// <summary>

@ -223,13 +223,14 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
public void Query()
{
lock (string.Empty)
{
#region 通过数据库获取数据进行刷新
var info = inStoreBusiness.GetInStoreTask();
if (info != null)
{
taskItems = new ObservableCollection<RealTaskInfo>();
//info.ForEach(x => RefreshInStoreTask(x));
try
{
foreach (var item in info)
@ -263,6 +264,7 @@ namespace Aucma.Scada.UI.viewModel.InStoreInfo
}
InstoreTask = taskItems.Where(x => !string.IsNullOrEmpty(search) ? x.materialCode == search : 1 == 1 && !string.IsNullOrEmpty(materialTypeCombox) ? x.storeCode == materialTypeCombox : 1 == 1);
}
}
/// <summary>
/// 重置

Loading…
Cancel
Save