|
|
@@ -10,7 +10,6 @@ using UAS_LabelMachine.PublicMethod;
|
|
|
using UAS_LabelMachine.Entity;
|
|
|
using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
|
-using System.Globalization;
|
|
|
using FastReport;
|
|
|
using System.Linq;
|
|
|
|
|
|
@@ -352,7 +351,7 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode where pi_id='" + PI_ID + "' and pd_prodcode='" + CurrentPrCode + "' and pd_pdno='" + CurrentPDNO + "'");
|
|
|
dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE" }, PIBID, CustBarCode.ToArray());
|
|
|
//更新流水号
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum) + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (MaxNum) + "'", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'");
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
|
//加载完数据之后进行容量的判断
|
|
|
int BoxNum = LabelInfDataTable.Select("pib_outboxcode2='" + OutBoxNum.Text + "'").Length;
|
|
|
@@ -373,26 +372,6 @@ namespace UAS_LabelMachine
|
|
|
//采集达到了数量进行换行
|
|
|
if (CollectQty == double.Parse(CurrentPrCount))
|
|
|
{
|
|
|
- //for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
- //{
|
|
|
- // string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
|
|
|
- // string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
|
|
|
- // //采集之前的行,如后续行有物料编号相同的并且编号较大的跳到这样
|
|
|
- // if (GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString() == CurrentPrCode && double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
- // {
|
|
|
- // if (int.Parse(GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString()) > int.Parse(CurrentPDNO))
|
|
|
- // {
|
|
|
- // GridPrcode.Rows[i].Selected = true;
|
|
|
- // if (i - 1 > 0)
|
|
|
- // GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
|
|
|
- // else
|
|
|
- // GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
- // Input.Clear();
|
|
|
- // OutBoxNum_Click(new object(), new EventArgs());
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
|
|
|
if (selectrow.Count > 0)
|
|
|
{
|
|
|
@@ -403,7 +382,6 @@ namespace UAS_LabelMachine
|
|
|
if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
{
|
|
|
GridPrcode.Rows[selectrow[0].Index + 1].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = selectrow[0].Index + 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -569,8 +547,8 @@ namespace UAS_LabelMachine
|
|
|
if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
{
|
|
|
GridPrcode.Rows[i].Selected = true;
|
|
|
- if (i - 1 > 0)
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
|
|
|
+ if (i - 2 >= 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = i - 2;
|
|
|
else
|
|
|
GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
}
|
|
|
@@ -667,7 +645,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MessageBox.Show("未勾选打印明细!", "提示");
|
|
|
+ MessageBox.Show("未勾选打印明细", "提示", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
|
|
|
}
|
|
|
LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印箱标", "打印成功");
|
|
|
dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
|
|
|
@@ -791,15 +769,34 @@ namespace UAS_LabelMachine
|
|
|
MidOutBoxCodeIndex.Clear();
|
|
|
SelectProdcode = LabelInf.Rows[SelectRowIndex].Cells["pib_prodcode"].Value.ToString();
|
|
|
SelectMidBoxCode = LabelInf.Rows[SelectRowIndex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- }
|
|
|
- for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode && LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == SelectMidBoxCode)
|
|
|
+ for (int i = SelectRowIndex; i >= 0; i--)
|
|
|
{
|
|
|
- if (!MidOutBoxCode.Contains(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())))
|
|
|
+ if (LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() == SelectProdcode)
|
|
|
{
|
|
|
- MidOutBoxCode.Add(int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()));
|
|
|
- MidOutBoxCodeIndex.Add(i);
|
|
|
+ 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)
|
|
|
+ {
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1026,6 +1023,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (OutBoxCombox.Text != "")
|
|
|
{
|
|
|
+ Pack_Click(sender, e);
|
|
|
thread = new Thread(OutBoxPrint);
|
|
|
stw = new SetLoadingWindow(thread, "正在打印外箱");
|
|
|
BaseUtil.SetFormCenter(stw);
|
|
|
@@ -1065,7 +1063,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
}
|
|
|
- //有数据的话默认取第一条的品牌去取采集策略
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
|
|
|
double CollectNum = 0;
|
|
|
@@ -1336,7 +1333,6 @@ namespace UAS_LabelMachine
|
|
|
CurrentPrCount = GridPrcode.Rows[0].Cells["pd_outqty"].Value.ToString();
|
|
|
CurrentBrand = GridPrcode.Rows[0].Cells["pd_brand"].Value.ToString();
|
|
|
GridPrcode.Rows[0].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1421,11 +1417,11 @@ namespace UAS_LabelMachine
|
|
|
break;
|
|
|
//流水需要通过MaxNumber去取
|
|
|
case "流水":
|
|
|
- string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'").ToString();
|
|
|
+ string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'").ToString();
|
|
|
//设置当前流水
|
|
|
if (maxnum == "")
|
|
|
{
|
|
|
- dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + pi_cardcode.Text + "','" + Prefix + "','1')", "insert");
|
|
|
+ dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "','" + Prefix + "','1')", "insert");
|
|
|
MaxNum = 1;
|
|
|
}
|
|
|
else
|
|
|
@@ -1455,8 +1451,10 @@ namespace UAS_LabelMachine
|
|
|
CurrentPrCount = GridPrcode.Rows[e.RowIndex].Cells["pd_outqty"].Value.ToString();
|
|
|
CurrentBrand = GridPrcode.Rows[e.RowIndex].Cells["pd_brand"].Value.ToString();
|
|
|
GridPrcode.Rows[e.RowIndex].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
|
|
|
- //dh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno='" + CurrentPDNO + "' and pib_prodcode='" + CurrentPrCode + "'", "delete");
|
|
|
+ if (e.RowIndex - 2 >= 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 2;
|
|
|
+ else
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
|
|
|
LoadGridData(sender, new EventArgs());
|
|
|
}
|
|
|
|
|
|
@@ -1472,8 +1470,8 @@ namespace UAS_LabelMachine
|
|
|
CurrentPrCount = GridPrcode.Rows[dsc[0].Index].Cells["pd_outqty"].Value.ToString();
|
|
|
CurrentBrand = GridPrcode.Rows[dsc[0].Index].Cells["pd_brand"].Value.ToString();
|
|
|
GridPrcode.Rows[dsc[0].Index].Selected = true;
|
|
|
- if (dsc[0].Index - 1 > 0)
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index - 1;
|
|
|
+ if (dsc[0].Index - 2 >= 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index - 2;
|
|
|
else
|
|
|
GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index;
|
|
|
}
|
|
|
@@ -1486,8 +1484,8 @@ namespace UAS_LabelMachine
|
|
|
if (e.RowIndex >= 0)
|
|
|
{
|
|
|
GridPrcode.Rows[e.RowIndex].Selected = true;
|
|
|
- if (e.RowIndex - 1 > 0)
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 1;
|
|
|
+ if (e.RowIndex - 2 > 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 2;
|
|
|
else
|
|
|
GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
|
|
|
}
|
|
|
@@ -1605,35 +1603,34 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2)", "select");
|
|
|
- string pibcustoutboxcode = dh.getFieldDataByCondition("prodiobarcode", "pib_custoutboxcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + LabelInf.Rows[LabelInf.Rows.Count - 1].Cells["pib_outboxcode2"].Value.ToString() + "' and pib_custoutboxcode is not null").ToString();
|
|
|
GetBarCodeRule(out Prefix, out Suffix, out MaxNum, out NumLength, out Radix);
|
|
|
- if (Radix > 0)
|
|
|
+ List<string> OutBoxCode = new List<string>();
|
|
|
+ List<string> PIBID = new List<string>();
|
|
|
+ for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
{
|
|
|
- //生成外箱条码
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ if (LabelInf.Rows[i].Cells["pib_custoutboxcode"].Value.ToString() == "")
|
|
|
{
|
|
|
- List<string> OutBoxCode = new List<string>();
|
|
|
- List<string> PIBOUTBOXCODE2 = new List<string>();
|
|
|
+ PIBID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
|
|
|
string serialcode = BaseUtil.DToAny(MaxNum, Radix);
|
|
|
for (int k = serialcode.ToString().Length; k < NumLength; k++)
|
|
|
{
|
|
|
serialcode = "0" + serialcode;
|
|
|
}
|
|
|
- if (pibcustoutboxcode == "")
|
|
|
- {
|
|
|
- OutBoxCode.Add(Prefix + serialcode + Suffix);
|
|
|
- MaxNum = MaxNum + 1;
|
|
|
- }
|
|
|
- else
|
|
|
+ if (i + 1 < LabelInf.Rows.Count)
|
|
|
{
|
|
|
- OutBoxCode.Add(pibcustoutboxcode);
|
|
|
+ string FPrcode = LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString();
|
|
|
+ string BPrcode = LabelInf.Rows[i + 1].Cells["pib_prodcode"].Value.ToString();
|
|
|
+ if (FPrcode != BPrcode)
|
|
|
+ {
|
|
|
+ MaxNum = MaxNum + 1;
|
|
|
+ }
|
|
|
}
|
|
|
- PIBOUTBOXCODE2.Add(dt.Rows[i]["pib_outboxcode2"].ToString());
|
|
|
- dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_outboxcode2=:pib_outboxcode2 and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBOUTBOXCODE2.ToArray());
|
|
|
+ OutBoxCode.Add(Prefix + serialcode + Suffix);
|
|
|
}
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
|
|
|
}
|
|
|
+ dh.BatchInsert("update prodiobarcode set pib_custoutboxcode=:pib_custoutboxcode where pib_id=:pib_id and pib_custoutboxcode is null", new string[] { "pib_custoutboxcode", "pib_outboxcode2" }, OutBoxCode.ToArray(), PIBID.ToArray());
|
|
|
+ MaxNum = MaxNum + 1;
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'");
|
|
|
LoadGridData(sender, e);
|
|
|
}
|
|
|
}
|
|
|
@@ -1676,7 +1673,7 @@ namespace UAS_LabelMachine
|
|
|
dh.BatchInsert("update prodiobarcode set pib_custmidboxcode=:pib_custmidboxcode,pib_outboxcode1=:pib_outboxcode1 where pib_id=:pib_id and pib_custmidboxcode is null", new string[] { "pib_custmidboxcode", "pib_outboxcode1", "pib_id" }, MidBoxCode.ToArray(), PIBOUTBOXCODE1.ToArray(), PIBID.ToArray());
|
|
|
}
|
|
|
MaxNum = MaxNum + 1;
|
|
|
- dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_prefix='" + Prefix + "'");
|
|
|
+ dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + MaxNum + "'", "rmn_nrcode='" + (pi_cardcode.Text == "" ? "Default" : pi_cardcode.Text) + "' and rmn_prefix='" + Prefix + "'");
|
|
|
}
|
|
|
LoadGridData(sender, e);
|
|
|
}
|