Commit 5ddaf0ae LN

增加入料照明

增加条码解析
增加接口代码
IO模块更新。
1 个父辈 ae2be12f
...@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient ...@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient
private void btnScan_Click(object sender, EventArgs e) private void btnScan_Click(object sender, EventArgs e)
{ {
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.LeftCamera, equipBean.Name); equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string msg = CodeManager.ProcessCode(LastCodeList); List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.LeftCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:\r\n" + msg); LogUtil.info(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:" + msg); MessageBox.Show(equipBean.Name + "[" + equipBean.Config.LeftCamera + "]扫码测试结果:" + msg);
} }
...@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient ...@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient
private void btnRScan_Click(object sender, EventArgs e) private void btnRScan_Click(object sender, EventArgs e)
{ {
List<string> LastCodeList = CodeManager.CameraScan(equipBean.Config.RightCamera, equipBean.Name); equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
string msg = CodeManager.ProcessCode(LastCodeList); List<string> LastCodeList = CodeManager.CameraScan(equipBean.Name,equipBean.Config.RightCamera );
string msg = CodeManager.GetValidCode(LastCodeList);
equipBean.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
LogUtil.info(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:\r\n" + msg); LogUtil.info(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:\r\n" + msg);
MessageBox.Show(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:" + msg); MessageBox.Show(equipBean.Name + "[" + equipBean.Config.RightCamera + "]扫码测试结果:" + msg);
} }
......
...@@ -12,3 +12,10 @@ ...@@ -12,3 +12,10 @@
4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。 4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。
去掉X56 去掉X56
20200526
增加入料照明
增加条码解析
增加接口代码
IO模块更新。
\ No newline at end of file \ No newline at end of file
...@@ -71,19 +71,14 @@ namespace OnlineStore.Common ...@@ -71,19 +71,14 @@ namespace OnlineStore.Common
} }
} }
return true; return true;
} }
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static string Post(string url, string paramData, int timeOut = 10000)
public static string Post(string url, string paramData, int timeOut = 2000)
{ {
return Post(url, paramData, Encoding.UTF8, timeOut); return Post(url, paramData, Encoding.UTF8, timeOut);
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open); private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string Post(string url, string paramData, Encoding encoding, int timeOut = 2000) public static string Post(string url, string paramData, Encoding encoding, int timeOut = 10000)
{ {
//if (PingURLIP(url, 100).Equals(false))
//{
// return "";
//}
if (isLog == 1) if (isLog == 1)
{ {
LogUtil.info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + paramData + "】 ");
......
...@@ -25,10 +25,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,10 +25,10 @@ namespace OnlineStore.DeviceLibrary
private InputEquip Robot private InputEquip Robot
{ {
get { return RobotManager.robot.inputEquip; } get { return RobotManager.robot.inputEquip; }
} }
public BatchMoveBean(InputEquip_Config config, AxisBean axis, int inType = 1) public BatchMoveBean(InputEquip_Config config, AxisBean axis, int inType = 1)
{ {
this.EquipType = inType; this.EquipType = inType;
this.BatchAxis = axis; this.BatchAxis = axis;
string ioAdd = "L_"; string ioAdd = "L_";
...@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
{ {
StopMove(); StopMove();
} }
MoveInfo.NewMove(RobotMoveType.Reset, StepEnum.IBR01_LocationDown); MoveInfo.NewMove(RobotMoveType.Reset, StepEnum.IBR01_LocationDown);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
WorkLog("开始复位,定位气缸下降"); WorkLog("开始复位,定位气缸下降");
LocationDown(MoveInfo); LocationDown(MoveInfo);
...@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
if (Robot.IOValue(IO_LineIn_Check).Equals(Robot.IOValue(IO_LineEnd_Check))) if (Robot.IOValue(IO_LineIn_Check).Equals(Robot.IOValue(IO_LineEnd_Check)))
{ {
LineStop(); LineStop();
MoveInfo.NextMoveStep( StepEnum.IBR03_BatchHome); MoveInfo.NextMoveStep(StepEnum.IBR03_BatchHome);
WorkLog("复位:批量轴开始回原点"); WorkLog("复位:批量轴开始回原点");
BatchAxis.HomeMove(MoveInfo); BatchAxis.HomeMove(MoveInfo);
} }
...@@ -173,8 +173,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -173,8 +173,8 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.IBR04_WaitTime); MoveInfo.NextMoveStep(StepEnum.IBR04_WaitTime);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(100));
// WorkLog("复位:顶升气缸下降"); // WorkLog("复位:顶升气缸下降");
// LocationDown(MoveInfo); // LocationDown(MoveInfo);
} }
else if (MoveInfo.IsStep(StepEnum.IBR04_WaitTime)) else if (MoveInfo.IsStep(StepEnum.IBR04_WaitTime))
{ {
...@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.SuddenStop(); BatchAxis.SuddenStop();
} }
public DateTime LastAlarmTime = DateTime.Now; public DateTime LastAlarmTime = DateTime.Now;
public AlarmType alarmType = AlarmType.None; public AlarmType alarmType = AlarmType.None;
internal void Alarm(AlarmType alarmType) internal void Alarm(AlarmType alarmType)
{ {
...@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示 //当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - moveInfo.LastSetpTime; TimeSpan span = DateTime.Now - moveInfo.LastSetpTime;
string NotOkMsg = ""; string NotOkMsg = "";
bool isOk = !moveInfo.OneWaitCanEndStep; bool isOk = !moveInfo.OneWaitCanEndStep;
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in list)
{ {
if (wait.IsEnd) if (wait.IsEnd)
...@@ -369,7 +369,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -369,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
isOk = false; isOk = false;
WarnMsg = Name + msg; WarnMsg = Name + msg;
Alarm(AlarmType.AxisMoveError); Alarm(AlarmType.AxisMoveError);
LogUtil.error(WarnMsg, DeviceID * 1000 + 14); LogUtil.error(WarnMsg, DeviceID * 1000 + 14);
break; break;
...@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary
} }
else if (wait.WaitType.Equals(WaitEnum.W002_IOValue)) else if (wait.WaitType.Equals(WaitEnum.W002_IOValue))
{ {
NotOkMsg = " [" + IOManager.GetDI(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]"; NotOkMsg = " [" + IOManager.GetIO(wait.IoType, Robot.DeviceID).DisplayStr + "=" + wait.IoValue + "]";
wait.IsEnd = Robot. IOValue(wait.IoType).Equals(wait.IoValue); wait.IsEnd = Robot.IOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd) if (!wait.IsEnd)
{ {
...@@ -417,19 +417,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -417,19 +417,20 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(msg); LogUtil.error(msg);
} }
} }
} }
} }
else if (wait.WaitType.Equals(WaitEnum.W003_Time)) else if (wait.WaitType.Equals(WaitEnum.W003_Time))
{ {
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds); wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove)) }
else if (wait.WaitType.Equals(WaitEnum.W101_BatchAxisMove))
{ {
//等待信号亮或者走到绝对位置才停止 //等待信号亮或者走到绝对位置才停止
if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue)) if (Robot.IOValue(BatchAxis.TargetIoType).Equals(BatchAxis.TargetIoValue))
{ {
LogUtil.debug(Name + "CheckWaitResult 检测到" + BatchAxis.TargetIoType + "=" + BatchAxis.TargetIoValue + ",停止运行"); LogUtil.debug(Name + "CheckWaitResult 检测到" + BatchAxis.TargetIoType + "=" + BatchAxis.TargetIoValue + ",停止运行");
BatchAxis.AxisStopCheckMove(); BatchAxis.AxisStopCheckMove();
if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1)) if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(1))
{ {
BatchAxis.SuddenStop(); BatchAxis.SuddenStop();
...@@ -437,14 +438,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -437,14 +438,15 @@ namespace OnlineStore.DeviceLibrary
wait.IsEnd = true; wait.IsEnd = true;
} }
else else
{ {
if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0)) if (ACServerManager.GetBusyStatus(wait.AxisInfo.DeviceName, wait.AxisInfo.GetAxisValue()).Equals(0))
{ {
BatchAxis.AxisStopCheckMove(); BatchAxis.AxisStopCheckMove();
wait.IsEnd = true; wait.IsEnd = true;
} }
} }
}else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode)) }
else if (wait.WaitType.Equals(WaitEnum.W102_FeedScanCode))
{ {
if (LastCodeList.Count > 0) if (LastCodeList.Count > 0)
{ {
...@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary
} }
public string GetMoveStr()
{
string code = MoveInfo.MoveParam != null ? MoveInfo.MoveParam.WareCode : "";
return MoveInfo.MoveType + " " + MoveInfo.MoveStep + " " + code + "\n";
}
} }
} }
...@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode)) else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{ {
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK); MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料串入料 :扫码结束,等待取料机构来取料"); MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
WorkLog("料串入料 :扫码结束【"+ MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
} }
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave)) else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{ {
...@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理"); LogUtil.error(Name + "当前状态:" + MoveInfo.MoveType + ",GetTrayOK暂不处理");
} }
} }
internal string GetCurrCode() //internal string LCodeStr = "";
{ //internal string GetCurrCode()
string code = CodeManager.ProcessCode(LastCodeList); //{
return code; // return LCodeStr = CodeManager.GetValidCode(LastCodeList);
} //}
private void FI_21_BatchAxisDown() private void FI_21_BatchAxisDown()
{ {
...@@ -273,13 +274,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -273,13 +274,14 @@ namespace OnlineStore.DeviceLibrary
try try
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{ {
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
NextCodeList = CodeManager.CameraScan(CameraName, Name); NextCodeList = CodeManager.CameraScan(Name, CameraName );
if (NextCodeList.Count <= 0) if (NextCodeList.Count <= 0)
{ {
NextCodeList = CodeManager.CameraScan(CameraName, Name); NextCodeList = CodeManager.CameraScan(Name, CameraName);
} }
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return NextCodeList; return NextCodeList;
}); });
} }
...@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary
if (NextCodeList.Count > 0) if (NextCodeList.Count > 0)
{ {
WorkLog("料盘移栽 :开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList); LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>(); NextCodeList = new List<string>();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK); MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
WorkLog("料盘移栽 :上料横移取料端"); WorkLog("料盘移栽 :使用预扫码【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料");
//WorkLog("料盘移栽 :上料横移取料端");
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take); // CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
} }
else if (isScan) else if (isScan)
...@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary
{ {
Task<List<string>> scanTask = Task.Factory.StartNew(delegate Task<List<string>> scanTask = Task.Factory.StartNew(delegate
{ {
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastCodeList = CodeManager.CameraScan(CameraName, Name); LastCodeList = CodeManager.CameraScan(Name, CameraName);
if (LastCodeList.Count <= 0) if (LastCodeList.Count <= 0)
{ {
LastCodeList = CodeManager.CameraScan(CameraName, Name); LastCodeList = CodeManager.CameraScan(Name, CameraName);
} }
Robot.IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return LastCodeList; return LastCodeList;
}); });
} }
...@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
if (LastHeight <= 8) { LastHeight = 8; } if (LastHeight <= 8) { LastHeight = 8; }
string code = CodeManager.ProcessCode(LastCodeList); string code = CodeManager.GetValidCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】"; string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + code + "】";
LogUtil.info(msg); LogUtil.info(msg);
return LastHeight; return LastHeight;
......
...@@ -240,12 +240,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,12 +240,14 @@ namespace OnlineStore.DeviceLibrary
{ {
//若左侧或右侧在等待扫码结束的状态,需要开始去取料 //若左侧或右侧在等待扫码结束的状态,需要开始去取料
if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
StartWorking(new WorkParam(1, 0, LeftBatchMove.GetCurrCode())); string code = LeftBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(1, 0, code));
} }
else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
StartWorking(new WorkParam(2, 0, RightBatchMove.GetCurrCode())); string code = RightBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(2, 0, code));
} }
} }
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm()) if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm())
...@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary
{ {
msg+= "\n"; msg+= "\n";
} }
msg += "左侧上料 :" + LeftBatchMove.MoveInfo.MoveType + " "+LeftBatchMove.MoveInfo.MoveStep + "\n"; msg += "左侧上料 :" + LeftBatchMove.GetMoveStr()+"\n";
msg += "右侧上料:" + RightBatchMove.MoveInfo.MoveType + " " + RightBatchMove.MoveInfo.MoveStep + "\n"; msg += "右侧上料:" + RightBatchMove.GetMoveStr() + "\n";
return msg; return msg;
} }
} }
......
...@@ -189,14 +189,40 @@ namespace OnlineStore.DeviceLibrary ...@@ -189,14 +189,40 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW10_SaveSize)) else if (MoveInfo.IsStep(StepEnum.IW10_SaveSize))
{ {
MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition); MoveInfo.NextMoveStep(StepEnum.IW11_GetTargetPosition);
if (MoveInfo.MoveParam.TargetPosType.Equals(0)) MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (SServerManager.CanConnect())
{ {
if (DefautTargetP > 0) Task task = Task.Factory.StartNew(delegate {
{ bool outNeed = false;
MoveInfo.MoveParam.TargetPosType = DefautTargetP; string msg = SServerManager.Get_VMICheckRLC(Name, MoveInfo.MoveParam.WareCode, out outNeed);
if (!msg.Equals(""))
{
WorkLog(" 【"+ MoveInfo.MoveParam.WareCode + "】获取是否测值失败:" + msg);
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg;
}else if (outNeed)
{
MoveInfo.MoveParam.TargetPosType = 2;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】需要测值" );
}else
{
MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】无需测值,开始点料");
}
});
}
else
{
if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{
if (DefautTargetP > 0)
{
MoveInfo.MoveParam.TargetPosType = DefautTargetP;
}
} }
WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr());
} }
WorkLog(" 根据条码获取目标位置:" + MoveInfo.MoveParam.ToStr());
} }
#endregion #endregion
...@@ -204,11 +230,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -204,11 +230,25 @@ namespace OnlineStore.DeviceLibrary
{ {
if (MoveInfo.MoveParam.TargetPosType.Equals(0)) if (MoveInfo.MoveParam.TargetPosType.Equals(0))
{ {
//随机目标地址 if (SServerManager.CanConnect())
Random r = new Random(); {
int targetP = r.Next(1, 100) % 3 + 1; if (MoveInfo.IsTimeOut(120))
MoveInfo.MoveParam.TargetPosType = targetP; {
WorkLog(" 随机放料目标:" + targetP); WarnMsg = Name + "等待" + MoveInfo.MoveParam.WareCode + "验证是否测值 超时[" + MoveInfo.TimeOutSeconds + "]秒";
LogUtil.error(Name + WarnMsg);
Alarm(AlarmType.IoSingleTimeOut);
}
return;
}
else
{
//随机目标地址
Random r = new Random();
int targetP = r.Next(1, 100) % 3 + 1;
MoveInfo.MoveParam.TargetPosType = targetP;
WorkLog(" 随机放料目标:" + targetP);
}
} }
if (MoveInfo.MoveParam.TargetPosType.Equals(1)) if (MoveInfo.MoveParam.TargetPosType.Equals(1))
{ {
...@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut); MoveInfo.NextMoveStep(StepEnum.IW24_WaitCanPut);
WorkLog(" 放料到XRay:等待XRay可放料"); WorkLog(" 放料到XRay:等待XRay可放料");
MoveInfo.TimeOutSeconds = 120;
//TODO //TODO
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_InLine_Check, IO_VALUE.LOW));
...@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut)) else if (MoveInfo.IsStep(StepEnum.IW24_WaitCanPut))
{ {
MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax); MoveInfo.NextMoveStep(StepEnum.IW41_Clamping_Relax);
RobotManager.robot.XrayBean.In_ReelInfo = new ReelInfo(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH); RobotManager.robot.XrayBean.In_ReelInfo = MoveInfo.MoveParam.GetReelInfo();
WorkLog(" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr()); WorkLog(" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:" + RobotManager.robot.XrayBean.In_ReelInfo.ToStr());
CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax); CylinderMove(MoveInfo, IO_Type.Clamping_Work, IO_Type.Clamping_Relax);
} }
......
...@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OBR02_CylinderBack)) else if (ShelfMoveInfo.IsStep(StepEnum.OBR02_CylinderBack))
{ {
ShelfMoveInfo.NextMoveStep(StepEnum.OBR03_LineRun); ; ShelfMoveInfo.NextMoveStep(StepEnum.OBR03_LineRun); ;
ShelfWorkLog(" :链条先转动3秒钟,横移电机停止"); ShelfWorkLog(" :链条先转动8秒钟,横移电机停止");
IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.O_WLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH); IOMove(IO_Type.O_ELine_Run, IO_VALUE.HIGH);
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(3000)); ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW); IOMove(IO_Type.O_SWLine_Run, IO_VALUE.LOW);
} }
else if (ShelfMoveInfo.IsStep(StepEnum.OBR03_LineRun)) else if (ShelfMoveInfo.IsStep(StepEnum.OBR03_LineRun))
...@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary
msg += "贴标状态:" + SecMoveInfo.MoveType + " " + SecMoveInfo.MoveStep + "\n"; msg += "贴标状态:" + SecMoveInfo.MoveType + " " + SecMoveInfo.MoveStep + "\n";
msg += "料串状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n"; msg += "料串状态:" + ShelfMoveInfo.MoveType + " " + ShelfMoveInfo.MoveStep + "\n";
//msg += "料盘信息:" + MoveInfo.MoveParam.ToStr() + " \r\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n"; // msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
msg += "当前料串:" + WorkShelfId + ",累积出料 "+OutReelCount+" 盘共 "+OutReelHeight+" mm \r\n"; msg += "当前料串:" + WorkShelfId + ",累积出料 "+OutReelCount+" 盘共 "+OutReelHeight+" mm \r\n";
msg += "打印机["+RobotManager.PrintName+"]:" + RobotManager.LastPrintStatus + "\n"; msg += "打印机["+RobotManager.PrintName+"]:" + RobotManager.LastPrintStatus + "\n";
if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
{
msg += "当前料盘:" + MoveInfo.MoveParam.OutStr() + " \r\n";
}
return msg; return msg;
} }
......
...@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk)) else if (SecMoveInfo.IsStep(StepEnum.OL04_PrintOk))
{ {
bool isPrintOk = RobotManager.LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle); bool isPrintOk = RobotManager.LastPrintStatus.Equals(Asa.PrintLabel.PrinterStatus.Idle);
bool isTimeOut = SecMoveInfo.IsTimeOut(120); bool isTimeOut = SecMoveInfo.IsTimeOut(30);
if (isPrintOk || isTimeOut) if (isPrintOk || isTimeOut)
{ {
SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack); SecMoveInfo.NextMoveStep(StepEnum.OL05_TakeBack);
......
...@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XW12_EndCount); MoveInfo.NextMoveStep(StepEnum.XW12_EndCount);
if (Work_ReelInfo.WareCount <= 0) if (Work_ReelInfo.WareCount <= 0)
{ {
MoveInfo.MoveParam.WareCount = 99999;
Work_ReelInfo.WareCount = 99999; Work_ReelInfo.WareCount = 99999;
} }
WorkLog("料盘处理:点料结束,关闭X关机互锁信号"); WorkLog("料盘处理:点料结束,关闭X关机互锁信号");
IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW); IOMove(IO_Type.X_Lock_On, IO_VALUE.LOW);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
Task.Factory.StartNew(delegate {
SServerManager.Return_Material(Name, MoveInfo.MoveParam.WareCode, Work_ReelInfo.WareCount);
});
} }
#endregion #endregion
else if (MoveInfo.IsStep(StepEnum.XW12_EndCount)) else if (MoveInfo.IsStep(StepEnum.XW12_EndCount))
{ {
MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel); MoveInfo.NextMoveStep(StepEnum.XW21_WaitOutNoReel);
MoveInfo.TimeOutSeconds = 120;
WorkLog("料盘处理:等待出口无料盘"); WorkLog("料盘处理:等待出口无料盘");
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.LOW));
} }
...@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
{ {
MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime); MoveInfo.NextMoveStep(StepEnum.XW25_WaitTime);
WorkLog("料盘处理:清空 Work_ReelInfo,更新 再转动3秒"); WorkLog("料盘处理:清空 Work_ReelInfo,更新 再转动3秒");
Out_ReelInfo = new ReelInfo(Work_ReelInfo.WareCode, Work_ReelInfo.PlateW, Work_ReelInfo.PlateH, Work_ReelInfo.WareCount); Out_ReelInfo = Work_ReelInfo.GetReelInfo();
Work_ReelInfo = new ReelInfo(); Work_ReelInfo = new ReelInfo();
IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.X_MLine_Run, IO_VALUE.HIGH);
IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH); IOMove(IO_Type.X_OLine_Run, IO_VALUE.HIGH);
......
...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static void LoadCamera(bool isReLoad) private static void LoadCamera(bool isReLoad)
{ {
if (isReLoad|| Camera._cam==null) if (isReLoad || Camera._cam == null)
{ {
try try
{ {
...@@ -59,13 +59,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -59,13 +59,13 @@ namespace OnlineStore.DeviceLibrary
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
Camera.Type = CameraType.HIK; Camera.Type = CameraType.HIK;
Camera._cam.Load(); Camera._cam.Load();
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("加载HIK相机出错:", ex); LogUtil.error("加载HIK相机出错:", ex);
} }
} }
string[] names = Camera._cam.Name; string[] names = Camera._cam.Name;
...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.info("加载到HIK相机:" + name); LogUtil.info("加载到HIK相机:" + name);
} }
} }
} }
public static void CloseCamera(string cameraName) public static void CloseCamera(string cameraName)
...@@ -92,22 +92,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -92,22 +92,17 @@ namespace OnlineStore.DeviceLibrary
Camera._cam.Close(cameraName); Camera._cam.Close(cameraName);
} }
public static void CloseAllCamera() public static void CloseAllCamera()
{
Camera._cam.CloseAll();
}
public static List<string> CameraScan(string camera, string deviceName, bool findRightCodeBreak = false)
{ {
List<string> cameraList = new List<string>(); Camera._cam.CloseAll();
cameraList.Add(camera);
return CameraScan(cameraList, deviceName, findRightCodeBreak);
} }
private static int ScanCount = 0;
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount); private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, bool findRightCodeBreak = false) public static List<string> CameraScan( string deviceName ,params string[] cameraList)
{ {
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
if (cameraList == null || cameraList.Count <= 0) if (cameraList == null || cameraList.Length <= 0)
{ {
return codeList; return codeList;
} }
...@@ -120,23 +115,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -120,23 +115,23 @@ namespace OnlineStore.DeviceLibrary
continue; continue;
} }
ScanCount++; ScanCount++;
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
if (deviceName != "") if (deviceName != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片"); LogUtil.debug (deviceName + " 【" + cameraName + "】开始取图片");
} }
HalconDotNet.HObject ho_Image = null; HalconDotNet.HObject ho_Image = null;
bool findRightCode = false;
try try
{ {
ho_Image = Camera._cam.CaptureOnImage(cameraName); ho_Image = Camera._cam.CaptureOnImage(cameraName);
if (ho_Image == null) if (ho_Image == null)
{ {
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机"); LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName); CloseCamera(cameraName);
continue; continue;
} }
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码"); LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>(); List<CodeInfo> cc = new List<CodeInfo>();
string r = ""; string r = "";
...@@ -157,18 +152,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -157,18 +152,10 @@ namespace OnlineStore.DeviceLibrary
if (!codeList.Contains(str)) if (!codeList.Contains(str))
{ {
codeList.Add(str); codeList.Add(str);
r = r + "##" + str; r = r + "##" + str;
if (!findRightCode)
{
findRightCode = IsRightCode(str);
}
} }
} }
if (findRightCodeBreak&&findRightCode)
{
break;
}
} }
if (String.IsNullOrEmpty(r)) if (String.IsNullOrEmpty(r))
{ {
...@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findRightCode + "]" + ScanCount + " :" + r); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】" + ScanCount + " :" + r);
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
...@@ -190,13 +177,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,13 +177,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString()); LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
} }
finally finally
{ {
if (ho_Image != null) if (ho_Image != null)
{ {
ho_Image.Dispose(); ho_Image.Dispose();
} }
} }
} }
} }
catch (AccessViolationException e) catch (AccessViolationException e)
{ {
...@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetCodeParamFilePath(string codePath) public static string GetCodeParamFilePath(string codePath)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
...@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary ...@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary
message = asciiEncoding.GetString(newBytes.ToArray()); message = asciiEncoding.GetString(newBytes.ToArray());
return message; return message;
} }
public static string ProcessCode(List<string> codeList) private static bool IsRightCode(string code)
{
//分号分割后长度=4,L,E,B,R
try
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
{
if (strarray[0].StartsWith("L") &&
strarray[1].StartsWith("E") &&
strarray[2].StartsWith("B") &&
strarray[3].StartsWith("R"))
{
return true;
}
}
}
catch (Exception ex)
{
}
return false;
}
public static string GetValidCode(List<string> codeList)
{ {
string code = ""; string code = "";
List<string> targetCode = new List<string>();
foreach (string cc in codeList) foreach (string cc in codeList)
{ {
if (string.IsNullOrEmpty(cc)) if (string.IsNullOrEmpty(cc))
...@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary ...@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary
} }
code += cc + "##"; code += cc + "##";
} }
return ReplaceCode(code); code = ReplaceCode(code);
if (String.IsNullOrEmpty(code))
{
return "";
}
foreach (string cc in codeList)
{
if (string.IsNullOrEmpty(cc))
{
continue;
}
string rCode = ReplaceCode(cc);
//L0000000000360K003732; E20200311 0365; B6D.49925.551014212020031105000; R014212020031103159##B29
string[] codearray = code.Split(';');
if (codearray.Length >= 4)
{
if (codearray[2].StartsWith("B") && codearray[2].Length >= 13 && codearray[3].StartsWith("R"))
{
string tc = codearray[2].Substring(1, 12) + ";" + codearray[3];
if (!targetCode.Contains(tc))
{
targetCode.Add(tc);
}
}
}
}
if (targetCode.Count == 1)
{
LogUtil.info("解析条码【" + code + "】结果【" + targetCode[0] + "】");
return targetCode[0];
}
else if (targetCode.Count <= 0)
{
LogUtil.info("解析条码【" + code + "】失败:未找到有效条码");
}
else
{
LogUtil.info("解析条码【" + code + "】失败:有多个(" + targetCode.Count + ")有效条码");
}
return "";
} }
} }
} }
...@@ -17,59 +17,93 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,59 +17,93 @@ namespace OnlineStore.DeviceLibrary
//http://10.85.17.233/ReturnOne/WebServiceF.asmx?op=Return_Material //http://10.85.17.233/ReturnOne/WebServiceF.asmx?op=Return_Material
private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx?op=VMICheckRLC"; private static string Addr_VMICheckRLC = "/ESMTCommonInterface/CommonService.asmx?op=VMICheckRLC";
private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx?op=Return_Material"; private static string Addr_Return_Material = "/ReturnOne/WebServiceF.asmx?op=Return_Material";
public static string Get_VMICheckRLC(string deviceName, string codeStr, out bool need) public static string Get_VMICheckRLC(string deviceName, string codeStr, out bool need)
{ {
//reelID:
//partNum:
//{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
need = false; need = false;
string msg = ""; string msg = "";
try try
{ {
if (String.IsNullOrEmpty(codeStr)) string[] codeArray = codeStr.Split(';');
if (codeArray.Length != 2)
{ {
return msg = deviceName + "未扫到条码"; return msg = deviceName + "【" + codeStr + "】未找到有效条码";
} }
Dictionary<string, string> paramMap = new Dictionary<string, string>(); Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("reelID", codeArray[1]);
paramMap.Add("barcode", codeStr);// barcode = 扫到的条码 paramMap.Add("partNum", codeArray[0]);
string server = GetAddr(Addr_VMICheckRLC, paramMap); string server = GetAddr(Addr_VMICheckRLC, paramMap);
if (server.Equals(""))
{
return "获取到测值结果失败";
}
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, ""); string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Get_VMICheckRLC " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】"); LogUtil.info("Get_VMICheckRLC " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
//返回: { "code": 0, "msg":"ok", data: 7} //{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr); CheckData dataResult = JsonHelper.DeserializeJsonToObject<CheckData>(resultStr);
if (dataResult == null)
{
return "获取到测值结果失败";
}
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("不需要"))
{
need = false;
return "";
}
else if (dataResult.status.Equals(1) && dataResult.IFneed.Equals("需要"))
{
need = true;
return "";
}
else
{
need = false;
return msg;
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(deviceName + " ", ex); LogUtil.error(deviceName + " ", ex);
return ex.ToString();
} }
return "";
} }
public static string Return_Material(string deviceName, string barcode, int count) public static string Return_Material(string deviceName, string codeStr, int count)
{ {
// Parameter Value
//txtQty:
// txtReelId:
string msg = ""; string msg = "";
try try
{ {
if (String.IsNullOrEmpty(barcode)) string[] codeArray = codeStr.Split(';');
if (codeArray.Length != 2)
{ {
return msg; return msg = deviceName + "【" + codeStr + "】未找到有效条码";
} }
Dictionary<string, string> paramMap = new Dictionary<string, string>(); Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("barcode", barcode); paramMap.Add("txtQty", count.ToString());
paramMap.Add("count", count.ToString()); paramMap.Add("txtReelId", codeArray[1]);
string server = GetAddr(Addr_Return_Material, paramMap); string server = GetAddr(Addr_Return_Material, paramMap);
if (server.Equals(""))
{
return "";
}
DateTime startTime = DateTime.Now; DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, ""); string resultStr = HttpHelper.Post(server, "");
LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】"); LogUtil.info("Return_Material " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// 返回: { "code": 0, "msg":"ok", "data":""}
ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr); // ServerData serverResult = JsonHelper.DeserializeJsonToObject<ServerData>(resultStr);
if (!msg.Equals("")) if (!msg.Equals(""))
{ {
...@@ -85,7 +119,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -85,7 +119,11 @@ namespace OnlineStore.DeviceLibrary
private static string GetAddr(string addr, Dictionary<string, string> paramsMap) private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{ {
string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr); string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr).Trim();
if (server.Equals(""))
{
return "";
}
if (server.EndsWith("/")) if (server.EndsWith("/"))
{ {
server = server.Substring(0, server.Length - 1); server = server.Substring(0, server.Length - 1);
...@@ -100,135 +138,22 @@ namespace OnlineStore.DeviceLibrary ...@@ -100,135 +138,22 @@ namespace OnlineStore.DeviceLibrary
return path; return path;
} }
private static string spiltStr = "##"; private static string server = ConfigAppSettings.GetValue(Setting_Init.ServerAddr).Trim();
public static string ProcessCodeList(List<string> codeList) public static bool CanConnect()
{ {
string codeStr = ""; return !String.IsNullOrEmpty(server);
List<string> list = new List<string>();
foreach (string str in codeList)
{
if (list.Contains(str.Trim()) || String.IsNullOrEmpty(str.Trim()))
{
continue;
}
codeStr = codeStr + str.Trim() + spiltStr;
}
return codeStr;
} }
//// 分盘料/紧急料放上料串或料串时调用 /rest/api/qisda/device/afterPutCut
//private static string Addr_afterPutCut = "/rest/api/qisda/device/afterPutCut";
//public static string afterPutCut(string deviceName, string rfid, string barcode, string cid, int rfidLoc, out TaskData afterData)
//{
// afterData = null;
// string msg = "";
// try
// {
// //参数:
// //cid: 料仓cid,流水线可传入空
// //barcode : 条码
// //rfid : RFID
// //rfidLoc: 料串位置,流水线可传-1
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("barcode", barcode); // 参数: barcode=料盘的条码
// paramMap.Add("rfid", rfid); // rfid = 料串的RFID信息
// paramMap.Add("rfidLoc", rfidLoc.ToString()); // rfidLoc=料串的架位信息
// paramMap.Add("cid", cid); // 料仓cid,流水线可传入空
// string server = GetAddr(Addr_afterPutCut, paramMap);
// DateTime startTime = DateTime.Now;
// string resultStr = HttpHelper.Post(server, "");
// if (barcode != "")
// {
// LogUtil.info(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// }
// else
// {
// LogUtil.debug(deviceName + "afterPutCut " + FormUtil.GetSpanStr(DateTime.Now - startTime) + " 【" + server + "】【" + resultStr + "】");
// }
// //> 返回:
// //>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
// //>>
// //>> - code: 0为正常,其他为异常,
// //>> - msg:消息,
// //>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
// //>> - cutPackageTask: 表示当前包装仓的分盘任务数
// //>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
// //>> - cutTask: 表示流水线分盘任务数
// //>> - urgentTask: 表示流水线紧急料任务数
// AfterPutData serverResult = JsonHelper.DeserializeJsonToObject<AfterPutData>(resultStr);
// if (serverResult == null)
// {
// return msg = deviceName + "afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】没有收到服务器反馈";
// }
// else if (serverResult.code.Equals(0).Equals(false))
// {
// return msg = deviceName + " afterPutCut【 " + barcode + "】【" + rfid + "】【" + rfidLoc + "】 :" + serverResult.msg;
// }
// afterData = serverResult.data;
// return "";
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " " + ex.ToString());
// }
// return msg;
//}
} }
public class ServerData public class CheckData
{ {
//{"code":0,"msg":"ok","data":"7"} //{"data":{"IFneed":"不需要","iftest":"","component":"","msg":"不需要测量RLC","status":1}}
public int code { get; set; } public int IFneed { get; set; }
public string iftest { get; set; }
public string component { get; set; }
public string msg { get; set; } public string msg { get; set; }
public int status { get; set; }
public string data { get; set; }
} }
//public class AfterPutData
//{
// //>>` {"code": 0, "msg":"ok", "data":{"cutPackageTask":"0","urgentPackageTask":"20","cutTask":"21","urgentTask":"22"}} `
// //>>
// //>> - code: 0为正常,其他为异常,
// //>> - msg:消息,
// //>> - data:为包装料仓的空闲仓位数(key为与客户端一致的料仓标识, value为空闲仓位)
// //>> - cutPackageTask: 表示当前包装仓的分盘任务数
// //>> - urgentPackageTask: 表示当前包装仓的紧急料任务数
// //>> - cutTask: 表示流水线分盘任务数
// //>> - urgentTask: 表示流水线紧急料任务数
// public int code { get; set; }
// public string msg { get; set; }
// public TaskData data { get; set; }
//}
//public class TaskData
//{
// /// <summary>
// /// urgentPackageTask: 表示当前包装仓的紧急料任务数
// /// </summary>
// public int urgentPackageTask { get; set; }
// /// <summary>
// /// cutPackageTask: 表示当前包装仓的分盘任务数
// /// </summary>
// public int cutPackageTask { get; set; }
// /// <summary>
// /// cutTask: 表示流水线分盘任务数
// /// </summary>
// public int cutTask { get; set; }
// /// <summary>
// /// urgentTask: 表示流水线紧急料任务数
// /// </summary>
// public int urgentTask { get; set; }
// public string ToStr()
// {
// return "[分盘料=" + cutTask + "][紧急料=" + urgentTask+"]";
// }
//}
} }
...@@ -26,24 +26,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,24 +26,16 @@ namespace OnlineStore.DeviceLibrary
this.PlateH = plateH; this.PlateH = plateH;
this.IsTest = test; this.IsTest = test;
} }
/// <summary>
/// 物品二维码信息
/// </summary>
public string WareCode = ""; public string WareCode = "";
/// <summary> /// <summary>
/// 当前状态 /// 当前状态
/// </summary> /// </summary>
public int TrayStatus = -1; public int TrayStatus = -1;
/// <summary>
/// 料盘高度
/// </summary>
public int PlateH = 0; public int PlateH = 0;
/// <summary>
/// 料盘宽度
/// </summary>
public int PlateW = 0; public int PlateW = 0;
/// <summary> /// <summary>
...@@ -60,11 +52,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -60,11 +52,9 @@ namespace OnlineStore.DeviceLibrary
/// 目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层 /// 目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层
/// </summary> /// </summary>
public int TargetPosType = 0; public int TargetPosType = 0;
/// <summary>
/// 取料时判断是否是NG料
/// </summary>
public bool IsNgReel = false; public bool IsNgReel = false;
public string NgMsg = "";
/// <summary> /// <summary>
/// 是否是测试步骤 /// 是否是测试步骤
/// </summary> /// </summary>
...@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary
} }
public string OutStr() public string OutStr()
{ {
return "[" + WareCode + "]:[" + PlateW + "]X[" + PlateH + "][" + WareCount + "]"; return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] [" + WareCount + "]" + (IsNgReel ? "[NG料:" + NgMsg + "]" : "") + "";
} }
public int Get_Inout_P2(InputEquip_Config config) public int Get_Inout_P2(InputEquip_Config config)
{ {
...@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary
this.PlateW = reel.PlateW; this.PlateW = reel.PlateW;
this.WareCode = reel.WareCode; this.WareCode = reel.WareCode;
this.WareCount = reel.WareCount; this.WareCount = reel.WareCount;
this.IsNgReel = reel.IsNgReel;
this.NgMsg = reel.NgMsg;
}
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
} }
} }
...@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary
public class ReelInfo public class ReelInfo
{ {
public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0) public ReelInfo(string code = "", int plateW = 7, int plateH = 8,int count=0,bool IsNg=false,string msg="")
{ {
this.WareCode = code; this.WareCode = code;
this.PlateH = plateH; this.PlateH = plateH;
this.PlateW = plateW; this.PlateW = plateW;
this.WareCount = count; this.WareCount = count;
this.IsNgReel = IsNg;
this.NgMsg = msg;
} }
/// <summary> /// <summary>
/// 物品二维码信息 /// 物品二维码信息
...@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary
public int WareCount = 0; public int WareCount = 0;
public bool IsNgReel = false;
public string NgMsg = "";
public string ToStr() public string ToStr()
{ {
return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]"; return "[" + WareCode + "] [ " + PlateW + "X" + PlateH + " ] ["+WareCount+"]"+(IsNgReel?"[NG料:"+NgMsg+"]":"")+"";
} }
public ReelInfo GetReelInfo()
{
ReelInfo reel = new ReelInfo(WareCode, PlateW, PlateH, WareCount, IsNgReel, NgMsg);
return reel;
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!