浏览代码

修改同名称标签不能用于同一个客户多个类型

章政 6 年之前
父节点
当前提交
1976e88d5d
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      UAS-出货标签管理(贸易版)/客户标签维护.cs

+ 9 - 3
UAS-出货标签管理(贸易版)/客户标签维护.cs

@@ -137,7 +137,7 @@ namespace UAS_LabelMachine
                     System.DateTime time;
                     System.DateTime time;
                     try
                     try
                     {
                     {
-                       time = Convert.ToDateTime(LabelDataGridView.Rows[e.RowIndex].Cells["cl_date"].Value.ToString());
+                        time = Convert.ToDateTime(LabelDataGridView.Rows[e.RowIndex].Cells["cl_date"].Value.ToString());
                     }
                     }
                     catch (Exception)
                     catch (Exception)
                     {
                     {
@@ -295,7 +295,7 @@ namespace UAS_LabelMachine
         {
         {
             if (LabelCode != "")
             if (LabelCode != "")
             {
             {
-          
+
             }
             }
         }
         }
 
 
@@ -303,7 +303,7 @@ namespace UAS_LabelMachine
         {
         {
             try
             try
             {
             {
-             
+
             }
             }
             catch (Exception)
             catch (Exception)
             {
             {
@@ -343,6 +343,12 @@ namespace UAS_LabelMachine
                     }
                     }
                     else
                     else
                     {
                     {
+                        DataTable dt = (DataTable)dh.ExecuteSql("select cl_custcode,cl_labeltype from customerlabel where cl_labelname='" + la_name.Text + "' and cl_custcode='" + 客户编号.Text + "' and cl_labeltype<>'" + la_type1.Text + "'", "select");
+                        if (dt.Rows.Count > 0)
+                        {
+                            MessageBox.Show("已有名称为" + la_name.Text + "的标签用作" + dt.Rows[0]["cl_custcode"].ToString() + dt.Rows[0]["cl_labeltype"].ToString());
+                            return;
+                        }
                         sql.Clear();
                         sql.Clear();
                         sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
                         sql.Append("insert into customerlabel (cl_id,cl_labelcode,cl_custcode,cl_labeltype,cl_labelurl,cl_labelname,cl_labelsoft,cl_date) values( customerlabel_seq.nextval, ");
                         sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "" : 客户编号.Text) + "','" + la_type1.Text + "','" + ftpOperater.FTPAddress + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");
                         sql.Append("'" + la_code.Text + "','" + (客户编号.Text == "" ? "" : 客户编号.Text) + "','" + la_type1.Text + "','" + ftpOperater.FTPAddress + "','" + la_name.Text + "','" + SoftWare + "',sysdate)");