瀏覽代碼

保存路径修改

Hcsy 8 年之前
父節點
當前提交
8cd3a4eea4
共有 2 個文件被更改,包括 40 次插入36 次删除
  1. 39 35
      UAS-MES/FunctionCode/Make/Make_Decompose.cs
  2. 1 1
      UAS-MES/PublicMethod/ftpOperater.cs

+ 39 - 35
UAS-MES/FunctionCode/Make/Make_Decompose.cs

@@ -37,9 +37,9 @@ namespace UAS_MES.Make
 
         //记录当前输入框的值
         string sncode_1;
-        string[] bccode ;
+        string[] bccode;
         string[] bgcode;
-        string[] id ;
+        string[] id;
 
         public Make_Decompose()
         {
@@ -78,10 +78,11 @@ namespace UAS_MES.Make
                         BaseUtil.SetFormValue(this.Controls, dt);
                         if (dt.Rows[0]["ms_firstsn"].ToString() == "")
                         {
-                            LoadData(ms_makecode.Text,sender,e);
+                            LoadData(ms_makecode.Text, sender, e);
                         }
-                        else {
-                            LoadData(dt.Rows[0]["ms_firstsn"].ToString(),sender,e);
+                        else
+                        {
+                            LoadData(dt.Rows[0]["ms_firstsn"].ToString(), sender, e);
                         }
                         GetItem();
                     }
@@ -94,9 +95,10 @@ namespace UAS_MES.Make
                         return;
                     }
                 }
-                else {
+                else
+                {
                     ms_id = null;
-                    OperateResult.AppendText(">>序列号"+ sncode_1 + "不存在\n",Color.Red);
+                    OperateResult.AppendText(">>序列号" + sncode_1 + "不存在\n", Color.Red);
                     sn_code.Text = "";
                     BaseUtil.CleanForm(this);
                     sn_code.Focus();
@@ -119,7 +121,7 @@ namespace UAS_MES.Make
         }
 
         //加载此序列号上料记录
-        private void LoadData(string sncode,object sender,KeyEventArgs e)
+        private void LoadData(string sncode, object sender, KeyEventArgs e)
         {
             sncode_1 = sncode;
             sql.Clear();
@@ -130,10 +132,11 @@ namespace UAS_MES.Make
             {
                 BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt);
             }
-            else {
-                OperateResult.AppendText(">>序列号"+ ms_sncode.Text + "无上料数据\n", Color.Red);              
+            else
+            {
+                OperateResult.AppendText(">>序列号" + ms_sncode.Text + "无上料数据\n", Color.Red);
             }
-            LoadBadcode(sender,e);
+            LoadBadcode(sender, e);
         }
 
 
@@ -198,18 +201,19 @@ namespace UAS_MES.Make
             sql.Append("mb_badremark from makebad left join badcode on bc_code=mb_badcode left join badgroup ");
             sql.Append("on bg_code=mb_bgcode where mb_sncode='" + ms_sncode.Text + "' and mb_makecode='" + ms_makecode.Text + "' and mb_status=0");
             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-            if (dt.Rows.Count > 0) {
+            if (dt.Rows.Count > 0)
+            {
                 sql.Clear();
                 bccode = new string[dt.Rows.Count];
                 bgcode = new string[dt.Rows.Count];
                 id = new string[dt.Rows.Count];
                 for (int i = 0; i < dt.Rows.Count; i++)
-                {     
-                    sql.Append( dt.Rows[i]["mb_bgcode"].ToString()+" : "+dt.Rows[i]["mb_badcode"].ToString()+"  ");
+                {
+                    sql.Append(dt.Rows[i]["mb_bgcode"].ToString() + " : " + dt.Rows[i]["mb_badcode"].ToString() + "  ");
                     bgcode[i] = dt.Rows[i]["mb_bgcode"].ToString();
                     bccode[i] = dt.Rows[i]["mb_badcode"].ToString();
                     id[i] = dh.GetSEQ("MakeBad_seq");
-                }            
+                }
                 for (int i = 0; i < LabelDataGridView.Rows.Count; i++)
                 {
                     LabelDataGridView.Rows[i].Cells["mb_badcode"].Value = sql.GetString();
@@ -224,7 +228,7 @@ namespace UAS_MES.Make
             {
                 if (LabelDataGridView.Rows[i].Cells["Choose"].Value != null)
                 {
-                    if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value == null|| LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null))
+                    if ((Boolean)LabelDataGridView.Rows[i].Cells["Choose"].Value == true && (LabelDataGridView.Rows[i].Cells["mb_badcode"].Value == null || LabelDataGridView.Rows[i].Cells["New_BarCode"].Value == null))
                     {
                         OperateResult.AppendText("第" + (i + 1) + "行没有采集不良代码或新批号\n", Color.Red);
                         return;
@@ -245,7 +249,7 @@ namespace UAS_MES.Make
                             sql.Append("select sp_id,sp_tracekind,sp_barcoderule,sp_prefix,sp_ifuseregex,sp_ifforsn,sp_length,sp_description,sp_soncode,pr_detail,pr_spec,");
                             sql.Append("sp_repcode,pr_id,sp_type,case when (sp_type='物料' and sp_soncode=pr_code) then '已采集' else '未采集' end sp_ifpick ,sp_prefix,");
                             sql.Append("sp_length,sp_regex,sp_ifforsn from stepproduct left join product on pr_code=sp_soncode where sp_bomversion='" + ma_bomversion + "' and ");
-                            sql.Append("sp_craftcode='" + ms_craftcode.Text + "'and sp_mothercode ='" + ms_prodcode.Text + "' and sp_soncode = '"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "' ");
+                            sql.Append("sp_craftcode='" + ms_craftcode.Text + "'and sp_mothercode ='" + ms_prodcode.Text + "' and sp_soncode = '" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "' ");
                             sql.Append("and((sp_type = '物料' and( sp_tracekind <> 2 or sp_tracekind is null))or sp_type <> '物料') order by SP_DETNO asc");
                             dtbar = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
 
@@ -256,15 +260,14 @@ namespace UAS_MES.Make
                             string sp_barcoderule = dtbar.Rows[0]["sp_barcoderule"].ToString();
                             if (!LogicHandler.CheckSNBeforeLoad(LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString(), sp_soncode, sp_barcoderule, sp_prefix, length, out ErrorMessage))
                             {
-                                OperateResult.AppendText(">>物料" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value.ToString() + " "+ErrorMessage + "\n", Color.Red);
+                                OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
                                 LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));
                                 return;
                             }
-                       
 
                             //获取物料生产类型属性
                             sql.Clear();
-                            sql.Append("select cm_soncode,cm_barcode, pr_manutype from craftmaterial left join product on cm_soncode=pr_code where cm_id ='"+ LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
+                            sql.Append("select cm_soncode,cm_barcode, pr_manutype from craftmaterial left join product on cm_soncode=pr_code where cm_id ='" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             string pr_manutype = dt.Rows[0]["pr_manutype"].ToString();
                             //制造件
@@ -283,11 +286,12 @@ namespace UAS_MES.Make
                                 dh.ExecuteSql(sql.GetString(), "update");
                             }
                             //采购件,则将不良信息插入不良零件表中MAKEBADRSPART
-                            else {
+                            else
+                            {
                                 sql.Clear();
                                 sql.Append("insert into  MAKEBADRSPART(mbp_id,mbp_indate,mbp_inman,mbp_sncode, mbp_badcode, mbp_part, mbp_makecode, mbp_sccode)values");
-                                sql.Append("(MAKEBADRSPART_seq.nextval, sysdate, '"+User.UserCode+"','"+ LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "',:bc_code,'"+ LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "','"+ms_makecode.Text+"','"+User.UserSourceCode+"')");
-                                dh.BatchInsert(sql.GetString(), new string[] {"bc_code"},bccode);
+                                sql.Append("(MAKEBADRSPART_seq.nextval, sysdate, '" + User.UserCode + "','" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "',:bc_code,'" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "','" + ms_makecode.Text + "','" + User.UserSourceCode + "')");
+                                dh.BatchInsert(sql.GetString(), new string[] { "bc_code" }, bccode);
                             }
 
                             sql.Clear();
@@ -303,10 +307,10 @@ namespace UAS_MES.Make
                             sql.Clear();
                             sql.Append("insert into craftmaterial (cm_id, cm_makecode,cm_maid,cm_maprodcode,cm_soncode,cm_mscode,cm_sncode,cm_stepcode,cm_stepname,");
                             sql.Append("cm_craftcode,cm_craftname,cm_barcode,cm_inqty,cm_indate,cm_inman,cm_linecode,cm_wccode,cm_sourcecode,cm_spid, cm_materialtype,cm_status)");
-                            sql.Append("values(Craftmaterial_seq.nextval,'"+ms_makecode.Text+"','"+ LabelDataGridView.Rows[i].Cells["cm_maid"].Value + "','"+ms_prodcode.Text+ "','" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
-                            sql.Append(",'"+ LabelDataGridView.Rows[i].Cells["cm_sncode"].Value + "','"+ LabelDataGridView.Rows[i].Cells["cm_sncode"].Value + "','"+User.CurrentStepCode+"','"+User.CurrentStepName+"',");
-                            sql.Append("'"+ms_craftcode.Text+"','"+ms_craftname.Text+"','"+ LabelDataGridView.Rows[i].Cells["New_BarCode"].Value + "',1,sysdate,'"+User.UserName+"','"+User.UserLineCode+"','"+ms_wccode.Text+"',");
-                            sql.Append("'"+User.UserSourceCode+"','"+ sp_id + "','"+ LabelDataGridView.Rows[i].Cells["cm_materialtype"].Value + "','0')");
+                            sql.Append("values(Craftmaterial_seq.nextval,'" + ms_makecode.Text + "','" + LabelDataGridView.Rows[i].Cells["cm_maid"].Value + "','" + ms_prodcode.Text + "','" + LabelDataGridView.Rows[i].Cells["cm_soncode"].Value + "'");
+                            sql.Append(",'" + LabelDataGridView.Rows[i].Cells["cm_sncode"].Value + "','" + LabelDataGridView.Rows[i].Cells["cm_sncode"].Value + "','" + User.CurrentStepCode + "','" + User.CurrentStepName + "',");
+                            sql.Append("'" + ms_craftcode.Text + "','" + ms_craftname.Text + "','" + LabelDataGridView.Rows[i].Cells["New_BarCode"].Value + "',1,sysdate,'" + User.UserName + "','" + User.UserLineCode + "','" + ms_wccode.Text + "',");
+                            sql.Append("'" + User.UserSourceCode + "','" + sp_id + "','" + LabelDataGridView.Rows[i].Cells["cm_materialtype"].Value + "','0')");
                             dh.ExecuteSql(sql.GetString(), "insert");
                             OperateResult.AppendText("物料" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "拆解换料成功\n", Color.Green);
                             decompose = true;
@@ -316,11 +320,11 @@ namespace UAS_MES.Make
                     {
                         //craftmaterial解除相应物料绑定
                         sql.Clear();
-                        sql.Append("update craftmaterial set cm_status=-1,cm_dropman='"+User.UserName+"',");
-                        sql.Append("cm_dropdate =sysdate,cm_dropstep='"+User.CurrentStepName+"',");
-                        sql.Append("cm_dropsccode='" + User.CurrentStepCode + "' where cm_id='"+ LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
+                        sql.Append("update craftmaterial set cm_status=-1,cm_dropman='" + User.UserName + "',");
+                        sql.Append("cm_dropdate =sysdate,cm_dropstep='" + User.CurrentStepName + "',");
+                        sql.Append("cm_dropsccode='" + User.CurrentStepCode + "' where cm_id='" + LabelDataGridView.Rows[i].Cells["cm_id"].Value + "'");
                         dh.ExecuteSql(sql.GetString(), "update");
-                        OperateResult.AppendText("物料"+ LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "拆解成功\n",Color.Green);
+                        OperateResult.AppendText("物料" + LabelDataGridView.Rows[i].Cells["cm_barcode"].Value + "拆解成功\n", Color.Green);
                         decompose = true;
                     }
                 }
@@ -329,11 +333,12 @@ namespace UAS_MES.Make
             {
                 count++;
                 deccount.Text = count + "";
-                LoadData(sncode_1,sender, new KeyEventArgs(Keys.Enter));
+                LoadData(sncode_1, sender, new KeyEventArgs(Keys.Enter));
             }
-            else {
+            else
+            {
                 OperateResult.AppendText("没有选择拆解项\n", Color.Red);
-            }          
+            }
         }
 
         private void LabelDataGridView_Sorted(object sender, EventArgs e)
@@ -342,4 +347,3 @@ namespace UAS_MES.Make
         }
     }
 }
-    

+ 1 - 1
UAS-MES/PublicMethod/ftpOperater.cs

@@ -255,7 +255,7 @@ namespace UAS_MES.PublicMethod
             string targetPath = BaseUtil.GetCacheData("SavePath").ToString();
             //var file = Directory.GetFiles(targetPath);
             string sourceFile = Path.Combine(URL);
-            string destFile = Path.Combine(DownLoadTo+@"\", fileName);
+            string destFile = Path.Combine(DownLoadTo, fileName);
             //不存在文件的话进行创建
             if (!Directory.Exists(DownLoadTo))
             Directory.CreateDirectory(DownLoadTo);