|
|
@ -217,8 +217,8 @@ namespace SlnMesnac.Business
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MesProductPlan prodPlan = _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
|
|
|
|
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
|
|
|
|
if (prodPlan == null || productPlanDto == null)
|
|
|
|
if (productPlanDto == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//throw new ArgumentException($"未获取到需要执行的生产计划");
|
|
|
|
//throw new ArgumentException($"未获取到需要执行的生产计划");
|
|
|
|
RefreshMessage($"3F未获取到需要执行的生产计划");
|
|
|
|
RefreshMessage($"3F未获取到需要执行的生产计划");
|
|
|
@ -253,26 +253,24 @@ namespace SlnMesnac.Business
|
|
|
|
|
|
|
|
|
|
|
|
RefreshMessage("3F设备要料信号触发成功");
|
|
|
|
RefreshMessage("3F设备要料信号触发成功");
|
|
|
|
|
|
|
|
|
|
|
|
RefreshProdPlanExecEvent?.Invoke(prodPlan);
|
|
|
|
// RefreshProdPlanExecEvent?.Invoke(prodPlan);
|
|
|
|
|
|
|
|
|
|
|
|
// string palletCode = GetPalletInfoByTask();
|
|
|
|
// string palletCode = GetPalletInfoByTask();
|
|
|
|
|
|
|
|
|
|
|
|
RefreshMessage($"执行计划:{prodPlan.PlanCode};计划数量:{Math.Round(prodPlan.PlanAmount, 2)};完成数量:{Math.Round(prodPlan.CompleteAmount, 2)};发起叫料申请");
|
|
|
|
RefreshMessage($"执行计划:{productPlanDto.PlanCode};计划数量:{Math.Round(productPlanDto.PlanAmount, 2)};完成数量:{Math.Round(productPlanDto.CompleteAmount, 2)};发起叫料申请");
|
|
|
|
|
|
|
|
|
|
|
|
//查询下发agv的主键
|
|
|
|
//查询下发agv的主键
|
|
|
|
WmsRawOutstock wmsRaw = _wmsOutStockService.GetProdPlanByPlanCode(prodPlan.PlanCode);
|
|
|
|
WmsRawOutstock wmsRaw = _wmsOutStockService.GetProdPlanByPlanCode(productPlanDto.PlanCode);
|
|
|
|
if (wmsRaw == null)
|
|
|
|
if (wmsRaw == null && debugConfig.ProductMode != "1") //不是手动模式,没有申请单
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RefreshMessage("查询不到该计划......");
|
|
|
|
RefreshMessage("自动模式,查询不到该计划出库申请单,请先创建...");
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//进行叫料
|
|
|
|
//进行叫料
|
|
|
|
if (ApplyDeliveryHandle(wmsRaw.rawOutstockId.ToString()))
|
|
|
|
if (ApplyDeliveryHandle(wmsRaw))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
RefreshMessage("3F根据计划自动申请叫料成功");
|
|
|
|
RefreshMessage("3F根据计划自动申请叫料成功");
|
|
|
|
#region 本地创建一个叫料任务
|
|
|
|
#region 本地创建一个叫料任务
|
|
|
|
//BaseRealTask realTask = new BaseRealTask();
|
|
|
|
//BaseRealTask realTask = new BaseRealTask();
|
|
|
@ -315,7 +313,7 @@ namespace SlnMesnac.Business
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//mes计划
|
|
|
|
//mes计划
|
|
|
|
MesProductPlan prodPlan = null;
|
|
|
|
// MesProductPlan prodPlan = null;
|
|
|
|
//本地叫料任务
|
|
|
|
//本地叫料任务
|
|
|
|
// BaseRealTask localPlan = null;
|
|
|
|
// BaseRealTask localPlan = null;
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -374,9 +372,9 @@ namespace SlnMesnac.Business
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO根据本地叫料计划查询对应的mes计划,完成
|
|
|
|
//TODO根据本地叫料计划查询对应的mes计划,完成
|
|
|
|
prodPlan = _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
|
|
|
|
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
|
|
|
|
|
|
|
|
|
|
|
|
if (productPlanDto == null || prodPlan == null)
|
|
|
|
if (productPlanDto == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RefreshMessage($"3F收到物料到位信号,未获取到正在执行的生产计划,请开始执行计划");
|
|
|
|
RefreshMessage($"3F收到物料到位信号,未获取到正在执行的生产计划,请开始执行计划");
|
|
|
|
|
|
|
|
|
|
|
@ -416,7 +414,7 @@ namespace SlnMesnac.Business
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
if (prodPlan != null)
|
|
|
|
if (productPlanDto != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 下发翻转信号
|
|
|
|
// 下发翻转信号
|
|
|
|
plc.writeBoolByAddress(GetPlcAddressByConfigKey("设备投料"), true);
|
|
|
|
plc.writeBoolByAddress(GetPlcAddressByConfigKey("设备投料"), true);
|
|
|
@ -518,7 +516,7 @@ namespace SlnMesnac.Business
|
|
|
|
/// <param name="materialCode"></param>
|
|
|
|
/// <param name="materialCode"></param>
|
|
|
|
/// <param name="result"></param>
|
|
|
|
/// <param name="result"></param>
|
|
|
|
/// <exception cref="InvalidOperationException"></exception>
|
|
|
|
/// <exception cref="InvalidOperationException"></exception>
|
|
|
|
public bool ApplyDeliveryHandle(String taskId)
|
|
|
|
public bool ApplyDeliveryHandle(WmsRawOutstock wmsRaw)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool result = false;
|
|
|
|
bool result = false;
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -539,12 +537,16 @@ namespace SlnMesnac.Business
|
|
|
|
targetLocationCode = PreferredOut.LocationCode;
|
|
|
|
targetLocationCode = PreferredOut.LocationCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//if (debugConfig.ProductMode == "1")
|
|
|
|
|
|
|
|
//{ //标记手工叫料
|
|
|
|
|
|
|
|
// taskId = "-1";
|
|
|
|
|
|
|
|
//}
|
|
|
|
var content = new
|
|
|
|
var content = new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rawOutstockId = taskId,
|
|
|
|
rawOutstockId = wmsRaw==null?"-1": wmsRaw.rawOutstockId.ToString(),
|
|
|
|
locationCode = targetLocationCode,
|
|
|
|
locationCode = targetLocationCode,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string message = JsonConvert.SerializeObject(content);
|
|
|
|
string message = JsonConvert.SerializeObject(content);
|
|
|
|
//询问小车是否离开接口 0已经离开
|
|
|
|
//询问小车是否离开接口 0已经离开
|
|
|
|