|
|
@@ -11,6 +11,7 @@ using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
using UAS_MES.DataOperate;
|
|
|
+using UAS_MES.Entity;
|
|
|
using UAS_MES.PublicForm;
|
|
|
using UAS_MES.PublicMethod;
|
|
|
|
|
|
@@ -42,8 +43,6 @@ namespace UAS_MES.Make
|
|
|
|
|
|
//ftpOperater ftp;
|
|
|
|
|
|
- System.DateTime[] indate;
|
|
|
-
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
bool canPrint = false;
|
|
|
@@ -92,22 +91,22 @@ namespace UAS_MES.Make
|
|
|
return;
|
|
|
}
|
|
|
//查询产品是否有自定义的标签模板
|
|
|
- listA = (DataTable)dh.ExecuteSql("select pl_labelcode ||':'||pl_labelname pl_name,pl_id,pl_labeltype,pl_labelcode,pl_labelurl,pl_isdefault,pl_detno,pl_labelsoft,pl_status,pl_statuscode,pl_labelname,pl_indate from productlabel where pl_prodcode='" + pr_code.Text + "' and pl_labeltype='自定义' order by pl_isdefault desc", "select");
|
|
|
+ listA = (DataTable)dh.ExecuteSql("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
if (listA.Rows.Count == 0)
|
|
|
{
|
|
|
OperateResult.AppendText("<<产品:" + pr_code.Text + ",没有维护自定义模板\n", Color.Red, pr_code);
|
|
|
return;
|
|
|
}
|
|
|
- if (listA.Rows[0]["pl_isdefault"].ToString() != "1") {
|
|
|
+ if (listA.Rows[0]["la_isdefault"].ToString() != "-1") {
|
|
|
//说明没有默认的模板,那就取pl_id最大的
|
|
|
- listA = (DataTable)dh.ExecuteSql("select pl_labelcode ||':'||pl_labelname pl_name,pl_id,pl_labeltype,pl_labelcode,pl_labelurl,pl_isdefault,pl_detno,pl_labelsoft,pl_status,pl_statuscode,pl_labelname,pl_indate from productlabel where pl_prodcode='" + pr_code.Text + "' and pl_labeltype='自定义' order by pl_id desc", "select");
|
|
|
+ listA = (DataTable)dh.ExecuteSql("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault", "select");
|
|
|
}
|
|
|
//下载标签
|
|
|
getLabels();
|
|
|
//标签显示
|
|
|
PrintLabel.DataSource = listA;
|
|
|
- PrintLabel.DisplayMember = "pl_name";
|
|
|
- PrintLabel.ValueMember = "pl_labelcode";
|
|
|
+ PrintLabel.DisplayMember = "la_name";
|
|
|
+ PrintLabel.ValueMember = "la_id";
|
|
|
//有值,填充界面
|
|
|
BaseUtil.SetFormValue(this.Controls, dt);
|
|
|
//paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='"+ listA.Rows[0]["pl_labelcode"].ToString() + "' order by lp_detno asc", "select");
|
|
|
@@ -142,7 +141,7 @@ namespace UAS_MES.Make
|
|
|
if (currentIndex==1) {
|
|
|
inputValues = new string[paramsInfo.Rows.Count];
|
|
|
sb = new StringBuilder();
|
|
|
- doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["pl_labelname"].ToString());
|
|
|
+ doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
|
|
|
}
|
|
|
//将值赋到doc对应的变量
|
|
|
for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
|
|
|
@@ -178,8 +177,8 @@ namespace UAS_MES.Make
|
|
|
doc.PrintDocument(int.Parse(printNum.Text));
|
|
|
doc.Close();
|
|
|
//讲文件最后写入时间改成数据库中拿到的时间
|
|
|
- info = new FileInfo(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
|
|
|
- info.LastWriteTime = indate[PrintLabel.SelectedIndex];
|
|
|
+ //记录打印日志
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");
|
|
|
//打印成功
|
|
|
OperateResult.AppendText("<<打印成功\n", Color.Green);
|
|
|
//重置currenIndex为1
|
|
|
@@ -199,11 +198,9 @@ namespace UAS_MES.Make
|
|
|
private void getLabels()
|
|
|
{
|
|
|
//ftp = new ftpOperater();
|
|
|
- indate = new System.DateTime[listA.Rows.Count];
|
|
|
for (int i = 0; i < listA.Rows.Count; i++)
|
|
|
{
|
|
|
- BaseUtil.GetPrintLabel(listA.Rows[i]["pl_labelname"].ToString(), listA.Rows[i]["pl_labelurl"].ToString(), listA.Rows[i]["pl_indate"].ToString());
|
|
|
- indate[i] = Convert.ToDateTime(listA.Rows[i]["pl_indate"].ToString());
|
|
|
+ BaseUtil.GetPrintLabel(listA.Rows[i]["la_name"].ToString(), listA.Rows[i]["la_url"].ToString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -212,12 +209,12 @@ namespace UAS_MES.Make
|
|
|
if (PrintLabel.Text.StartsWith("System")) {
|
|
|
return;
|
|
|
}
|
|
|
- paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='" + listA.Rows[PrintLabel.SelectedIndex]["pl_labelcode"].ToString() + "' order by lp_detno asc", "select");
|
|
|
+ paramsInfo = (DataTable)dh.ExecuteSql("select lp_detno, lp_name, lp_valuetype,lp_sql from label left join labelparameter on lp_laid=la_id where la_code='" + listA.Rows[PrintLabel.SelectedIndex]["la_code"].ToString() + "' order by lp_detno asc", "select");
|
|
|
if (paramsInfo.Rows.Count > 0)
|
|
|
{
|
|
|
//根据查询出来的参数,一次提示用户, “<<SN001 “,
|
|
|
//“>> 请输入自定义模板的(XXXX参数名称)lp_name”
|
|
|
- OperateResult.AppendText("<<" + listA.Rows[PrintLabel.SelectedIndex]["pl_labelcode"].ToString() + "\n", Color.Black);
|
|
|
+ OperateResult.AppendText("<<" + listA.Rows[PrintLabel.SelectedIndex]["la_code"].ToString() + "\n", Color.Black);
|
|
|
OperateResult.AppendText(">>请输入自定义模板" + paramsInfo.Rows[0]["lp_name"].ToString() + "的值\n", Color.Green);
|
|
|
//打开模板路径
|
|
|
//doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.SelectedText.Split(':')[1]);
|
|
|
@@ -228,7 +225,7 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- OperateResult.AppendText("<<标签编号:" + listA.Rows[0]["pl_labelcode"].ToString() + "无标签参数\n", Color.Red);
|
|
|
+ OperateResult.AppendText("<<标签编号:" + listA.Rows[0]["la_code"].ToString() + "无标签参数\n", Color.Red);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -256,7 +253,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
if (canPrint)
|
|
|
{
|
|
|
- doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["pl_labelname"].ToString());
|
|
|
+ doc = lbl.Documents.Open(ftpOperater.DownLoadTo + listA.Rows[PrintLabel.SelectedIndex]["la_name"].ToString());
|
|
|
sb = new StringBuilder();
|
|
|
//将值赋到doc对应的变量
|
|
|
for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
|
|
|
@@ -279,8 +276,8 @@ namespace UAS_MES.Make
|
|
|
doc.PrintDocument(int.Parse(printNum.Text));
|
|
|
doc.Close();
|
|
|
//讲文件最后写入时间改成数据库中拿到的时间
|
|
|
- info = new FileInfo(ftpOperater.DownLoadTo + PrintLabel.Text.Split(':')[1]);
|
|
|
- info.LastWriteTime = indate[PrintLabel.SelectedIndex];
|
|
|
+ //记录打印日志
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "自定义标打印", "成功打印", "", "");
|
|
|
//打印成功
|
|
|
OperateResult.AppendText("<<打印成功\n", Color.Green);
|
|
|
}
|