Browse Source

更新烧录macbt去除符号

shim 8 years ago
parent
commit
6c14c2802c
1 changed files with 17 additions and 3 deletions
  1. 17 3
      UAS-MES/FunctionCode/Make/Make_UpdateCollectCode.cs

+ 17 - 3
UAS-MES/FunctionCode/Make/Make_UpdateCollectCode.cs

@@ -25,6 +25,8 @@ namespace UAS_MES.Make
 
         DataTable info;
 
+        DataTable macRange;
+
         int step = 0;
 
         List<CheckBox> list = new List<CheckBox>();//记录勾选的控件
@@ -159,10 +161,22 @@ namespace UAS_MES.Make
                             else
                             {
                                 //判断是否有合同号MAC范围
-                                if (dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'"))
+                                //if (dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'"))
+                                //{
+                                //    //有范围的情况下看是否在范围内
+                                //    if (!dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and  sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "' AND  '" + inputValue.Text.Replace(":", "").Replace("-", "") + "' between sr_startcode and sr_endcode"))
+                                //    {
+                                //        OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + "错误,不在合同防呆范围内\n", Color.Red, inputValue);
+                                //        OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black);
+                                //        return;
+                                //    }
+                                //}
+                                sql.Clear();
+                                sql.Append("select sr_startcode,sr_endcode from SaleMacBTRange where sr_sacode = '" + dt.Rows[0]["ms_salecode"].ToString() + "' and sr_type = '"+ ((CheckBox)list[step - 1]).Text.Split('/')[0] + "'");
+                                macRange = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
+                                if (macRange.Rows.Count > 0)
                                 {
-                                    //有范围的情况下看是否在范围内
-                                    if (!dh.CheckExist("SaleMacBTRange", "sr_sacode='" + dt.Rows[0]["ms_salecode"].ToString() + "' and  sr_type='" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "' AND  '" + inputValue.Text + "' between sr_startcode and sr_endcode"))
+                                    if (!(macRange.Rows[0]["sr_startcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(inputValue.Text.Replace(":", "").Replace("-", "")) <= 0 && macRange.Rows[0]["sr_endcode"].ToString().Replace(":", "").Replace("-", "").CompareTo(inputValue.Text.Replace(":", "").Replace("-", "")) >= 0))
                                     {
                                         OperateResult.AppendText("<<" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + ":" + inputValue.Text + "错误,不在合同防呆范围内\n", Color.Red, inputValue);
                                         OperateResult.AppendText(">>请采集" + ((CheckBox)list[step - 1]).Text.Split('/')[0] + "\n", Color.Black);