Query_DateRate.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using HslCommunication;
  2. using System;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using UAS_MES_NEW.DataOperate;
  7. using UAS_MES_NEW.Entity;
  8. using UAS_MES_NEW.PublicMethod;
  9. namespace UAS_MES_NEW.Query
  10. {
  11. public partial class Query_DateRate : Form
  12. {
  13. string querysql = "";
  14. DataHelper dh = SystemInf.dh;
  15. DataTable Dbfind;
  16. LogStringBuilder sql = new LogStringBuilder();
  17. //存放产品信息
  18. DataTable dt;
  19. //存放标签信息
  20. DataTable listA;
  21. public Query_DateRate()
  22. {
  23. InitializeComponent();
  24. }
  25. private void Export_Click(object sender, EventArgs e)
  26. {
  27. }
  28. //选择导出Excel时是选择导出数据的还是模板
  29. private void ExcelExport(string DataOrTemplet)
  30. {
  31. }
  32. private void Query_SpecialReport_Load(object sender, EventArgs e)
  33. {
  34. pi_inoutno.TableName = "prodinout ";
  35. pi_inoutno.SelectField = "pi_inoutno # 出库单号";
  36. pi_inoutno.FormName = Name;
  37. pi_inoutno.SetValueField = new string[] { "pi_inoutno" };
  38. pi_inoutno.Condition = "pi_class in ('生产领料单','其它出库单')";
  39. pi_inoutno.DbChange += pr_code_DbChange;
  40. }
  41. private void pr_code_DbChange(object sender, EventArgs e)
  42. {
  43. Dbfind = pi_inoutno.ReturnData;
  44. BaseUtil.SetFormValue(this.Controls, Dbfind);
  45. }
  46. private void pr_code_KeyDown(object sender, KeyEventArgs e)
  47. {
  48. if (e.KeyCode == Keys.Enter)
  49. {
  50. //判断产品是否存在
  51. dt = (DataTable)dh.ExecuteSql("select pr_code,pr_detail,pr_spec from product where pr_code='" + pr_code.Text + "' and pr_statuscode ='AUDITED'", "select");
  52. //查询没有值,返回提示用户“产品:XXX,不存在或者为审核”,清空产品代码输入框中的值
  53. if (dt.Rows.Count == 0)
  54. {
  55. OperateResult.AppendText("<<产品:" + pr_code.Text + ",不存在或者未审核\n", Color.Red, pr_code);
  56. return;
  57. }
  58. //查询产品是否有自定义的标签模板
  59. sql.Clear();
  60. sql.Append("select la_code,la_id,substr(la_url,instr(la_url,'\\',-1)+1)la_name,la_url,la_isdefault ");
  61. sql.Append("from label where la_prodcode='" + pr_code.Text + "' and la_templatetype='自定义' and la_statuscode='AUDITED' order by la_isdefault");
  62. listA = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  63. if (listA.Rows.Count == 0)
  64. {
  65. OperateResult.AppendText("<<产品:" + pr_code.Text + ",没有维护自定义模板\n", Color.Red, pr_code);
  66. return;
  67. }
  68. string la_id = listA.Rows[0]["la_id"].ToString();
  69. string la_code = listA.Rows[0]["la_code"].ToString();
  70. {
  71. //说明没有默认的模板,那就取pl_id最大的
  72. listA = (DataTable)dh.ExecuteSql("select fp_name la_url,'" + la_id + "' la_id,'" + la_code + "'la_code from FILEPATH where fp_id in (select * from table(select parsestring(LA_SOFTTYPE,';') from label where la_id='" + la_id + "' ) where COLUMN_VALUE is not null)", "select");
  73. }
  74. //标签显示
  75. PrintLabel.DataSource = listA;
  76. PrintLabel.DisplayMember = "la_url";
  77. PrintLabel.ValueMember = "la_id";
  78. //有值,填充界面
  79. BaseUtil.SetFormValue(this.Controls, dt);
  80. }
  81. }
  82. }
  83. }