frmUsePlanMAdd.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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 com.hnshituo.pur.vo;
  10. using Core.Mes.Client.Comm.Tool;
  11. using CoreFS.CA06;
  12. using Pur.configure;
  13. using Pur.Entity;
  14. using Pur.Entity.configureEntity;
  15. using Pur.Entity.require_planEntiy;
  16. using Pur.Pop_upWindow;
  17. using Pur.PublicTools;
  18. namespace Pur.ck
  19. {
  20. public partial class frmUsePlanMAdd : FrmPmsBase
  21. {
  22. private string showType;
  23. private DataTable dt2 = new DataTable();
  24. private DataTable dt3 = new DataTable();
  25. private string req_org_id="";
  26. public string tips = "0";
  27. public String mrId = "";
  28. public frmUsePlanMAdd()
  29. {
  30. InitializeComponent();
  31. }
  32. public frmUsePlanMAdd(OpeBase OB, string showType)
  33. {
  34. // TODO: Complete member initialization
  35. this.ob = OB;
  36. this.showType = showType;
  37. InitializeComponent();
  38. }
  39. private void frmUsePlanMAdd_Load(object sender, EventArgs e)
  40. {
  41. PurmatclassEntity mat = new PurmatclassEntity();
  42. mat.DeleteUserid = "1";
  43. mat.DeleteName = "1";
  44. dt2 = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatClassService", "getMatClass", new object[] { mat });
  45. //publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", true, "/", "");
  46. PhysicSeatEntity Phouse = new PhysicSeatEntity();
  47. Phouse.Validflag = "1";
  48. Phouse.DeleteUserid = "1";
  49. if (showType == "1")
  50. {
  51. Phouse.IsGybCk = "0";
  52. }
  53. dt3 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
  54. // publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", true, "/", "");
  55. publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", false, "/", "");
  56. publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", false, "/", "");
  57. if (showType == "1")
  58. {
  59. //txt_REQ_ORG.Enabled = false;
  60. //txt_REQ_ORG.Text = UserInfo.GetDepartment();
  61. //req_org_id = UserInfo.GetDeptid();
  62. txt_REQ_ORG.Enabled = true;
  63. }
  64. else
  65. {
  66. txt_REQ_ORG.Enabled = true;
  67. }
  68. txt_ApplyTime.Value = DateTime.Now.AddDays(5);
  69. txt_planType.SelectedIndex = 0;
  70. }
  71. private void btn_addUsePlan_Click(object sender, EventArgs e)
  72. {
  73. UsePlanM Upm = new UsePlanM();
  74. if (showType == "1")
  75. {
  76. Upm.PlanType = "1";
  77. }
  78. else if (showType == "2")
  79. {
  80. Upm.PlanType = "2";
  81. }
  82. else
  83. {
  84. MessageUtil.ShowTips("界面配置错误,请指定界面使用者[1:生产厂,2:供应部]");
  85. return;
  86. }
  87. if (txt_ItemClass.SelectedIndex == -1)
  88. {
  89. MessageUtil.ShowTips("请选择领用物料中类");
  90. txt_ItemClass.Focus();
  91. return;
  92. }
  93. if (String.IsNullOrEmpty(txt_REQ_ORG.Text.Trim()) || String.IsNullOrEmpty(req_org_id))
  94. {
  95. MessageUtil.ShowTips("请选择领用部门");
  96. txt_REQ_ORG.Focus();
  97. return;
  98. }
  99. if (txt_planType.SelectedIndex == -1)
  100. {
  101. MessageUtil.ShowTips("请选择计划类型");
  102. txt_planType.Focus();
  103. return;
  104. }
  105. if (txt_InvPhysic.Value == null)
  106. {
  107. MessageUtil.ShowTips("请选择仓库");
  108. txt_InvPhysic.Focus();
  109. return;
  110. }
  111. if (txt_ApplyTime.Value == null)
  112. {
  113. MessageUtil.ShowTips("领用时间不能为空");
  114. txt_ApplyTime.Focus();
  115. return;
  116. }
  117. //if (Convert.ToDateTime(txt_ApplyTime.Value) <= DateTime.Now)
  118. //{
  119. // MessageUtil.ShowTips("领用时间需大于当前时间");
  120. // txt_ApplyTime.Focus();
  121. // return;
  122. //}
  123. if (String.IsNullOrEmpty(txt_selectlocation.Text.Trim()))
  124. {
  125. MessageUtil.ShowTips("请选择交货地址");
  126. txt_selectlocation.Focus();
  127. return;
  128. }
  129. if (String.IsNullOrEmpty(txt_selectlocationCode.Text.Trim()) || txt_selectlocationCode.Text.Trim() == "-")
  130. {
  131. MessageUtil.ShowTips("请选择交货地址,交付地址编码不能为空");
  132. txt_selectlocation.Focus();
  133. return;
  134. }
  135. Upm.Status = "1";
  136. Upm.Validflag = "1";
  137. Upm.Classes = this.UserInfo.GetUserGroup();
  138. Upm.MrPeriodEnd = (DateTime)txt_ApplyTime.Value;
  139. Upm.InvPhysic = txt_InvPhysic.Value.ToString();
  140. Upm.PlanType = txt_planType.Value.ToString().Trim();
  141. Upm.ReqOrgName = txt_REQ_ORG.Text.Trim();
  142. Upm.ReqOrgId = req_org_id;
  143. Upm.WorkShop = txt_WorkShop.Text.ToString().Trim();
  144. Upm.ItemClass = txt_ItemClass.Value.ToString().Trim();
  145. Upm.ApplyName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  146. Upm.ApplyTime = DateTime.Now;
  147. Upm.ApplyReqOrgId = UserInfo.GetDeptid();
  148. Upm.ApplyReqOrgName = UserInfo.GetDepartment();
  149. Upm.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  150. Upm.CreateTime = DateTime.Now;
  151. Upm.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  152. Upm.DeliveryLocationCode = txt_selectlocationCode.Text.Trim();
  153. Upm.DeliveryLocation = txt_selectlocation.Text.Trim();
  154. CoreResult crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.requireplan.service.UsePlanMService", "insert_M", new object[] { Upm});
  155. if (crt.Resultcode != 0)
  156. {
  157. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("领用单头生成失败!" + crt.Resultmsg);
  158. return;
  159. }
  160. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("生成领用单:" + crt.Resultmsg);
  161. this.tips = "1";
  162. mrId = crt.Resultmsg;
  163. this.Close();
  164. }
  165. private void txt_REQ_ORG_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  166. {
  167. frmdepartment frm = new frmdepartment(this.ob);
  168. //frm.StartPosition = FormStartPosition.Manual;
  169. //frm.Location = publicPms.getShowLocation(frm);
  170. frm.ShowDialog();
  171. String strdeptId = frm.BuyerUnitCode;
  172. String strDeptName = frm.Fulltext;
  173. if (!String.IsNullOrEmpty(strdeptId) && !String.IsNullOrEmpty(strDeptName))
  174. {
  175. txt_REQ_ORG.Text = strDeptName;
  176. req_org_id = strdeptId;
  177. }
  178. }
  179. private void txt_selectlocation_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  180. {
  181. FrmPop_upDeliveryLocation frm = new FrmPop_upDeliveryLocation(this.ob, "0", "");
  182. frm.ShowDialog();
  183. if (frm.tips == "1")
  184. {
  185. if (!String.IsNullOrEmpty(frm.DeliveryLocationCode) && !String.IsNullOrEmpty(frm.DeliveryLocation))
  186. {
  187. txt_selectlocationCode.Text = frm.DeliveryLocationCode;
  188. txt_selectlocation.Text = frm.DeliveryLocation;
  189. }
  190. }
  191. }
  192. }
  193. }