Browse Source

BUG调整

callm 6 years ago
parent
commit
248a0aa882

+ 1 - 1
UAS-出货标签管理(吉利通)/PublicMethod/BaseUtil.cs

@@ -343,7 +343,7 @@ namespace UAS_LabelMachine
             //如果是传入的数据是从FTP取的文件
             if (URL.Contains("ftp:"))
             {
-                ftpOperater ftp = new ftpOperater();
+                ftpOperater ftp = new ftpOperater(false);
                 return ftp.Download(LabelName, time);
             }
             else

+ 13 - 1
UAS-出货标签管理(吉利通)/PublicMethod/DataHelper.cs

@@ -343,7 +343,19 @@ namespace UAS_LabelMachine
             sql += " from " + TableName + " where " + Condition;
             command = new OracleCommand(sql, connection);
             OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
+            try
+            {
+                ad.Fill(dt);
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(DBConnectionString);
+                connection.Open();
+                command.Connection = connection;
+                ad = new OracleDataAdapter(command);
+                ad.Fill(dt);
+                ad.Dispose();
+            }
             command.Dispose();
             return dt;
         }

+ 5 - 2
UAS-出货标签管理(吉利通)/PublicMethod/ftpOperater.cs

@@ -16,7 +16,7 @@ namespace UAS_LabelMachine
         private string ftpUser;
         private string ftpPwd;
 
-        public ftpOperater()
+        public ftpOperater(bool PortModel)
         {
             string[] FTPInf = DataHelper.FTPAdress.Split('|');
             this.ftpServerIP = FTPInf[0];
@@ -43,6 +43,7 @@ namespace UAS_LabelMachine
             FtpWebRequest reqFTP;
             reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpServerIP + "/" + filename));
             reqFTP.UseBinary = true;
+            reqFTP.UsePassive = false;
             reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
             reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
             FileInfo file = new FileInfo(filepath + "/" + filename);
@@ -81,6 +82,7 @@ namespace UAS_LabelMachine
                 reqFTP.UseBinary = true;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
                 reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
+                reqFTP.UsePassive = false;
                 WebResponse response = reqFTP.GetResponse();
                 StreamReader reader = new StreamReader(response.GetResponseStream());
 
@@ -119,6 +121,7 @@ namespace UAS_LabelMachine
                 reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpServerIP + "/" + filename));
                 reqFTP.Method = WebRequestMethods.Ftp.GetFileSize;
                 reqFTP.UseBinary = true;
+                reqFTP.UsePassive = false;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
@@ -147,7 +150,7 @@ namespace UAS_LabelMachine
                 reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
                 reqFTP.UseBinary = true;
                 reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPwd);
-                reqFTP.UsePassive = true;
+                reqFTP.UsePassive = false;
                 FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
                 Stream ftpStream = response.GetResponseStream();
                 long cl = response.ContentLength;

+ 9 - 15
UAS-出货标签管理(吉利通)/UAS_出货标签管理.cs

@@ -331,8 +331,10 @@ namespace UAS_LabelMachine
                         //}
                         break;
                     case "PLC2":
+                        ScanGroup = BaseUtil.filterDataTable(ScanGroup, "sg_autolabel<>0");
                         break;
                     case "FrontendCheck":
+                        ScanGroup = BaseUtil.filterDataTable(ScanGroup, "sg_autolabel<>0");
                         //比对当前箱数量和容量
                         FrontCollect.Text = msg;
                         if (!FrontCheckFunction(msg, out ErrorMsg))
@@ -377,6 +379,7 @@ namespace UAS_LabelMachine
                         }
                         break;
                     case "BackendCheck":
+                        ScanGroup = BaseUtil.filterDataTable(ScanGroup, "sg_autolabel<>0");
                         BackCheck.Text = msg;
                         if (BackendCheckFunction(msg, "Auto", out ErrorMsg))
                         {
@@ -570,11 +573,7 @@ namespace UAS_LabelMachine
                         ErrorMsg = "订单号不匹配";
                     }
                     //如果匹配到的行的品牌和当前正则的品牌不相等结束本次循环
-                    if (LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].Value.ToString() != sg_brand)
-                    {
-                        continue;
-                    }
-                    else
+                    if (LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"].Value.ToString() == sg_brand)
                     {
                         break;
                     }
@@ -1376,7 +1375,7 @@ namespace UAS_LabelMachine
             for (int j = 0; j < MidDoc.Variables.FormVariables.Count; j++)
             {
                 DataRow[] dr1 = MidLabelParam.Select("lp_name='" + MidDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串")
+                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                 {
                     sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
@@ -1462,7 +1461,7 @@ namespace UAS_LabelMachine
             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[0]["lp_valuetype"].ToString() == "字符串")
+                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                 {
                     sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
@@ -1604,11 +1603,7 @@ namespace UAS_LabelMachine
             {
                 //嵌套查询重置RowNum
                 sql.Clear();
-                sql.Append("select t.*,rownum from (select pd_pdno,pib_autoset,pd_ordercode,pib_year,pi_remark,pi_remark2,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,(select pr_brand from saledetail left join product on pr_code=sd_prodcode where sd_code=pd_ordercode and sd_detno=pd_orderdetno ) sd_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  where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");
+                sql.Append("select t.*,rownum from prodiobarcode_view t where pib_inoutno='" + pi_inoutno.Text + "'");
                 LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 //检验查询的字段和本地数据库字段是否匹配
                 adh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
@@ -2553,10 +2548,9 @@ namespace UAS_LabelMachine
             for (int j = 0; j < SingleDoc.Variables.FormVariables.Count; j++)
             {
                 DataRow[] dr1 = SingleLabelParam.Select("lp_name='" + SingleDoc.Variables.FormVariables.Item(j + 1).Name + "'");
-                if (dr1.Length > 0)
+                if (dr1.Length > 0 && dr1[0]["lp_valuetype"].ToString() == "字符串" && dr1[0]["lp_sql"].ToString() != "")
                 {
-                    if (dr1[0]["lp_valuetype"].ToString() == "字符串")
-                        sql.Append(dr1[0]["lp_sql"].ToString() + ",");
+                    sql.Append(dr1[0]["lp_sql"].ToString() + ",");
                 }
             }
             sql.Append("1,");

+ 1 - 1
UAS-出货标签管理(吉利通)/客户标签维护.cs

@@ -335,7 +335,7 @@ namespace UAS_LabelMachine
                 }
                 if (FTPShare.Checked)
                 {
-                    ftpOperater ftp = new ftpOperater();
+                    ftpOperater ftp = new ftpOperater(false);
                     ftp.UpLoadFile(sourcePath, fileName);
                     string SoftWare = "CodeSoft";
                     if (CL_ID2 != null)