浏览代码

代码优化

Hcsy 8 年之前
父节点
当前提交
30e1f4950a

+ 0 - 1
UAS-MES/FunctionCode/Make/Make_PositionStock.Designer.cs

@@ -394,7 +394,6 @@
             this.mss_id.DataPropertyName = "mss_id";
             this.mss_id.HeaderText = "ID";
             this.mss_id.Name = "mss_id";
-            this.mss_id.Visible = false;
             // 
             // mss_prodcode
             // 

+ 45 - 23
UAS-MES/FunctionCode/Make/Make_PositionStock.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
 using System.Text;
@@ -159,7 +160,7 @@ namespace UAS_MES.Make
             if (!show_all_check.Checked)
             {
                 sql.Clear();
-                sql.Append("select mss_makecode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
+                sql.Append("select nvl(mss_makecode,' ') mss_makecode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
                 sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
                 sql.Append("pr_code=sp_mothercode left join makesourcestock on mss_makecode='" + ma_code.Text + "' and  mss_craftcode=sb_craftcode ");
                 sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode where sb_prodcode='" + ma_prodcode.Text + "' and sb_craftcode='" + ma_craftcode.Text + "' ");
@@ -171,7 +172,7 @@ namespace UAS_MES.Make
             else
             {
                 sql.Clear();
-                sql.Append("select mss_makecode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
+                sql.Append("select nvl(mss_makecode,' ') mss_makecode,nvl(mss_id,0) mss_id,sp_soncode,mss_prodcode,sp_oneuseqty,mss_barcode,nvl(mss_qty,0) mss_qty ,nvl(mss_remain,0)mss_remain,");
                 sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
                 sql.Append("pr_code=sp_mothercode left join makesourcestock on  mss_craftcode=sb_craftcode ");
                 sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode where  ");
@@ -218,15 +219,10 @@ namespace UAS_MES.Make
                     string soncode = BatchProductDGV.Rows[e.RowIndex].Cells["sp_soncode"].Value.ToString();
                     if (id != "0")
                     {
-                        //if (useqty == "0")
-                        //{
-                            //BatchProductDGV.Rows.RemoveAt(e.RowIndex);
                             dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
                             LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
                             OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
                             FillDataGridView();
-                        //}
-                        //else OperateResult.AppendText(">>料号" + soncode + "已被使用,不允许删除\n", Color.Red);
                     }
                 }
             }
@@ -345,28 +341,54 @@ namespace UAS_MES.Make
 
         private void normalButton1_Click(object sender, EventArgs e)
         {
-            String dialog = MessageBox.Show("是否确认全部下料", "提示", MessageBoxButtons.OKCancel).ToString();
-            if (dialog != "OK")
+            bool makesources = false;
+            for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
             {
-                OperateResult.AppendText("取消全部下料\n", Color.Black);
-                return;
+                string id_1 = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
+                if (id_1 != "0")
+                {
+                    makesources = true;
+                }
             }
-            else
+            if (makesources)
             {
-                for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
+                String dialog = MessageBox.Show("是否确认全部下料", "提示", MessageBoxButtons.OKCancel).ToString();
+                if (dialog != "OK")
                 {
-                    string id = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
-                    string useqty = BatchProductDGV.Rows[i].Cells["mss_useqty"].Value.ToString();
-                    string soncode = BatchProductDGV.Rows[i].Cells["sp_soncode"].Value.ToString();
-                    if (id != "0")
+                    OperateResult.AppendText("取消全部下料\n", Color.Black);
+                    return;
+                }
+                else
+                {
+                    List<string> idcol = new List<string>();
+                    List<string> makecodecol = new List<string>();
+                    List<string> soncodecol = new List<string>();
+                    for (int i = 0; i < BatchProductDGV.Rows.Count; i++)
                     {
-                      //BatchProductDGV.Rows.RemoveAt(i);
-                        dh.ExecuteSql("delete from makesourcestock where mss_id='" + id + "'", "delete");
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "岗位备料", "删除物料" + soncode, "", "");
-                        OperateResult.AppendText(">>料号" + soncode + "删除成功\n");
-                        FillDataGridView();
+                       
+                        string id = BatchProductDGV.Rows[i].Cells["mss_id"].Value.ToString();
+                        string useqty = BatchProductDGV.Rows[i].Cells["mss_useqty"].Value.ToString();
+                        string soncode = BatchProductDGV.Rows[i].Cells["sp_soncode"].Value.ToString();
+                        string makecode = BatchProductDGV.Rows[i].Cells["mss_makecode"].Value.ToString();
+                        if (id != "0")
+                        {
+                            idcol.Add(id);
+                            makecodecol.Add(makecode);
+                            soncodecol.Add("删除物料"+soncode);
+                            OperateResult.AppendText(">>料号" + soncode + "删除成功\n");   
+                        }
                     }
-                } 
+                    sql.Clear();
+                    sql.Append("insert into commandlog(cl_id,cl_caller,cl_man,cl_date,cl_linecode,cl_sourcecode,cl_makecode,cl_operate,");
+                    sql.Append("cl_result,cl_sncode,cl_code) values( commandlog_seq.nextval,'" + Tag.ToString() + "','" + User.UserCode + "',sysdate,'" + User.UserLineCode + "' ,");
+                    sql.Append("'" + User.UserSourceCode + " ' ,:iMakeCode,'岗位备料',:iResult,' ',' ')");
+                    dh.BatchInsert(sql.GetString(), new String[] { "iMakeCode", "iResult" }, makecodecol.ToArray(), soncodecol.ToArray());
+                    dh.BatchInsert("delete from makesourcestock where mss_id=:id", new String[] { "id" }, idcol.ToArray());
+                    FillDataGridView();
+                }
+            }
+            else {
+                OperateResult.AppendText(">>没有上料记录,无需全部下料\n",Color.Red);
             }
         }
     }

+ 16 - 10
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.Designer.cs

@@ -243,6 +243,7 @@
             this.pi_id.Name = "pi_id";
             this.pi_id.Size = new System.Drawing.Size(0, 21);
             this.pi_id.TabIndex = 229;
+            this.pi_id.Visible = false;
             // 
             // pi_type
             // 
@@ -284,13 +285,13 @@
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.Clean.Image = null;
             this.Clean.IsShowBorder = true;
-            this.Clean.Location = new System.Drawing.Point(478, 464);
+            this.Clean.Location = new System.Drawing.Point(479, 475);
             this.Clean.Margin = new System.Windows.Forms.Padding(2);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
             this.Clean.Power = null;
-            this.Clean.Size = new System.Drawing.Size(75, 31);
+            this.Clean.Size = new System.Drawing.Size(74, 20);
             this.Clean.TabIndex = 224;
             this.Clean.Text = "清除明细";
             this.Clean.UseVisualStyleBackColor = false;
@@ -334,13 +335,13 @@
             this.ConfirmOut.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ConfirmOut.Image = null;
             this.ConfirmOut.IsShowBorder = true;
-            this.ConfirmOut.Location = new System.Drawing.Point(563, 17);
+            this.ConfirmOut.Location = new System.Drawing.Point(563, 20);
             this.ConfirmOut.Margin = new System.Windows.Forms.Padding(2);
             this.ConfirmOut.MoveImage = ((System.Drawing.Image)(resources.GetObject("ConfirmOut.MoveImage")));
             this.ConfirmOut.Name = "ConfirmOut";
             this.ConfirmOut.NormalImage = ((System.Drawing.Image)(resources.GetObject("ConfirmOut.NormalImage")));
             this.ConfirmOut.Power = null;
-            this.ConfirmOut.Size = new System.Drawing.Size(75, 30);
+            this.ConfirmOut.Size = new System.Drawing.Size(75, 27);
             this.ConfirmOut.TabIndex = 216;
             this.ConfirmOut.Text = "确认出货";
             this.ConfirmOut.UseVisualStyleBackColor = false;
@@ -354,13 +355,13 @@
             this.NewProdInOut.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.NewProdInOut.Image = null;
             this.NewProdInOut.IsShowBorder = true;
-            this.NewProdInOut.Location = new System.Drawing.Point(648, 16);
+            this.NewProdInOut.Location = new System.Drawing.Point(654, 21);
             this.NewProdInOut.Margin = new System.Windows.Forms.Padding(2);
             this.NewProdInOut.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewProdInOut.MoveImage")));
             this.NewProdInOut.Name = "NewProdInOut";
             this.NewProdInOut.NormalImage = ((System.Drawing.Image)(resources.GetObject("NewProdInOut.NormalImage")));
             this.NewProdInOut.Power = null;
-            this.NewProdInOut.Size = new System.Drawing.Size(78, 31);
+            this.NewProdInOut.Size = new System.Drawing.Size(75, 26);
             this.NewProdInOut.TabIndex = 215;
             this.NewProdInOut.Text = "新增出货单";
             this.NewProdInOut.UseVisualStyleBackColor = false;
@@ -374,13 +375,13 @@
             this.ProdDetail.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ProdDetail.Image = null;
             this.ProdDetail.IsShowBorder = true;
-            this.ProdDetail.Location = new System.Drawing.Point(478, 16);
+            this.ProdDetail.Location = new System.Drawing.Point(488, 20);
             this.ProdDetail.Margin = new System.Windows.Forms.Padding(2);
             this.ProdDetail.MoveImage = ((System.Drawing.Image)(resources.GetObject("ProdDetail.MoveImage")));
             this.ProdDetail.Name = "ProdDetail";
             this.ProdDetail.NormalImage = ((System.Drawing.Image)(resources.GetObject("ProdDetail.NormalImage")));
             this.ProdDetail.Power = null;
-            this.ProdDetail.Size = new System.Drawing.Size(75, 31);
+            this.ProdDetail.Size = new System.Drawing.Size(65, 27);
             this.ProdDetail.TabIndex = 214;
             this.ProdDetail.Text = "产品明细";
             this.ProdDetail.UseVisualStyleBackColor = false;
@@ -411,6 +412,7 @@
             this.pim_outboxcode.HeaderText = "栈板/箱号";
             this.pim_outboxcode.MinimumWidth = 120;
             this.pim_outboxcode.Name = "pim_outboxcode";
+            this.pim_outboxcode.ReadOnly = true;
             this.pim_outboxcode.Width = 120;
             // 
             // pim_mac
@@ -418,24 +420,28 @@
             this.pim_mac.DataPropertyName = "pim_mac";
             this.pim_mac.HeaderText = "SN号";
             this.pim_mac.Name = "pim_mac";
+            this.pim_mac.ReadOnly = true;
             // 
             // pim_prodcode
             // 
             this.pim_prodcode.DataPropertyName = "pim_prodcode";
             this.pim_prodcode.HeaderText = "产品代码";
             this.pim_prodcode.Name = "pim_prodcode";
+            this.pim_prodcode.ReadOnly = true;
             // 
             // pr_detail
             // 
             this.pr_detail.DataPropertyName = "pr_detail";
             this.pr_detail.HeaderText = "名称";
             this.pr_detail.Name = "pr_detail";
+            this.pr_detail.ReadOnly = true;
             // 
             // pr_spec
             // 
             this.pr_spec.DataPropertyName = "pr_spec";
             this.pr_spec.HeaderText = "规格";
             this.pr_spec.Name = "pr_spec";
+            this.pr_spec.ReadOnly = true;
             // 
             // Warehouse_FinishedProductOut
             // 
@@ -468,10 +474,10 @@
             this.Text = "成品出货";
             this.Load += new System.EventHandler(this.Warehouse_FinishedProductOut_Load);
             this.SizeChanged += new System.EventHandler(this.Warehouse_FinishedProductOut_SizeChanged);
-            this.panel1.ResumeLayout(false);
+            this.panel1.ResumeLayout(true);
             this.panel1.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.InOutDetailDGV)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }

+ 2 - 1
UAS-MES/FunctionCode/Warehouse/Warehouse_FinishedProductOut.cs

@@ -168,7 +168,8 @@ namespace UAS_MES.Warehouse
                         dh.ExecuteSql("update package set pa_status=2 where exists (select 1 from prodiomac where pim_inoutno='" + pi_inoutno.Text + "' and pim_outboxcode=pa_outboxcode and ((pim_type='PALLET' AND PA_TYPE=3) OR (PIM_TYPE='BOX' AND PA_TYPE IN(1,2)))) AND PA_OUTNO='" + pi_inoutno.Text + "'", "update");
                         dh.ExecuteSql("update prodinout set pi_pdastatus='已出库' where pi_inoutno='" + pi_inoutno.Text + "'", "update");
                         dh.ExecuteSql("insert into messagelog(ml_id,ml_date,ml_man,ml_content,ml_result,ml_search)values(messagelog_seq.nextval,sysdate,'" + User.UserName + "','确认出货','确认出货成功','ProdInOut!Sale|pi_id=" + pi_id.Text + "')", "insert");
-                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Red,pi_inoutno);
+                        OperateResult.AppendText("出货单" + pi_inoutno.Text + "出库成功\n", Color.Black,pi_inoutno);
+                        BaseUtil.CleanDataGridView(InOutDetailDGV);
                     }
                 }
                 else