Commit 291c42bb 刘韬

1

1 个父辈 f436ade8
......@@ -26,14 +26,21 @@ namespace OnlineStore.Common
}
var ls = File.ReadAllText(algopnFile);
algopnList = JsonConvert.DeserializeObject<Dictionary<string, string>>(ls);
if (algopnList == null)
algopnList = new Dictionary<string, string>();
}
static void SaveFile()
{
Directory.CreateDirectory(Path.GetDirectoryName(algopnFile));
string s = JsonConvert.SerializeObject(algopnList);
File.WriteAllText(algopnFile, s);
File.Copy(algopnFile, algopnFile + "."+DateTime.Now.ToShortDateString(), true);
File.WriteAllText(algopnFile + ".ready", JsonConvert.SerializeObject(algopnList));
try
{
File.Delete(algopnFile + ".bck");
File.Move(algopnFile, algopnFile + ".bck");
File.Move(algopnFile + ".ready", algopnFile);
}
catch { }
}
public static void Set(string pn, string value, double? finetuning = null)
{
......@@ -42,7 +49,7 @@ namespace OnlineStore.Common
if (string.IsNullOrEmpty(value))
return;
//Common.LOG.Info($"set pnalgo pn:{pn}, algo:{value}, finetuning:{finetuning}");
LogUtil.info($"set pnalgo pn:{pn}, algo:{value}, finetuning:{finetuning}");
if (finetuning != null)
value = value + "," + finetuning.ToString();
......@@ -58,6 +65,7 @@ namespace OnlineStore.Common
{
hasMatch = false;
finetuning = null;
if (algopnList.ContainsKey(pn))
{
hasMatch = true;
......@@ -65,9 +73,10 @@ namespace OnlineStore.Common
if (value.IndexOf(",") > 0)
{
var vs = value.Split(',');
if (double.TryParse(vs[1], out double result))
if (vs.Length == 3 && double.TryParse(vs[2], out double result))
{
value = vs[0];
value = vs[0] + "," + vs[1];
finetuning = result;
}
}
......
......@@ -14,8 +14,7 @@ namespace DeviceLibrary
ZebraPrinterHelper.ZebraManger zebraManger;
string Port;
public PrinterHelper() {
print = new Asa.PrintLabel(Application.StartupPath + "\\Label",300);
print = new Asa.PrintLabel(Application.StartupPath + "\\Label", 300);
}
public bool Connection(string port) {
......@@ -28,7 +27,10 @@ namespace DeviceLibrary
return false;
}
else
{
print = new Asa.PrintLabel(Application.StartupPath + "\\Label", zebraManger.PrinterDPI);
return true;
}
}
public void Close() {
zebraManger.Close();
......
......@@ -302,7 +302,7 @@ namespace DeviceLibrary
}
else {
if (angleblock[180].Count==0)
return rightangle+180;
return rightangle+120;
else
return GetAngleAvg(angleblock[180]);
}
......
......@@ -150,7 +150,7 @@ namespace DeviceLibrary
}
else
{
LogUtil.info($"{wait.AxisInfo.DeviceName},继续上升:{wait.TargetPosition}");
LogUtil.info($"{wait.AxisInfo.Explain},继续上升:{wait.TargetPosition}");
axisBean.AbsMove(null, wait.TargetPosition, wait.TargetSpeed);
wait.IsEnd = false;
}
......
......@@ -59,6 +59,7 @@ namespace DeviceLibrary
{
Setting_Init.Temp_Last_Reel_Height = 8;
}
scantrytimes = 0;
}
else {
Msg.add("点料机放料位没有检测到料盘",MsgLevel.alarm);
......@@ -71,19 +72,21 @@ namespace DeviceLibrary
ScanCode();
CountMoveInfo.log($"开始扫码");
break;
case MoveStep.Count_03:
CountMoveInfo.NextMoveStep(MoveStep.Count_04);
case MoveStep.Count_03:
int retrytime = 0;
retry:
if (RobotManage.XRay.Start())
{
CountMoveInfo.NextMoveStep(MoveStep.Count_04);
CountMoveInfo.log($"打开X光");
CountMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(Setting_Init.XRay_Light_Delay));
return;
}
else {
if (RobotManage.XRay.Start())
{
CountMoveInfo.log($"打开X光第2次");
CountMoveInfo.NextMoveStep(MoveStep.Count_04);
CountMoveInfo.log($"打开X光第{retrytime}次");
CountMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(Setting_Init.XRay_Light_Delay));
return;
}
......@@ -138,8 +141,11 @@ namespace DeviceLibrary
CountMoveInfo.MoveParam.PN = CountMoveInfo.MoveParam.codeInfos.Where(c=>c.CodeStr.StartsWith("AT")).FirstOrDefault()?.CodeStr;
if (string.IsNullOrWhiteSpace(CountMoveInfo.MoveParam.PN)) {
var hc =CountMoveInfo.MoveParam.codeInfos.Where(c => Regex.IsMatch(c.CodeStr, @"(?:@@|-)(AT\w*)(?:@@|-)")).FirstOrDefault()?.CodeStr;
var pn = Regex.Match(hc, "@@(AT\\w*)@@").Groups[1].Value;
CountMoveInfo.MoveParam.PN = pn;
if (!string.IsNullOrEmpty(hc))
{
var pn = Regex.Match(hc, "@@(AT\\w*)@@").Groups[1].Value;
CountMoveInfo.MoveParam.PN = pn;
}
}
//var xx = CountMoveInfo.MoveParam.codeInfos.Find(c=> { return c.CodeStr.StartsWith("S20") && c.CodeType == "barcode"; });
//if (xx != null)
......@@ -280,7 +286,7 @@ namespace DeviceLibrary
IOMove(IO_Type.Counting_Camera_Led, IO_VALUE.HIGH);
var (LastCodeList, filename) = CodeManager.CameraScan(CodeManager.hikNameList);
LogUtil.info("扫码完成:"+ filename);
return (LastCodeList, filename);
}));
}
......
......@@ -197,6 +197,7 @@ namespace DeviceLibrary
case MoveStep.InCarOut_01:
InCarMoveInfo.NextMoveStep(MoveStep.InCarOut_02);
incarProcessFinish = true;
InCarMoveInfo.log($"料串下降到P1点");
Loading_Batch_Axis.AbsMove(InCarMoveInfo, Config.Loading_Batch_Axis_P1, Config.Loading_Batch_Axis_P1_speed);
InCarMoveInfo.WaitList.Add(WaitResultInfo.WaitMsg("料串正在下降", MsgLevel.warning));
......
......@@ -20,6 +20,10 @@ namespace DeviceLibrary
public CarTypeE OutCarType = CarTypeE.None;
public int OutCurrentStringNum = 0;
bool outnewreel = false;
/// <summary>
/// 指示入料车是否已经处理完毕
/// </summary>
bool incarProcessFinish = false;
void OutCarProcess()
{
if (CheckWait(OutCarMoveInfo))
......@@ -73,15 +77,23 @@ namespace DeviceLibrary
case MoveStep.OutCar_03:
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_04);
outnewreel = true;
incarProcessFinish = true;
OutCarMoveInfo.log($"新料串");
break;
case MoveStep.OutCar_04:
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_05);
OutCarMoveInfo.log($"批量轴高速上升到顶部检测点");
BatchAxisToP2(OutCarMoveInfo, Unloading_Batch_Axis, OutGetLowReelCheckIOList(),IO_VALUE.HIGH, Config.Unloading_Batch_Axis_P2, Config.Unloading_Batch_Axis_P1_speed);
var lowlist = OutGetLowReelCheckIOList();
if (lowlist.Length > 0)
{
OutCarMoveInfo.log($"批量轴高速上升到顶部检测点");
BatchAxisToP2(OutCarMoveInfo, Unloading_Batch_Axis, OutGetLowReelCheckIOList(), IO_VALUE.HIGH, Config.Unloading_Batch_Axis_P2, Config.Unloading_Batch_Axis_P1_speed);
}
else {
OutCarMoveInfo.log($"批量轴所有监测点都已Low");
}
break;
case MoveStep.OutCar_05:
var lowlist = OutGetLowReelCheckIOList();
lowlist = OutGetLowReelCheckIOList();
if (Unloading_Batch_Axis.IsInPosition(Config.Unloading_Batch_Axis_P2)) {
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_06);
OutCarMoveInfo.log($"批量轴已到顶,可放料位置有:{string.Join(",", lowlist)}");
......@@ -140,6 +152,10 @@ namespace DeviceLibrary
break;
case MoveStep.OutCarReadyPut:
Msg.add("出口料串放料准备就绪", MsgLevel.info);
if (incarProcessFinish && InMoveInfo.MoveStep == MoveStep.Wait && CountMoveInfo.MoveStep == MoveStep.Wait && OutMoveInfo.MoveStep == MoveStep.Wait) {
OutCarMoveInfo.NextMoveStep(MoveStep.OutCarOut_01);
OutCarMoveInfo.log($"入料车已处理完毕");
}
break;
case MoveStep.OutCarReelPut:
OutCarMoveInfo.NextMoveStep(MoveStep.OutCar_04);
......
......@@ -130,11 +130,17 @@ namespace DeviceLibrary
}else
LogUtil.info("图像平板打开成功");
if (!printerHelper.Connection(Setting_Init.Printer_IP)) {
if (!printerHelper.Connection(Setting_Init.Printer_IP))
{
msg += "标签打印机打开失败" + "\n";
IsLoadOk = false;
}else
}
else
{
LogUtil.info("标签打印机打开成功");
}
LogUtil.info("设备初始化完成");
}
catch (Exception ex) {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!