|
|
@@ -10,12 +10,10 @@ using System.Diagnostics;
|
|
|
using LabelManager2;
|
|
|
using UAS_LabelMachine.PublicMethod;
|
|
|
using UAS_LabelMachine.Entity;
|
|
|
-using UAS_特殊解析规则;
|
|
|
using UAS_LabelMachine.PublicForm;
|
|
|
using System.Threading;
|
|
|
using System.IO;
|
|
|
using System.Globalization;
|
|
|
-using System.Threading.Tasks;
|
|
|
using System.Reflection;
|
|
|
|
|
|
namespace UAS_LabelMachine
|
|
|
@@ -214,22 +212,7 @@ namespace UAS_LabelMachine
|
|
|
Height = ScreenArea.Height;
|
|
|
MidBoxCapacity.Value = Properties.Settings.Default.MidBoxCapacity;
|
|
|
OutboxCapacity.Value = Properties.Settings.Default.OutboxCapacity;
|
|
|
- //怡海能达添加的特殊字段
|
|
|
- if (DataHelper.DBConnectionString.Contains("sz.hi-mantech.com") || DataHelper.DBConnectionString.Contains("192.168.1.200"))
|
|
|
- {
|
|
|
- pib_datecode1.Visible = true;
|
|
|
- SingleLabelAutoPrint.Checked = true;
|
|
|
- MidLabelAutoPrint.Checked = true;
|
|
|
- pib_madein.Visible = true;
|
|
|
- }
|
|
|
- if (!(DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88")))
|
|
|
- {
|
|
|
- pib_cusbarcode.Visible = false;
|
|
|
- pib_cusoutboxcode.Visible = false;
|
|
|
- ViVoPlate.Visible = false;
|
|
|
- OutBoxLabelPackage.Visible = false;
|
|
|
- //GetOutBoxCode.Visible = false;
|
|
|
- }
|
|
|
+
|
|
|
asc.controllInitializeSize(this);
|
|
|
asc.controlAutoSize(this);
|
|
|
//实例化打印进程
|
|
|
@@ -703,8 +686,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
SingleDoc.PrintDocument();
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
|
|
|
@@ -959,18 +940,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
catch (Exception e) { LogManager.DoLog(e.StackTrace); }
|
|
|
break;
|
|
|
- case "二次解析":
|
|
|
- if (SiItem[item]["si_indexstring"] != "")
|
|
|
- {
|
|
|
- //长度不为空的时候按照指定的长度去取数据
|
|
|
- if (SiItem[item]["si_length"] != "")
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
|
|
|
- //长度为空的时候取index之后的全部数据
|
|
|
- else
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
|
|
|
- }
|
|
|
- str = Analysis.AnalysisData(Brand, item, str);
|
|
|
- break;
|
|
|
case "全部":
|
|
|
break;
|
|
|
default:
|
|
|
@@ -1182,11 +1151,6 @@ namespace UAS_LabelMachine
|
|
|
MessageBox.Show("中盘标签未维护参数");
|
|
|
}
|
|
|
}
|
|
|
- string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- string cl_labelname = SingleLabelCombox.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();
|
|
|
- //查询该模板维护的所有参数
|
|
|
- dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
|
|
|
if (SingleLabelParam.Rows.Count > 0 && LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
//每次打印清除之前缓存的行号和ID,后面会判断需要打印的数据重新加载
|
|
|
@@ -1246,25 +1210,7 @@ namespace UAS_LabelMachine
|
|
|
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++)
|
|
|
- {
|
|
|
- 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 == "")
|
|
|
- {
|
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- 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());
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
+ AutoPrintSingleLabel(pib_id);
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
{
|
|
|
//判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
|
@@ -1585,7 +1531,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
MidDoc.PrintDocument();
|
|
|
}
|
|
|
|
|
|
@@ -1645,7 +1590,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
MidDoc.PrintDocument();
|
|
|
}
|
|
|
|
|
|
@@ -1696,7 +1640,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
OutBoxDoc.PrintDocument();
|
|
|
LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
|
|
|
}
|
|
|
@@ -1779,7 +1722,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
|
}
|
|
|
-
|
|
|
+ DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
|
/// 自定义函数 加载明细行的数据,多处使用添加进函数
|
|
|
/// </summary>
|
|
|
@@ -1788,32 +1731,26 @@ namespace UAS_LabelMachine
|
|
|
private void LoadGridData(object sender, EventArgs e)
|
|
|
{
|
|
|
AllCollect = false;
|
|
|
- PrintedVivoOutboxCode.Clear();
|
|
|
- //如果是富为则使用特殊的查询语句
|
|
|
- if (DataHelper.DBConnectionString.Contains("richwell") || DataHelper.DBConnectionString.Contains("192.168.0.88"))
|
|
|
- {
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select pd_custprodcode,pd_pocode,pd_inoutno,pib_custbarcode,pib_brand,pib_cusbarcode,pib_cusoutboxcode,pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,");
|
|
|
- sql.Append("pr_brand,pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pib_barcode,pib_outboxcode1,pib_outboxcode2,pib_ifpick,pib_ifprint,");
|
|
|
- sql.Append("pr_spec,pd_prodcode,pd_pocode,pr_code from prodiobarcode left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno ");
|
|
|
- sql.Append("and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join (select pd_prodcode ");
|
|
|
- sql.Append("prcode,pd_pocode pocode,max(pd_detno) pd_detno from prodinout left join packing on packing.pi_code=prodinout.pi_packingcode ");
|
|
|
- sql.Append("left join packingdetail on packing.pi_id=pd_piid where prodinout.pi_id='" + PI_ID + "' group by pd_prodcode,pd_pocode");
|
|
|
- sql.Append(")A on pd_pocode=A.pocode and pd_prodcode=A.PRCODE where pd_piid='" + PI_ID + "' order by pr_code,a.pd_detno,pib_id");
|
|
|
- GetOutBoxCode.Visible = true;
|
|
|
- }
|
|
|
- else
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by rownum ");
|
|
|
+ LabelInfDataTable = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
|
|
|
+ if (LabelInfDataTable.Rows.Count == 0)
|
|
|
{
|
|
|
+ //嵌套查询重置RowNum
|
|
|
sql.Clear();
|
|
|
- sql.Append("select pd_custprodcode,pd_custprodspec,pd_pocode,pib_madein,pib_custbarcode,pib_custoutboxcode,pib_id,pib_datecode1,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,");
|
|
|
- sql.Append("pib_lotno,pib_datecode,pib_qty,pr_spec,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,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");
|
|
|
- }
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
- MidSource.DataSource = dt;
|
|
|
- BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
|
|
|
+ sql.Append("select t.*,rownum from (select pd_ordercode,pib_year,pib_month,pib_day,pr_barcode,pr_detail,pib_custoutboxcode,pib_custmidboxcode,pr_orispeccode,pd_id,pd_custprodcode,pib_indate,pi_date,pib_inoutno,pd_custprodspec,");
|
|
|
+ sql.Append("nvl(pib_ifrecheck,0)pib_ifrecheck,nvl(pib_ifupload,0)pib_ifupload,nvl(pib_ifmodify,0)pib_ifmodify,pd_pocode,pib_madein,pib_custbarcode,pib_id,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,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
|
|
|
+ sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and ");
|
|
|
+ sql.Append("pd_pdno=pib_pdno and pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");
|
|
|
+ LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
+ //检验查询的字段和本地数据库字段是否匹配
|
|
|
+ sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
|
|
|
+ //将数据保存在本地数据库
|
|
|
+ sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
|
|
|
+ }
|
|
|
+ bindingsource(LabelInf, LabelInfDataTable);
|
|
|
+ BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
//有数据的话默认取第一条的品牌去取采集策略
|
|
|
TotalCount.Text = LabelInf.RowCount.ToString();
|
|
|
if (LabelInf.RowCount > 0)
|
|
|
@@ -1837,6 +1774,21 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ delegate void BindDataSource(DataGridView dgv, DataTable dt);//定义委托
|
|
|
+
|
|
|
+ void bindingsource(DataGridView dgv, DataTable dt)
|
|
|
+ {
|
|
|
+ if (dgv.InvokeRequired)
|
|
|
+ {
|
|
|
+ dgv.Invoke(new BindDataSource(bindingsource), new object[] { dgv, dt });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dgv.AutoGenerateColumns = false;
|
|
|
+ dgv.DataSource = dt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 重绘Cell的颜色
|
|
|
/// </summary>
|
|
|
@@ -1881,43 +1833,6 @@ namespace UAS_LabelMachine
|
|
|
pr_code.Condition = " pd_inoutno='" + pi_inoutno.Text + "'";
|
|
|
}
|
|
|
|
|
|
- private void OutBoxLabelPackage_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- thread = new Thread(CusLabelPrint);
|
|
|
- stw = new SetLoadingWindow(thread, "正在打印客户外箱号");
|
|
|
- BaseUtil.SetFormCenter(stw);
|
|
|
- stw.ShowDialog();
|
|
|
- }
|
|
|
-
|
|
|
- private void CusLabelPrint()
|
|
|
- {
|
|
|
- //MaxOutBoxCode = MaxOutBoxCode + 1;
|
|
|
- List<int> CusOutBoxCode = new List<int>();
|
|
|
- //统计客户外箱号
|
|
|
- if (LabelInf.Rows.Count > 0)
|
|
|
- CusOutBoxCode.Add(0);
|
|
|
- for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (i - 1 > 0 && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() == "True")
|
|
|
- {
|
|
|
- string cutboxcode = LabelInf.Rows[i].Cells["pib_cusoutboxcode"].Value.ToString();
|
|
|
- string nextcutboxcode = LabelInf.Rows[i - 1].Cells["pib_cusoutboxcode"].Value.ToString();
|
|
|
- if (cutboxcode != nextcutboxcode)
|
|
|
- CusOutBoxCode.Add(i);
|
|
|
- }
|
|
|
- }
|
|
|
- //打印外箱号
|
|
|
- string la_id = OutBoxCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- for (int i = 0; i < CusOutBoxCode.Count; i++)
|
|
|
- {
|
|
|
- if (!PrintedVivoOutboxCode.Contains(CusOutBoxCode[i].ToString()))
|
|
|
- {
|
|
|
- OutBoxCodePrint(la_id, CusOutBoxCode[i]);
|
|
|
- PrintedVivoOutboxCode.Add(CusOutBoxCode[i].ToString());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void pr_code_UserControlTextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
//用户在重新勾选后重置采集项目的索引
|
|
|
@@ -2177,82 +2092,6 @@ namespace UAS_LabelMachine
|
|
|
catch (Exception) { }
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取ViVo的料盘信息
|
|
|
- /// </summary>
|
|
|
- /// <param name="sender"></param>
|
|
|
- /// <param name="e"></param>
|
|
|
- private void ViVoPlate_Click(object sender, EventArgs e)
|
|
|
- {
|
|
|
- thread = new Thread(GetVivoInf);
|
|
|
- stw = new SetLoadingWindow(thread, "正在获取Vivo箱号");
|
|
|
- BaseUtil.SetFormCenter(stw);
|
|
|
- stw.ShowDialog();
|
|
|
- }
|
|
|
-
|
|
|
- private void GetVivoInf()
|
|
|
- {
|
|
|
- if (LabelInf.Rows.Count > 0)
|
|
|
- {
|
|
|
- if (LabelInf.Rows[0].Cells["pib_outboxcode2"].Value != null)
|
|
|
- {
|
|
|
- Vivo_GetPlateID.Service1SoapClient getPlateID = new Vivo_GetPlateID.Service1SoapClient();
|
|
|
- Vivo_BoxReelRelation.Service1SoapClient getOutBox = new Vivo_BoxReelRelation.Service1SoapClient();
|
|
|
- string VenderCode = dh.GetConfig("VivoCode", "ProdInOut!Sale").ToString();
|
|
|
- string CurrentTime = System.DateTime.Now.ToString("yyyyMM");
|
|
|
- string Createcode = VenderCode + CurrentTime;
|
|
|
- string outboxcode = "";
|
|
|
- //装入箱内的数量统计,用于判断是否达到容量
|
|
|
- decimal InBoxCount = OutboxCapacity.Value;
|
|
|
- for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
- {
|
|
|
- //勾选了的内容才进行料盘的获取和箱号的维护
|
|
|
- if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
|
|
|
- {
|
|
|
- int amount = int.Parse(LabelInf.Rows[i].Cells["pib_qty"].Value.ToString());
|
|
|
- string DateCode = LabelInf.Rows[i].Cells["pib_datecode"].Value.ToString();
|
|
|
- string LotNo = LabelInf.Rows[i].Cells["pib_lotno"].Value.ToString();
|
|
|
- string OrderCode = LabelInf.Rows[i].Cells["pr_vendprodcode"].Value.ToString();
|
|
|
- string custprodcode = LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString();
|
|
|
- //通过接口获取Vivo料盘号
|
|
|
- string custbarcode = getPlateID.getCompID(Createcode, "", custprodcode, VenderCode, LotNo, DateCode, amount, OrderCode, "", "").Replace("T-", "");
|
|
|
- LabelInf.Rows[i].Cells["pib_cusbarcode"].Value = custbarcode;
|
|
|
- //如果下一行的外箱号和当前行不一致
|
|
|
- bool NextBoxDiff = false;
|
|
|
- //通过接口维护料盘和外箱关系,需要根据箱内容量计算
|
|
|
- //判断下一行箱号不一样重新取一个客户外箱号
|
|
|
- if (i - 1 > 0)
|
|
|
- {
|
|
|
- string CurrentOutBoxCode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
- string NextOutBoxCode = LabelInf.Rows[i - 1].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
- if (CurrentOutBoxCode != NextOutBoxCode)
|
|
|
- {
|
|
|
- NextBoxDiff = true;
|
|
|
- InBoxCount = OutboxCapacity.Value - 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if (InBoxCount == OutboxCapacity.Value || NextBoxDiff)
|
|
|
- {
|
|
|
- outboxcode = VenderCode + "-" + CurrentTime + "-" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- InBoxCount = 1;
|
|
|
- NextBoxDiff = false;
|
|
|
- }
|
|
|
- else
|
|
|
- InBoxCount = InBoxCount + 1;
|
|
|
- //获取信息为T-表示成功获取了信息
|
|
|
- string Message = getOutBox.insertBoxReelRelation(Createcode, VenderCode, outboxcode, custbarcode, "", "");
|
|
|
- if (Message.Substring(0, 1) == "T")
|
|
|
- LabelInf.Rows[i].Cells["pib_cusoutboxcode"].Value = outboxcode;
|
|
|
- else
|
|
|
- LabelInf.Rows[i].Cells["pib_cusoutboxcode"].Value = Message;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- MessageBox.Show("请先维护外箱号");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void ChooseAll_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (AllChecked)
|
|
|
@@ -2379,5 +2218,26 @@ namespace UAS_LabelMachine
|
|
|
LoadGridData(sender, e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void LabelPrinter_UserOnSelectIndexChange(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ switch ((sender as Control).Parent.Name)
|
|
|
+ {
|
|
|
+ case "SingleLabelPrinter":
|
|
|
+ if (SingleDoc != null)
|
|
|
+ SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+ break;
|
|
|
+ case "MidLabelPrinter":
|
|
|
+ if (MidDoc != null)
|
|
|
+ MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
+ break;
|
|
|
+ case "OutBoxPrinter":
|
|
|
+ if (OutBoxDoc != null)
|
|
|
+ OutBoxDoc.Printer.SwitchTo(OutBoxLabelPrint.Text);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|