|
@@ -135,10 +135,6 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
bool AllCollect = false;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- bool AllChecked = false;
|
|
|
-
|
|
|
|
|
|
|
|
|
bool GetPackingCode = false;
|
|
@@ -971,8 +967,8 @@ namespace UAS_LabelMachine
|
|
|
SingleLabelCombox.DataSource = dt;
|
|
|
if (SingleDoc != null)
|
|
|
SingleDoc.Close();
|
|
|
- if (SingleFormat != null)
|
|
|
- SingleFormat.Close(SaveOptions.DoNotSaveChanges);
|
|
|
+
|
|
|
+
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
@@ -1007,8 +1003,11 @@ namespace UAS_LabelMachine
|
|
|
MidLabelCombox.DataSource = dt;
|
|
|
if (MidDoc != null)
|
|
|
MidDoc.Close();
|
|
|
- if (MidFormat != null)
|
|
|
- MidFormat.Close(SaveOptions.DoNotSaveChanges);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
@@ -1045,8 +1044,8 @@ namespace UAS_LabelMachine
|
|
|
OutBoxCombox.DataSource = dt;
|
|
|
if (OutBoxDoc != null)
|
|
|
OutBoxDoc.Close();
|
|
|
- if (OutFormat != null)
|
|
|
- OutFormat.Close(SaveOptions.DoNotSaveChanges);
|
|
|
+
|
|
|
+
|
|
|
if (!GetGridOnly.Checked)
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
@@ -1581,7 +1580,6 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by rownum ");
|
|
|
LabelInfDataTable = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
|
|
|
bindingsource(LabelInf, LabelInfDataTable);
|
|
|
- BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
|
|
|
TotalCount.Text = LabelInf.RowCount.ToString();
|
|
|
if (LabelInf.RowCount > 0)
|
|
@@ -1940,17 +1938,21 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void ChooseAll_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (AllChecked)
|
|
|
- {
|
|
|
- foreach (DataGridViewRow dr in LabelInf.Rows)
|
|
|
- dr.Cells[0].Value = false;
|
|
|
- AllChecked = false;
|
|
|
- }
|
|
|
- else
|
|
|
+ if (LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
- foreach (DataGridViewRow dr in LabelInf.Rows)
|
|
|
- dr.Cells[0].Value = true;
|
|
|
- AllChecked = true;
|
|
|
+ if (LabelInf.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ if (LabelInf.Rows[0].Cells["Choose"].FormattedValue.ToString() == "True")
|
|
|
+ {
|
|
|
+ foreach (DataGridViewRow dr in LabelInf.Rows)
|
|
|
+ dr.Cells[0].Value = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (DataGridViewRow dr in LabelInf.Rows)
|
|
|
+ dr.Cells[0].Value = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2111,6 +2113,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void Menu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
|
|
{
|
|
|
+ Menu.Close();
|
|
|
DataTable dt;
|
|
|
DialogResult result;
|
|
|
switch (e.ClickedItem.Text)
|
|
@@ -2202,38 +2205,86 @@ namespace UAS_LabelMachine
|
|
|
if (result == DialogResult.OK)
|
|
|
{
|
|
|
dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
|
|
|
- DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_orispeccode,pr_zxbzs from prodiodetail left join product on pd_prodcode=pr_code where pd_inoutno='" + pi_inoutno.Text + "'", "select");
|
|
|
- ArrayList<string> midcode = new ArrayList<string>();
|
|
|
- ArrayList<string> barcode = new ArrayList<string>();
|
|
|
- ArrayList<string> custbarcode = new ArrayList<string>();
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_orispeccode,pr_id,pd_piclass,pd_piid,pd_id,pr_zxbzs,pr_brand,pd_pdno,pd_id,pd_prodcode,pd_ordercode,pd_orderdetno from prodiodetail left join product on pd_prodcode=pr_code where pd_inoutno='" + pi_inoutno.Text + "'", "select");
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
- string pr_orispeccode = dt.Rows[i]["原厂型号"].ToString();
|
|
|
+ ArrayList<string> barcode = new ArrayList<string>();
|
|
|
+ ArrayList<string> datecode = new ArrayList<string>();
|
|
|
+ ArrayList<string> lotno = new ArrayList<string>();
|
|
|
+ ArrayList<string> pib_inqty = new ArrayList<string>();
|
|
|
+ ArrayList<string> piboutboxcode2 = new ArrayList<string>();
|
|
|
+ string pr_orispeccode = dt.Rows[i]["规格型号"].ToString();
|
|
|
string qty = dt.Rows[i]["数量"].ToString();
|
|
|
- string DateCode = dt.Rows[i]["DateCode"].ToString();
|
|
|
- string LotNO = dt.Rows[i]["LotNO"].ToString();
|
|
|
+ string DateCode = "";
|
|
|
+ string LotNo = "";
|
|
|
+ if (dt.Columns.Contains("DC/LOT NO"))
|
|
|
+ {
|
|
|
+ DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
|
|
|
+ LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
|
|
|
+ }
|
|
|
+ if (dt.Columns.Contains("DC"))
|
|
|
+ {
|
|
|
+ DateCode = dt.Rows[i]["DC"].ToString();
|
|
|
+ }
|
|
|
+ if (dt.Columns.Contains("LOT NO"))
|
|
|
+ {
|
|
|
+ LotNo = dt.Rows[i]["LOT NO"].ToString();
|
|
|
+ }
|
|
|
string pib_outboxcode2 = dt.Rows[i]["箱号"].ToString();
|
|
|
DataRow[] dr = dt1.Select("pr_orispeccode='" + pr_orispeccode + "'");
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
|
+ string pd_orderdetno = dr[0]["pd_orderdetno"].ToString();
|
|
|
+ string pd_prodcode = dr[0]["pd_prodcode"].ToString();
|
|
|
+ string pd_ordercode = dr[0]["pd_ordercode"].ToString();
|
|
|
+ string pd_piid = dr[0]["pd_piid"].ToString();
|
|
|
+ string pr_brand = dr[0]["pr_brand"].ToString();
|
|
|
+ string pd_pdno = dr[0]["pd_pdno"].ToString();
|
|
|
+ string pd_id = dr[0]["pd_id"].ToString();
|
|
|
+ string pd_piclass = dr[0]["pd_piclass"].ToString();
|
|
|
+ string pr_id = dr[0]["pr_id"].ToString();
|
|
|
decimal zxbzs = decimal.Parse(dr[0]["pr_zxbzs"].ToString());
|
|
|
- decimal outqty = decimal.Parse(qty);
|
|
|
+ decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
|
|
|
decimal barcodenum = 0;
|
|
|
- if (outqty / zxbzs != 0)
|
|
|
+ string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
+ if (outqty % zxbzs != 0)
|
|
|
{
|
|
|
barcodenum = outqty / zxbzs + 1;
|
|
|
+
|
|
|
+ for (int j = 0; j < barcodenum - 1; j++)
|
|
|
+ {
|
|
|
+ barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
+ piboutboxcode2.Add(pib_outboxcode2);
|
|
|
+ pib_inqty.Add(zxbzs);
|
|
|
+ datecode.Add(DateCode);
|
|
|
+ lotno.Add(LotNo);
|
|
|
+ }
|
|
|
+ barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
+ pib_inqty.Add(outqty % zxbzs);
|
|
|
+ piboutboxcode2.Add(pib_outboxcode2);
|
|
|
+ datecode.Add(DateCode);
|
|
|
+ lotno.Add(LotNo);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
barcodenum = outqty / zxbzs;
|
|
|
+ for (int j = 0; j < barcodenum; j++)
|
|
|
+ {
|
|
|
+ barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
+ pib_inqty.Add(zxbzs);
|
|
|
+ piboutboxcode2.Add(pib_outboxcode2);
|
|
|
+ datecode.Add(DateCode);
|
|
|
+ lotno.Add(LotNo);
|
|
|
+ }
|
|
|
}
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
|
|
|
+ sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,pib_outboxcode2)");
|
|
|
+ sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "','" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'");
|
|
|
+ sql.Append("," + pd_piid + ",'" + pr_brand + "',:barcode,'" + pd_pdno + "','" + pd_id + "',");
|
|
|
+ sql.Append("'" + pd_piclass + "',:pib_inqty,:pib_datecode,:pib_lotno,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "',:outboxcode)");
|
|
|
+ dh.BatchInsert(sql.ToString(), new string[] { "barcode", "pib_inqty", "pib_datecode", "pib_lotno", "outboxcode" }, barcode.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), piboutboxcode2.ToArray());
|
|
|
}
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
|
|
|
- sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_OUTBOXCODE1,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
|
|
|
- sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "','" + User.UserName + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
|
|
|
- sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',:midcode,0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty", "midcode" }, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray(), midcode.ToArray());
|
|
|
}
|
|
|
}
|
|
|
break;
|