FrmPurRequireProcessQuery.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Control;
  10. using Pur.configure;
  11. using Pur.Entity;
  12. using Pur.Entity.configureEntity;
  13. using Pur.PublicTools;
  14. namespace Pur.require_plan
  15. {
  16. public partial class FrmPurRequireProcessQuery : FrmPmsBase
  17. {
  18. private string req_org_id = "";
  19. public FrmPurRequireProcessQuery()
  20. {
  21. InitializeComponent();
  22. }
  23. private void FrmPurRequireProcessQuery_Load(object sender, EventArgs e)
  24. {
  25. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  26. PurmatclassEntity mat = new PurmatclassEntity();
  27. mat.DeleteUserid = "1";
  28. mat.DeleteName = "1";
  29. ck_instock.Checked = true;
  30. ck_isNotice.Checked = true;
  31. DataTable dt2 = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatClassService", "getMatClass", new object[] { mat });
  32. publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", true, "/", "");
  33. txt_ItemClass.SelectedIndex = 0;
  34. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  35. Phouse.Validflag = "1";
  36. Phouse.DeleteUserid = "1";
  37. DataTable dt3 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
  38. publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", true, "/", "");
  39. txt_InvPhysic.SelectedIndex = 0;
  40. txt_REQ_ORG.Text = UserInfo.GetDepartment();
  41. req_org_id = UserInfo.GetDeptid();
  42. }
  43. private void txt_REQ_ORG_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  44. {
  45. frmdepartment frm = new frmdepartment(this.ob);
  46. //frm.StartPosition = FormStartPosition.Manual;
  47. //frm.Location = publicPms.getShowLocation(frm);
  48. frm.ShowDialog();
  49. String strdeptId = frm.BuyerUnitCode;
  50. String strDeptName = frm.Fulltext;
  51. txt_REQ_ORG.Text = strDeptName;
  52. req_org_id = strdeptId;
  53. }
  54. /// <summary>
  55. /// toolbar
  56. /// </summary>
  57. /// <param name="sender"></param>
  58. /// <param name="ToolbarKey"></param>
  59. public override void ToolBar_Click(object sender, string ToolbarKey)//菜单toolbar按钮
  60. {
  61. switch (ToolbarKey)
  62. {
  63. case "Query":
  64. getUserPlan();
  65. break;
  66. case "Quit"://退出
  67. this.Close();
  68. break;
  69. case "doExcel"://退出
  70. //doExcel();
  71. break;
  72. }
  73. }
  74. private void getUserPlan()
  75. {
  76. dataSet1.Clear();
  77. EntityPurPlanD pd = new EntityPurPlanD();
  78. pd.UpdateName = req_org_id;
  79. if (txt_ItemClass.SelectedIndex != -1 && txt_ItemClass.SelectedIndex != 0)
  80. {
  81. pd.ItemDescE = txt_ItemClass.Value.ToString().Trim();
  82. }
  83. if (txt_InvPhysic.SelectedIndex != -1 && txt_InvPhysic.SelectedIndex != 0)
  84. {
  85. pd.DeleteName = txt_InvPhysic.Value.ToString().Trim();
  86. }
  87. pd.ItemCode = txt_itemCode.Text.Trim();
  88. pd.ItemName = txt_itemName.Text.Trim();
  89. pd.ItemDesc = txt_mrId.Text.Trim();
  90. pd.DeleteUserid = ck_instock.Checked == true ? "1" : "0";
  91. pd.UpdateUserid = ck_isNotice.Checked == true ? "1" : "0";
  92. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.purplan.service.PurPlanDService", "getCanOutBillPlanRe", new object[] { pd });
  93. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  94. foreach (DataRow rowq in dataTable1.Rows)
  95. {
  96. double QtyPur = 0;
  97. double QtyInstock = 0;
  98. double QtyReq = 0;
  99. double QtyUse = 0;
  100. double QtyWill = 0;
  101. double.TryParse(rowq["qty"].ToString(), out QtyPur);//采购计划数量
  102. double.TryParse(rowq["qtyYcUseable"].ToString(), out QtyInstock);//库存量
  103. double.TryParse(rowq["qtyYc"].ToString(), out QtyReq);//通知发货量---生产厂
  104. double.TryParse(rowq["qtyYcUsed"].ToString(), out QtyUse);//已经领用量(所有部门)
  105. double.TryParse(rowq["QTYPURED"].ToString(), out QtyWill);//待领用量(所有部门)
  106. double canUseQty = QtyInstock;//-----供应部可全部编制
  107. canUseQty = Math.Min(Math.Min(QtyPur, (QtyInstock - QtyWill)), (QtyReq - QtyUse - QtyWill));//------生产厂只能部分编制
  108. if (canUseQty <= 0)
  109. {
  110. rowq["canUseQty"] = 0;
  111. }
  112. else
  113. {
  114. rowq["canUseQty"] = canUseQty;
  115. }
  116. if (rowq["itemuom"].ToString() == "基吨")
  117. {
  118. rowq["itemuom"] = "吨";
  119. }
  120. }
  121. GridHelper.RefreshAndAutoSize(ultraGrid1);
  122. }
  123. }
  124. }