新增取货错处理
手动下发任务处理 查找任务时判断是否有外侧仓位,优先出外侧仓位 入库请求新增入库口字段
This commit is contained in:
parent
277442158f
commit
2eb58d78b7
3
.gitignore
vendored
3
.gitignore
vendored
@ -360,4 +360,5 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
.DS_Store
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="SqlConnect" value="server=127.0.0.1;port=3306;user=root;password=abc123*;database=wcs_yongfeng_cp;"/>
|
||||
<add key="SqlConnect" value="server=10.211.55.2;port=3306;user=root;password=abc123*;database=wcs_yongfeng_cp;sslMode=None"/>
|
||||
<add key="WcsApiServer" value="http://localhost:65533"/>
|
||||
<add key="WmsApiClient" value="http://localhost/api/IWCS"/>
|
||||
<!--
|
||||
|
||||
@ -17,5 +17,10 @@
|
||||
/// 高度(只在入库请求时反馈)
|
||||
/// </summary>
|
||||
public int Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库口
|
||||
/// </summary>
|
||||
public string InPort { get; set; }
|
||||
}
|
||||
}
|
||||
@ -23,11 +23,10 @@
|
||||
<Button Name="btnReqFinish" Style="{StaticResource AduButton}" Content="完成当前任务状态" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="Finish" />
|
||||
<Button Name="btnEmptyOut" Style="{StaticResource AduButton}" Content="空出处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="EmptyOut" />
|
||||
<Button Name="btnFullIn" Style="{StaticResource AduButton}" Content="满入处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="FullIn" />
|
||||
<Button Name="btnTakeErr" Style="{StaticResource AduButton}" Content="取货错处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="PickError" />
|
||||
<Button Name="btnDel" Style="{StaticResource AduButton}" Content="删除堆垛机任务" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="Del" />
|
||||
<!--
|
||||
<Button Name="btnContinue" Style="{StaticResource AduButton}" Content="继续当前任务" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="Continue" />-->
|
||||
<!--<Button Name="btnTakeErr" Style="{StaticResource AduButton}" Content="取货错处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="PickError" />
|
||||
<Button Name="btnPutErr" Style="{StaticResource AduButton}" Content="放货错处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="PutError" />-->
|
||||
<!--<Button Name="btnContinue" Style="{StaticResource AduButton}" Content="继续当前任务" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="Continue" />-->
|
||||
<!--<Button Name="btnPutErr" Style="{StaticResource AduButton}" Content="放货错处理" FontWeight="Light" Background="Transparent" Click="btn_Click" CommandParameter="PutError" />-->
|
||||
|
||||
</StackPanel>
|
||||
</UniformGrid>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
|
||||
namespace WCS_YongFeng
|
||||
{
|
||||
@ -25,29 +26,63 @@ namespace WCS_YongFeng
|
||||
/// <param name="e"></param>
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var fromplace = from.Text.Trim().ToString();
|
||||
var toplace = to.Text.Trim().ToString();
|
||||
var fromloc = from.Text.Trim().ToString();
|
||||
var toloc = to.Text.Trim().ToString();
|
||||
var pall = pallet.Text.Trim().ToString();
|
||||
|
||||
string type = "";
|
||||
if (string.IsNullOrWhiteSpace(fromplace) && !string.IsNullOrWhiteSpace(toplace))
|
||||
//if (string.IsNullOrWhiteSpace(fromplace) && !string.IsNullOrWhiteSpace(toplace))
|
||||
//{
|
||||
// fromplace = "EntranceStationA01";
|
||||
// type = E_TaskType.入库.GetIndexString();
|
||||
//}
|
||||
//else if (!string.IsNullOrWhiteSpace(fromplace) && string.IsNullOrWhiteSpace(toplace))
|
||||
//{
|
||||
// toplace = "ExitStationA01";
|
||||
// type = E_TaskType.出库.GetIndexString();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MessageBox.Show("起点终点不允许都为空!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
var fromplace = App.poseList.FirstOrDefault(x => x.wcName == fromloc);
|
||||
var toplace = App.poseList.FirstOrDefault(x => x.wcName == toloc);
|
||||
|
||||
|
||||
if (fromplace != null && toplace != null && fromplace.wcType == "Entrance" && toplace.wcType == "WareCell")
|
||||
{
|
||||
fromplace = "EntranceStationA01";
|
||||
type = E_TaskType.入库.GetIndexString();
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(fromplace) && string.IsNullOrWhiteSpace(toplace))
|
||||
else if (fromplace != null && toplace != null && fromplace.wcType == "EntranceExit" && toplace.wcType == "WareCell")
|
||||
{
|
||||
type = E_TaskType.入库1.GetIndexString();
|
||||
}
|
||||
else if (fromplace != null && toplace != null && toplace.wcType == "Exit" && fromplace.wcType == "WareCell")
|
||||
{
|
||||
toplace = "ExitStationA01";
|
||||
type = E_TaskType.出库.GetIndexString();
|
||||
}
|
||||
else if (fromplace != null && toplace != null && toplace.wcType == "EntranceExit" && fromplace.wcType == "WareCell")
|
||||
{
|
||||
type = E_TaskType.出库1.GetIndexString();
|
||||
}
|
||||
else if (fromplace != null && toplace != null && toplace.wcType == "WareCell" && fromplace.wcType == "WareCell")
|
||||
{
|
||||
type = E_TaskType.移库.GetIndexString();
|
||||
}
|
||||
else if (fromplace == null && toplace != null && toplace.wcType == "WareCell")
|
||||
{
|
||||
fromplace = App.poseList.FirstOrDefault(x => x.wcName == "Enter_0000");
|
||||
type = E_TaskType.入库.GetIndexString();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("起点终点不允许都为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BllResult<I_Task> result = baseBll.CreateTask("", type, pall, fromplace, toplace, "WCS手动");
|
||||
BllResult<I_Task> result = baseBll.CreateTask("", type, pall, fromloc, toloc, "WCS手动");
|
||||
if (result.Success)
|
||||
{
|
||||
MessageBox.Show($"手动下发任务成功,任务号:{result.Data.tNo}");
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<DataGridCheckBoxColumn Width="*" Header="满入故障" Binding="{Binding read.Fork1_FullIn}" IsReadOnly="True" />
|
||||
<DataGridCheckBoxColumn Width="*" Header="空出故障" Binding="{Binding read.Fork1_EmptyOut}" IsReadOnly="True" />
|
||||
<DataGridCheckBoxColumn Width="*" Header="取货错故障" Binding="{Binding read.Fork1_PickError}" IsReadOnly="True" />
|
||||
<DataGridCheckBoxColumn Width="*" Header="放货错故障" Binding="{Binding read.Fork1_Allow}" IsReadOnly="True" />
|
||||
<!--<DataGridCheckBoxColumn Width="*" Header="放货错故障" Binding="{Binding read.Fork1_Allow}" IsReadOnly="True" />-->
|
||||
<DataGridTextColumn Foreground ="Black" Width="*" Header="更新时间" Binding="{Binding read.LatTime, StringFormat={}{0:HH:mm:ss}}" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
<DataGrid.Resources>
|
||||
|
||||
@ -526,6 +526,49 @@ namespace WCS_YongFeng
|
||||
|
||||
#endregion
|
||||
|
||||
#region 取货错处理
|
||||
/// <summary>
|
||||
/// 取货错处理
|
||||
/// </summary>
|
||||
/// <param name="wcstaskno"></param>
|
||||
/// <returns></returns>
|
||||
public BllResult PickErrorExcute(string taskno)
|
||||
{
|
||||
var task = App.taskList.FirstOrDefault(a => a.tNo == taskno);
|
||||
if (!string.IsNullOrWhiteSpace(task.tNo_WMS))
|
||||
{
|
||||
ReqTaskFinish reqEmptyOut = new ReqTaskFinish() { TaskNo = task.tNo_WMS, State = 0 };
|
||||
var apiResult = WcsWebApiClient.PickErrorHandle(reqEmptyOut);
|
||||
if (apiResult.Success)
|
||||
{
|
||||
var delResult = TaskDelete(taskno);
|
||||
if (delResult.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteDebug($"取货错处理成功,任务信息{taskno}已恢复");
|
||||
return BllResult.Sucess($"取货错处理成功,任务信息{taskno}已恢复");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogExecute.logNet.WriteError($"取货错处理失败,WCS任务恢复失败,错误原因是{delResult.Msg}");
|
||||
return BllResult.Error($"取货错处理失败,WCS任务恢复失败,错误原因是{delResult.Msg}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogExecute.logNet.WriteError($"请求WMS接口取货错失败,任务号是{taskno},错误原因是{apiResult.Msg}");
|
||||
return BllResult.Error($"请求WMS接口取货错失败,任务号是{taskno},错误原因是{apiResult.Msg}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogExecute.logNet.WriteError($"请求WMS接口取货错失败,WMS无此任务");
|
||||
return BllResult.Error($"请求WMS接口取货错失败,WMS无此任务");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 到达操作任务回传处理
|
||||
/// <summary>
|
||||
|
||||
@ -4,11 +4,11 @@ namespace WCS_YongFeng
|
||||
{
|
||||
public class LogExecute
|
||||
{
|
||||
public static ILogNet logNet = new LogNetDateTime("D:\\Log\\Logs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet SrmlogNet = new LogNetDateTime("D:\\Log\\SrmLogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet ApilogNet = new LogNetDateTime("D:\\Log\\Apilogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet TibcologNet = new LogNetDateTime("D:\\Log\\Tibcologs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet AutoChecklogNet = new LogNetDateTime("D:\\Log\\AutoChecklogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet logNet = new LogNetDateTime("C:\\Log\\Logs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet SrmlogNet = new LogNetDateTime("C:\\Log\\SrmLogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet ApilogNet = new LogNetDateTime("C:\\Log\\Apilogs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet TibcologNet = new LogNetDateTime("C:\\Log\\Tibcologs", GenerateMode.ByEveryDay);
|
||||
public static ILogNet AutoChecklogNet = new LogNetDateTime("C:\\Log\\AutoChecklogs", GenerateMode.ByEveryDay);
|
||||
public static HslCommunication.BasicFramework.SoftNumericalOrder softNumericalOrder = new HslCommunication.BasicFramework.SoftNumericalOrder("", "yyyyMMdd", 4, @"\numericalOrder.txt");
|
||||
|
||||
public LogExecute()
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
public abstract BllResult DeleteTask();
|
||||
|
||||
//public abstract BllResult PickErrorExcute();
|
||||
public abstract BllResult PickErrorExcute();
|
||||
|
||||
//public abstract BllResult PutErrorExcute();
|
||||
|
||||
|
||||
@ -109,7 +109,23 @@ namespace WCS_YongFeng
|
||||
List<I_Task> TAllTask = AllTask.FindAll(a => a.NextState == E_TaskState.堆垛机取货.GetIndexInt()).OrderBy(a => a.tNo).ToList();
|
||||
if (TAllTask.Count != 0 && TAllTask != null)
|
||||
{
|
||||
var sendResult = SendTask(TAllTask[0]);
|
||||
var sendTask = TAllTask[0];
|
||||
|
||||
var loc = App.poseList.First(x => x.wcName == TAllTask[0].EntrancePlace);
|
||||
if (loc.Zpose == 2 || loc.Zpose == 4)
|
||||
{
|
||||
// 找外侧仓位
|
||||
var outLoc = App.poseList.FirstOrDefault(x =>
|
||||
x.Xpose == loc.Xpose
|
||||
&& x.Ypose == loc.Ypose
|
||||
&& loc.Zpose - x.Zpose == 1);
|
||||
var moveTask = AllTask.Find(x => x.EntrancePlace == outLoc?.wcName);
|
||||
if (moveTask != null)
|
||||
{
|
||||
sendTask = moveTask;
|
||||
}
|
||||
}
|
||||
var sendResult = SendTask(sendTask);
|
||||
if (sendResult.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteDebug($"{device.Name}任务下发成功,任务号{TAllTask[0].tNo}");
|
||||
@ -664,6 +680,49 @@ namespace WCS_YongFeng
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取货错处理
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override BllResult PickErrorExcute()
|
||||
{
|
||||
if (vM_SrmRead.Fork1_PickError && vM_SrmRead.SRM_Mode == E_SrmMode.联机.GetIndexInt() && vM_SrmRead.Fork1_State == E_SrmForkState.任务中断.GetIndexInt())
|
||||
{
|
||||
var tasks = App.taskList.ToList().FindAll(a => a.PalletOrBoxNo == vM_SrmWrite.Fork1_Code);
|
||||
if (tasks.Count != 1)
|
||||
{
|
||||
//多条任务
|
||||
LogExecute.logNet.WriteError($"{vM_SrmRead.Name},找到多条空出托盘号{vM_SrmWrite.Fork1_Code}对应的任务");
|
||||
return BllResult.Error($"{vM_SrmRead.Name},找到多条空出托盘号{vM_SrmWrite.Fork1_Code}对应的任务");
|
||||
}
|
||||
else
|
||||
{
|
||||
var emptyoutresult = _bll.PickErrorExcute(tasks[0].tNo);
|
||||
if (!emptyoutresult.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"{vM_SrmRead.Name}取货错处理失败,错误原因是:{emptyoutresult.Msg}。");
|
||||
return BllResult.Error($"{vM_SrmRead.Name}取货错处理失败,错误原因是:{emptyoutresult.Msg}。");
|
||||
}
|
||||
}
|
||||
// 恢复当前任务到初始状态 todo
|
||||
var deleteresult = DeleteTask();
|
||||
if (deleteresult.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteDebug($"{vM_SrmRead.Name}取货错处理成功");
|
||||
return BllResult.Sucess($"{vM_SrmRead.Name},取货错处理成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogExecute.logNet.WriteError($"{vM_SrmRead.Name},取货错删除堆垛机任务失败,请重试,错误原因{deleteresult.Msg}.");
|
||||
return BllResult.Error($"{vM_SrmRead.Name},取货错删除堆垛机任务失败,请重试,错误原因{deleteresult.Msg}.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogExecute.logNet.WriteError($"{vM_SrmRead.Name}取货错处理,未存在取货错错误或未出于联机状态");
|
||||
return BllResult.Error($"{vM_SrmRead.Name}取货错处理,未存在取货错错误或未出于联机状态");
|
||||
}
|
||||
}
|
||||
#endregion 特殊故障处理
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -60,35 +60,6 @@ namespace WCS_YongFeng
|
||||
vM_StationDACK.PalletID = vM_StationDR.PalletID;
|
||||
vM_StationDACK.DeStation = device.ToPoint;
|
||||
|
||||
if (taskresur.ExitPlace == "WareCell")
|
||||
{
|
||||
ReqTaskFinish reqTaskFinish = new ReqTaskFinish()
|
||||
{
|
||||
TaskNo = taskresur.tNo_WMS,
|
||||
State = 10,
|
||||
Height = vM_StationDR.Height
|
||||
};
|
||||
|
||||
//var interfaceresult = WcsWebApiClient.FinishTask(reqTaskFinish);
|
||||
//if (!interfaceresult.Success)
|
||||
//{
|
||||
// LogExecute.logNet.WriteError($"请求仓位时调用WMS接口失败,任务号{taskresur.tNo},高度{vM_StationDR.Height},错误原因{interfaceresult.Msg}");
|
||||
// return BllResult.Error(); ;
|
||||
//}
|
||||
BaseDal<I_Task> _baseDal = new BaseDal<I_Task>();
|
||||
Dictionary<string, object> lstColumnValues = new Dictionary<string, object>();
|
||||
//lstColumnValues.Add("ExitPlace", interfaceresult.Data.LocationCode);
|
||||
lstColumnValues.Add("ExitPlace", "L-01-04-03-01");
|
||||
var updatewarecell = _baseDal.Update(lstColumnValues, a => a.tNo == taskresur.tNo);
|
||||
if (!updatewarecell.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"请求仓位时更新数据库失败,任务号{taskresur.tNo},高度{vM_StationDR.Height},错误原因{updatewarecell.Msg}");
|
||||
return BllResult.Error(); ;
|
||||
}
|
||||
//taskresur.ExitPlace = interfaceresult.Data.LocationCode;
|
||||
taskresur.ExitPlace = "L-01-04-03-01";
|
||||
}
|
||||
|
||||
var pose = App.poseList.FirstOrDefault(a => a.Station == device.Point);
|
||||
if (pose == null)
|
||||
{
|
||||
@ -96,6 +67,56 @@ namespace WCS_YongFeng
|
||||
return BllResult.Sucess();
|
||||
}
|
||||
|
||||
if (taskresur.ExitPlace == "WareCell")
|
||||
{
|
||||
ReqTaskFinish reqTaskFinish = new ReqTaskFinish()
|
||||
{
|
||||
TaskNo = taskresur.tNo_WMS,
|
||||
State = 10,
|
||||
Height = vM_StationDR.Height,
|
||||
InPort = pose.wcName
|
||||
};
|
||||
|
||||
var interfaceresult = WcsWebApiClient.FinishTask(reqTaskFinish);
|
||||
if (!interfaceresult.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"请求仓位时调用WMS接口失败,任务号{taskresur.tNo},高度{vM_StationDR.Height},入库口{reqTaskFinish.InPort},错误原因{interfaceresult.Msg}");
|
||||
vM_StationDACK.MessageID = 6;
|
||||
vM_StationDACK.LoadingStatus = 1;
|
||||
vM_StationDACK.ScannerNr = vM_StationDR.ScannerNr;
|
||||
vM_StationDACK.PalletID = vM_StationDR.PalletID;
|
||||
vM_StationDACK.DeStation = device.BackPoint;
|
||||
var sendtask_send = this.PutWriteAddress();
|
||||
if (sendtask_send.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteDebug($"响应{device.Name}站台地址回退成功,托盘号{vM_StationDR.PalletID} ,目的地{vM_StationDACK.DeStation}");
|
||||
return BllResult.Sucess();
|
||||
}
|
||||
|
||||
return BllResult.Sucess();
|
||||
//return BllResult.Error(); ;
|
||||
}
|
||||
BaseDal<I_Task> _baseDal = new BaseDal<I_Task>();
|
||||
Dictionary<string, object> lstColumnValues = new Dictionary<string, object>();
|
||||
lstColumnValues.Add("ExitPlace", interfaceresult.Data.LocationCode);
|
||||
//lstColumnValues.Add("ExitPlace", "L-01-04-03-01");
|
||||
var updatewarecell = _baseDal.Update(lstColumnValues, a => a.tNo == taskresur.tNo);
|
||||
if (!updatewarecell.Success)
|
||||
{
|
||||
LogExecute.logNet.WriteError($"请求仓位时更新数据库失败,任务号{taskresur.tNo},高度{vM_StationDR.Height},错误原因{updatewarecell.Msg}");
|
||||
return BllResult.Error(); ;
|
||||
}
|
||||
taskresur.ExitPlace = interfaceresult.Data.LocationCode;
|
||||
//taskresur.ExitPlace = "L-01-04-03-01";
|
||||
}
|
||||
|
||||
//var pose = App.poseList.FirstOrDefault(a => a.Station == device.Point);
|
||||
//if (pose == null)
|
||||
//{
|
||||
// LogExecute.logNet.WriteError($"响应{device.Name}站台地址请求失败,未找站台对应的坐标");
|
||||
// return BllResult.Sucess();
|
||||
//}
|
||||
|
||||
BaseDal<I_Task> baseDal = new BaseDal<I_Task>();
|
||||
baseDal.BeginTran();
|
||||
|
||||
|
||||
@ -116,5 +116,15 @@ namespace WCS_YongFeng
|
||||
{
|
||||
return FormPost(reqEmptyOut, "/EmptyOut");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取货错
|
||||
/// </summary>
|
||||
/// <param name = "reqEmptyOut" ></ param >
|
||||
/// < returns ></ returns >
|
||||
public static BllResult PickErrorHandle(ReqTaskFinish reqEmptyOut)
|
||||
{
|
||||
return FormPost(reqEmptyOut, "/PickError");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user