callm 1 жил өмнө
parent
commit
5ce2ab939e

+ 16 - 13
FileWatcher/SOP.Designer.cs

@@ -46,11 +46,11 @@
             this.li_code = new System.Windows.Forms.TextBox();
             this.label5 = new System.Windows.Forms.Label();
             this.SendDGV = new System.Windows.Forms.DataGridView();
-            this.ChooseALL = new System.Windows.Forms.Button();
             this.CheckColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.fp_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.fp_path = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.issend = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ChooseALL = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.SendDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -218,6 +218,7 @@
             // 
             // SendDGV
             // 
+            this.SendDGV.AllowUserToAddRows = false;
             this.SendDGV.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
             this.SendDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@@ -226,29 +227,20 @@
             this.fp_name,
             this.fp_path,
             this.issend});
-            this.SendDGV.Location = new System.Drawing.Point(865, 32);
+            this.SendDGV.Location = new System.Drawing.Point(865, 61);
             this.SendDGV.Name = "SendDGV";
             this.SendDGV.RowHeadersWidth = 82;
             this.SendDGV.RowTemplate.Height = 37;
-            this.SendDGV.Size = new System.Drawing.Size(1068, 788);
+            this.SendDGV.Size = new System.Drawing.Size(1068, 759);
             this.SendDGV.TabIndex = 22;
             // 
-            // ChooseALL
-            // 
-            this.ChooseALL.Location = new System.Drawing.Point(865, 54);
-            this.ChooseALL.Name = "ChooseALL";
-            this.ChooseALL.Size = new System.Drawing.Size(80, 42);
-            this.ChooseALL.TabIndex = 23;
-            this.ChooseALL.Text = "全选";
-            this.ChooseALL.UseVisualStyleBackColor = true;
-            this.ChooseALL.Click += new System.EventHandler(this.ChooseALL_Click);
-            // 
             // CheckColumn
             // 
             this.CheckColumn.DataPropertyName = "CheckColumn";
             this.CheckColumn.HeaderText = "勾选";
             this.CheckColumn.MinimumWidth = 100;
             this.CheckColumn.Name = "CheckColumn";
+            this.CheckColumn.Width = 200;
             // 
             // fp_name
             // 
@@ -256,6 +248,7 @@
             this.fp_name.HeaderText = "文件名";
             this.fp_name.MinimumWidth = 10;
             this.fp_name.Name = "fp_name";
+            this.fp_name.Width = 200;
             // 
             // fp_path
             // 
@@ -273,6 +266,16 @@
             this.issend.Name = "issend";
             this.issend.Width = 200;
             // 
+            // ChooseALL
+            // 
+            this.ChooseALL.Location = new System.Drawing.Point(865, 61);
+            this.ChooseALL.Name = "ChooseALL";
+            this.ChooseALL.Size = new System.Drawing.Size(80, 42);
+            this.ChooseALL.TabIndex = 23;
+            this.ChooseALL.Text = "全选";
+            this.ChooseALL.UseVisualStyleBackColor = true;
+            this.ChooseALL.Click += new System.EventHandler(this.ChooseALL_Click);
+            // 
             // SOP
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);

+ 19 - 37
FileWatcher/SOP.cs

@@ -33,6 +33,7 @@ namespace FileWatcher
         private void Form3_Load(object sender, EventArgs e)
         {
             CheckForIllegalCrossThreadCalls = false;
+            tcpserver.Start();
         }
 
         void uploadfile()
@@ -42,22 +43,16 @@ namespace FileWatcher
             DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "' ", "select");
             if (dt.Rows.Count == 0)
             {
-                //DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where pr_code='" + pr_code.Text + "'", "select");
-                //if (dt1.Rows.Count > 0)
-                //{
                 string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
                 dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman)values(productsop_seq.nextval,'" + code + "','" + pr_code.Text + "',sysdate,'" + usercode + "')", "insert");
-                //}
-                //else
-                //{
-                //    MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-                //    return;
-                //}
             }
             else
             {
+                string ps_id = dt.Rows[0]["ps_id"].ToString();
+                dh.ExecuteSql("delete from ProductSOPdetail where psd_psid='" + ps_id + "'", "delete");
                 pr_code.Text = dt.Rows[0]["ps_prodcode"].ToString();
             }
+
             Workbook workbook = new Workbook(FilePath.Text);
             List<Worksheet> list = new List<Worksheet>();
             List<string> filename = new List<string>();
@@ -116,7 +111,7 @@ namespace FileWatcher
                 imgOptions.ImageFormat = ImageFormat.Png;
                 imgOptions.OnePagePerSheet = true;
                 imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
-                imgOptions.SetDesiredSize(1565, 1240);
+                imgOptions.SetDesiredSize(1565, 1043);
                 SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
                 sr.ToImage(0, Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg");
                 //// 创建一个图片
@@ -127,10 +122,12 @@ namespace FileWatcher
                 dic.Add("caller", "ProductSOP");
                 OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
                 string fp_id = UploadFilesToRemoteUrl("http://113.98.196.181:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg", dic);
-                if (fp_id != "")
-                {
-                    dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
-                }
+                string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + pr_code.Text + "'").ToString();
+                dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + sheet.Name + ".jpg" + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + pr_code.Text + "'", "insert");
+                //if (fp_id != "")
+                //{
+                //    dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
+                //}
             }
             catch (Exception ex)
             {
@@ -284,7 +281,6 @@ namespace FileWatcher
                 dh.ExecuteSql("update SOPSOURCE set SS_BRDIP='" + IPAddress + "'", "update");
                 if (SendDGV.Rows.Count > 0)
                 {
-                    tcpserver.Start();
                     Thread.Sleep(8000);
                     List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
                     JavaScriptSerializer jss = new JavaScriptSerializer();
@@ -311,6 +307,7 @@ namespace FileWatcher
                     map.Add("success", true);
                     map.Add("data", map1);
                     tcpserver.Send(jss.Serialize(map));
+                    //Thread.Sleep(2000);
                     //tcpserver.Stop();
                     LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
                     MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
@@ -360,26 +357,16 @@ namespace FileWatcher
 
         private void LoadPrCode()
         {
-            //DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where pr_code='" + pr_code.Text + "'", "select");
-            //if (dt.Rows.Count > 0)
-            //{
-            //    pr_spec.Clear();
-            //    pr_spec.AppendText(dt.Rows[0]["pr_spec"].ToString());
-            //    pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
-            //    pr_code.Text = dt.Rows[0]["pr_code"].ToString();
-            //}
-            //else
-            //{
-            //    MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-            //}
             DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
-                List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
-                string PS_ATTACHSOP = dt.Rows[0]["PS_ATTACHSOP"].ToString();
-                PS_ATTACHSOP = PS_ATTACHSOP.Substring(0, PS_ATTACHSOP.Length - 1).Replace(";", ",");
-                dt = (DataTable)dh.ExecuteSql("select fp_path, fp_name,'' issend from filepath where fp_id in (" + PS_ATTACHSOP + ") and nvl(fp_path, ' ') <> ' '", "select");
-                SendDGV.DataSource = dt;
+                string ps_id = dt.Rows[0]["ps_id"].ToString();
+                dt = (DataTable)dh.ExecuteSql("select fp_name,fp_path,'' issend from ProductSOPdetail left join " +
+                    "filepath on FP_ID=substr(PSD_ATTACH,instr(PSD_ATTACH,';')+1)  where psd_psid=" + ps_id, "select");
+                if (dt.Rows.Count > 0)
+                {
+                    SendDGV.DataSource = dt;
+                }
             }
         }
 
@@ -388,11 +375,6 @@ namespace FileWatcher
             LoadPrCode();
         }
 
-        private void pr_spec_Click(object sender, EventArgs e)
-        {
-
-        }
-
         bool AllChecked = false;
         private void ChooseALL_Click(object sender, EventArgs e)
         {

+ 0 - 12
FileWatcher/SOP.resx

@@ -132,16 +132,4 @@
   <metadata name="issend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="CheckColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_path.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="issend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
 </root>