|
@@ -56,7 +56,7 @@ namespace UAS_MES_NEW.Query
|
|
|
{
|
|
|
Dbfind = ma_code.ReturnData;
|
|
|
BaseUtil.SetFormValue(this.Controls, Dbfind);
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,mil_makecode from makeimeilist where mil_printstatus=-1 group by mil_makecode) on mil_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
@@ -82,127 +82,63 @@ namespace UAS_MES_NEW.Query
|
|
|
{
|
|
|
DataTable dt = new DataTable();
|
|
|
string ErrorMessage = "";
|
|
|
- if (!PrintNums.Checked)
|
|
|
+
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0 order by msl_sncode", "select");
|
|
|
+ if (dt.Rows.Count < PrintNum.Value)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("未打印数量不足,剩余" + dt.Rows.Count + "未打印\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < PrintNum.Value; i++)
|
|
|
{
|
|
|
- string batch = System.DateTime.Now.ToString("yyyyMMddhhmiss");
|
|
|
- if (RePrintSn.Text == "")
|
|
|
+ string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
|
|
|
+ string oMakecode = "";
|
|
|
+ string oErrMessage = "";
|
|
|
+ string oMsid = "";
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, mil_sncode, User.UserCode, out oMakecode, out oMsid, out oErrMessage))
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0 order by msl_sncode", "select");
|
|
|
- if (dt.Rows.Count < PrintNum.Value)
|
|
|
+ if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
|
|
|
{
|
|
|
- OperateResult.AppendText("未打印数量不足,剩余" + dt.Rows.Count + "未打印\n");
|
|
|
- return;
|
|
|
+
|
|
|
+ dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
+ OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
|
|
|
}
|
|
|
- for (int i = 0; i < PrintNum.Value; i++)
|
|
|
+ else
|
|
|
{
|
|
|
- string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
|
|
|
- if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
|
|
|
- {
|
|
|
-
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
- }
|
|
|
+ dh.ExecuteSql("update makesnlist set msl_printstatus=-1where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
+ OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
}
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+
|
|
|
+ if (!LogicHandler.SetTestResult(ma_code.Text, User.UserSourceCode, mil_sncode, "", "OK", User.UserCode, out ErrorMessage))
|
|
|
{
|
|
|
- pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
- ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
- ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
- pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
+ OperateResult.AppendText(">>ErrorMessage\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dt = (DataTable)dh.ExecuteSql("select msl_sncode from makesnlist left join makeimeilist on mil_sncode=msl_sncode and mil_makecode=msl_makecode where msl_makecode='" + ma_code.Text + "' and (msl_sncode='" + RePrintSn.Text + "' or mil_imei1='"+RePrintSn.Text+"' or mil_imei2='"+RePrintSn.Text + "')order by msl_sncode", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- string mil_sncode = dt.Rows[0]["msl_sncode"].ToString();
|
|
|
- if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
|
|
|
- {
|
|
|
-
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1,msl_printbatch='" + batch + "' where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号:" + RePrintSn.Text + "不在工单" + ma_code.Text + "\n", Color.Red, RePrintSn);
|
|
|
- }
|
|
|
+ OperateResult.AppendText(">>ErrorMessage\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- dh.ExecuteSql("update make set ma_printqty='" + SingleRowCount.Value + "' where ma_code='" + ma_code.Text + "'", "update");
|
|
|
- dt = (DataTable)dh.ExecuteSql("select msl_sncode from (select msl_sncode from makesnlist where msl_makecode='" + ma_code.Text + "' and nvl(msl_printstatus,0)=0 order by msl_sncode) where rownum<='" + PrintNum.Value * SingleRowCount.Value + "'", "select");
|
|
|
- decimal rowcount = 0;
|
|
|
- for (int i = 0; i < dt.Rows.Count; i = i + 1)
|
|
|
- {
|
|
|
- string mil_sncode = dt.Rows[i]["msl_sncode"].ToString();
|
|
|
- if (rowcount % SingleRowCount.Value == 0)
|
|
|
- {
|
|
|
- if (Print.BarTender(Tag.ToString(), ref engine, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, mil_sncode, int.Parse("1"), ma_code.Text, pr_code.Text, "机身标", "0", out ErrorMessage))
|
|
|
- {
|
|
|
-
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dh.ExecuteSql("update makeimeilist set mil_printstatus=-1 where mil_sncode='" + mil_sncode + "'", "update");
|
|
|
- dh.ExecuteSql("update makesnlist set msl_printstatus=-1 where msl_sncode='" + mil_sncode + "'", "update");
|
|
|
- OperateResult.AppendText(">>序列号:" + mil_sncode + "打印结束\n", Color.Green);
|
|
|
- }
|
|
|
- rowcount = rowcount + 1;
|
|
|
- }
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ma_qty,ma_prodcode,pr_detail,ma_printnum from make left join product on ma_prodcode=pr_code left join (select count(1)ma_printnum,msl_makecode from makesnlist where msl_printstatus=-1 group by msl_makecode) on msl_makecode=ma_code where ma_code='" + ma_code.Text + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
- ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
- ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
- pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
- }
|
|
|
+ pr_code.Text = dt.Rows[0]["ma_prodcode"].ToString();
|
|
|
+ ma_qty.Text = dt.Rows[0]["ma_qty"].ToString();
|
|
|
+ ma_printcount.Text = dt.Rows[0]["ma_printnum"].ToString();
|
|
|
+ pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void pr_code_TextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
+ _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
if (_dt.Rows.Count == 0)
|
|
|
{
|
|
|
- _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault,replace(LA_SOFTTYPE,';',',')LA_SOFTTYPE from label where la_prodcode is null and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
- }
|
|
|
- if (_dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- string la_id = _dt.Rows[0]["la_id"].ToString();
|
|
|
- _dt = (DataTable)dh.ExecuteSql("select fp_name la_url,'" + la_id + "' la_id from FILEPATH where fp_id in (select * from table(select parsestring(LA_SOFTTYPE,';') from label where la_templatetype='机身标' and la_id='" + la_id + "') where COLUMN_VALUE is not null)", "select");
|
|
|
- PrintLabel.DataSource = _dt;
|
|
|
- PrintLabel.DisplayMember = "la_url";
|
|
|
- PrintLabel.ValueMember = "la_id";
|
|
|
+ _dt = (DataTable)dh.ExecuteSql("select la_id,la_url,la_isdefault from label where la_prodcode is null and la_templatetype='机身标' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
}
|
|
|
+ PrintLabel.DataSource = _dt;
|
|
|
+ PrintLabel.DisplayMember = "la_url";
|
|
|
+ PrintLabel.ValueMember = "la_id";
|
|
|
}
|
|
|
|
|
|
private void PrintByBatch_Click(object sender, EventArgs e)
|