123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Make
- {
- public partial class Make_StepReportDetail : CustomControl.BaseForm.BaseForm
- {
- //所有用到了headBar的部分都需要这段代码
- [DllImport("user32.dll")]
- public static extern bool ReleaseCapture();
- [DllImport("user32.dll")]
- public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
- [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
- public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
- [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
- public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
- public const int WM_SYSCOMMAND = 0x0112;
- public const int SC_MOVE = 0xF010;
- public const int HTCAPTION = 0x0002;
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- string msid;
- double badqty;
- string macode;
- public Make_StepReportDetail(string msid, double badqty, string macode)
- {
- dh = SystemInf.dh;
- InitializeComponent();
- this.msid = msid;
- this.badqty = badqty;
- this.macode = macode;
- }
- private void Warehouse_ProdDetail_Load(object sender, EventArgs e)
- {
- ngsum.Text = badqty.ToString();
- ma_code.Text = macode;
- stepcode.Text = User.CurrentStepCode;
- //comBoxWithFocus1.Items.Add("线缺陷");
- //comBoxWithFocus1.Items.Add("破片");
- //comBoxWithFocus1.Items.Add("切割不良");
- //comBoxWithFocus1.Items.Add("mura");
- //comBoxWithFocus1.Items.Add("LCD刮伤");
- //comBoxWithFocus1.Items.Add("LCD脏污");
- //comBoxWithFocus1.Items.Add("线缺陷");
- //comBoxWithFocus1.Items.Add("亮点/碎亮点");
- //comBoxWithFocus1.Items.Add("画异");
- //comBoxWithFocus1.Items.Add("发黄");
- //if (User.CurrentStepCode == "CT1")
- //{
- // comBoxWithFocus1.Items.Add("来料液漏液&打X");
- //}
- //else if (User.CurrentStepCode == "CT2")
- //{
- // comBoxWithFocus1.Items.Add("上POL异物");
- // comBoxWithFocus1.Items.Add("上POL偏移");
- // comBoxWithFocus1.Items.Add("下POL异物");
- // comBoxWithFocus1.Items.Add("下POL偏移");
- // comBoxWithFocus1.Items.Add("上POL脏污");
- // comBoxWithFocus1.Items.Add("上POL刮伤");
- // comBoxWithFocus1.Items.Add("下POL脏污");
- // comBoxWithFocus1.Items.Add("下POL刮伤");
- // comBoxWithFocus1.Items.Add("上POL白边");
- // comBoxWithFocus1.Items.Add("上POL气泡");
- // comBoxWithFocus1.Items.Add("下POL白边");
- // comBoxWithFocus1.Items.Add("下POL气泡");
- //}
- //如果ms_makecode的值修改过再去查询
- sql.Clear();
- sql.Append("select BGD_BADCODE from badgroupdetail left join badgroup on bgd_bgid = bg_id where bg_code = '"+ User.CurrentStepCode + "' ORDER BY BGD_ID ASC");
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- comBoxWithFocus1.DisplayMember = "BGD_BADCODE";
- comBoxWithFocus1.ValueMember = "BGD_BADCODE";
- comBoxWithFocus1.DataSource = dt;
- comBoxWithFocus1.Text = "";
- FillDataGridView();
- }
- private void headBar1_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
- }
- private void BatchProductDGV_CellContentClick66(object sender, DataGridViewCellEventArgs e)
- {
- if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
- {
- if (e.RowIndex >= 0)
- {
- string id = BatchProductDGV.Rows[e.RowIndex].Cells["msd_id"].Value.ToString();
- if (id != "0")
- {
- dh.ExecuteSql("update MES_STEPREPORTdet set msd_status =-1 where msd_id='" + id + "'", "delete");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "工序不良报工", "删除记录" + id, "", "");
- FillDataGridView();
- }
- }
- }
- }
- private void FillDataGridView()
- {
- sql.Clear();
- sql.Append("select msd_id,msd_msid,msd_badname,msd_qty,msd_indate,msd_status,msd_stepcode from MES_STEPREPORTdet ");
- sql.Append("where msd_msid = '" + msid + "' and msd_stepcode = '" + User.CurrentStepCode + "' and msd_status = 0");
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
- }
- private void button1_Click(object sender, EventArgs e)
- {
-
- }
- private void BatchProductDGV_CellFormatting12(object sender, DataGridViewCellFormattingEventArgs e)
- {
- if (BatchProductDGV.Columns[e.ColumnIndex].Name == "DeleteRow")
- {
- if (BatchProductDGV.Rows[e.RowIndex].Cells["msd_id"].Value.ToString() == "0")
- e.Value = Properties.Resources.WhiteImage;
- else
- e.Value = Properties.Resources.bindingNavigatorDeleteItem_Image;
- }
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- }
- private void BatchProductDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
- {
- bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
- if (e.ColumnIndex > 0)
- {
- if (BatchProductDGV.Columns[e.ColumnIndex].Name == "msd_qty")
- {
- SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
- e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
- Rectangle border = e.CellBounds;
- border.Width -= 1;
- e.Graphics.DrawRectangle(Pens.White, border);
- e.PaintContent(e.CellBounds);
- e.Handled = true;
- }
- }
- }
- private void button1_Click_2(object sender, EventArgs e)
- {
- try
- {
- if (comBoxWithFocus1.Text == "" || ngqty.Text == "")
- {
- MessageBox.Show("必填项为空");
- return;
- }
- double ng = double.Parse(ngqty.Text);
- double nowng = double.Parse(dh.getFieldDataByCondition("MES_STEPREPORTdet", "nvl(sum(msd_qty),0)", " msd_msid = '" + msid + "' and msd_stepcode = '" + User.CurrentStepCode + "' and msd_status = 0 ").ToString());
- if (nowng + double.Parse(ngqty.Text) > badqty)
- {
- MessageBox.Show("已录入不良" + nowng + "+待录入不良" + ng + "大于不良总数" + badqty + "");
- return;
- }
- else
- {
- string msdid = dh.GetSEQ("MES_STEPREPORTDET_seq");
- sql.Clear();
- sql.Append("insert into MES_STEPREPORTdet (MSD_ID,MSD_MSID,MSD_BADNAME ,MSD_QTY,");
- sql.Append("MSD_INDATE,MSD_STATUS,MSD_STEPCODE");
- sql.Append(") values(" + msdid + "," + msid + ",'" + comBoxWithFocus1.Text + "',");
- sql.Append("'" + ng + "',sysdate,'0','" + User.CurrentStepCode + "')");
- dh.ExecuteSql(sql.GetString(), "insert");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "工序不良报工", "现象:" + comBoxWithFocus1.Text + ",数量:" + ng + "", "", "");
- FillDataGridView();
- comBoxWithFocus1.Text = "";
- ngqty.Text = "";
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
- }
- }
|