F_MST_1601.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. using Dongke.IBOSS.PRD.Basics.BaseResources;
  2. using Dongke.IBOSS.PRD.Basics.DockPanel;
  3. using Dongke.IBOSS.PRD.Client.CommonModule;
  4. using Dongke.IBOSS.PRD.Client.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.DataModels;
  6. using Dongke.IBOSS.PRD.WCF.Proxys;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Dongke.IBOSS.PRD.Client.SystemModule
  17. {
  18. public partial class F_MST_1601 : DockPanelBase
  19. {
  20. #region 成员变量
  21. private static F_MST_1601 _instance;
  22. private bool _init = false;
  23. //订单详细
  24. ArrayList arraylist = new ArrayList();
  25. #endregion
  26. #region 构造函数
  27. public F_MST_1601()
  28. {
  29. InitializeComponent();
  30. this.Text = "订单信息";
  31. this.tsbtnAdd.Text = ButtonText.TSBTN_ADD;
  32. this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT;
  33. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  34. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  35. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  36. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  37. }
  38. #endregion
  39. #region 单列模式
  40. public static F_MST_1601 Instance
  41. {
  42. get
  43. {
  44. if (_instance == null)
  45. {
  46. _instance = new F_MST_1601();
  47. }
  48. return _instance;
  49. }
  50. }
  51. #endregion
  52. #region 事件
  53. /// <summary>
  54. /// 页面加载事件
  55. /// </summary>
  56. /// <param name="sender"></param>
  57. /// <param name="e"></param>
  58. private void F_MST_1401_Load(object sender, EventArgs e)
  59. {
  60. try
  61. {
  62. // 加载权限
  63. FormPermissionManager.FormPermissionControl(this.Name, this,
  64. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  65. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  66. // 设置表格不自动创建列
  67. this.dgvRpt.AutoGenerateColumns = false;
  68. this.dgvRpt2.AutoGenerateColumns = false;
  69. }
  70. catch (Exception ex)
  71. {
  72. // 对异常进行共通处理
  73. ExceptionManager.HandleEventException(this.ToString(),
  74. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  75. }
  76. }
  77. /// <summary>
  78. /// 查询事件
  79. /// </summary>
  80. /// <param name="sender"></param>
  81. /// <param name="e"></param>
  82. private void btnSearch_Click(object sender, EventArgs e)
  83. {
  84. try
  85. {
  86. _init = true;
  87. if (this.dgvOrder.SelectedIndex == 0)
  88. {
  89. this.dgvRpt.DataSource = null;
  90. ClientRequestEntity cre = new ClientRequestEntity();
  91. cre.NameSpace = "F_MST_1601";
  92. cre.Name = "GetOrder";
  93. cre.Properties["ORDERSCODE"] = txtOrdersCode.Text;
  94. cre.Properties["GOODSCODE"] = txtProductModel.Text;
  95. cre.Properties["ORDERSDETAILID"] = "";
  96. cre.Properties["GOODSNAME"] = this.goodsnamess.Text;
  97. cre.Properties["CUSTOMERNAME"] = this.customcode.Text;
  98. cre.Properties["LAYOUTNAME"] = this.layoutcode.Text;
  99. cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text;
  100. if (this.chkCreateTimes.Checked)
  101. {
  102. cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  103. cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  104. }
  105. else {
  106. cre.Properties["CreateTimeStart"] = "";
  107. cre.Properties["CreateTimeStartEnd"] = "";
  108. }
  109. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  110. {
  111. cre.Properties["VALUEFLAG"] = "";
  112. }
  113. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  114. {
  115. cre.Properties["VALUEFLAG"] = 1;
  116. }
  117. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  118. {
  119. cre.Properties["VALUEFLAG"] = 0;
  120. }
  121. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  122. {
  123. cre.Properties["VALUEFLAG"] = 2;
  124. }
  125. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  126. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  127. {
  128. this.DataSource = sre.Data;
  129. if (this.DataSource != null)
  130. {
  131. if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0)
  132. {
  133. this.dgvRpt.DataSource = this.DataSource.Tables[0];
  134. }
  135. else
  136. {
  137. // 清空明细中的数据
  138. this.dgvRpt.DataSource = null;
  139. // 提示未查找到数据
  140. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  141. MessageBoxButtons.OK, MessageBoxIcon.Information);
  142. }
  143. }
  144. }
  145. else
  146. {
  147. // 清空明细中的数据
  148. this.dgvRpt.DataSource = null;
  149. // 提示未查找到数据
  150. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  151. MessageBoxButtons.OK, MessageBoxIcon.Information);
  152. }
  153. }
  154. else if (this.dgvOrder.SelectedIndex == 1)
  155. {
  156. this.dgvRpt2.DataSource = null;
  157. ClientRequestEntity cre = new ClientRequestEntity();
  158. cre.NameSpace = "F_MST_1601";
  159. cre.Name = "GetOrderDetails";
  160. cre.Properties["ORDERCODE"] = txtOrdersCode.Text;
  161. cre.Properties["GOODSCODE"] = txtProductModel.Text;
  162. cre.Properties["ORDERSDETAILID"] = "";
  163. cre.Properties["GOODSNAME"] = this.goodsnamess.Text;
  164. cre.Properties["CUSTOMERNAME"] = this.customcode.Text;
  165. cre.Properties["LAYOUTNAME"] = this.layoutcode.Text;
  166. cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text;
  167. if (this.chkCreateTimes.Checked)
  168. {
  169. cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  170. cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  171. }
  172. else {
  173. cre.Properties["CreateTimeStart"] = "";
  174. cre.Properties["CreateTimeStartEnd"] = "";
  175. }
  176. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  177. {
  178. cre.Properties["VALUEFLAG"] = "";
  179. }
  180. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  181. {
  182. cre.Properties["VALUEFLAG"] = 1;
  183. }
  184. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  185. {
  186. cre.Properties["VALUEFLAG"] = 0;
  187. }
  188. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  189. {
  190. cre.Properties["VALUEFLAG"] = 2;
  191. }
  192. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  193. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  194. {
  195. this.DataSource = sre.Data;
  196. if (this.DataSource != null)
  197. {
  198. this.dgvRpt2.DataSource = this.DataSource.Tables[0];
  199. }
  200. }
  201. }
  202. }
  203. catch (Exception ex)
  204. {
  205. this.btnSearch.Enabled = true;
  206. this.btnClearCondition.Enabled = true;
  207. // 对异常进行共通处理
  208. ExceptionManager.HandleEventException(this.ToString(),
  209. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  210. }
  211. finally
  212. {
  213. _init = false;
  214. }
  215. }
  216. /// <summary>
  217. /// 清空按钮
  218. /// </summary>
  219. /// <param name="sender"></param>
  220. /// <param name="e"></param>
  221. private void btnClearCondition_Click(object sender, EventArgs e)
  222. {
  223. this.txtOrdersCode.Text = null;
  224. this.txtProductModel.Text = null;
  225. }
  226. /// <summary>
  227. /// 自适应列宽
  228. /// </summary>
  229. /// <param name="sender"></param>
  230. /// <param name="e"></param>
  231. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  232. {
  233. this.dgvRpt.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  234. this.dgvRpt2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  235. }
  236. /// <summary>
  237. /// 退出
  238. /// </summary>
  239. /// <param name="sender"></param>
  240. /// <param name="e"></param>
  241. private void tsbtnClose_Click(object sender, EventArgs e)
  242. {
  243. this.Close();
  244. }
  245. /// <summary>
  246. /// 编辑
  247. /// </summary>
  248. /// <param name="sender"></param>
  249. /// <param name="e"></param>
  250. private void tsbtnEdit_Click(object sender, EventArgs e)
  251. {
  252. try
  253. {
  254. if (this.dgvRpt.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 0)
  255. {
  256. arraylist.Add(this.dgvRpt.SelectedRows[0].Cells["ORDERSCODES"].Value.ToString());
  257. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 1);
  258. DialogResult dialogresult = frmFPC1602.ShowDialog();
  259. btnSearch_Click(sender, null);
  260. arraylist.Clear();
  261. }
  262. if (this.dgvRpt2.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 1)
  263. {
  264. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSDETAILID"].Value.ToString());
  265. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 2);
  266. DialogResult dialogresult = frmFPC1602.ShowDialog();
  267. btnSearch_Click(sender, null);
  268. arraylist.Clear();
  269. }
  270. }
  271. catch (Exception ex)
  272. {
  273. // 对异常进行共通处理
  274. ExceptionManager.HandleEventException(this.ToString(),
  275. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  276. }
  277. }
  278. /// <summary>
  279. /// 新建
  280. /// </summary>
  281. /// <param name="sender"></param>
  282. /// <param name="e"></param>
  283. private void tsbtnAdd_Click(object sender, EventArgs e)
  284. {
  285. try{
  286. if(this.dgvOrder.SelectedIndex == 0){
  287. F_MST_1602 frmMST1602 = new F_MST_1602(Constant.FormMode.Add, arraylist,0);
  288. DialogResult dialogResult = frmMST1602.ShowDialog();
  289. // 重新加载GridView
  290. btnSearch_Click(sender, null);
  291. }
  292. }
  293. catch (Exception ex)
  294. {
  295. // 对异常进行共通处理
  296. ExceptionManager.HandleEventException(this.ToString(),
  297. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  298. }
  299. }
  300. /// <summary>
  301. /// 窗体关闭事件
  302. /// </summary>
  303. /// <param name="sender"></param>
  304. /// <param name="e"></param>
  305. private void F_MST_1601_FormClosed(object sender, FormClosedEventArgs e)
  306. {
  307. _instance = null;
  308. }
  309. #endregion
  310. #region 私有方法
  311. /// <summary>
  312. /// 根据界面查询条件获取数据集
  313. /// </summary>
  314. private DataSet GetSearchData()
  315. {
  316. try
  317. {
  318. ClientRequestEntity cre = new ClientRequestEntity();
  319. cre.NameSpace = "F_MST_1601";
  320. cre.Name = "GetCustomer";
  321. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  322. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  323. {
  324. return sre.Data;
  325. }
  326. return null;
  327. }
  328. catch (Exception ex)
  329. {
  330. throw ex;
  331. }
  332. }
  333. #endregion
  334. private void dgvRpt2_ColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e)
  335. {
  336. if (this.dgvOrder.SelectedIndex == 0)
  337. {
  338. this.tsbtnAdd.Enabled = true;
  339. }
  340. if (this.dgvOrder.SelectedIndex == 1)
  341. {
  342. this.tsbtnAdd.Enabled = false;
  343. }
  344. }
  345. private void chkCreateTimes_CheckedChanged(object sender, EventArgs e)
  346. {
  347. this.dtpGroutingDateStart.Enabled = this.chkCreateTimes.Checked;
  348. this.dtpGroutingDateEnd.Enabled = this.chkCreateTimes.Checked;
  349. if (!this.chkCreateTimes.Checked)
  350. {
  351. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  352. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  353. }
  354. }
  355. }
  356. }