Commit 3f2df859 刘韬

修正入库库位格式判断

1 个父辈 5072d6b6
...@@ -594,11 +594,6 @@ namespace OnlineStore.AutoInOutStore ...@@ -594,11 +594,6 @@ namespace OnlineStore.AutoInOutStore
} }
} }
} }
int addSpeed = 0;
int delSpeed = 0;
int HomeHighSpeed = 0;
int HomeLowSpeed = 0;
int HomeAddSpeed = 0;
private void btnSavePosition_Click(object sender, EventArgs e) private void btnSavePosition_Click(object sender, EventArgs e)
...@@ -716,7 +711,7 @@ namespace OnlineStore.AutoInOutStore ...@@ -716,7 +711,7 @@ namespace OnlineStore.AutoInOutStore
private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed) private void AxisABSMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{ {
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, addSpeed, delSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed, moveAxis.AddSpeed, moveAxis.DelSpeed);
} }
private void btnUpDownP1_Click(object sender, EventArgs e) private void btnUpDownP1_Click(object sender, EventArgs e)
{ {
......
...@@ -9,7 +9,7 @@ using System.Runtime.InteropServices; ...@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO815-AutoInOutStore-newui 8085497464b826c220b36d5ffe07195ff287ff2a")] [assembly: AssemblyProduct("SO815-AutoInOutStore-newui 5072d6b64fa922fb976758170e2bcb644ff8bf92")]
[assembly: AssemblyCopyright("edf7e3d07d3c8cafa890a08f4b855e559a36d414")] [assembly: AssemblyCopyright("edf7e3d07d3c8cafa890a08f4b855e559a36d414")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
......
...@@ -13,6 +13,7 @@ using System.IO; ...@@ -13,6 +13,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static OnlineStore.AutoInOutStore.ResourceCulture; using static OnlineStore.AutoInOutStore.ResourceCulture;
...@@ -114,20 +115,53 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -114,20 +115,53 @@ namespace OnlineStore.ACSingleStore.useControl
public int row; public int row;
public int col; public int col;
} }
int PosCompare(string a, string b) { int PosCompare(string a, string b)
if (a.StartsWith("fix") || b.StartsWith("fix")) {
if (a.StartsWith("fix"))
return -1; return -1;
if (b.StartsWith("fix"))
return 1;
string[] pa = a.Split('_'); string[] pa = a.Split('_');
string[] pb = b.Split('_'); string[] pb = b.Split('_');
if (pa[1].Length == 1) if (int.TryParse(pa[1], out _))
pa[1] += "A"; pa[1] += "A";
if (pb[1].Length == 1) if (int.TryParse(pb[1], out _))
pb[1] += "A"; pb[1] += "A";
var isa = pa[1][0]+(pa[1][1].Equals('A') ? "1" : "2") + pa[2][0] + pa[3].PadLeft(2, '0');
var isb = pb[1][0]+(pb[1][1].Equals('A') ? "1" : "2") + pb[2][0] + pb[3].PadLeft(2, '0');
var pa1 = pa[1][0] + (pa[1][1].Equals('A') ? "1" : "2");
var pb1 = pb[1][0] + (pb[1][1].Equals('A') ? "1" : "2");
var pa2 = pa[2];
var pb2 = pb[2];
if (pa[2].Length == 2)
{
if (pa[2][1].Equals('A') || pa[2][1].Equals('B'))
{
pa2 = (pa[2][1].Equals('A') ? "1" : "2") + pa[2][0];
}
else if (pa[2][1].Equals('1') || pa[2][1].Equals('2'))
{
pa2 = (pa[2][1].Equals('1') ? "1" : "2") + pa[2][0];
}
}
if (pb[2].Length == 2)
{
if ((pb[2][1].Equals('A') || pb[2][1].Equals('B')))
{
pb2 = (pb[2][1].Equals('A') ? "1" : "2") + pb[2][0];
}
else if ((pb[2][1].Equals('1') || pb[2][1].Equals('2')))
{
pb2 = (pb[2][1].Equals('1') ? "1" : "2") + pb[2][0];
}
}
var isa = Regex.Replace(pa[1], @"[^\d]*", "") + pa1 + pa2 + pa[3].PadLeft(2, '0');
var isb = Regex.Replace(pb[1], @"[^\d]*", "") + pb1 + pb2 + pb[3].PadLeft(2, '0');
if (int.Parse(isa) == int.Parse(isb)) if (int.Parse(isa) == int.Parse(isb))
return 0; return 0;
...@@ -184,7 +218,10 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -184,7 +218,10 @@ namespace OnlineStore.ACSingleStore.useControl
//store.PositionNumList.Reverse(); //store.PositionNumList.Reverse();
string[] posstr = store.PositionNumList[store.PositionNumList.Count-1].Split('_'); string[] posstr = store.PositionNumList[store.PositionNumList.Count-1].Split('_');
int colcount = int.Parse(posstr[1][0].ToString())+1; int colcount = 0;
if (!int.TryParse(posstr[1],out colcount))
colcount= int.Parse(posstr[1][0].ToString());
colcount++;
for (int i = 0; i < colcount; i++) for (int i = 0; i < colcount; i++)
{ {
dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A"); dataGridView1.Columns.Add("Col" + i + "_A", "Col" + i + "_A");
...@@ -207,11 +244,21 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -207,11 +244,21 @@ namespace OnlineStore.ACSingleStore.useControl
if (posname.StartsWith("fix")) if (posname.StartsWith("fix"))
continue; continue;
string[] _posstr = posname.Split('_'); string[] _posstr = posname.Split('_');
int col = int.Parse(_posstr[1][0].ToString()); int col = 0;
if (!int.TryParse(_posstr[1],out col))
col = int.Parse(_posstr[1][0].ToString());
string ab = "A"; string ab = "A";
if (_posstr[1].Length>1) if (_posstr[2].Length > 1)
ab = _posstr[1][1].ToString(); ab = _posstr[2][1].ToString();
if (ab != "A" && ab != "B")
{
if (ab == "1")
ab = "A";
else if (ab == "2")
ab = "B";
else
ab = "A";
}
if (col != lastcol || lastAB!= ab) if (col != lastcol || lastAB!= ab)
currentRowIndex = 0; currentRowIndex = 0;
...@@ -235,6 +282,24 @@ namespace OnlineStore.ACSingleStore.useControl ...@@ -235,6 +282,24 @@ namespace OnlineStore.ACSingleStore.useControl
currentRowIndex++; currentRowIndex++;
} }
dataGridView1.Rows.RemoveAt(dataGridView1.Rows.Count - 1); dataGridView1.Rows.RemoveAt(dataGridView1.Rows.Count - 1);
for (int i = 0; i < dataGridView1.Columns.Count; i++)
{
if (dataGridView1.Rows[0].Cells[i].Value == null)
{
dataGridView1.Columns[i].Width = 0;
}
}
if (dataGridView1.Rows[0].Cells[dataGridView1.Columns.Count - 1].Value != null)
{
dataGridView1.Rows[0].Cells[dataGridView1.Columns.Count - 1].Selected = true;
}
else if (dataGridView1.Rows[0].Cells[dataGridView1.Columns.Count - 2].Value != null)
{
dataGridView1.Rows[0].Cells[dataGridView1.Columns.Count - 2].Selected = true;
}
if (dataGridView1.SelectedCells.Count > 0)
setData(dataGridView1.SelectedCells[0].Tag.ToString());
} }
void setData(string posid) { void setData(string posid) {
AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(posid); AutoStorePosition ktkPosition = CSVPositionReader<AutoStorePosition>.GetPositon(posid);
......
...@@ -2007,15 +2007,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -2007,15 +2007,15 @@ namespace OnlineStore.DeviceLibrary
int plateW = Convert.ToInt32(plateWArray[index]); int plateW = Convert.ToInt32(plateWArray[index]);
int plateH = Convert.ToInt32(plateHArray[index]); int plateH = Convert.ToInt32(plateHArray[index]);
bool isSingleOut = singleOutArray[index].ToLower().Equals("true"); bool isSingleOut = singleOutArray[index].ToLower().Equals("true");
string[] posArray = posId.Split('#'); //string[] posArray = posId.Split('#');
if (posArray.Length != 2) //if (posArray.Length != 2)
{ //{
//WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreError, "出库格式错误:") + "【" + posId + "】"; // //WarnMsg = StoreName + ResourceControl.GetString(ResourceControl.OutStoreError, "出库格式错误:") + "【" + posId + "】";
SetWarnMsgAndLog(ResourceControl.OutStoreError, posId); // SetWarnMsgAndLog(ResourceControl.OutStoreError, posId);
//LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误"); // //LogUtil.error(LOGGER, "收到服务器出库命令:库位号【" + posId + "】格式错误");
continue; // continue;
} //}
int storeId = int.Parse(posArray[0]); //int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId); AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
......
...@@ -576,14 +576,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -576,14 +576,14 @@ namespace OnlineStore.DeviceLibrary
int plateH = Convert.ToInt32(data[ParamDefine.plateH]); int plateH = Convert.ToInt32(data[ParamDefine.plateH]);
string singleOut = data[ParamDefine.singleOut]; string singleOut = data[ParamDefine.singleOut];
//bool isSingleOut = singleOut.ToLower().Equals("true"); //bool isSingleOut = singleOut.ToLower().Equals("true");
string[] posArray = posId.Split('#'); //string[] posArray = posId.Split('#');
if (!(posArray.Length == 2)) //if (!(posArray.Length == 2))
{ //{
SetWarnMsgAndLog(ResourceControl.InStoreError, message, posId); // SetWarnMsgAndLog(ResourceControl.InStoreError, message, posId);
return null; // return null;
} //}
int storeId = int.Parse(posArray[0]); //int storeId = int.Parse(posArray[0]);
//根据发送的posId获取位置列表 //根据发送的posId获取位置列表
AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId); AutoStorePosition position = CSVPositionReader<AutoStorePosition>.GetPositon(posId);
if (position == null) if (position == null)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!