|
@@ -140,6 +140,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
void bindingsource(DataGridView dgv, DataTable dt)
|
|
|
{
|
|
|
+ dgv.AutoGenerateColumns = false;
|
|
|
dgv.DataSource = null;
|
|
|
dgv.DataSource = dt;
|
|
|
//if (dgv.InvokeRequired)
|
|
@@ -400,7 +401,7 @@ namespace UAS_LabelMachine
|
|
|
string pib_outboxcode2 = "";
|
|
|
|
|
|
int BoxNum = LabelInfDataTable.Select("pib_outboxcode2='" + OutBoxNum.Text + "'").Length;
|
|
|
- //if (!ConnectToMachine)
|
|
|
+ if (ConnectToMachine)
|
|
|
{
|
|
|
if (BoxNum + CodeCount > OutboxCapacity.Value && AutoSetOutBox.Checked)
|
|
|
{
|
|
@@ -422,9 +423,8 @@ namespace UAS_LabelMachine
|
|
|
io = new ItemObject("全部", "全部");
|
|
|
OutBoxNum.Items.Add(io);
|
|
|
io = new ItemObject(pib_outboxcode2, pib_outboxcode2);
|
|
|
- PassSixTenCount = 1;
|
|
|
OutBoxNum.Items.Add(io);
|
|
|
-
|
|
|
+ PassSixTenCount = 1;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
string piboutboxcode2 = dt.Rows[i]["pib_outboxcode2"].ToString();
|
|
@@ -450,7 +450,6 @@ namespace UAS_LabelMachine
|
|
|
pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
|
|
|
}
|
|
|
OutBoxNum.Items.Clear();
|
|
|
- PassSixTenCount = 1;
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2) desc", "select");
|
|
|
ItemObject io = new ItemObject("新增", "新增");
|
|
|
OutBoxNum.Items.Add(io);
|
|
@@ -458,6 +457,7 @@ namespace UAS_LabelMachine
|
|
|
OutBoxNum.Items.Add(io);
|
|
|
io = new ItemObject(pib_outboxcode2, pib_outboxcode2);
|
|
|
OutBoxNum.Items.Add(io);
|
|
|
+ PassSixTenCount = 1;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
string piboutboxcode2 = dt.Rows[i]["pib_outboxcode2"].ToString();
|
|
@@ -474,38 +474,38 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // if (OutBoxNum.Text == "新增")
|
|
|
- // {
|
|
|
- // string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(to_number(pib_outboxcode2))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
- // //如果没有则从开始插入
|
|
|
- // if (maxoutbox == "")
|
|
|
- // {
|
|
|
- // pib_outboxcode2 = "1";
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // pib_outboxcode2 = OutBoxNum.Text;
|
|
|
- // }
|
|
|
- // if (!AutoPrintOutBox.Checked)
|
|
|
- // {
|
|
|
- // if (BoxNum + CodeCount > OutboxCapacity.Value)
|
|
|
- // {
|
|
|
- // string close = MessageBox.Show(this.ParentForm, "箱号【" + OutBoxNum.Text + "】后超数量为" + (BoxNum + CodeCount) + ",超出容量" + OutboxCapacity.Value + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
- // if (close != "Yes")
|
|
|
- // {
|
|
|
- // Input.SelectAll();
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (OutBoxNum.Text == "新增")
|
|
|
+ {
|
|
|
+ string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(to_number(pib_outboxcode2))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
+ //如果没有则从开始插入
|
|
|
+ if (maxoutbox == "")
|
|
|
+ {
|
|
|
+ pib_outboxcode2 = "1";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pib_outboxcode2 = (int.Parse(maxoutbox) + 1).ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pib_outboxcode2 = OutBoxNum.Text;
|
|
|
+ }
|
|
|
+ if (!AutoPrintOutBox.Checked)
|
|
|
+ {
|
|
|
+ if (BoxNum + CodeCount > OutboxCapacity.Value)
|
|
|
+ {
|
|
|
+ string close = MessageBox.Show(this.ParentForm, "箱号【" + OutBoxNum.Text + "】后超数量为" + (BoxNum + CodeCount) + ",超出容量" + OutboxCapacity.Value + ",是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
+ if (close != "Yes")
|
|
|
+ {
|
|
|
+ Input.SelectAll();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (OutBoxNum.Text == "全部")
|
|
|
{
|
|
|
MessageBox.Show("请选择指定箱号或者新增");
|
|
@@ -1101,45 +1101,54 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- //如果有选中行
|
|
|
- if (SelectRowIndex >= 0 && LabelInf.Rows.Count > SelectRowIndex)
|
|
|
+ try
|
|
|
{
|
|
|
- MidOutBoxCode.Clear();
|
|
|
- MidOutBoxCodeIndex.Clear();
|
|
|
- SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
|
|
|
- for (int i = SelectRowIndex; i >= 0; i--)
|
|
|
+ //如果有选中行
|
|
|
+ if (SelectRowIndex >= 0 && LabelInf.Rows.Count > SelectRowIndex)
|
|
|
{
|
|
|
- if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
|
|
|
+ MidOutBoxCode.Clear();
|
|
|
+ MidOutBoxCodeIndex.Clear();
|
|
|
+ SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
|
|
|
+ for (int i = SelectRowIndex; i >= 0; i--)
|
|
|
{
|
|
|
- LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
|
|
|
- if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
|
|
|
{
|
|
|
- MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
- MidOutBoxCodeIndex.Add(i);
|
|
|
+ LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
|
|
|
+ if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ {
|
|
|
+ MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
+ MidOutBoxCodeIndex.Add(i);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
|
|
|
- {
|
|
|
- if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
|
|
|
- {
|
|
|
- LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
|
|
|
- if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ else
|
|
|
{
|
|
|
- MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
- MidOutBoxCodeIndex.Add(i);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ for (int i = SelectRowIndex; i < LabelInf.Rows.Count - 1; i++)
|
|
|
{
|
|
|
- break;
|
|
|
+ if ((LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_midifprint"].FormattedValue.ToString().ToLower() != "true") || i == SelectRowIndex)
|
|
|
+ {
|
|
|
+ LabelInf.Rows[i].Cells["pib_midifprint"].Value = true;
|
|
|
+ if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ {
|
|
|
+ MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
+ MidOutBoxCodeIndex.Add(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MessageBox.Show(e.Message);
|
|
|
+ LogManager.DoLog(e.Message + e.StackTrace);
|
|
|
+ return;
|
|
|
+ }
|
|
|
try
|
|
|
{
|
|
|
MidBoxCodePrint(MidOutBoxCodeIndex.ToArray());
|
|
@@ -1147,6 +1156,7 @@ namespace UAS_LabelMachine
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
MessageBox.Show(e.Message);
|
|
|
+ LogManager.DoLog(e.Message + e.StackTrace);
|
|
|
return;
|
|
|
}
|
|
|
return;
|
|
@@ -1963,22 +1973,22 @@ namespace UAS_LabelMachine
|
|
|
string maxnum = "";
|
|
|
if (ReSetType != " ")
|
|
|
{
|
|
|
- maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
|
|
|
+ maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'", "update of rmn_maxnumber nowait").ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ").ToString();
|
|
|
+ maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ", "update of rmn_maxnumber nowait").ToString();
|
|
|
}
|
|
|
//设置当前流水
|
|
|
if (maxnum == "")
|
|
|
{
|
|
|
if (ReSetType != " ")
|
|
|
{
|
|
|
- maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'").ToString();
|
|
|
+ maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and nvl(rmn_type,' ')='" + ReSetType + "'", "update of rmn_maxnumber nowait").ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ").ToString();
|
|
|
+ maxnum = dh.getFieldDataByConditionForUpdate("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (NrCode == "" ? "Default" : NrCode) + "' and rmn_prefix='" + Prefix + "' ", "update of rmn_maxnumber nowait").ToString();
|
|
|
}
|
|
|
if (maxnum == "")
|
|
|
{
|