Special_MakeBad.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Windows.Forms;
  3. using UAS_MES_NEW.DataOperate;
  4. using UAS_MES_NEW.Entity;
  5. using UAS_MES_NEW.PublicMethod;
  6. using static DevExpress.Utils.Drawing.Helpers.NativeMethods;
  7. namespace UAS_MES_NEW.Special
  8. {
  9. public partial class Special_MakeBad : Form
  10. {
  11. DataHelper dh;
  12. LogStringBuilder sql = new LogStringBuilder();
  13. public Special_MakeBad()
  14. {
  15. InitializeComponent();
  16. }
  17. private void Special_BoxSplit_Load(object sender, EventArgs e)
  18. {
  19. dh = SystemInf.dh;
  20. ma_code.TableName = "make left join product on pr_code=ma_prodcode";
  21. ma_code.DBTitle = "工单号查询";
  22. ma_code.SelectField = "ma_code # 工单号,ma_qty # 工单数量,pr_detail # 产品名称,pr_code # 产品编号";
  23. ma_code.SetValueField = new string[] { "ma_code", "pr_detail", "pr_code" };
  24. ma_code.FormName = Name;
  25. li_code.TableName = "line";
  26. li_code.Condition = "li_code like '%贴片%'";
  27. li_code.DBTitle = "线别查询";
  28. li_code.SelectField = "li_code # 线别编号";
  29. li_code.SetValueField = new string[] { "li_code" };
  30. li_code.FormName = Name;
  31. pr_code.TableName = "product";
  32. pr_code.DBTitle = "产品查询";
  33. pr_code.SelectField = "pr_code # 产品编号,pr_detail # 产品名称 ,pr_spec # 产品规格";
  34. pr_code.SetValueField = new string[] { "pr_code" };
  35. pr_code.FormName = Name;
  36. bc_code.TableName = "(select bc_code,bc_name from badcode left join DATAINPUTRECORD ON bc_name = DIR_COMMENT AND DIR_GROUP = '不良代码组' and DIR_SOURCECODE = '" + User.UserSourceCode + "' where bc_groupcode='SMT' ORDER BY NVL(DIR_NUMBER,0) DESC)";
  37. bc_code.Field = "bc_name";
  38. bc_code.ValueField = "bc_code";
  39. bc_code.Condition = " 1=1 ORDER BY ROWNUM asc";
  40. nrg_name.TableName = "(select nrg_name,nrg_code from QUA_NGREASONGROUP left join DATAINPUTRECORD ON NRG_NAME = DIR_COMMENT AND DIR_GROUP = '不良原因组' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC)";
  41. nrg_name.Field = "nrg_name";
  42. nrg_name.ValueField = "nrg_code";
  43. nrg_name.Condition = " 1=1 ORDER BY ROWNUM asc";
  44. nr_name.TableName = "QUA_NGREASONGROUPDET left join QUA_NGREASONGROUP on nrgd_nrgid=nrg_id left join QUA_NGReason on nrgd_nrcode=nr_code left join DATAINPUTRECORD ON nr_name = DIR_COMMENT AND DIR_GROUP = '不良原因' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ";
  45. nr_name.Field = "nr_name";
  46. nr_name.ValueField = "nr_code";
  47. mbr_dutyname.TableName = "(select nd_name,nd_code from ngduty left join DATAINPUTRECORD ON nd_name = DIR_COMMENT AND DIR_GROUP = '责任别' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC) ";
  48. mbr_dutyname.Field = "nd_name";
  49. mbr_dutyname.ValueField = "nd_code";
  50. mbr_dutyname.Condition = " 1=1 ORDER BY ROWNUM asc";
  51. so_name.TableName = "(select so_name,so_code from solution left join DATAINPUTRECORD ON so_name = DIR_COMMENT AND DIR_GROUP = '解决方案' and DIR_SOURCECODE = '" + User.UserSourceCode + "' ORDER BY NVL(DIR_NUMBER,0) DESC)";
  52. so_name.Field = "so_name";
  53. so_name.ValueField = "so_code";
  54. so_name.Condition = " 1=1 ORDER BY ROWNUM asc";
  55. so_name.SendToBack();
  56. mb_badlocation.SendToBack();
  57. mbr_inman.SendToBack();
  58. }
  59. private void Split_Click(object sender, EventArgs e)
  60. {
  61. }
  62. private void SaveRepairInf_Click(object sender, EventArgs e)
  63. {
  64. if (sn_code.Text == "")
  65. {
  66. OperateResult.AppendText("序列号不允许为空\n", System.Drawing.Color.Red, sn_code);
  67. return;
  68. }
  69. if (dh.CheckExist("makebadreason", "MBR_SNCODE='" + sn_code.Text + "'"))
  70. {
  71. OperateResult.AppendText("序列号" + sn_code.Text + "已录入\n", System.Drawing.Color.Red, sn_code);
  72. return;
  73. }
  74. if (!dh.CheckExist("product", "pr_code='" + pr_code.Text + "'"))
  75. {
  76. OperateResult.AppendText("产品编号" + pr_code.Text + "不存在\n", System.Drawing.Color.Red, sn_code);
  77. return;
  78. }
  79. if (nrg_name.Text == "" || nr_name.Text == "" || mbr_dutyname.Text == "" || so_name.Text == "")
  80. {
  81. OperateResult.AppendText("请完善维修信息\n", System.Drawing.Color.Red, sn_code);
  82. return;
  83. }
  84. dh.ExecuteSql("insert into makebadreason(MBR_ID,mbr_badlocation,MBR_BADCODE, MBR_SNCODE, MBR_MAKECODE, MBR_SOLUTIONNAME, MBR_DUTYNAME,mbr_linecode,MBR_INMAN,mbr_prodcode,mbr_reason)values(makebadreason_seq.nextval,'" + mb_badlocation.Text + "','" + bc_code.Text + "','" + sn_code.Text + "','" + ma_code.Text + "','" + so_name.Text + "','" + mbr_dutyname.Text + "','" + li_code.Text + "','" + (mbr_inman.Text == "" ? User.UserName : mbr_inman.Text) + "','" + pr_code.Text + "','"+ nr_name.Text + "')", "insert");
  85. OperateResult.AppendText("序列号" + sn_code.Text + "记录维修信息成功\n", System.Drawing.Color.Green, sn_code);
  86. sn_code.Focus();
  87. //nrg_name.Text = "";
  88. //nr_name.Text = "";
  89. //mbr_dutyname.Text = "";
  90. //so_name.Text = "";
  91. //bc_code.Text = "";
  92. //mb_badlocation.Text = "";
  93. }
  94. }
  95. }