Commit 043fa856 刘韬

SO1540 FAC_OPL修正

1 个父辈 5d993d2e
......@@ -76,9 +76,15 @@ namespace OnlineStore.Common
[MyConfigComment("超声波传感器液位距离")]
public static MyConfig<int> Device_Liquid_level_distance = 180;
[MyConfigComment("超声波传感器桶底距离")]
public static MyConfig<int> Device_Liquid_Max_distance = 380;
[MyConfigComment("取料检测位置,取料低点p3-偏移量")]
public static MyConfig<int> Device_TinDetect_Offset = 205000;
[MyConfigComment("step by step mode")]
public static MyConfig<bool> Device_step_by_step_mode = false;
[MyConfigComment("打印机IP地址")]
public static MyConfig<string> Printer_IP = "192.168.4.21";
[MyConfigComment("打印机标签模版")]
......
......@@ -295,11 +295,21 @@ namespace OnlineStore.Common
public static string selfAuditException = "selfAuditException";
public static string inDoorStatus= "inDoorStatus";
public static string outDoorStatus= "outDoorStatus";
public static string pauseBuzzer = "pauseBuzzer";
public static string open= "open";
public static string close= "close";
public static string openInLock= "openInLock";
public static string closeInLock = "closeInLock";
public static string closeOutLock = "closeOutLock";
public static string openOutLock = "openOutLock";
public static string D01Status = "D01Status";
public static string D02Status = "D02Status";
public static string D03Status = "D03Status";
public static string openD01 = "openD01";
public static string openD02 = "openD02";
public static string openD03 = "openD03";
public static string closeD01 = "closeD01";
public static string closeD02 = "closeD02";
public static string closeD03 = "closeD03";
}
}
......@@ -23,6 +23,9 @@ namespace DeviceLibrary
}
}
}
public static bool IsOn { get => State == AlarmBuzzerState.ON; }
static AlarmBuzzerState State = AlarmBuzzerState.OFF;
public static event EventHandler<bool> BuzzerStateChange;
public static void SetOnOffAction(Action ona, Action offa)
......
......@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
......@@ -29,6 +30,7 @@ namespace DeviceLibrary
}
int logType = 1000;
string WarnMsg = "";
Dictionary<DateTime, WaitResultInfo> delaymsg = new Dictionary<DateTime, WaitResultInfo>();
public bool CheckWait(MoveInfo MoveInfo)
{
//当等待超过一分钟时,需要打印提示
......@@ -44,11 +46,26 @@ namespace DeviceLibrary
{
isOk = false;
}
foreach (var d in delaymsg.Keys.ToArray())
{
if (d > DateTime.Now)
{
var w = delaymsg[d];
Msg.add("WaitType." + w.WaitType, w.ActionMsg, w.Data);
}
else
{
delaymsg.Remove(d);
}
}
MoveInfo.WaitList.ForEach((w) => {
if (w.WaitType.Equals(WaitEnum.W014_Msg)) {
w.IsEnd = true;
Msg.add("WaitType."+ w.WaitType, w.ActionMsg, w.Data);
if (w.TimeMSeconds > 0)
{
delaymsg.Add(DateTime.Now.AddSeconds(w.TimeMSeconds/1000), w);
}
}
});
foreach (WaitResultInfo wait in MoveInfo.WaitList.ToArray())
......
......@@ -59,12 +59,12 @@ namespace DeviceLibrary
//}
if (RobotManage.dauxiKS107.Distance < Setting_Init.Device_Liquid_level_distance) {
Msg.add(crc.GetString("Res0163.f6ad5099","冷凝液回收桶已满"), MsgLevel.warning);
Msg.add(crc.GetString("Res0163.f6ad5099","冷凝液回收桶已满"), MsgLevel.alarm);
}
if (IOValue(IO_Type.Airpressure_Check).Equals(IO_VALUE.LOW)) {
Msg.add(crc.GetString("Res0079","未检测到气压信号."), MsgLevel.warning);
Msg.add(crc.GetString("Res0079","未检测到气压信号."), MsgLevel.alarm);
}
//airprocess();
......
......@@ -248,6 +248,10 @@ namespace DeviceLibrary
{
return false;
}
if (IOValue(IO_Type.ElecDoor_Check).Equals(IO_VALUE.LOW))
{
return false;
}
if (IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.HIGH))
{
return false;
......@@ -372,6 +376,7 @@ namespace DeviceLibrary
public void Stop() {
mstart = false;
AutoInOutTest = false;
ServerCM.storeStatus = StoreStatus.None;
ServerCM.StopConnectServer();
Thread.Sleep(300);
Alarm(AlarmType.None);
......@@ -506,7 +511,22 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
Msg.add("printdoor",crc.GetString("Res0134","打印机维护门未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "D03" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add("printdoor", crc.GetString("Res0134", "打印机维护门未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
}
if (IOValue(IO_Type.ElecDoor_Check).Equals(IO_VALUE.LOW))
{
if (!IgnoreSafecheck)
{
ok = false;
DeviceSuddenStop();
}
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "D04" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add("printdoor", crc.GetString("Res0134", "打印机维护门未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
}
if (IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.HIGH))
{
......@@ -515,6 +535,9 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "D01" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add("leftsafedoor",crc.GetString("Res0097","左侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
}
if (IOValue(IO_Type.RightDoor_Check).Equals(IO_VALUE.HIGH))
......@@ -524,11 +547,17 @@ namespace DeviceLibrary
ok = false;
DeviceSuddenStop();
}
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "D02" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add("rightsafedoor", crc.GetString("Res0098","右侧防护门没有关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
}
if (IOValue(IO_Type.SafeDoor_Disable).Equals(IO_VALUE.LOW) && IOValue(IO_Type.DoorLock_Check).Equals(IO_VALUE.LOW))
{
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "D01,D02" + crc.GetString("Res0184.9246169f","上锁失败") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add(crc.GetString("Res0135","防护门没有锁定"), MsgLevel.warning);
DeviceSuddenStop();
ok = false;
......@@ -536,12 +565,18 @@ namespace DeviceLibrary
if (StoreMoveInfo.MoveStep != MoveStep.Wait && IOValue(IO_Type.Entry_Drawer_Lock).Equals(IO_VALUE.LOW))
{
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "P01" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add(crc.GetString("Res0164.37b8d13a","出入库时请关好入库抽屉"), MsgLevel.alarm);
DeviceSuddenStop();
ok = false;
}
if (StoreMoveInfo.MoveStep != MoveStep.Wait && StoreMoveInfo.MoveStep < MoveStep.StoreOut14 && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.LOW))
{
if (Setting_Init.Module_No == Module_SO.SO21637)
Msg.add("printdoor", "P02" + crc.GetString("Res0183.781c71a4","未关闭") + (ok ? ignorestring : ""), MsgLevel.alarm);
else
Msg.add(crc.GetString("Res0165.970b4edb","出入库时请关好出库抽屉"), MsgLevel.alarm);
DeviceSuddenStop();
ok = false;
......
......@@ -206,6 +206,8 @@ namespace DeviceLibrary
LabelingMoveInfo.NextMoveStep(MoveStep.Labeling09);
RotateEquip.TurnToEnd(false);
LabelingMoveInfo.log("滚动回位");
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
break;
case MoveStep.Labeling09:
if (RotateEquip.WaitStatus(null))
......
......@@ -177,6 +177,8 @@ namespace DeviceLibrary
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
LabelingMoveInfo.NewMove(MoveStep.Labeling01);
StoreMoveInfo.log($"等待贴标完成");
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
}
else
{
......@@ -214,6 +216,8 @@ namespace DeviceLibrary
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn04);
StoreMoveInfo.log($"收到完成贴标");
ServerCM.SendStoreState(StoreMoveInfo.MoveParam.PosID, StoreStatus.InStoreExecute);
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
}
}
else
......@@ -239,11 +243,16 @@ namespace DeviceLibrary
case MoveStep.StoreIn05:
if (!boxTransport.IsComplateOrFree)
break;
Setting_Init.Runtime_Step = Runtime_StepE.None;
if (StoreMoveInfo.MoveParam.usedCount == 0 && !Setting_Init.Device_Disable_RFID_Check || Setting_Init.Module_No.Val == Module_SO.SO21637)
{
if (StoreMoveInfo.MoveParam.RFID.Length > 16)
StoreMoveInfo.MoveParam.RFID = StoreMoveInfo.MoveParam.RFID.Substring(0, 16);
StoreMoveInfo.Msg(crc.GetString("Res0185.7b3d057f","正在写入RFID"), MsgLevel.info);
ServerCM.RfidMsg = crc.GetString("Res0185.7b3d057f", "正在写入RFID");
bool writeok = false;
var r=RobotManage.RFID.ReOpen();
var r1=RobotManage.RFID2?.ReOpen();
......@@ -300,7 +309,7 @@ namespace DeviceLibrary
if (!writeok)
{
var of = i * 2000 * (i % 2 == 0 ? 1 : -1);
var of = i * 3000 * (i % 2 == 0 ? 1 : -1);
var zp = Z_Axis.GetAclPosition() + of;
var yp = Y_Axis.GetAclPosition() + of;
var zt = Z_Axis.AbsMoveASYNC(zp, Config.Z_Axis_P1_speed);
......@@ -309,7 +318,8 @@ namespace DeviceLibrary
}
//Thread.Sleep(100);
}
if (!writeok) {
if (!writeok)
{
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn08);
StoreMoveInfo.MoveParam.ReelOnFixture = true;
StoreMoveInfo.MoveParam.IsNg = true;
......@@ -317,8 +327,18 @@ namespace DeviceLibrary
StoreMoveInfo.log($"RFID 写入失败 NG");
ServerCM.cancelPutInTask("", StoreMoveInfo.MoveParam.WareCode);
Z_Axis.AbsMove(StoreMoveInfo, Config.Z_Axis_P1, Config.Z_Axis_P1_speed);
StoreMoveInfo.Msg(crc.GetString("Res0186.7faa6f6b","RFID 写入失败"), MsgLevel.info, 5);
ServerCM.RfidMsg = crc.GetString("Res0186.7faa6f6b", "RFID 写入失败");
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
return;
}
else
{
StoreMoveInfo.Msg(crc.GetString("Res0187.6b2d7028","RFID 写入成功"), MsgLevel.info, 5);
ServerCM.RfidMsg = crc.GetString("Res0187.6b2d7028", "RFID 写入成功");
}
}
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn09);
from = CSVPositionReader<ACStorePosition>.GetPositon(RFIDP);
......@@ -327,6 +347,9 @@ namespace DeviceLibrary
StoreMoveInfo.MoveParam.ReelOnFixture = true;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.InStore, true);
StoreMoveInfo.log($"开始转运到入库位置");
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
break;
case MoveStep.StoreIn06:
StoreMoveInfo.NextMoveStep(MoveStep.StoreIn07);
......@@ -409,6 +432,8 @@ namespace DeviceLibrary
StoreMoveInfo.NewMove(MoveStep.StoreIn01);
else
StoreMoveInfo.NewMove(MoveStep.Wait);
ServerCM.RfidMsg = "";
break;
case MoveStep.StoreOut10:
if (IOValue(IO_Type.Out_Drawer).Equals(IO_VALUE.HIGH) && IOValue(IO_Type.Out_Drawer_Lock).Equals(IO_VALUE.HIGH))
......@@ -566,7 +591,8 @@ namespace DeviceLibrary
StoreMoveInfo.MoveParam.ReelOnFixture = true;
boxTransport.Start(new BoxStorePosition(Config, from, StoreMoveInfo.MoveParam), new BoxStorePosition(Config, to, StoreMoveInfo.MoveParam), StoreMoveType.OutStore, true);
if (Setting_Init.Device_step_by_step_mode)
RobotManage.UserPause();
}
break;
case MoveStep.StoreOut12:
......
......@@ -136,9 +136,9 @@ namespace DeviceLibrary
LogUtil.error(msg);
}
}
public void Msg(string msg, MsgLevel msgLevel)
public void Msg(string msg, MsgLevel msgLevel, int keepsec = 0)
{
WaitList.Add(WaitResultInfo.WaitMsg(msg, msgLevel));
WaitList.Add(WaitResultInfo.WaitMsg(msg, msgLevel, keepsec));
}
}
......@@ -222,11 +222,12 @@ namespace DeviceLibrary
wait.ActionMsg = msg;
return wait;
}
public static WaitResultInfo WaitMsg(string msg, MsgLevel msgLevel)
public static WaitResultInfo WaitMsg(string msg, MsgLevel msgLevel, int keepsec=0)
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = WaitEnum.W014_Msg;
wait.ActionMsg = msg;
wait.TimeMSeconds = keepsec*1000;
wait.IsEnd = true;
wait.Data = msgLevel;
return wait;
......
......@@ -150,7 +150,7 @@ namespace OnlineStore.LoadCSVLibrary
for (int i = 0; i < array.Length; i++)
{
string title = array[i];
if (cvsTitleList.Contains(title))
//if (cvsTitleList.Contains(title))
{
titleIndex.Add(title, i);
}
......
......@@ -52,6 +52,7 @@ DI,0,锡膏定位翻转水平端,Tin_Dock_Flip_Horizontal,28,HC,X28,,,,,,,,,,
DI,0,锡膏定位翻转垂直端,Tin_Dock_Flip_Vertical,29,HC,X29,,,,,,,,,,
DI,0,锡膏定位旋转水平端,Tin_Dock_Rotate_Horizontal,30,HC,X30,,,,,,,,,,
DI,0,锡膏定位旋转垂直端,Tin_Dock_Rotate_Vertical,31,HC,X31,,,,,,,,,,
DI,0,电器柜门禁,ElecDoor_Check,32,HC,X32,,,,,,,,,,
,,,,,,,,,,,,,,,,
DO,0,自动指示灯,AuroRun_Led,0,HC,Y00,,,,,,,,,,
DO,0,故障指示灯,Alarm_Led,1,HC,Y01,,,,,,,,,,
......
......@@ -263,7 +263,7 @@ namespace OnlineStore.LoadCSVLibrary
string value = array[csvIndex];
if (value.Equals(position.PositionNum))
{
string newValue = PostionToString(position, titleIndex, proTitleMap);
string newValue = PostionToString(position, titleIndex, proTitleMap, array);
lines[index] = newValue;
return WriteCSVFile(filePath, lines);
}
......@@ -274,13 +274,13 @@ namespace OnlineStore.LoadCSVLibrary
return true;
}
private static string PostionToString(StorePostionBase position, Dictionary<string, int> titleIndex, Dictionary<string, string> proTitleMap)
private static string PostionToString(StorePostionBase position, Dictionary<string, int> titleIndex, Dictionary<string, string> proTitleMap, string[] oldline)
{
//取得属性集合
PropertyInfo[] props = typeof(T).GetProperties();
List<string> cvsTitleList = new List<string>(proTitleMap.Values);
List<string> propertyList = new List<string>(proTitleMap.Keys);
String[] array = new String[titleIndex.Count];
String[] array = oldline.ToArray();
foreach (string proName in proTitleMap.Keys)
{
PropertyInfo prop = props.First(c => c.Name == proName);//获取同名属性
......
......@@ -52,6 +52,10 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
public static string RightDoor_Check = "RightDoor_Check";
/// <summary>
/// DI,0,电器柜门禁,RightDoor_Check,32,HC,X32,,,,,,,,,,
/// </summary>
public static string ElecDoor_Check = "ElecDoor_Check";
/// <summary>
/// DI,0,门禁锁定监控,DoorLock_Check,6,HC,X06,,,,,,,,,,
/// </summary>
public static string DoorLock_Check = "DoorLock_Check";
......
......@@ -74,12 +74,14 @@ namespace TheMachine
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.error(e.ToString());
LogUtil.error("CurrentDomain_UnhandledException:" + e.ToString());
LogUtil.error("CurrentDomain_UnhandledException:" + e.ExceptionObject.ToString());
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
LogUtil.error(e.ToString());
LogUtil.error("Application_ThreadException:" + e.ToString());
LogUtil.error("Application_ThreadException:" + e.Exception.ToString());
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!