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_NewDev : 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; /// /// 序列号 /// string sncode = ""; /// /// 工单号 /// string macode = ""; string licode = ""; DataHelper dh; DataTable dt; LogStringBuilder sql = new LogStringBuilder(); public Make_NewDev(string iMakeCode,string iLicode) { InitializeComponent(); macode = iMakeCode; licode = iLicode; } private void Make_NewBadCode_Load(object sender, EventArgs e) { dh = SystemInf.dh; sql.Clear(); //sql.Append("select nvl(mss_makecode,' ') mss_makecode,mss_linecode,sp_fsoncode,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 and sp_fsoncode=mss_fprodcode where "); //sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '" + User.UserLineCode + "' order by sp_soncode"); sql.Append(" select DSL_LOCATION,DSL_PRODCODE,DSL_BASEQTY,substr(pr_spec,0,25)pr_spec,SUM(DSL_GETQTY) DSL_GETQTY1 ,SUM(DSL_REMAINQTY) DSL_REMAINQTY1,round(SUM(DSL_REMAINQTY)*100/SUM(DSL_GETQTY),3)||'%' bi from devsmtlocation LEFT JOIN PRODUCT ON DSL_PRODCODE = PR_CODE "); sql.Append(" where dsl_linecode = '"+ licode + "' AND DSL_INVALIDTIME IS NULL GROUP BY DSL_LOCATION,DSL_PRODCODE,DSL_BASEQTY,pr_spec order by round(SUM(DSL_REMAINQTY)*100/SUM(DSL_GETQTY),3) asc "); DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt); } private void headBar1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } } }