|
@@ -251,8 +251,8 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
CollectInputData();
|
|
|
- Input.Clear();
|
|
|
}
|
|
|
+ Input.Text = "";
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -296,8 +296,19 @@ namespace UAS_LabelMachine
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ if (Data["PRCODE"] != CurrentPrCode)
|
|
|
+ {
|
|
|
+ MessageBox.Show("当前采集物料编号不对应,请重新采集");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (Data["BRAND"] != CurrentBrand)
|
|
|
+ {
|
|
|
+ MessageBox.Show("当前采集品牌不对应,请重新采集");
|
|
|
+ return;
|
|
|
+ }
|
|
|
int CodeCount = 0;
|
|
|
//如果单位是KPCS则需要除1000
|
|
|
+ int CollectNum = 0;
|
|
|
if (CurrentUnit == "KPCS")
|
|
|
{
|
|
|
if (int.Parse(Data["QTY"]) / 1000 % int.Parse(CurrentZXBZ) != 0)
|
|
@@ -306,6 +317,7 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
CodeCount = int.Parse(Data["QTY"]) / 1000 / int.Parse(CurrentZXBZ);
|
|
|
+ CollectNum = int.Parse(Data["QTY"]) / 1000;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -315,6 +327,7 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
|
|
|
+ CollectNum = int.Parse(Data["QTY"]);
|
|
|
}
|
|
|
|
|
|
string pib_barcode = Data.ContainsKey("SERIAL") ? Data["SERIAL"] : "";
|
|
@@ -338,6 +351,14 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
pib_outboxcode2 = OutBoxNum.Text;
|
|
|
}
|
|
|
+ //计算当前采集数量
|
|
|
+ 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))
|
|
|
+ {
|
|
|
+ MessageBox.Show("采集后超出数量");
|
|
|
+ return;
|
|
|
+ }
|
|
|
List<string> CustBarCode = new List<string>();
|
|
|
List<string> CustOutBarCode = new List<string>();
|
|
|
for (int i = 0; i < CodeCount; i++)
|
|
@@ -348,22 +369,30 @@ namespace UAS_LabelMachine
|
|
|
serialcode = "0" + serialcode;
|
|
|
}
|
|
|
CustBarCode.Add(SinglePrefix + serialcode + SingleSuffix);
|
|
|
- serialcode = BaseUtil.DToAny(OutMaxNum, OutRadix);
|
|
|
- for (int j = serialcode.ToString().Length; j < OutNumLength; j++)
|
|
|
+ if (OutPrefix != "")
|
|
|
{
|
|
|
- serialcode = "0" + serialcode;
|
|
|
+ serialcode = BaseUtil.DToAny(OutMaxNum, OutRadix);
|
|
|
+ for (int j = serialcode.ToString().Length; j < OutNumLength; j++)
|
|
|
+ {
|
|
|
+ serialcode = "0" + serialcode;
|
|
|
+ }
|
|
|
+ CustOutBarCode.Add(OutPrefix + serialcode + OutSuffix);
|
|
|
+ SingleMaxNum = SingleMaxNum + 1;
|
|
|
+ OutMaxNum = OutMaxNum + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CustOutBarCode.Add("");
|
|
|
}
|
|
|
- CustOutBarCode.Add(OutPrefix + serialcode + OutSuffix);
|
|
|
- SingleMaxNum = SingleMaxNum + 1;
|
|
|
- OutMaxNum = OutMaxNum + 1;
|
|
|
}
|
|
|
sql.Clear();
|
|
|
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_OUTBOXCODE1,PIB_OUTBOXCODE2,pib_custoutboxcode,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO) ");
|
|
|
+ sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,PIB_OUTBOXCODE1,pib_datecode,pib_lotno,PIB_OUTBOXCODE2,pib_custoutboxcode,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO) ");
|
|
|
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 + "','','" + pib_outboxcode2 + "',:pib_custoutboxcode,0,pd_ordercode,pd_pocode ");
|
|
|
+ sql.Append("'" + pib_barcode + "',:PIB_CUSTBARCODE,'" + CurrentZXBZ + "','','" + Data["LOTNO"] + "','" + Data["DATECODE"] + "','" + pib_outboxcode2 + "',:pib_custoutboxcode,0,pd_ordercode,pd_pocode ");
|
|
|
sql.Append("from prodinout left join prodiodetail on pi_id=pd_piid where pi_id='" + PI_ID + "' and pd_prodcode='" + CurrentPrCode + "'");
|
|
|
dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE", "pib_custoutboxcode" }, PIBID, CustBarCode.ToArray(), CustOutBarCode.ToArray());
|
|
|
+ //更新流水号
|
|
|
dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (SingleMaxNum + CodeCount) + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_type='Single' and rmn_prefix='" + SinglePrefix + "'");
|
|
|
dh.UpdateByCondition("RULEMAXNUM", "rmn_maxnumber='" + (OutMaxNum + CodeCount) + "'", "rmn_nrcode='" + pi_cardcode.Text + "' and rmn_type='Out' and rmn_prefix='" + OutPrefix + "'");
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
@@ -372,6 +401,22 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
MessageBox.Show("箱号" + OutBoxNum.Text + "超出容量");
|
|
|
}
|
|
|
+ if (SingleLabelAutoPrint.Checked)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ //采集后重新计数,自动跳到下一行
|
|
|
+ collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
+ CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
|
|
|
+ if (CollectQty == int.Parse(CurrentPrCount))
|
|
|
+ {
|
|
|
+ DataGridViewSelectedRowCollection dsc = GridPrcode.SelectedRows;
|
|
|
+ GridPrcode.Rows[dsc[0].Index + 1].Selected = true;
|
|
|
+ for (int i = 0; i < dsc.Count; i++)
|
|
|
+ {
|
|
|
+ dsc[i].Selected = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void AutoPrintSingleLabel(string la_id, string LabelUrl)
|
|
@@ -391,49 +436,14 @@ namespace UAS_LabelMachine
|
|
|
DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
|
|
|
if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("产地"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_madein"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.Contains("pib_cusbarcode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- }
|
|
|
if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ DataRow[] drow = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (drow.Length > 0)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = drow[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
ParamLog.AppendLine("pib_id:" + LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == "DateCode1")
|
|
|
- {
|
|
|
- if (LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
LogManager.DoLog(ParamLog.ToString());
|
|
@@ -575,6 +585,7 @@ namespace UAS_LabelMachine
|
|
|
pi_cardcode.Text = dt.Rows[0]["pi_cardcode"].ToString();
|
|
|
pi_date.Text = dt.Rows[0]["pi_date"].ToString();
|
|
|
PI_ID = dt.Rows[0]["pi_id"].ToString();
|
|
|
+ LoadPrcodeData();
|
|
|
LoadGridData(sender, e);
|
|
|
//获取条码规则
|
|
|
GetBarCodeRule("Single", out SinglePrefix, out SingleSuffix, out SingleMaxNum, out SingleNumLength, out SingleRadix);
|
|
@@ -590,7 +601,6 @@ namespace UAS_LabelMachine
|
|
|
SingleID.Clear();
|
|
|
//获取外箱数据
|
|
|
OutBoxNum_Click(sender, new EventArgs());
|
|
|
- LoadPrcodeData();
|
|
|
thread = new Thread(GetInOutInfAndLabelFile);
|
|
|
stw = new SetLoadingWindow(thread, "正在获取打印标签");
|
|
|
BaseUtil.SetFormCenter(stw);
|
|
@@ -683,79 +693,49 @@ namespace UAS_LabelMachine
|
|
|
CheckedRowCount = CheckedRowCount + 1;
|
|
|
CurrentRowIndex = i;
|
|
|
//以标签模板的参数为基准,循环取数
|
|
|
- try
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
+ DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
|
|
|
+ StringBuilder ParamLog = new StringBuilder();
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
- string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- DataRow[] dr = SingleBoxCacheData.Select("pib_id=" + pib_id);
|
|
|
- StringBuilder ParamLog = new StringBuilder();
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
- {
|
|
|
- if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_datecode1"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_lotno"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_datecode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("产地"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_madein"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_madein"].Value.ToString();
|
|
|
- }
|
|
|
- else if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("pib_cusbarcode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_cusbarcode"].Value != null)
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[i].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- }
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
- }
|
|
|
- LogManager.DoLog(ParamLog.ToString());
|
|
|
- //保存参数打印
|
|
|
- if (EnablePrint)
|
|
|
+ if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
+ DataRow[] drow = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (drow.Length > 0)
|
|
|
+ SingleDoc.Variables.FreeVariables.Item(j + 1).Value = drow[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
- if (MidLabelAutoPrint.Checked)
|
|
|
+ ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
+ }
|
|
|
+ LogManager.DoLog(ParamLog.ToString());
|
|
|
+ //保存参数打印
|
|
|
+ if (EnablePrint)
|
|
|
+ {
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ SingleDoc.PrintDocument();
|
|
|
+ }
|
|
|
+ if (MidLabelAutoPrint.Checked)
|
|
|
+ {
|
|
|
+ //判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
|
+ if (i + 1 == LabelInf.RowCount || LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() != LabelInf.Rows[i + 1 == LabelInf.RowCount ? i : i + 1].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
{
|
|
|
- //判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
|
- if (i + 1 == LabelInf.RowCount || LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() != LabelInf.Rows[i + 1 == LabelInf.RowCount ? i : i + 1].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
+ if (outboxcode1[LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()])
|
|
|
{
|
|
|
- if (outboxcode1[LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()])
|
|
|
+ if (MidLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- if (MidLabelCombox.SelectedValue != null)
|
|
|
- {
|
|
|
- string la_id_mid = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- MidBoxCodePrint(la_id_mid, CurrentRowIndex);
|
|
|
- }
|
|
|
+ string la_id_mid = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
+ MidBoxCodePrint(la_id_mid, CurrentRowIndex);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //勾选为已打印
|
|
|
- LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
- catch (Exception ex) { LogManager.DoLog(ex.Message); }
|
|
|
+ //勾选为已打印
|
|
|
+ LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
+ //}
|
|
|
+ //catch (Exception ex) { LogManager.DoLog(ex.StackTrace); }
|
|
|
}
|
|
|
}
|
|
|
dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
|
|
@@ -1186,22 +1166,7 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
{
|
|
|
DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode1"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("lotno"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_lotno"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
|
|
|
- }
|
|
|
- else if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode"))
|
|
|
- {
|
|
|
- if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
|
|
|
- }
|
|
|
- else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
+ if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
{
|
|
|
if (dr.Length > 0)
|
|
|
{
|
|
@@ -1210,14 +1175,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ DataRow[] drow = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (drow.Length > 0)
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = drow[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
@@ -1295,14 +1255,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ DataRow[] drow = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (drow.Length > 0)
|
|
|
+ MidDoc.Variables.FreeVariables.Item(j + 1).Value = drow[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
@@ -1347,36 +1302,17 @@ namespace UAS_LabelMachine
|
|
|
string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
//获取打印执行的SQL
|
|
|
string sql = OutLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
- //select * from productiobarcode where pib_id={pib_id} and pib_outboxcode1={pib_outboxcode1}
|
|
|
try
|
|
|
{
|
|
|
string ExeSQL = "";
|
|
|
- if (sql.ToLower().Contains("pib_lotno"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_lotno"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_datecode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_madein"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_madein"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_cusbarcode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusbarcode"].Value.ToString();
|
|
|
- else if (sql.ToLower().Contains("pib_cusoutboxcode"))
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_cusoutboxcode"].Value.ToString();
|
|
|
- else
|
|
|
- {
|
|
|
- ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
|
|
|
- ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
|
|
|
- }
|
|
|
+ ExeSQL = sql.ToLower().Replace("{pib_id}", "'" + pib_id + "'");
|
|
|
+ ExeSQL = ExeSQL.Replace("{pib_outboxcode2}", "'" + pib_outboxcode2 + "'");
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(ExeSQL).ToString();
|
|
|
if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'")[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ DataRow[] drow = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
+ if (drow.Length > 0)
|
|
|
+ OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = drow[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
@@ -1460,13 +1396,21 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifprint,0)pib_ifprint");
|
|
|
sql.Append(" from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
|
|
|
sql.Append(" pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode ");
|
|
|
- sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode1),pib_id,pd_prodcode");
|
|
|
+ sql.Append("where pib_piid='" + PI_ID + "' order by to_number(pib_outboxcode2),pib_id,pd_prodcode");
|
|
|
LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
//有数据的话默认取第一条的品牌去取采集策略
|
|
|
TotalCount.Text = LabelInf.RowCount.ToString();
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
|
|
|
+
|
|
|
+ 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 collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
|
|
|
+ GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void Refresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
@@ -1744,6 +1688,7 @@ namespace UAS_LabelMachine
|
|
|
CurrentPDNO = GridPrcode.Rows[0].Cells["pd_pdno"].Value.ToString();
|
|
|
CurrentPrCount = GridPrcode.Rows[0].Cells["pd_outqty"].Value.ToString();
|
|
|
CurrentBrand = GridPrcode.Rows[0].Cells["pd_brand"].Value.ToString();
|
|
|
+ GridPrcode.Rows[0].Selected = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1758,6 +1703,7 @@ namespace UAS_LabelMachine
|
|
|
CurrentPDNO = GridPrcode.Rows[e.RowIndex].Cells["pd_pdno"].Value.ToString();
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
|