change - 组装计划、货道信息设置

collectionStore
wenjy 6 months ago
parent 69484298b1
commit c66668b66a

@ -88,7 +88,7 @@ namespace Aucma.Scada.Business
_spaceDetailService = registerServices.GetService<IBaseSpaceDetailService>(); _spaceDetailService = registerServices.GetService<IBaseSpaceDetailService>();
_spaceInfoService = registerServices.GetService<IBaseSpaceInfoService>(); _spaceInfoService = registerServices.GetService<IBaseSpaceInfoService>();
_realTaskInfoService = registerServices.GetService<IRealTaskInfoService>(); _realTaskInfoService = registerServices.GetService<IRealTaskInfoService>();
} }
@ -104,11 +104,11 @@ namespace Aucma.Scada.Business
{ {
productPlanInfos = _productPlanInfoService.GetProductPlanInfosByProductLineCode(appConfig.stationCode); productPlanInfos = _productPlanInfoService.GetProductPlanInfosByProductLineCode(appConfig.stationCode);
if(productPlanInfos.Count>0 ) if (productPlanInfos.Count > 0)
{ {
if(!string.IsNullOrEmpty(orderCode)) if (!string.IsNullOrEmpty(orderCode))
{ {
productPlanInfos = productPlanInfos.Where(x=>x.orderCode.Contains(orderCode)).ToList(); productPlanInfos = productPlanInfos.Where(x => x.orderCode.Contains(orderCode)).ToList();
} }
} }
} }
@ -155,7 +155,7 @@ namespace Aucma.Scada.Business
/// <param name="materialType">BOM类型</param> /// <param name="materialType">BOM类型</param>
/// <param name="storeCode"></param> /// <param name="storeCode"></param>
/// <returns></returns> /// <returns></returns>
public bool JudgmentStock(ProductPlanInfo planInfo,int transmitAmount, string materialType,string storeCode) public bool JudgmentStock(ProductPlanInfo planInfo, int transmitAmount, string materialType, string storeCode)
{ {
bool result = false; bool result = false;
try try
@ -176,16 +176,16 @@ namespace Aucma.Scada.Business
materialType = baseBomInfo.materialCode; materialType = baseBomInfo.materialCode;
var planInfos = _executePlanInfoService.GetExecutePlanInfosByProductLineCode(appConfig.stationCode); var planInfos = _executePlanInfoService.GetExecutePlanInfosByProductLineCode(appConfig.stationCode);
var spaceInfo = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode,materialType); var spaceInfo = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType);
if(spaceInfo != null) if (spaceInfo != null)
{ {
int sumStock = spaceInfo.Sum(x=>x.spaceStock); int sumStock = spaceInfo.Sum(x => x.spaceStock);
if(planInfos != null) if (planInfos != null)
{ {
int sumPlanAmount = planInfos.Sum(x => x.planAmount - x.completeAmount); int sumPlanAmount = planInfos.Sum(x => x.planAmount - x.completeAmount);
if(sumStock - sumPlanAmount > transmitAmount) if (sumStock - sumPlanAmount > transmitAmount)
{ {
result = true; result = true;
} }
@ -411,36 +411,21 @@ namespace Aucma.Scada.Business
{ {
isFlase = autoFlag; isFlase = autoFlag;
break; break;
} }
var taksInfos =_realTaskInfoService.GetTaskInfosByTaskStatus(new string[] { appConfig.shellStoreCode, appConfig.linerStoreCode }, 2,2); var taksInfos = _realTaskInfoService.GetTaskInfosByStoreCode(new string[] { appConfig.shellStoreCode, appConfig.linerStoreCode }, 2);
if (taksInfos.Count == 0) if (taksInfos != null)
{ {
var prodPlanInfo = _productPlanInfoService.GetProductPlanByPlanCode(planInfo.productPlanCode); taksInfos = taksInfos.Where(x => x.taskStatus != 3).ToList();
if(prodPlanInfo!= null)
if (taksInfos.Count == 0)
{ {
if(prodPlanInfo.planAmount > prodPlanInfo.completeAmount) var prodPlanInfo = _productPlanInfoService.GetProductPlanByPlanCode(planInfo.productPlanCode);
{ if (prodPlanInfo != null)
if((prodPlanInfo.planAmount - prodPlanInfo.completeAmount) >= planInfo.planAmount)
{
//创建新计划
PlanTransmitByProductPlan(planInfo.productPlanCode, planInfo.planAmount);
}
else
{
//创建新计划
PlanTransmitByProductPlan(planInfo.productPlanCode, prodPlanInfo.planAmount - prodPlanInfo.completeAmount);
}
}
else
{ {
var prodPlanInfos = _productPlanInfoService.GetProductPlanInfosByProductLineCode(appConfig.stationCode); if (prodPlanInfo.planAmount > prodPlanInfo.completeAmount)
if(prodPlanInfos != null)
{ {
prodPlanInfos = prodPlanInfos.Where(x=>x.materialCode == planInfo.materialCode && x.planAmount > x.completeAmount).ToList();
prodPlanInfo = prodPlanInfos.First();
if ((prodPlanInfo.planAmount - prodPlanInfo.completeAmount) >= planInfo.planAmount) if ((prodPlanInfo.planAmount - prodPlanInfo.completeAmount) >= planInfo.planAmount)
{ {
//创建新计划 //创建新计划
@ -452,18 +437,41 @@ namespace Aucma.Scada.Business
PlanTransmitByProductPlan(planInfo.productPlanCode, prodPlanInfo.planAmount - prodPlanInfo.completeAmount); PlanTransmitByProductPlan(planInfo.productPlanCode, prodPlanInfo.planAmount - prodPlanInfo.completeAmount);
} }
} }
else
{
var prodPlanInfos = _productPlanInfoService.GetProductPlanInfosByProductLineCode(appConfig.stationCode);
if (prodPlanInfos != null)
{
prodPlanInfos = prodPlanInfos.Where(x => x.materialCode == planInfo.materialCode && x.planAmount > x.completeAmount).ToList();
prodPlanInfo = prodPlanInfos.First();
if ((prodPlanInfo.planAmount - prodPlanInfo.completeAmount) >= planInfo.planAmount)
{
//创建新计划
PlanTransmitByProductPlan(planInfo.productPlanCode, planInfo.planAmount);
}
else
{
//创建新计划
PlanTransmitByProductPlan(planInfo.productPlanCode, prodPlanInfo.planAmount - prodPlanInfo.completeAmount);
}
}
}
} }
isFlase = false;
} }
isFlase = false;
} }
Task.Delay(2000).Wait(); Task.Delay(2000).Wait();
} while (isFlase); } while (isFlase);
} }
} }
Task.Delay(5000).Wait(); Task.Delay(5000).Wait();
}catch(Exception ex) }
catch (Exception ex)
{ {
Console.WriteLine($"组装计划自动执行异常:{ex.Message}"); Console.WriteLine($"组装计划自动执行异常:{ex.Message}");
} }

@ -246,7 +246,7 @@ namespace Aucma.Scada.Business
if (spaceList != null) if (spaceList != null)
{ {
spaceList = spaceList.Where(x => x.spaceStatus == 4).ToList(); spaceList = spaceList.Where(x => x.unusualFlag == 2).ToList();
BaseSpaceInfo spaceInfo = GetSpaceInfosByPlc(spaceList, false); BaseSpaceInfo spaceInfo = GetSpaceInfosByPlc(spaceList, false);

@ -70,7 +70,7 @@ namespace Aucma.Scada.Business
List<BaseSpaceInfo> spaceInfos = null; List<BaseSpaceInfo> spaceInfos = null;
try try
{ {
spaceInfos = _spaceInfoService.GetSpaceInfosByStoreCode(storeCode).OrderBy(x=>x.objId).ToList(); spaceInfos = _spaceInfoService.GetSpaceInfosByStoreCode(storeCode).OrderBy(x => x.objId).ToList();
} }
catch (Exception ex) catch (Exception ex)
@ -149,6 +149,7 @@ namespace Aucma.Scada.Business
if (spaceInfo != null) if (spaceInfo != null)
{ {
spaceInfo.unusualFlag = spaceInfo.unusualFlag == 1 ? 2 : 1; spaceInfo.unusualFlag = spaceInfo.unusualFlag == 1 ? 2 : 1;
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo); result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};异常标识:{spaceInfo.unusualFlag};修改{(result == true ? "" : "")}"); logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};异常标识:{spaceInfo.unusualFlag};修改{(result == true ? "" : "")}");
} }
@ -175,7 +176,7 @@ namespace Aucma.Scada.Business
BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode); BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode);
if (spaceInfo != null) if (spaceInfo != null)
{ {
spaceInfo.spaceStatus = spaceInfo.spaceStatus == 1 ? 2 : 1; spaceInfo.spaceStatus = spaceInfo.spaceStatus == 1 ? 3 : 1;
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo); result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};货道状态:{spaceInfo.unusualFlag};修改{(result == true ? "" : "")}"); logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};货道状态:{spaceInfo.unusualFlag};修改{(result == true ? "" : "")}");
} }

@ -69,7 +69,7 @@ namespace Aucma.Scada.Business
private IRecordProductfinishService _recordProductfinishService; private IRecordProductfinishService _recordProductfinishService;
#endregion #endregion
#region 委托事件 #region 委托事件
@ -97,7 +97,7 @@ namespace Aucma.Scada.Business
public delegate void RefreshLogMessage(string message); public delegate void RefreshLogMessage(string message);
public event RefreshLogMessage RefreshLogMessageEvent; public event RefreshLogMessage RefreshLogMessageEvent;
public delegate void RefreshAssemblyPlanInit(); public delegate void RefreshAssemblyPlanInit(int isFlag = 0);
public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent; public event RefreshAssemblyPlanInit RefreshAssemblyPlanInitEvent;
public delegate void RefreshStoreStock(); public delegate void RefreshStoreStock();
@ -122,7 +122,8 @@ namespace Aucma.Scada.Business
taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish; taskHandleBusiness.OutStoreFinsihEvent += OutStoreFinish;
taskHandleBusiness.UpdateMesPlanCompleteEvent += UpdatePlanInfo; taskHandleBusiness.UpdateMesPlanCompleteEvent += UpdatePlanInfo;
StartPassDown(); StartPassDown();
}catch (Exception ex) }
catch (Exception ex)
{ {
Console.WriteLine($"OutStoreBusiness异常{ex.Message}"); Console.WriteLine($"OutStoreBusiness异常{ex.Message}");
PrintLogErrorMessage($"OutStoreBusiness异常{ex.Message}"); PrintLogErrorMessage($"OutStoreBusiness异常{ex.Message}");
@ -146,25 +147,70 @@ namespace Aucma.Scada.Business
var shellBomInfo = _bomInfoService.GetBomInfoByMaterialCode(planInfo.materialCode); var shellBomInfo = _bomInfoService.GetBomInfoByMaterialCode(planInfo.materialCode);
var linerBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.linerMaterialType); var linerBomInfo = _bomInfoService.GetChildenBomInfoByMaterialCode(planInfo.materialCode, appConfig.linerMaterialType);
if(shellBomInfo != null && linerBomInfo != null) if (shellBomInfo != null && linerBomInfo != null)
{ {
for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++) for (int i = 0; i < planInfo.planAmount - planInfo.completeAmount; i++)
{ {
string taskCode = System.Guid.NewGuid().ToString("N").Substring(0,10); string taskCode = System.Guid.NewGuid().ToString("N").Substring(0, 10);
RealTaskInfo shellTask = OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
Thread.Sleep(500); //RealTaskInfo shellTask = OutStore(appConfig.shellStoreCode, shellBomInfo, planInfo.executePlanCode, taskCode);
RealTaskInfo linerTask = OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode); //Thread.Sleep(500);
//RealTaskInfo linerTask = OutStore(appConfig.linerStoreCode, linerBomInfo, planInfo.executePlanCode, taskCode);
Thread.Sleep(500); //Thread.Sleep(500);
var shellSpaceInfo = GetSpaceInfoByMaterialType(appConfig.shellStoreCode, shellBomInfo.materialCode);
Thread.Sleep(100);
var linerSpaceInfo = GetSpaceInfoByMaterialType(appConfig.linerStoreCode, linerBomInfo.materialCode);
Thread.Sleep(100);
//判断库存
if (shellSpaceInfo != null && linerSpaceInfo != null)
{
RealTaskInfo shell_task = CreateOutStoreTask(shellSpaceInfo, planInfo.executePlanCode, taskCode); //创建出库任务
if (shell_task != null)
{
PrintLogInfoMessage("箱壳出库计划创建成功");
}
else
{
PrintLogInfoMessage("箱壳出库计划创建失败");
assemblyPlanBusiness.autoFlag = false;
RefreshAssemblyPlanInitEvent?.Invoke(2);
}
Thread.Sleep(100);
RealTaskInfo liner_task = CreateOutStoreTask(shellSpaceInfo, planInfo.executePlanCode, taskCode); //创建出库任务
if (shell_task != null)
{
PrintLogInfoMessage("箱壳出库计划创建成功");
}
else
{
PrintLogInfoMessage("箱壳出库计划创建失败");
assemblyPlanBusiness.autoFlag = false;
RefreshAssemblyPlanInitEvent?.Invoke(2);
}
}
else
{
PrintLogInfoMessage($"组装计划:{planInfo.executePlanCode};出库失败,货道不匹配,未匹配到相同型号物料");
assemblyPlanBusiness.autoFlag = false;
}
Thread.Sleep(1000 * 2);
} }
} }
else else
{ {
PrintLogInfoMessage($"物料:{planInfo.materialCode}获取Bom信息为空"); PrintLogInfoMessage($"物料:{planInfo.materialCode}获取Bom信息为空");
} }
} }
}); });
} }
@ -181,13 +227,13 @@ namespace Aucma.Scada.Business
try try
{ {
PrintLogInfoMessage($"收到出库计划,物料码:{bomInfo.materialCode}"); PrintLogInfoMessage($"收到出库计划,物料码:{bomInfo.materialCode}");
BaseSpaceInfo spaceInfo = GetSpaceInfoByMaterialType(storeCode, bomInfo.materialCode); BaseSpaceInfo spaceInfo = GetSpaceInfoByMaterialType(storeCode, bomInfo.materialCode);
if (spaceInfo != null) if (spaceInfo != null)
{ {
PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}"); PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}");
RealTaskInfo task = CreateOutStoreTask(spaceInfo, planCode, taskCode); //创建出库任务 RealTaskInfo task = CreateOutStoreTask(spaceInfo, planCode, taskCode); //创建出库任务
if (task!=null) if (task != null)
{ {
PrintLogInfoMessage("出库任务创建成功"); PrintLogInfoMessage("出库任务创建成功");
return task; return task;
@ -200,7 +246,7 @@ namespace Aucma.Scada.Business
} }
else else
{ {
//报警停线 //报警停线
PrintLogInfoMessage($"{storeCode};仓库内未获取到{bomInfo.materialCode}相匹配的物料及货道"); PrintLogInfoMessage($"{storeCode};仓库内未获取到{bomInfo.materialCode}相匹配的物料及货道");
return null; return null;
@ -217,7 +263,7 @@ namespace Aucma.Scada.Business
/// 创建出库任务 /// 创建出库任务
/// </summary> /// </summary>
/// <param name="spaceInfo"></param> /// <param name="spaceInfo"></param>
private RealTaskInfo CreateOutStoreTask(BaseSpaceInfo spaceInfo, string planCode, string taksCode, int taskModel = 0,int emptyDetailFlag=0) private RealTaskInfo CreateOutStoreTask(BaseSpaceInfo spaceInfo, string planCode, string taksCode, int taskModel = 0, int emptyDetailFlag = 0)
{ {
bool result = false; bool result = false;
try try
@ -291,7 +337,7 @@ namespace Aucma.Scada.Business
/// </summary> /// </summary>
/// <param name="spaceInfo"></param> /// <param name="spaceInfo"></param>
/// <returns></returns> /// <returns></returns>
private BaseSpaceDetail GetSpaceDetailFirstOrderByCreatTime(BaseSpaceInfo spaceInfo,string type) private BaseSpaceDetail GetSpaceDetailFirstOrderByCreatTime(BaseSpaceInfo spaceInfo, string type)
{ {
BaseSpaceDetail spaceDetail = null; BaseSpaceDetail spaceDetail = null;
try try
@ -299,7 +345,7 @@ namespace Aucma.Scada.Business
List<BaseSpaceDetail> spaceDetails = _spaceDetailService.GetSpaceDetailsBySpaceCode(spaceInfo.storeCode, spaceInfo.spaceCode); List<BaseSpaceDetail> spaceDetails = _spaceDetailService.GetSpaceDetailsBySpaceCode(spaceInfo.storeCode, spaceInfo.spaceCode);
if (spaceDetails.Count > 0) if (spaceDetails.Count > 0)
{ {
spaceDetails = spaceDetails.Where(x => x.isFlag != 1 && x.materialType==type).ToList(); spaceDetails = spaceDetails.Where(x => x.isFlag != 1 && x.materialType == type).ToList();
if (spaceDetails.Count > 0) if (spaceDetails.Count > 0)
{ {
spaceDetail = spaceDetails.OrderBy(x => x.createTime).First(); spaceDetail = spaceDetails.OrderBy(x => x.createTime).First();
@ -356,11 +402,11 @@ namespace Aucma.Scada.Business
//获取箱壳出库任务 //获取箱壳出库任务
RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, appConfig.outstoreTaskType); RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, appConfig.outstoreTaskType);
if(taskInfo != null) if (taskInfo != null)
{ {
PrintLogInfoMessage($"下发箱壳出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); PrintLogInfoMessage($"下发箱壳出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
int result = taskHandleBusiness.SendShellTask_OutStore(taskInfo); int result = taskHandleBusiness.SendShellTask_OutStore(taskInfo);
if (result==1) if (result == 1)
{ {
PrintLogInfoMessage($"箱壳出库任务:{taskInfo.taskCode}下发成功等待PLC执行反馈"); PrintLogInfoMessage($"箱壳出库任务:{taskInfo.taskCode}下发成功等待PLC执行反馈");
@ -385,9 +431,10 @@ namespace Aucma.Scada.Business
} }
else else
{ {
// PrintLogInfoMessage("未获取到需要下发的箱壳出库任务"); // PrintLogInfoMessage("未获取到需要下发的箱壳出库任务");
} }
}catch(Exception ex) }
catch (Exception ex)
{ {
PrintLogErrorMessage("下传箱壳出库任务逻辑处理异常", ex); PrintLogErrorMessage("下传箱壳出库任务逻辑处理异常", ex);
} }
@ -405,7 +452,7 @@ namespace Aucma.Scada.Business
{ {
PrintLogInfoMessage($"下发内胆出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); PrintLogInfoMessage($"下发内胆出库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}");
int result = taskHandleBusiness.SendLinerTask_OutStore(taskInfo); int result = taskHandleBusiness.SendLinerTask_OutStore(taskInfo);
if (result==1) if (result == 1)
{ {
PrintLogInfoMessage($"内胆出库任务:{taskInfo.taskCode}下发成功等待PLC执行反馈"); PrintLogInfoMessage($"内胆出库任务:{taskInfo.taskCode}下发成功等待PLC执行反馈");
@ -430,7 +477,7 @@ namespace Aucma.Scada.Business
} }
else else
{ {
// PrintLogInfoMessage("未获取到需要下发的内胆出库任务"); // PrintLogInfoMessage("未获取到需要下发的内胆出库任务");
} }
} }
catch (Exception ex) catch (Exception ex)
@ -440,7 +487,7 @@ namespace Aucma.Scada.Business
} }
#endregion #endregion
#region PLC应答反馈 #region PLC应答反馈
/// <summary> /// <summary>
/// 出库应答 /// 出库应答
@ -517,7 +564,7 @@ namespace Aucma.Scada.Business
if (taskInfo != null) if (taskInfo != null)
{ {
var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode); var spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(taskInfo.storeCode, taskInfo.spaceCode);
if (spaceInfo != null) if (spaceInfo != null)
{ {
#region Add By wenjy 2023-10-30 13:44:00 通过PLC获取货道信息 #region Add By wenjy 2023-10-30 13:44:00 通过PLC获取货道信息
@ -557,7 +604,7 @@ namespace Aucma.Scada.Business
RefreshAssemblyPlanInitEvent?.Invoke(); RefreshAssemblyPlanInitEvent?.Invoke();
RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode); RefreshScanMateriaCodeEvent?.Invoke(string.Empty, string.Empty, string.Empty, taskInfo.storeCode);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -573,8 +620,8 @@ namespace Aucma.Scada.Business
{ {
try try
{ {
var executeInfo = _executePlanInfoService.GetExecutePlanInfoByPlanCode(planCode); var executeInfo = _executePlanInfoService.GetExecutePlanInfoByPlanCode(planCode);
if (executeInfo != null) if (executeInfo != null)
{ {
executeInfo.completeAmount += 1; executeInfo.completeAmount += 1;
@ -586,7 +633,7 @@ namespace Aucma.Scada.Business
_executePlanInfoService.UpdateExecutePlanInfo(executeInfo); _executePlanInfoService.UpdateExecutePlanInfo(executeInfo);
var productInfo = _productPlanInfoService.GetProductPlanByPlanCode(executeInfo.productPlanCode); var productInfo = _productPlanInfoService.GetProductPlanByPlanCode(executeInfo.productPlanCode);
if(productInfo != null) if (productInfo != null)
{ {
productInfo.completeAmount += 1; productInfo.completeAmount += 1;
if (productInfo.completeAmount == productInfo.planAmount) if (productInfo.completeAmount == productInfo.planAmount)
@ -609,9 +656,9 @@ namespace Aucma.Scada.Business
} }
RefreshAssemblyPlanInitEvent?.Invoke(); RefreshAssemblyPlanInitEvent?.Invoke();
} }
catch(Exception ex) catch (Exception ex)
{ {
PrintLogErrorMessage("计划信息更新异常", ex); PrintLogErrorMessage("计划信息更新异常", ex);
} }
@ -635,39 +682,39 @@ namespace Aucma.Scada.Business
/// </summary> /// </summary>
/// <param name="taskCode"></param> /// <param name="taskCode"></param>
/// <returns></returns> /// <returns></returns>
public bool DeleteTaskInfoByTaskCode(string taskCode,bool isFlag) public bool DeleteTaskInfoByTaskCode(string taskCode, bool isFlag)
{ {
bool result = false; bool result = false;
var info = _taskInfoService.GetTaskInfosByTaskCode(taskCode); var info = _taskInfoService.GetTaskInfosByTaskCode(taskCode);
if(info != null && info.Count>0) if (info != null && info.Count > 0)
{ {
RealTaskInfo taskInfo = info[0]; RealTaskInfo taskInfo = info[0];
//foreach(var taskInfo in info) //foreach(var taskInfo in info)
//{ //{
//if(taskInfo.taskStatus == 2) //if(taskInfo.taskStatus == 2)
//{ //{
// PrintLogInfoMessage("任务正在执行中不运行删除"); // PrintLogInfoMessage("任务正在执行中不运行删除");
// continue; // continue;
//} //}
result = _taskInfoService.DeleteTaskInfoById(taskInfo.objId); result = _taskInfoService.DeleteTaskInfoById(taskInfo.objId);
if (result) if (result)
{
var spaceDetailInfo = _spaceDetailService.GetSpaceDetailByMaterialCode(taskInfo.spaceCode, taskInfo.materialCode, taskInfo.detailCode);
if (spaceDetailInfo != null)
{ {
var spaceDetailInfo =_spaceDetailService.GetSpaceDetailByMaterialCode(taskInfo.spaceCode,taskInfo.materialCode,taskInfo.detailCode); if (!isFlag)
if(spaceDetailInfo != null)
{ {
if (!isFlag) spaceDetailInfo.isFlag = 0;
{ _spaceDetailService.UpdateSpaceDetail(spaceDetailInfo);
spaceDetailInfo.isFlag = 0; }
_spaceDetailService.UpdateSpaceDetail(spaceDetailInfo); else
} {
else _spaceDetailService.DeleteSpaceDetailByMaterialCode(spaceDetailInfo.spaceCode, spaceDetailInfo.materialCode, spaceDetailInfo.detailCode);
{
_spaceDetailService.DeleteSpaceDetailByMaterialCode(spaceDetailInfo.spaceCode,spaceDetailInfo.materialCode,spaceDetailInfo.detailCode);
}
} }
// }
}
// }
} }
} }
return result; return result;
@ -689,7 +736,7 @@ namespace Aucma.Scada.Business
{ {
RealTaskInfo task = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N"), System.Guid.NewGuid().ToString("N"), 1); RealTaskInfo task = this.CreateOutStoreTask(spaceInfo, System.Guid.NewGuid().ToString("N"), System.Guid.NewGuid().ToString("N"), 1);
if (task != null) if (task != null)
result = true; result = true;
} }
else else
{ {
@ -760,11 +807,11 @@ namespace Aucma.Scada.Business
PrintLogInfoMessage($"通过PLC读取货道信息货道{spaceInfo.spaceName};在库数量:{item.spaceStock};货道状态:{item.spaceStatus}"); PrintLogInfoMessage($"通过PLC读取货道信息货道{spaceInfo.spaceName};在库数量:{item.spaceStock};货道状态:{item.spaceStatus}");
} }
var list = info.Where(x=>x.spaceStatus == 1 && x.spaceStock > 0 && (x.spaceStock - x.outRouteAmount) > 0).ToList(); var list = info.Where(x => x.spaceStatus == 1 && x.spaceStock > 0).ToList(); // && (x.spaceStock - x.outRouteAmount) > 0
if (list.Count > 0) if (list.Count > 0)
{ {
result = info.OrderBy(x => x.spaceStock - x.outRouteAmount).First(); result = info.OrderBy(x => x.spaceStock).First();
} }
else else
{ {

@ -124,7 +124,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
set { beginTime = value; RaisePropertyChanged(nameof(BeginTime)); } set { beginTime = value; RaisePropertyChanged(nameof(BeginTime)); }
} }
private string autoSendContent =string.Empty; private string autoSendContent = string.Empty;
// //
public string AutoSendContent public string AutoSendContent
@ -255,7 +255,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
public RelayCommand MaterialStatisticsCommand { get; set; } public RelayCommand MaterialStatisticsCommand { get; set; }
public RelayCommand AutoSendCommand { get;set; } public RelayCommand AutoSendCommand { get; set; }
#endregion #endregion
@ -348,13 +348,27 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
/// <summary> /// <summary>
/// 出库完成刷新计划列表 /// 出库完成刷新计划列表
/// </summary> /// </summary>
private void RefreshPlanInfoDataGrid() private void RefreshPlanInfoDataGrid(int isFlag = 0)
{ {
if (isFlag == 1)
{
AutoSendContent = "关闭";
}
else if (isFlag == 2)
{
AutoSendContent = "自动下发";
}
else
{
//
}
RefreshExecutePlan(); RefreshExecutePlan();
App.Current.Dispatcher.Invoke((Action)(() => App.Current.Dispatcher.Invoke((Action)(() =>
{ {
OrderCode = string.Empty; OrderCode = string.Empty;
PlanCode = string.Empty; PlanCode = string.Empty;
ProductModel = string.Empty; ProductModel = string.Empty;
@ -424,7 +438,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
/// <param name="planInfos"></param> /// <param name="planInfos"></param>
private void RefreshStatisticsGauge(List<ExecutePlanInfo> planInfos) private void RefreshStatisticsGauge(List<ExecutePlanInfo> planInfos)
{ {
if(planInfos != null) if (planInfos != null)
{ {
if (planInfos.Count > 0) if (planInfos.Count > 0)
{ {
@ -456,28 +470,28 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan
try try
{ {
App.Current.Dispatcher.Invoke((Action)(() => App.Current.Dispatcher.Invoke((Action)(() =>
{ {
//获取物料型号统计 //获取物料型号统计
List<dynamic> materialStats = assemblyPlanBusiness.GetMaterialStats(); List<dynamic> materialStats = assemblyPlanBusiness.GetMaterialStats();
if (materialStats != null) if (materialStats != null)
{ {
ModelStatistics.Clear(); ModelStatistics.Clear();
MaterialNameList = new List<string>(); MaterialNameList = new List<string>();
ChartValues<double> materialAchievement = new ChartValues<double>(); ChartValues<double> materialAchievement = new ChartValues<double>();
foreach (var item in materialStats) foreach (var item in materialStats)
{ {
MaterialNameList.Add(item.MATERIAL_NAME); MaterialNameList.Add(item.MATERIAL_NAME);
materialAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT)); materialAchievement.Add(Convert.ToDouble(item.PRODUCT_AMOUNT));
} }
var materialColumn = new ColumnSeries(); var materialColumn = new ColumnSeries();
materialColumn.DataLabels = true; materialColumn.DataLabels = true;
materialColumn.Title = "型号"; materialColumn.Title = "型号";
materialColumn.Values = materialAchievement; materialColumn.Values = materialAchievement;
materialColumn.Foreground = Brushes.White; materialColumn.Foreground = Brushes.White;
ModelStatistics.Add(materialColumn); ModelStatistics.Add(materialColumn);
} }
})); }));
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -24,7 +24,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance; private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance; private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
private AppConfig appConfig = AppConfig.Instance; private AppConfig appConfig = AppConfig.Instance;
private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance; private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance;
@ -135,7 +135,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
foreach (var item in info) foreach (var item in info)
{ {
// item.typeNameA = GetSubstringBetweenCommas(item.typeNameA); // item.typeNameA = GetSubstringBetweenCommas(item.typeNameA);
spaceItems.Add(item); spaceItems.Add(item);
} }
Shapes = spaceItems; Shapes = spaceItems;

Loading…
Cancel
Save