|
|
@@ -6,14 +6,13 @@ using System.Text.RegularExpressions;
|
|
|
using System.Text;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
|
-using LabelManager2;
|
|
|
using UAS_LabelMachine.PublicMethod;
|
|
|
using UAS_LabelMachine.Entity;
|
|
|
using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
|
-using System.IO;
|
|
|
using System.Globalization;
|
|
|
using FastReport;
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
|
{
|
|
|
@@ -201,9 +200,10 @@ namespace UAS_LabelMachine
|
|
|
Input.Text = "";
|
|
|
return;
|
|
|
}
|
|
|
+ Input.Text = Input.Text.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "");
|
|
|
Dictionary<string, string> Data = new Dictionary<string, string>();
|
|
|
string[] SplitData = Input.Text.Split('*');
|
|
|
- if (SplitData.Length < 6)
|
|
|
+ if (SplitData.Length < 5)
|
|
|
{
|
|
|
MessageBox.Show("数据格式错误,无法解析", "提示");
|
|
|
Input.SelectAll();
|
|
|
@@ -253,35 +253,38 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (Data["BRAND"] != CurrentBrand)
|
|
|
{
|
|
|
- MessageBox.Show("当前采集【品牌】不对应,请重新采集", "提示");
|
|
|
- Input.SelectAll();
|
|
|
- return;
|
|
|
+ string close = MessageBox.Show(this.ParentForm, "当前采集【品牌】不对应,是否继续采集", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
+ if (close != "Yes")
|
|
|
+ {
|
|
|
+ Input.SelectAll();
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
int CodeCount = 0;
|
|
|
//如果单位是KPCS则需要除1000
|
|
|
- int CollectNum = 0;
|
|
|
+ double CollectNum = 0;
|
|
|
if (CurrentUnit == "KPCS")
|
|
|
{
|
|
|
//如果单位是KPCS则必须是1000的整数倍
|
|
|
- if (int.Parse(Data["QTY"]) % 1000 != 0 || int.Parse(Data["QTY"]) / 1000 % int.Parse(CurrentZXBZ) != 0)
|
|
|
+ if ((int.Parse(Data["QTY"]) > 1000 && int.Parse(Data["QTY"]) % 1000 != 0) || int.Parse(Data["QTY"]) / 1000 % double.Parse(CurrentZXBZ) != 0)
|
|
|
{
|
|
|
MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
|
|
|
Input.SelectAll();
|
|
|
return;
|
|
|
}
|
|
|
- CodeCount = int.Parse(Data["QTY"]) / 1000 / int.Parse(CurrentZXBZ);
|
|
|
- CollectNum = int.Parse(Data["QTY"]) / 1000;
|
|
|
+ CodeCount = int.Parse((double.Parse(Data["QTY"]) / 1000 / double.Parse(CurrentZXBZ)).ToString());
|
|
|
+ CollectNum = double.Parse(Data["QTY"]) / 1000;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (int.Parse(Data["QTY"]) % int.Parse(CurrentZXBZ) != 0)
|
|
|
+ if (double.Parse(Data["QTY"]) % double.Parse(CurrentZXBZ) != 0)
|
|
|
{
|
|
|
MessageBox.Show("采集【数量】无法按照最小包装数拆分", "提示");
|
|
|
Input.SelectAll();
|
|
|
return;
|
|
|
}
|
|
|
- CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
|
|
|
- CollectNum = int.Parse(Data["QTY"]);
|
|
|
+ CodeCount = int.Parse((double.Parse(Data["QTY"]) / double.Parse(CurrentZXBZ)).ToString());
|
|
|
+ CollectNum = double.Parse(Data["QTY"]);
|
|
|
}
|
|
|
string pib_barcode = Data.ContainsKey("SERIAL") ? Data["SERIAL"] : "";
|
|
|
//获取ID
|
|
|
@@ -289,7 +292,7 @@ namespace UAS_LabelMachine
|
|
|
string pib_outboxcode2 = "";
|
|
|
if (OutBoxNum.Text == "新增")
|
|
|
{
|
|
|
- string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(pib_outboxcode2)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
+ string maxoutbox = dh.getFieldDataByCondition("prodiobarcode", "max(to_number(pib_outboxcode2))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString();
|
|
|
//如果没有则从开始插入
|
|
|
if (maxoutbox == "")
|
|
|
{
|
|
|
@@ -306,8 +309,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//计算当前采集数量
|
|
|
string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
- int CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
|
|
|
- if (CollectQty + CollectNum > int.Parse(CurrentPrCount))
|
|
|
+ double CollectQty = (collectqty == "" ? 0 : double.Parse(collectqty));
|
|
|
+ if (Convert.ToDouble((CollectQty + CollectNum).ToString("0.000")) > double.Parse(CurrentPrCount))
|
|
|
{
|
|
|
MessageBox.Show("物料" + Data["PRCODE"] + "采集后数量为" + (CollectQty + CollectNum) + ",【超出】本行出货数量" + CurrentPrCount, "提示");
|
|
|
Input.SelectAll();
|
|
|
@@ -341,7 +344,7 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("insert into prodiobarcode(PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_PDNO, PIB_PDID,PIB_PICLASS,");
|
|
|
sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,pib_brand,pib_datecode,pib_lotno,PIB_OUTBOXCODE2,pib_inman,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO,pib_remark) ");
|
|
|
sql.Append("select :PIB_ID,pd_prodcode,sysdate,pi_inoutno,pi_id,pd_pdno,pd_id,pi_class,");
|
|
|
- sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "',pjd_brand,'" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint && SingleLabelAutoPrint.Checked ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode,pd_remark ");
|
|
|
+ sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "','" + Data["BRAND"] + "','" + Data["DATECODE"] + "','" + Data["LOTNO"] + "','" + pib_outboxcode2 + "','" + User.UserCode + "','" + (EnablePrint && SingleLabelAutoPrint.Checked ? 1 : 0).ToString() + "',pd_ordercode,pd_pocode,pd_remark ");
|
|
|
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());
|
|
|
//更新流水号
|
|
|
@@ -362,33 +365,41 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//采集后重新计数,自动跳到下一行
|
|
|
collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
- CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
|
|
|
+ CollectQty = (collectqty == "" ? 0 : double.Parse(collectqty));
|
|
|
//采集达到了数量进行换行
|
|
|
- if (CollectQty == int.Parse(CurrentPrCount))
|
|
|
+ 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 && int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
+ 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;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
+ if (i - 1 > 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
|
|
|
+ else
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
+ Input.Clear();
|
|
|
+ OutBoxNum_Click(new object(), new EventArgs());
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
|
|
|
+ DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
|
|
|
+ if (selectrow.Count > 0)
|
|
|
{
|
|
|
- string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
|
|
|
- string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
|
|
|
- if (int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
- {
|
|
|
- GridPrcode.Rows[i].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
+ if (selectrow[0].Index + 1 < GridPrcode.Rows.Count) {
|
|
|
+ string outqty = GridPrcode.Rows[selectrow[0].Index + 1].Cells["pd_outqty"].Value.ToString();
|
|
|
+ string collectnum = GridPrcode.Rows[selectrow[0].Index + 1].Cells["CollectedNum"].Value.ToString();
|
|
|
+ if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
+ {
|
|
|
+ GridPrcode.Rows[selectrow[0].Index + 1].Selected = true;
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = selectrow[0].Index + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -410,6 +421,8 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
pibid += PIBID[i];
|
|
|
}
|
|
|
+ if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
|
|
|
for (int j = 0; j < SingleReport.Parameters.Count; j++)
|
|
|
{
|
|
|
SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
|
|
|
@@ -464,74 +477,77 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
ComBoxClickChangeLabelDoc = false;
|
|
|
sql.Clear();
|
|
|
- sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
+ sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelurl,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
|
|
|
sql.Append("and pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='单盘' order by cl_custcode,cl_date desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
SingleLabelCombox.DisplayMember = "cl_labelname";
|
|
|
- SingleLabelCombox.ValueMember = "la_id";
|
|
|
+ SingleLabelCombox.ValueMember = "cl_labelurl";
|
|
|
SingleLabelCombox.DataSource = dt;
|
|
|
- if (!GetGridOnly.Checked)
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
- string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
- System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
- FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
- if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
- BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
- }
|
|
|
+ //if (!GetGridOnly.Checked)
|
|
|
+ // for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ // {
|
|
|
+ // string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
+ // string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
+ // System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
+ // FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
+ // if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
+ // BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
+ // }
|
|
|
if (SingleLabelCombox.Text != "")
|
|
|
{
|
|
|
- SingleReport.Load(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
+ if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
sql.Clear();
|
|
|
- sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
+ sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelurl,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
|
|
|
sql.Append("and pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='中盒' order by cl_custcode,cl_date desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
MidLabelCombox.DisplayMember = "cl_labelname";
|
|
|
- MidLabelCombox.ValueMember = "la_id";
|
|
|
+ MidLabelCombox.ValueMember = "cl_labelurl";
|
|
|
MidLabelCombox.DataSource = dt;
|
|
|
- if (!GetGridOnly.Checked)
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
- string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
- System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
- FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
- if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
- BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
- }
|
|
|
+ //if (!GetGridOnly.Checked)
|
|
|
+ // for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ // {
|
|
|
+ // string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
+ // string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
+ // System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
+ // FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
+ // if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
+ // BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
+ // }
|
|
|
if (MidLabelCombox.Text != "")
|
|
|
{
|
|
|
- MidReport.Load(ftpOperater.DownLoadTo + MidLabelCombox.Text);
|
|
|
+ if (!MidLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ MidReport.Load(MidLabelCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
//缓存中盒参数
|
|
|
sql.Clear();
|
|
|
- sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
+ sql.Append("select to_char(nvl(cl_date,sysdate),'YYYY-MM-DD HH24:Mi:SS') cl_date,cl_labelurl,cl_labelname,cl_isdefault,la_id||'#'||cl_labelurl||'#'||to_char(cl_date,'YYYY-MM-DD HH24:Mi:SS') la_id,cl_custcode from customerlabel left join prodinout on pi_cardcode=cl_custcode ");
|
|
|
sql.Append("left join customer on cu_code=cl_custcode left join label on la_code=CL_LABELCODE where ((pi_cardcode='" + pi_cardcode.Text + "' ");
|
|
|
sql.Append("and pi_inoutno='" + pi_inoutno.Text + "') or( cl_custcode is null)) and cl_labeltype='外箱' order by cl_custcode,cl_date desc");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
OutBoxCombox.DisplayMember = "cl_labelname";
|
|
|
- OutBoxCombox.ValueMember = "la_id";
|
|
|
+ OutBoxCombox.ValueMember = "cl_labelurl";
|
|
|
OutBoxCombox.DataSource = dt;
|
|
|
- if (!GetGridOnly.Checked)
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
- string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
- System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
- FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
- if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
- BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
- }
|
|
|
+ //if (!GetGridOnly.Checked)
|
|
|
+ // for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ // {
|
|
|
+ // string LabelUrl = dt.Rows[i]["la_id"].ToString().Split('#')[1];
|
|
|
+ // string LabelName = dt.Rows[i]["cl_labelname"].ToString();
|
|
|
+ // System.DateTime time = Convert.ToDateTime(dt.Rows[i]["cl_date"].ToString());
|
|
|
+ // FileInfo file = new FileInfo(ftpOperater.DownLoadTo + LabelName);
|
|
|
+ // if (time.ToString() != file.LastWriteTime.ToString())
|
|
|
+ // BaseUtil.GetLabelUrl(LabelUrl, LabelName, time);
|
|
|
+ // }
|
|
|
if (OutBoxCombox.Text != "")
|
|
|
{
|
|
|
- OutReport.Load(ftpOperater.DownLoadTo + OutBoxCombox.Text);
|
|
|
+ if (!OutBoxCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ OutReport.Load(OutBoxCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
- BaseUtil.GetLabelUrl(DataHelper.FTPAdress, "唛头.frx", System.DateTime.Now);
|
|
|
- FootReport.Load(ftpOperater.DownLoadTo + "唛头.frx");
|
|
|
+ //BaseUtil.GetLabelUrl(DataHelper.FTPAdress, "唛头.frx", System.DateTime.Now);
|
|
|
+ FootReport.Load(@"\\10.2.10.211\文件服务 (f)\FastReport\唛头.frx");
|
|
|
//缓存外箱参数
|
|
|
ComBoxClickChangeLabelDoc = true;
|
|
|
}
|
|
|
@@ -547,11 +563,12 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
Input.Clear();
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pi_id,pi_cardcode,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "' and pi_invostatuscode='AUDITED'");
|
|
|
+ sql.Append("select pi_id,pi_cardcode,pi_title,to_char(pi_date,'yyyymmdd')pi_date from prodinout where pi_inoutno='" + pi_inoutno.Text + "' and pi_invostatuscode='AUDITED'");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
|
|
|
+ pi_title.Text = dt.Rows[0]["pi_title"].ToString();
|
|
|
if (pi_cardcode.Text != "ZGCC")
|
|
|
{
|
|
|
CustomerLabel.Enabled = false;
|
|
|
@@ -569,15 +586,18 @@ namespace UAS_LabelMachine
|
|
|
GetBarCodeRule(out Prefix, out Suffix, out MaxNum, out NumLength, out Radix);
|
|
|
SingleID.Clear();
|
|
|
Input.Focus();
|
|
|
- //从后往前找未采集的行
|
|
|
+ ////从后往前找未采集的行
|
|
|
for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
|
|
|
{
|
|
|
string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
|
|
|
string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
|
|
|
- if (int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
+ if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
{
|
|
|
GridPrcode.Rows[i].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
+ if (i - 1 > 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
|
|
|
+ else
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = i;
|
|
|
}
|
|
|
}
|
|
|
bi_inman.Text = dh.getFieldDataByCondition("barcodeio left join employee on bi_inman=em_code", "wm_concat(distinct em_name)", "bi_piid=" + PI_ID).ToString();
|
|
|
@@ -631,25 +651,27 @@ namespace UAS_LabelMachine
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
//勾选了并且未打印
|
|
|
- if (LabelInf.Rows[i].Cells["Choose"].FormattedValue != null && LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true")
|
|
|
+ if (LabelInf.Rows[i].Cells["Choose"].FormattedValue != null && LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true")
|
|
|
{
|
|
|
pibid += LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",";
|
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
}
|
|
|
- for (int j = 0; j < SingleReport.Parameters.Count; j++)
|
|
|
+ if (pibid != "")
|
|
|
{
|
|
|
- SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
|
|
|
- for (int k = 0; k < Attach.Rows.Count; k++)
|
|
|
+ if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
|
|
|
+ for (int j = 0; j < SingleReport.Parameters.Count; j++)
|
|
|
{
|
|
|
- if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
|
|
|
+ SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
|
|
|
+ for (int k = 0; k < Attach.Rows.Count; k++)
|
|
|
{
|
|
|
- SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
|
|
|
+ if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
|
|
|
+ {
|
|
|
+ SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if (pibid != "")
|
|
|
- {
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID in (" + pibid.Substring(0, pibid.Length - 1) + ")", "select");
|
|
|
SingleReport.RegisterData(dt, "prodiosingleinfo_view");
|
|
|
SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
|
|
|
@@ -771,7 +793,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
List<int> MidOutBoxCode = new List<int>();
|
|
|
List<int> MidOutBoxCodeIndex = new List<int>();
|
|
|
- string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
for (int i = (begin == 0 ? 0 : begin); i <= (end == 0 ? LabelInf.Rows.Count - 1 : end); i++)
|
|
|
{
|
|
|
try
|
|
|
@@ -788,11 +809,28 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+ //如果有选中行
|
|
|
+ if (SelectProdcode != "")
|
|
|
+ {
|
|
|
+ MidOutBoxCode.Clear();
|
|
|
+ MidOutBoxCodeIndex.Clear();
|
|
|
+ }
|
|
|
+ for (int i = 0; i < LabelInf.Rows.Count; 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
for (int i = 0; i < MidOutBoxCodeIndex.Count; i++)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- MidBoxCodePrint(la_id, MidOutBoxCodeIndex[i]);
|
|
|
+ MidBoxCodePrint(MidOutBoxCodeIndex[i]);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
@@ -805,9 +843,6 @@ namespace UAS_LabelMachine
|
|
|
bool FindMidLabel = false;
|
|
|
if (MidLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- string cl_labelname = MidLabelCombox.Text;
|
|
|
- string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
|
|
|
//中盒号所在的行
|
|
|
int MidLabelRowIndex = 0;
|
|
|
//缓存中盒数据
|
|
|
@@ -822,7 +857,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//找到了指定的盒号
|
|
|
if (FindMidLabel)
|
|
|
- MidBoxCodePrint(la_id, MidLabelRowIndex);
|
|
|
+ MidBoxCodePrint(MidLabelRowIndex);
|
|
|
else
|
|
|
MessageBox.Show("该出入库单未找到该中盒号!", "提示");
|
|
|
}
|
|
|
@@ -848,9 +883,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
List<string> Outboxcode = new List<string>();
|
|
|
//如果未勾选箱号则对勾选的数据的箱号进行整合
|
|
|
- string la_id = OutBoxCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- string cl_labelname = OutBoxCombox.Text;
|
|
|
- string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
|
|
|
if (OutBoxNum.Text == "" || OutBoxNum.Text == "新增")
|
|
|
{
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
@@ -870,7 +902,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (LabelInf.Rows[h].Cells["pib_outboxcode2"].Value.ToString() == Outboxcode.ToArray()[i])
|
|
|
{
|
|
|
- OutBoxCodePrint(la_id, h);
|
|
|
+ OutBoxCodePrint(h);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -900,7 +932,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//找到了指定的盒号
|
|
|
if (FindMidLabel)
|
|
|
- OutBoxCodePrint(la_id, OutBoxLabelRowIndex);
|
|
|
+ OutBoxCodePrint(OutBoxLabelRowIndex);
|
|
|
else
|
|
|
MessageBox.Show("该出入库单未找到该外箱号!", "提示");
|
|
|
}
|
|
|
@@ -909,21 +941,11 @@ namespace UAS_LabelMachine
|
|
|
Outboxcode.Clear();
|
|
|
}
|
|
|
|
|
|
- private void MidBoxCodePrint(string la_id, int rowindex)
|
|
|
+ private void MidBoxCodePrint(int rowindex)
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
- for (int j = 0; j < MidReport.Parameters.Count; j++)
|
|
|
- {
|
|
|
- MidReport.SetParameterValue(MidReport.Parameters[j].Name, "");
|
|
|
- for (int i = 0; i < Attach.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (Attach.Rows[i][0].ToString() == MidReport.Parameters[j].Name)
|
|
|
- {
|
|
|
- MidReport.SetParameterValue(MidReport.Parameters[j].Name, Attach.Rows[i][1].ToString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
//名称相等的时候,取SQL进行值的查询
|
|
|
string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
@@ -938,6 +960,19 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
+ if (!MidLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ MidReport.Load(MidLabelCombox.SelectedValue.ToString());
|
|
|
+ for (int j = 0; j < MidReport.Parameters.Count; j++)
|
|
|
+ {
|
|
|
+ MidReport.SetParameterValue(MidReport.Parameters[j].Name, "");
|
|
|
+ for (int i = 0; i < Attach.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (Attach.Rows[i][0].ToString() == MidReport.Parameters[j].Name)
|
|
|
+ {
|
|
|
+ MidReport.SetParameterValue(MidReport.Parameters[j].Name, Attach.Rows[i][1].ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
MidReport.RegisterData(dt, "prodiomidinfo_view");
|
|
|
MidReport.GetDataSource("prodiomidinfo_view").Enabled = true;
|
|
|
MidReport.PrintSettings.ShowDialog = false;
|
|
|
@@ -952,10 +987,12 @@ namespace UAS_LabelMachine
|
|
|
/// <summary>
|
|
|
/// 执行打印外箱号
|
|
|
/// </summary>
|
|
|
- private void OutBoxCodePrint(string la_id, int rowindex)
|
|
|
+ private void OutBoxCodePrint(int rowindex)
|
|
|
{
|
|
|
if (EnablePrint)
|
|
|
{
|
|
|
+ if (!OutBoxCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ OutReport.Load(OutBoxCombox.SelectedValue.ToString());
|
|
|
for (int j = 0; j < OutReport.Parameters.Count; j++)
|
|
|
{
|
|
|
OutReport.SetParameterValue(OutReport.Parameters[j].Name, "");
|
|
|
@@ -969,34 +1006,11 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiooutinfo_view where 出货单号='" + pi_inoutno.Text + "' and 外箱号='" + pib_outboxcode2 + "'", "select");
|
|
|
- DataTable dt1 = dt.Clone();
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- DataRow dr = dt1.NewRow();
|
|
|
- for (int j = 0; j < dt.Columns.Count; j++)
|
|
|
- {
|
|
|
- dr[j] = dt.Rows[i][j].ToString();
|
|
|
- }
|
|
|
- dt1.Rows.Add(dr);
|
|
|
- if ((i + 1) % 5 == 0 || (i + 1) == dt.Rows.Count)
|
|
|
- {
|
|
|
- OutReport.RegisterData(dt1, "prodiooutinfo_view");
|
|
|
- OutReport.GetDataSource("prodiooutinfo_view").Enabled = true;
|
|
|
- OutReport.PrintSettings.ShowDialog = false;
|
|
|
- OutReport.PrintSettings.Printer = OutBoxPrinter.Text;
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- OutReport.Print();
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- MessageBox.Show(e.Message);
|
|
|
- return;
|
|
|
- }
|
|
|
- BaseUtil.CleanDataTableData(dt1);
|
|
|
- }
|
|
|
- }
|
|
|
+ OutReport.RegisterData(dt, "prodiooutinfo_view");
|
|
|
+ OutReport.GetDataSource("prodiooutinfo_view").Enabled = true;
|
|
|
+ OutReport.PrintSettings.ShowDialog = false;
|
|
|
+ OutReport.PrintSettings.Printer = OutBoxPrinter.Text;
|
|
|
+ OutReport.Print();
|
|
|
Properties.Settings.Default.OPrinter = OutBoxPrinter.Text;
|
|
|
Properties.Settings.Default.Save();
|
|
|
}
|
|
|
@@ -1057,7 +1071,7 @@ namespace UAS_LabelMachine
|
|
|
AllChecked = false;
|
|
|
sql.Clear();
|
|
|
sql.Append("select pd_custprodcode,pd_custprodspec,pib_custmidboxcode,pd_pocode,pjd_orispeccode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,");
|
|
|
- sql.Append("pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand,pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,");
|
|
|
+ sql.Append("pib_pdno,pib_prodcode,pib_brand,pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,");
|
|
|
sql.Append("pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join ");
|
|
|
sql.Append("prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode ");
|
|
|
sql.Append("left join sale on sa_code=pib_ordercode left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode where pib_piid='" + PI_ID + "' ");
|
|
|
@@ -1075,14 +1089,20 @@ namespace UAS_LabelMachine
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
|
|
|
//计算所有的采集数量
|
|
|
+ double CollectNum = 0;
|
|
|
+ double OutNum = 0;
|
|
|
for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
{
|
|
|
string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
|
|
|
+ string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
|
|
|
string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
+ CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
|
|
|
+ OutNum += double.Parse(CurrentOutQTY);
|
|
|
GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
|
|
|
- GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = int.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - int.Parse(collectqty == "" ? "0" : collectqty);
|
|
|
+ GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
|
|
|
}
|
|
|
+ ProcessCount.Text = CollectNum + "/" + OutNum;
|
|
|
}
|
|
|
|
|
|
private void Refresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
@@ -1143,7 +1163,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
- SingleReport.Load(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
+ if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|
|
|
@@ -1160,7 +1181,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
- MidReport.Load(ftpOperater.DownLoadTo + MidLabelCombox.Text);
|
|
|
+ if (!MidLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ MidReport.Load(MidLabelCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|
|
|
@@ -1177,7 +1199,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (ComBoxClickChangeLabelDoc)
|
|
|
{
|
|
|
- OutReport.Load(ftpOperater.DownLoadTo + OutBoxCombox.Text);
|
|
|
+ if (!OutBoxCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
+ OutReport.Load(OutBoxCombox.SelectedValue.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception) { }
|
|
|
@@ -1280,7 +1303,51 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void LoadPrcodeData()
|
|
|
{
|
|
|
- GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_pdno,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
|
|
|
+ GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_pdno,pd_custprodcode,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
|
|
|
+ List<int> RemoveIndex = new List<int>();
|
|
|
+ if (Combindetail.Checked)
|
|
|
+ {
|
|
|
+ int CurrentIndex = 0;
|
|
|
+ for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (i + 1 < GridPrcode.Rows.Count)
|
|
|
+ {
|
|
|
+ string BProdCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
+ string BPrUnit = GridPrcode.Rows[i].Cells["pr_unit"].Value.ToString();
|
|
|
+ string BPrBrand = GridPrcode.Rows[i].Cells["pd_brand"].Value.ToString();
|
|
|
+ string FProdCode = GridPrcode.Rows[i + 1].Cells["pd_prodcode"].Value.ToString();
|
|
|
+ string FPrUnit = GridPrcode.Rows[i + 1].Cells["pr_unit"].Value.ToString();
|
|
|
+ string FrBrand = GridPrcode.Rows[i + 1].Cells["pd_brand"].Value.ToString();
|
|
|
+ if (BProdCode == FProdCode && BPrUnit == FPrUnit && BPrBrand == FrBrand)
|
|
|
+ {
|
|
|
+ GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value = double.Parse(GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["pd_outqty"].Value.ToString());
|
|
|
+ RemoveIndex.Add(i + 1);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CurrentIndex = i + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (int item in RemoveIndex.OrderByDescending(x => x))
|
|
|
+ {
|
|
|
+ GridPrcode.Rows.RemoveAt(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double CollectNum = 0;
|
|
|
+ double OutNum = 0;
|
|
|
+ for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
+ string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
|
|
|
+ string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
|
|
|
+ string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
+ CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
|
|
|
+ OutNum += double.Parse(CurrentOutQTY);
|
|
|
+ GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
|
|
|
+ GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
|
|
|
+ }
|
|
|
+ ProcessCount.Text = CollectNum + "/" + OutNum;
|
|
|
if (GridPrcode.Rows.Count > 0)
|
|
|
{
|
|
|
CurrentPrCode = GridPrcode.Rows[0].Cells["pd_prodcode"].Value.ToString();
|
|
|
@@ -1296,8 +1363,9 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void OutBoxNum_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
+ string OutBox = OutBoxNum.Text;
|
|
|
OutBoxNum.Items.Clear();
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by pib_outboxcode2", "select");
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2)", "select");
|
|
|
ItemObject io = new ItemObject("新增", "新增");
|
|
|
OutBoxNum.Items.Add(io);
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
@@ -1308,6 +1376,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (OutBoxNum.Text == "新增" || OutBoxNum.Text == "")
|
|
|
OutBoxNum.SelectedIndex = OutBoxNum.Items.Count - 1;
|
|
|
+ if (OutBox != "新增" && OutBox != "")
|
|
|
+ OutBoxNum.Text = OutBox;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -1407,7 +1477,7 @@ namespace UAS_LabelMachine
|
|
|
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");
|
|
|
+ //dh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno='" + CurrentPDNO + "' and pib_prodcode='" + CurrentPrCode + "'", "delete");
|
|
|
LoadGridData(sender, new EventArgs());
|
|
|
}
|
|
|
|
|
|
@@ -1423,7 +1493,10 @@ 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;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index;
|
|
|
+ if (dsc[0].Index - 1 > 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index - 1;
|
|
|
+ else
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1434,7 +1507,10 @@ namespace UAS_LabelMachine
|
|
|
if (e.RowIndex >= 0)
|
|
|
{
|
|
|
GridPrcode.Rows[e.RowIndex].Selected = true;
|
|
|
- GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
|
|
|
+ if (e.RowIndex - 1 > 0)
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 1;
|
|
|
+ else
|
|
|
+ GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1476,8 +1552,8 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void PrintFooter_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select pib_outboxcode2,max(pib_id) pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' group by pib_outboxcode2 order by pib_outboxcode2", "select");
|
|
|
- string SQL = "select pib_outboxcode2||'/'||(select max(pib_outboxcode2) from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "') from prodiobarcode where pib_id=";
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select pib_outboxcode2,max(pib_id) pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' group by pib_outboxcode2 order by to_number(pib_outboxcode2)", "select");
|
|
|
+ string SQL = "select pib_outboxcode2||'/'||(select max(to_number(pib_outboxcode2)) from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "') from prodiobarcode where pib_id=";
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
DataTable dt1 = (DataTable)dh.ExecuteSql(SQL + dt.Rows[i]["pib_id"].ToString(), "select");
|
|
|
@@ -1512,13 +1588,13 @@ namespace UAS_LabelMachine
|
|
|
e.PaintContent(e.CellBounds);
|
|
|
e.Handled = true;
|
|
|
}
|
|
|
- if (GridPrcode.Columns[e.ColumnIndex].Name == "UnCollectedNum" || GridPrcode.Columns[e.ColumnIndex].Name == "CollectedNum")
|
|
|
+ if (GridPrcode.Columns[e.ColumnIndex].Name == "UnCollectedNum")
|
|
|
{
|
|
|
SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
|
|
|
- if (GridPrcode.Rows[e.RowIndex].Cells["UnCollectedNum"].Value.ToString() == "0")
|
|
|
+ if (GridPrcode.Rows[e.RowIndex].Cells["UnCollectedNum"].Value.ToString() == "0.000")
|
|
|
e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
|
|
|
else
|
|
|
- e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.Gray, e.CellBounds);
|
|
|
+ e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.Red, e.CellBounds);
|
|
|
Rectangle border = e.CellBounds;
|
|
|
border.Width -= 1;
|
|
|
e.Graphics.DrawRectangle(Pens.White, border);
|
|
|
@@ -1550,7 +1626,7 @@ 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 pib_outboxcode2", "select");
|
|
|
+ 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)
|
|
|
@@ -1590,22 +1666,25 @@ namespace UAS_LabelMachine
|
|
|
if (Radix > 0)
|
|
|
{
|
|
|
//生成中盒条码
|
|
|
- int pib_outboxcode1 = int.Parse(dh.getFieldDataByCondition("prodiobarcode", "nvl(max(pib_outboxcode1),0)", "pib_inoutno='" + pi_inoutno.Text + "'").ToString());
|
|
|
+ int pib_outboxcode1 = int.Parse(dh.getFieldDataByCondition("prodiobarcode", "max(to_number(nvl(pib_outboxcode1,0)))", "pib_inoutno='" + pi_inoutno.Text + "'").ToString());
|
|
|
MaxNum = MaxNum - 1;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
List<string> MidBoxCode = new List<string>();
|
|
|
List<string> PIBID = new List<string>();
|
|
|
List<string> PIBOUTBOXCODE1 = new List<string>();
|
|
|
- DataTable dt1 = (DataTable)dh.ExecuteSql("select pib_id from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + dt.Rows[i]["pib_outboxcode2"].ToString() + "' and pib_outboxcode1 is null order by to_number(pib_id)", "select");
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql("select pib_id,pib_prodcode from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2='" + dt.Rows[i]["pib_outboxcode2"].ToString() + "' and pib_outboxcode1 is null order by to_number(pib_id)", "select");
|
|
|
//如果不是10的整数倍则为尾盒
|
|
|
+ int tencount = 0;
|
|
|
for (int j = 0; j < dt1.Rows.Count; j++)
|
|
|
{
|
|
|
- if (j % 10 == 0)
|
|
|
+ if (tencount % 10 == 0 || (dt1.Rows[j]["pib_prodcode"].ToString() != dt1.Rows[j - 1]["pib_prodcode"].ToString()))
|
|
|
{
|
|
|
pib_outboxcode1 = pib_outboxcode1 + 1;
|
|
|
MaxNum = MaxNum + 1;
|
|
|
+ tencount = 0;
|
|
|
}
|
|
|
+ tencount = tencount + 1;
|
|
|
string serialcode = BaseUtil.DToAny(MaxNum, Radix);
|
|
|
for (int k = serialcode.ToString().Length; k < NumLength; k++)
|
|
|
{
|
|
|
@@ -1649,5 +1728,16 @@ namespace UAS_LabelMachine
|
|
|
LoadGridData(sender, e);
|
|
|
CustomerLabel.Enabled = false;
|
|
|
}
|
|
|
+
|
|
|
+ private void Combindetail_CheckedChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ LoadPrcodeData();
|
|
|
+ }
|
|
|
+ string SelectProdcode = "";
|
|
|
+ private void LabelInf_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
|
+ {
|
|
|
+ LabelInf.Rows[e.RowIndex].Selected = true;
|
|
|
+ SelectProdcode = LabelInf.Rows[e.RowIndex].Cells["pib_prodcode"].Value.ToString();
|
|
|
+ }
|
|
|
}
|
|
|
}
|