Make_NewDev.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Runtime.InteropServices;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using UAS_MES_NEW.DataOperate;
  11. using UAS_MES_NEW.Entity;
  12. using UAS_MES_NEW.PublicMethod;
  13. namespace UAS_MES_NEW.Make
  14. {
  15. public partial class Make_NewDev : CustomControl.BaseForm.BaseForm
  16. {
  17. //所有用到了headBar的部分都需要这段代码
  18. [DllImport("user32.dll")]
  19. public static extern bool ReleaseCapture();
  20. [DllImport("user32.dll")]
  21. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
  22. [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
  23. public static extern int GetWindowLong(HandleRef hWnd, int nIndex);
  24. [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
  25. public static extern IntPtr SetWindowLong(HandleRef hWnd, int nIndex, int dwNewLong);
  26. public const int WM_SYSCOMMAND = 0x0112;
  27. public const int SC_MOVE = 0xF010;
  28. public const int HTCAPTION = 0x0002;
  29. /// <summary>
  30. /// 序列号
  31. /// </summary>
  32. string sncode = "";
  33. /// <summary>
  34. /// 工单号
  35. /// </summary>
  36. string macode = "";
  37. string licode = "";
  38. DataHelper dh;
  39. DataTable dt;
  40. LogStringBuilder sql = new LogStringBuilder();
  41. public Make_NewDev(string iMakeCode,string iLicode)
  42. {
  43. InitializeComponent();
  44. macode = iMakeCode;
  45. licode = iLicode;
  46. }
  47. private void Make_NewBadCode_Load(object sender, EventArgs e)
  48. {
  49. dh = SystemInf.dh;
  50. sql.Clear();
  51. //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,");
  52. //sql.Append("pr_detail,nvl(mss_useqty,0) mss_useqty from stepbom left join stepproduct on sp_sbid=sb_id left join product on ");
  53. //sql.Append("pr_code=sp_mothercode left join makesourcestock on mss_craftcode=sb_craftcode ");
  54. //sql.Append("and mss_stepcode=sp_stepcode and sp_soncode=mss_prodcode and sp_fsoncode=mss_fprodcode where ");
  55. //sql.Append(" sp_stepcode='" + User.CurrentStepCode + "' and sp_tracekind=2 and mss_linecode = '" + User.UserLineCode + "' order by sp_soncode");
  56. 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 ");
  57. 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 ");
  58. DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  59. BaseUtil.FillDgvWithDataTable(BatchProductDGV, dt);
  60. }
  61. private void headBar1_MouseDown(object sender, MouseEventArgs e)
  62. {
  63. ReleaseCapture();
  64. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  65. }
  66. }
  67. }