|
|
@@ -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
|
|
|
@@ -96,7 +94,6 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
Dictionary<string, string> CollectData;
|
|
|
//缓存单盘数据数据的DataTable
|
|
|
- DataTable SingleBoxCacheData;
|
|
|
/// <summary>
|
|
|
/// 存放单盘的ID
|
|
|
/// </summary>
|
|
|
@@ -108,7 +105,6 @@ namespace UAS_LabelMachine
|
|
|
/// <summary>
|
|
|
/// 中盒缓存数据
|
|
|
/// </summary>
|
|
|
- DataTable MidBoxCacheData;
|
|
|
/// <summary>
|
|
|
/// 存放中盒的ID和盒号
|
|
|
/// </summary>
|
|
|
@@ -186,8 +182,6 @@ namespace UAS_LabelMachine
|
|
|
CloumnCount = LabelInf.Columns.Count;
|
|
|
pi_inoutno.Focus();
|
|
|
//将本地读取的打印机设置进Combox,并选中默认打印机
|
|
|
- MidBoxCacheData = new DataTable();
|
|
|
- SingleBoxCacheData = new DataTable();
|
|
|
sg_code.FormName = Name;
|
|
|
sg_code.SetValueField = new string[] { "sg_code" };
|
|
|
sg_code.SelectField = "sg_code # 策略编号 ,sg_name # 策略名称,sg_brand # 品牌,sg_separator # 分隔符";
|
|
|
@@ -214,22 +208,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);
|
|
|
//实例化打印进程
|
|
|
@@ -314,7 +293,6 @@ namespace UAS_LabelMachine
|
|
|
DataTable savedt = (LabelInf.DataSource as DataTable);
|
|
|
if (savedt != null && savedt.GetChanges() != null)
|
|
|
{
|
|
|
- MidSource.EndEdit();
|
|
|
dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
|
|
|
MessageBox.Show("保存成功!");
|
|
|
}
|
|
|
@@ -387,12 +365,6 @@ namespace UAS_LabelMachine
|
|
|
return;
|
|
|
}
|
|
|
CollectInputData();
|
|
|
- DataTable savedt = (LabelInf.DataSource as DataTable);
|
|
|
- if (savedt != null && savedt.GetChanges() != null)
|
|
|
- {
|
|
|
- MidSource.EndEdit();
|
|
|
- dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -528,71 +500,75 @@ namespace UAS_LabelMachine
|
|
|
if (CollectVeProdCodePass && CollectQTYPass)
|
|
|
{
|
|
|
//如果按盒号采集,所有的此盒的均更新为
|
|
|
- DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
+ DataTable dt = (DataTable)LabelInf.DataSource;
|
|
|
+ StringBuilder pibid1 = new StringBuilder();
|
|
|
if (CollectionUnit.Text == "盒")
|
|
|
{
|
|
|
- string la_id = "";
|
|
|
- if (SingleLabelCombox.SelectedValue != null)
|
|
|
- {
|
|
|
- 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();
|
|
|
+ string lotno = "";
|
|
|
+ string datecode = "";
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
{
|
|
|
- dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
|
|
|
- dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
|
|
|
+ lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
|
|
|
+ datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
+ string pibid = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
+ dt.Rows[i]["pib_lotno"] = lotno;
|
|
|
+ dt.Rows[i]["pib_datecode"] = datecode;
|
|
|
LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
|
|
|
LabelInf.Rows[i].Cells["Choose"].Value = true;
|
|
|
+ pibid1.Append(pibid + ",");
|
|
|
LabelInf.Invalidate();
|
|
|
//当前行的索引随循环增长
|
|
|
CurrentRowIndex = i;
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
- if (la_id != "")
|
|
|
- AutoPrintSingleLabel(la_id);
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("未维护单盘标签");
|
|
|
- return;
|
|
|
- }
|
|
|
+ AutoPrintSingleLabel(pibid);
|
|
|
}
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
AutoPrintMidLabel();
|
|
|
SetOutBoxCode2(true);
|
|
|
}
|
|
|
}
|
|
|
+ pibid1.Append("1");
|
|
|
+ sdh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_lotno='" + lotno + "',pib_datecode='" + pib_datecode + "' where pib_id in (" + pibid1 + ")", "update");
|
|
|
}
|
|
|
else if (CollectionUnit.Text == "全部")
|
|
|
{
|
|
|
+ string lotno = "";
|
|
|
+ string datecode = "";
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
- dt.Rows[i]["pib_lotno"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value;
|
|
|
- dt.Rows[i]["pib_datecode"] = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value;
|
|
|
+ lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
|
|
|
+ datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
+ string pibid = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
+ dt.Rows[i]["pib_lotno"] = lotno;
|
|
|
+ dt.Rows[i]["pib_datecode"] = datecode;
|
|
|
CurrentRowIndex = i;
|
|
|
LabelInf.Refresh();
|
|
|
LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
|
|
|
LabelInf.Rows[i].Cells["Choose"].Value = true;
|
|
|
+ pibid1.Append(pibid + ",");
|
|
|
LabelInf.Invalidate();
|
|
|
SetOutBoxCode2(true);
|
|
|
}
|
|
|
+ pibid1.Append("1");
|
|
|
+ sdh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_lotno='" + lotno + "',pib_datecode='" + pib_datecode + "' where pib_id in (" + pibid1 + ")", "update");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ string lotno = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value.ToString();
|
|
|
+ string datecode = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value.ToString();
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["Choose"].Value = true;
|
|
|
+ sdh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_lotno='" + lotno + "',pib_datecode='" + pib_datecode + "' where pib_id in (" + pibid1 + ")", "update");
|
|
|
LabelInf.Invalidate();
|
|
|
//勾选了单盘自动打印
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
if (SingleLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- 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();
|
|
|
- AutoPrintSingleLabel(la_id);
|
|
|
+ AutoPrintSingleLabel(LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -703,8 +679,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
SingleDoc.PrintDocument();
|
|
|
- SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
- SingleDoc.PrintDocument();
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
}
|
|
|
|
|
|
@@ -824,7 +798,7 @@ namespace UAS_LabelMachine
|
|
|
string MatchResult = "";
|
|
|
if (kind != "MPN" && kind != "QTY" && kind != "品牌")
|
|
|
{
|
|
|
- DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
+ DataTable dt = (DataTable)LabelInf.DataSource;
|
|
|
cell.Value = Matchstr;
|
|
|
MatchResult = "成功";
|
|
|
}
|
|
|
@@ -959,18 +933,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:
|
|
|
@@ -1041,7 +1003,7 @@ namespace UAS_LabelMachine
|
|
|
if (SingleLabelCombox.Text != "")
|
|
|
{
|
|
|
SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
- SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
+ SingleLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + SingleLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
for (int i = 0; i < SingleDoc.Variables.FreeVariables.Count; i++)
|
|
|
{
|
|
|
SingleParam.Add(SingleDoc.Variables.FreeVariables.Item(i + 1).Name);
|
|
|
@@ -1070,7 +1032,7 @@ namespace UAS_LabelMachine
|
|
|
if (MidLabelCombox.Text != "")
|
|
|
{
|
|
|
MidDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + MidLabelCombox.Text);
|
|
|
- MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
+ MidLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + MidLabelCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
}
|
|
|
//缓存中盒参数
|
|
|
sql.Clear();
|
|
|
@@ -1127,11 +1089,7 @@ namespace UAS_LabelMachine
|
|
|
LoadGridData(sender, e);
|
|
|
//重新输入单号后清除缓存
|
|
|
MidBoxArgument.Clear();
|
|
|
- MidBoxCacheData.Clear();
|
|
|
- BaseUtil.CleanDataTable(MidBoxCacheData);
|
|
|
SingleBoxArgument.Clear();
|
|
|
- SingleBoxCacheData.Clear();
|
|
|
- BaseUtil.CleanDataTable(SingleBoxCacheData);
|
|
|
MidIDAndOutboxcode.Clear();
|
|
|
SingleID.Clear();
|
|
|
//刷新采集进度
|
|
|
@@ -1182,11 +1140,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 +1199,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)
|
|
|
{
|
|
|
//判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
|
@@ -1274,8 +1209,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (MidLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- string la_id_mid = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- MidBoxCodePrint(la_id_mid, CurrentRowIndex);
|
|
|
+ MidBoxCodePrint(CurrentRowIndex);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1287,8 +1221,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
|
|
|
- MidBoxCacheData.Clear();
|
|
|
- BaseUtil.CleanDataTable(MidBoxCacheData);
|
|
|
if (CheckedRowCount == 0)
|
|
|
MessageBox.Show("未勾选打印明细!");
|
|
|
else if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
|
|
|
@@ -1386,11 +1318,8 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
MidBoxArgument.Clear();
|
|
|
- MidBoxCacheData.Clear();
|
|
|
- BaseUtil.CleanDataTable(MidBoxCacheData);
|
|
|
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++)
|
|
|
{
|
|
|
if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
|
|
|
@@ -1403,19 +1332,14 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
for (int i = 0; i < MidOutBoxCodeIndex.Count; i++)
|
|
|
{
|
|
|
- MidBoxCodePrint(la_id, MidOutBoxCodeIndex[i]);
|
|
|
+ MidBoxCodePrint(MidOutBoxCodeIndex[i]);
|
|
|
}
|
|
|
MidBoxArgument.Clear();
|
|
|
- MidBoxCacheData.Clear();
|
|
|
- BaseUtil.CleanDataTable(MidBoxCacheData);
|
|
|
return;
|
|
|
}
|
|
|
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;
|
|
|
//查找是否存在该中盒号
|
|
|
@@ -1433,7 +1357,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//找到了指定的盒号
|
|
|
if (FindMidLabel)
|
|
|
- MidBoxCodePrint(la_id, MidLabelRowIndex, MidRowIndex.ToArray());
|
|
|
+ MidBoxCodePrint(MidLabelRowIndex);
|
|
|
else
|
|
|
MessageBox.Show("该出入库单未找到该中盒号!");
|
|
|
}
|
|
|
@@ -1458,9 +1382,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 == "")
|
|
|
{
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
@@ -1486,7 +1407,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (LabelInf.Rows[h].Cells["pib_outboxcode2"].Value.ToString() == Outboxcode.ToArray()[i])
|
|
|
{
|
|
|
- OutBoxCodePrint(la_id, h);
|
|
|
+ OutBoxCodePrint(h);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -1518,7 +1439,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//找到了指定的盒号
|
|
|
if (FindMidLabel)
|
|
|
- OutBoxCodePrint(la_id, OutBoxLabelRowIndex);
|
|
|
+ OutBoxCodePrint(OutBoxLabelRowIndex);
|
|
|
else
|
|
|
MessageBox.Show("该出入库单未找到该外箱号!");
|
|
|
}
|
|
|
@@ -1527,189 +1448,137 @@ namespace UAS_LabelMachine
|
|
|
Outboxcode.Clear();
|
|
|
}
|
|
|
|
|
|
- private void MidBoxCodePrint(string la_id, int rowindex)
|
|
|
+ private void MidBoxCodePrint(int rowindex)
|
|
|
{
|
|
|
- if (MidBoxCacheData.Rows.Count == 0)
|
|
|
+ //获取对应行的pib_id
|
|
|
+ string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
+ sql.Clear();
|
|
|
+
|
|
|
+ //查询参数名称相同的获取到取值字段
|
|
|
+ for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- MidIDAndOutboxcode.Add(LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString());
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
+ {
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ }
|
|
|
}
|
|
|
- DataTable 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");
|
|
|
- string[] arg = MidBoxArgument.ToArray();
|
|
|
- for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
|
+ sql.Append("1,");
|
|
|
+ DataTable dt = (DataTable)sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (pib_outboxcode1 == "" ? "0" : pib_outboxcode1), "select");
|
|
|
+ for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
+ DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length == 0)
|
|
|
+ dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
- //名称相等的时候,取SQL进行值的查询
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ MidDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ //SQL判断多个值的时候
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
|
|
|
+ {
|
|
|
+ DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode1), "select");
|
|
|
+ for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
{
|
|
|
- //获取对应行的pib_id
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- //获取打印执行的SQL
|
|
|
- string sql = MidLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
- try
|
|
|
+ for (int k = 0; k < MidDoc.Variables.FormVariables.Count; k++)
|
|
|
{
|
|
|
- //获取打印执行的SQL
|
|
|
- if (sql.IndexOf("{") == 0)
|
|
|
+ if (i == 0 & MidDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
{
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
|
|
|
- LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + dt.Rows[k]["lp_sql"].ToString() + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
+ MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
- else
|
|
|
+ //使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
+ if (MidDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
{
|
|
|
- DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1='" + pib_outboxcode1 + "'");
|
|
|
- if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
|
|
|
- {
|
|
|
- if (dr.Length > 0)
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][MidDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
- {
|
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
+ MidDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- LogManager.DoLog("SQL维护不正确,请检查SQL语句\n" + sql);
|
|
|
- return;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
+ if (MidDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
+ {
|
|
|
+ dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ MidDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
+ }
|
|
|
}
|
|
|
- MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
MidDoc.PrintDocument();
|
|
|
}
|
|
|
|
|
|
- private void MidBoxCodePrint(string la_id, int rowindex, int[] midindex)
|
|
|
+ private void OutBoxCodePrint(int rowindex)
|
|
|
{
|
|
|
- for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
|
|
|
+ //获取对应行的pib_id
|
|
|
+ string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string pib_outboxcode2 = LabelInf.Rows[rowindex].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
+ sql.Clear();
|
|
|
+ for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
{
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- for (int k = 0; k < MidLabelParam.Rows.Count; k++)
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
- //名称相等的时候,取SQL进行值的查询
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Name == MidLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ sql.Append(dr1[0]["lp_sql"].ToString() + ",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sql.Append("1,");
|
|
|
+ DataTable dt = (DataTable)sdh.ExecuteSql("select " + sql.ToString().Substring(0, sql.Length - 1) + " from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (pib_outboxcode2 == "" ? "0" : pib_outboxcode2), "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < OutBoxDoc.Variables.FormVariables.Count; j++)
|
|
|
+ {
|
|
|
+ DataRow[] dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ //多参数命名
|
|
|
+ if (dr1.Length == 0)
|
|
|
+ dr1 = OutLabelParam.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name.Replace("_1", "") + "'");
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
|
|
|
{
|
|
|
- //获取对应行的pib_id
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- string pib_outboxcode1 = LabelInf.Rows[rowindex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
- //获取打印执行的SQL
|
|
|
- string sql = MidLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
- try
|
|
|
+ OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dt.Rows[0][dr1[0]["lp_sql"].ToString()].ToString();
|
|
|
+ }
|
|
|
+ //SQL判断多个值的时候
|
|
|
+ if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "SQL值")
|
|
|
+ {
|
|
|
+ DataTable dt1 = (DataTable)sdh.ExecuteSql(dr1[0]["lp_sql"].ToString().Replace("{1}", "'" + pi_inoutno.Text + "'").Replace("{2}", pib_outboxcode2), "select");
|
|
|
+ for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
{
|
|
|
- //获取打印执行的SQL
|
|
|
- if (sql.IndexOf("{") == 0)
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
|
|
|
- LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + dt.Rows[k]["lp_sql"].ToString() + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
- }
|
|
|
- else
|
|
|
+ for (int k = 0; k < OutBoxDoc.Variables.FormVariables.Count; k++)
|
|
|
{
|
|
|
- if (sql.ToLower().Contains("pib_qty"))
|
|
|
+ if (i == 0 & OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == dr1[0]["lp_name"].ToString())
|
|
|
{
|
|
|
- sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
|
|
|
- sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
|
|
|
+ OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
- else
|
|
|
+ //使用SN开头的参数赋值SN1,SN2,SN3等参数
|
|
|
+ if (OutBoxDoc.Variables.FormVariables.Item(k + 1).Name == (dr1[0]["lp_name"].ToString() + "_" + (i + 1)))
|
|
|
{
|
|
|
- sql = sql.Substring(0, sql.IndexOf("{"));
|
|
|
- sql = sql.Substring(0, sql.LastIndexOf("="));
|
|
|
- sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
|
|
|
+ OutBoxDoc.Variables.FormVariables.Item(k + 1).Value = dt1.Rows[i][0].ToString();
|
|
|
}
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
|
|
|
- if (MidDoc.Variables.FreeVariables.Item(j + 1).Value == "")
|
|
|
+ if (dr1[0]["lp_sql"].ToString().Contains("pib_year"))
|
|
|
{
|
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
+ string date = dt1.Rows[0][0].ToString();
|
|
|
}
|
|
|
- LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
}
|
|
|
}
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- LogManager.DoLog("SQL维护不正确,请检查SQL语句\n" + sql);
|
|
|
- return;
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- MidDoc.Printer.SwitchTo(MidLabelPrinter.Text);
|
|
|
- MidDoc.PrintDocument();
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 执行打印外箱号
|
|
|
- /// </summary>
|
|
|
- private void OutBoxCodePrint(string la_id, int rowindex)
|
|
|
- {
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
|
|
|
- try
|
|
|
- {
|
|
|
- for (int j = 0; j < OutBoxDoc.Variables.FreeVariables.Count; j++)
|
|
|
- {
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- for (int k = 0; k < OutLabelParam.Rows.Count; k++)
|
|
|
+ if (OutBoxDoc.Variables.FormVariables.Item(j + 1).Value == "")
|
|
|
{
|
|
|
- //名称相等的时候,取SQL进行值的查询
|
|
|
- if (OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name == OutLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
- {
|
|
|
- //获取对应行的pib_id
|
|
|
- string pib_id = LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString();
|
|
|
- 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 = "";
|
|
|
- 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 == "")
|
|
|
- {
|
|
|
- DataRow[] dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "'");
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
- }
|
|
|
- }
|
|
|
- LogManager.DoLog("打印参数【" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + ExeSQL + ",取到值" + OutBoxDoc.Variables.FreeVariables.Item(j + 1).Value);
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- LogManager.DoLog("SQL维护不正确,请检查SQL语句" + sql);
|
|
|
- MessageBox.Show("SQL维护不正确,请检查SQL语句\n" + sql);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ dr1 = Attach.Select("lp_name='" + OutBoxDoc.Variables.FormVariables.Item(j + 1).Name + "'");
|
|
|
+ if (dr1.Length > 0)
|
|
|
+ OutBoxDoc.Variables.FormVariables.Item(j + 1).Value = dr1[0]["lp_sql"].ToString();
|
|
|
}
|
|
|
}
|
|
|
- OutBoxDoc.Printer.SwitchTo(OutBoxPrinter.Text);
|
|
|
OutBoxDoc.PrintDocument();
|
|
|
- LogManager.DoLog("执行打印外箱,pib_id:" + LabelInf.Rows[rowindex].Cells["pib_id1"].Value.ToString());
|
|
|
}
|
|
|
- catch (Exception ex) { MessageBox.Show(ex.Message); }
|
|
|
}
|
|
|
|
|
|
private void CleanDetail_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
ArrayList<string> DeleteID = new ArrayList<string>();
|
|
|
+ StringBuilder pibid = new StringBuilder();
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
|
|
|
+ {
|
|
|
DeleteID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
|
|
|
+ pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",");
|
|
|
+ }
|
|
|
}
|
|
|
//勾选了删除的明细之后
|
|
|
if (DeleteID.ToArray().Length > 0)
|
|
|
@@ -1717,6 +1586,8 @@ namespace UAS_LabelMachine
|
|
|
string close = MessageBox.Show(this.ParentForm, "删除后不可恢复,是否确认删除", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
if (close.ToString() == "Yes")
|
|
|
{
|
|
|
+ pibid.Append("1");
|
|
|
+ sdh.ExecuteSql("delete from prodiobarcode where pib_id in(" + pibid + ")", "delete");
|
|
|
dh.BatchInsert("delete from prodiobarcode where pib_id=:pib_id", new string[] { "pib_id" }, DeleteID.ToArray());
|
|
|
MessageBox.Show("删除成功");
|
|
|
LoadGridData(sender, e);
|
|
|
@@ -1779,7 +1650,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
|
}
|
|
|
-
|
|
|
+ DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
|
/// 自定义函数 加载明细行的数据,多处使用添加进函数
|
|
|
/// </summary>
|
|
|
@@ -1788,32 +1659,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 +1702,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 +1761,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)
|
|
|
{
|
|
|
//用户在重新勾选后重置采集项目的索引
|
|
|
@@ -1984,8 +1827,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (MidLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
|
|
|
- MidBoxCodePrint(la_id, CurrentRowIndex);
|
|
|
+ MidBoxCodePrint(CurrentRowIndex);
|
|
|
}
|
|
|
else
|
|
|
MessageBox.Show("未维护中盒模板");
|
|
|
@@ -2177,82 +2019,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)
|
|
|
@@ -2271,24 +2037,31 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void LabelInf_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
+ StringBuilder pibid = new StringBuilder();
|
|
|
+ string madein = LabelInf.Rows[e.RowIndex].Cells["pib_madein"].Value.ToString();
|
|
|
if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "盒")
|
|
|
{
|
|
|
- string madein = LabelInf.Rows[e.RowIndex].Cells["pib_madein"].Value.ToString();
|
|
|
+
|
|
|
string midbox = LabelInf.Rows[e.RowIndex].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
{
|
|
|
if (midbox == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
+ {
|
|
|
LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
|
|
|
+ pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (LabelInf.Columns[e.ColumnIndex].Name == "pib_madein" && CollectionUnit.Text == "全部")
|
|
|
{
|
|
|
- string madein = LabelInf.Rows[e.RowIndex].Cells["pib_madein"].Value.ToString();
|
|
|
for (int i = 0; i < LabelInf.Rows.Count; i++)
|
|
|
{
|
|
|
LabelInf.Rows[i].Cells["pib_madein"].Value = madein;
|
|
|
+ pibid.Append(LabelInf.Rows[i].Cells["pib_id1"].Value + ",");
|
|
|
}
|
|
|
}
|
|
|
+ pibid.Append("1");
|
|
|
+ sdh.ExecuteSql("update prodiobarcode set pib_madein='" + madein + "' where pib_id in (" + pibid + ")", "update");
|
|
|
}
|
|
|
|
|
|
private void ExportData_Click(object sender, EventArgs e)
|
|
|
@@ -2298,7 +2071,7 @@ namespace UAS_LabelMachine
|
|
|
if (result == DialogResult.OK)
|
|
|
{
|
|
|
ExcelHandler eh = new ExcelHandler();
|
|
|
- DataTable dt = ((DataTable)MidSource.DataSource).Copy();
|
|
|
+ DataTable dt = ((DataTable)LabelInf.DataSource).Copy();
|
|
|
for (int i = dt.Columns.Count - 1; i >= 0; i--)
|
|
|
{
|
|
|
for (int j = 0; j < LabelInf.Columns.Count; j++)
|
|
|
@@ -2379,5 +2152,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;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|