change-人工叫料修改

dev
liuwf 1 week ago
parent c7c6c10937
commit 1197e71c9d

@ -72,82 +72,82 @@ namespace SlnMesnac.Business
public void Init()
{
EmptyPalletHandle();
// EmptyPalletHandle();
}
/// <summary>
/// 空托盘进入码垛位处理
/// </summary>
private void EmptyPalletHandle()
{
//读取PLC空托盘流转信号
while (true)
{
try
{
var plc = base.GetPlcByKey("plc");
if (plc == null)
{
_logger.LogInformation("读取PLC空托盘流转信号,PLC连接信息为空......");
Thread.Sleep(3000);
continue;
}
if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("空托到位")))
{
// _logger.LogInformation("等待空托盘到位信号触发......");
Thread.Sleep(5000);
continue;
}
//读取RFID、获取当前正在执行的计划、将当前计划、工单等信息与托盘绑定
RefreshMessage("空托盘到位信号触发成功,读取托盘RFID信息");
ReadEpcStrByRfidKey("test", out string epcStr);
if (string.IsNullOrEmpty(epcStr))
{
throw new ArgumentException($"托盘信息读取失败");
}
RefreshMessage($"空托盘RFID信息读取成功标签信息{epcStr}");
Thread.Sleep(1000);
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
if (productPlanDto == null)
{
throw new ArgumentException($"未获取到正在执行的生产计划");
}
plc.writeInt16ByAddress(GetPlcAddressByConfigKey("空托到位"), 0);
//绑定信息存入wms_product_instock
_msInstockService.Insert(new WmsInstock()
{
PalletInfoCode = epcStr,
PlanCode = productPlanDto.PlanCode,
SaleorderCode = productPlanDto.SaleorderCode,
SaleOrderId = productPlanDto.SaleOrderId,
});
RefreshMessage($"绑定托盘信息,托盘:{epcStr};计划:{productPlanDto.PlanCode};工单:{productPlanDto.SaleorderCode}");
_realPalletTaskService.InsertPalletTask(new RealPalletTask() { PalletCode = epcStr,RecordTime = DateTime.Now });
// RefreshPalletTaskListEvent?.Invoke(_palletTasks);
}
catch (Exception e)
{
RefreshMessage($"空托盘进入码垛位处理异常:{e.Message}");
}
Thread.Sleep(5000);
}
}
///// <summary>
///// 空托盘进入码垛位处理
///// </summary>
//private void EmptyPalletHandle()
//{
// //读取PLC空托盘流转信号
// while (true)
// {
// try
// {
// var plc = base.GetPlcByKey("plc");
// if (plc == null)
// {
// _logger.LogInformation("读取PLC空托盘流转信号,PLC连接信息为空......");
// Thread.Sleep(3000);
// continue;
// }
// if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("空托到位")))
// {
// // _logger.LogInformation("等待空托盘到位信号触发......");
// Thread.Sleep(5000);
// continue;
// }
// //读取RFID、获取当前正在执行的计划、将当前计划、工单等信息与托盘绑定
// RefreshMessage("空托盘到位信号触发成功,读取托盘RFID信息");
// ReadEpcStrByRfidKey("test", out string epcStr);
// if (string.IsNullOrEmpty(epcStr))
// {
// throw new ArgumentException($"托盘信息读取失败");
// }
// RefreshMessage($"空托盘RFID信息读取成功标签信息{epcStr}");
// Thread.Sleep(1000);
// _mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
// if (productPlanDto == null)
// {
// throw new ArgumentException($"未获取到正在执行的生产计划");
// }
// plc.writeInt16ByAddress(GetPlcAddressByConfigKey("空托到位"), 0);
// //绑定信息存入wms_product_instock
// _msInstockService.Insert(new WmsInstock()
// {
// PalletInfoCode = epcStr,
// PlanCode = productPlanDto.PlanCode,
// SaleorderCode = productPlanDto.SaleorderCode,
// SaleOrderId = productPlanDto.SaleOrderId,
// });
// RefreshMessage($"绑定托盘信息,托盘:{epcStr};计划:{productPlanDto.PlanCode};工单:{productPlanDto.SaleorderCode}");
// _realPalletTaskService.InsertPalletTask(new RealPalletTask() { PalletCode = epcStr,RecordTime = DateTime.Now });
// // RefreshPalletTaskListEvent?.Invoke(_palletTasks);
// }
// catch (Exception e)
// {
// RefreshMessage($"空托盘进入码垛位处理异常:{e.Message}");
// }
// Thread.Sleep(5000);
// }
//}
public void RemovePalletInfo(string palletCode)
{

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

@ -205,7 +205,6 @@ namespace SlnMesnac.Business.@base
var rfidEquip = GetRfidByKey(rfidKey);
if(rfidEquip == null)
{
return null;
}
List<TagInfo> tagInfoList =await rfidEquip.GetRFIDAsync();

@ -89,7 +89,10 @@ namespace SlnMesnac.Repository.service.Impl
productPlanDto = base._rep.AsQueryable()
.LeftJoin<MesProductOrder>((plan, order) => plan.ProductOrderId == order.ProductOrderId)
.LeftJoin<BaseMaterialInfo>((plan, order, material) => plan.MaterialId == material.MaterialId)
.Where(plan => plan.StationId == _appConfig.stationId && plan.PlanStatus == PlanStatusEnum.)
.Where((plan,order) =>
plan.PlanStatus == PlanStatusEnum. &&
(order.DispatchId == 2)
)
.Select((plan, order, material) => new MesProductPlanDto
{
PlanId = plan.PlanId,
@ -116,8 +119,8 @@ namespace SlnMesnac.Repository.service.Impl
MaterialUnitId = material.MaterialUnitId,
}).First();
return base._rep.GetFirst(x => x.StationId == _appConfig.stationId && x.PlanStatus == PlanStatusEnum.);
//不使用return值使用out MesProductPlanDto productPlanDto
return null;
}
catch (Exception e)
{

@ -505,7 +505,7 @@ namespace SlnMesnac.WPF.ViewModel
{
await Task.Run(() =>
{
ProductionHourList = new List<string>() { "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "20:00" };
ProductionHourList = new List<string>() { "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00" };
List<MesBaseBarcodeInfo> list = _mesBaseBarcodeInfoService.Query(x => x.bindTime != null && x.bindTime >= DateTime.Now.Date && x.bindTime <= DateTime.Now.AddDays(1)).ToList();
if (list != null && list.Count > 0)
{

Loading…
Cancel
Save