F_MST_1601.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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. else if (this.dgvOrder.SelectedIndex == 2)
  203. {
  204. this.dgvRpt2.DataSource = null;
  205. ClientRequestEntity cre = new ClientRequestEntity();
  206. cre.NameSpace = "F_MST_1601";
  207. cre.Name = "GetOrderNumber";
  208. cre.Properties["ORDERCODE"] = txtOrdersCode.Text;
  209. cre.Properties["GOODSCODE"] = txtProductModel.Text;
  210. cre.Properties["ORDERSDETAILID"] = "";
  211. cre.Properties["GOODSNAME"] = this.goodsnamess.Text;
  212. cre.Properties["CUSTOMERNAME"] = this.customcode.Text;
  213. cre.Properties["LAYOUTNAME"] = this.layoutcode.Text;
  214. cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text;
  215. if (this.chkCreateTimes.Checked)
  216. {
  217. cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  218. cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  219. }
  220. else
  221. {
  222. cre.Properties["CreateTimeStart"] = "";
  223. cre.Properties["CreateTimeStartEnd"] = "";
  224. }
  225. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  226. {
  227. cre.Properties["VALUEFLAG"] = "";
  228. }
  229. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  230. {
  231. cre.Properties["VALUEFLAG"] = 1;
  232. }
  233. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  234. {
  235. cre.Properties["VALUEFLAG"] = 0;
  236. }
  237. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  238. {
  239. cre.Properties["VALUEFLAG"] = 2;
  240. }
  241. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  242. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  243. {
  244. this.DataSource = sre.Data;
  245. if (this.DataSource != null)
  246. {
  247. this.dgvRpt3.DataSource = this.DataSource.Tables[0];
  248. }
  249. }
  250. }
  251. }
  252. catch (Exception ex)
  253. {
  254. this.btnSearch.Enabled = true;
  255. this.btnClearCondition.Enabled = true;
  256. // 对异常进行共通处理
  257. ExceptionManager.HandleEventException(this.ToString(),
  258. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  259. }
  260. finally
  261. {
  262. _init = false;
  263. }
  264. }
  265. /// <summary>
  266. /// 清空按钮
  267. /// </summary>
  268. /// <param name="sender"></param>
  269. /// <param name="e"></param>
  270. private void btnClearCondition_Click(object sender, EventArgs e)
  271. {
  272. this.txtOrdersCode.Text = null;
  273. this.txtProductModel.Text = null;
  274. this.customcode.Text = null;
  275. this.layoutcode.Text = null;
  276. this.goodsnamess.Text = null;
  277. this.ENTRUCKINGCODES.Text = null;
  278. }
  279. /// <summary>
  280. /// 自适应列宽
  281. /// </summary>
  282. /// <param name="sender"></param>
  283. /// <param name="e"></param>
  284. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  285. {
  286. this.dgvRpt.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  287. this.dgvRpt2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  288. this.dgvRpt3.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  289. }
  290. /// <summary>
  291. /// 退出
  292. /// </summary>
  293. /// <param name="sender"></param>
  294. /// <param name="e"></param>
  295. private void tsbtnClose_Click(object sender, EventArgs e)
  296. {
  297. this.Close();
  298. }
  299. /// <summary>
  300. /// 编辑
  301. /// </summary>
  302. /// <param name="sender"></param>
  303. /// <param name="e"></param>
  304. private void tsbtnEdit_Click(object sender, EventArgs e)
  305. {
  306. try
  307. {
  308. if (this.dgvRpt.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 0)
  309. {
  310. arraylist.Add(this.dgvRpt.SelectedRows[0].Cells["ORDERSCODES"].Value.ToString());
  311. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 1);
  312. DialogResult dialogresult = frmFPC1602.ShowDialog();
  313. btnSearch_Click(sender, null);
  314. arraylist.Clear();
  315. }
  316. if (this.dgvRpt2.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 1)
  317. {
  318. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSDETAILID"].Value.ToString());
  319. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 2);
  320. DialogResult dialogresult = frmFPC1602.ShowDialog();
  321. btnSearch_Click(sender, null);
  322. arraylist.Clear();
  323. }
  324. }
  325. catch (Exception ex)
  326. {
  327. // 对异常进行共通处理
  328. ExceptionManager.HandleEventException(this.ToString(),
  329. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  330. }
  331. }
  332. /// <summary>
  333. /// 新建
  334. /// </summary>
  335. /// <param name="sender"></param>
  336. /// <param name="e"></param>
  337. private void tsbtnAdd_Click(object sender, EventArgs e)
  338. {
  339. try{
  340. if(this.dgvOrder.SelectedIndex == 0){
  341. F_MST_1602 frmMST1602 = new F_MST_1602(Constant.FormMode.Add, arraylist,0);
  342. DialogResult dialogResult = frmMST1602.ShowDialog();
  343. // 重新加载GridView
  344. btnSearch_Click(sender, null);
  345. }
  346. }
  347. catch (Exception ex)
  348. {
  349. // 对异常进行共通处理
  350. ExceptionManager.HandleEventException(this.ToString(),
  351. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  352. }
  353. }
  354. /// <summary>
  355. /// 窗体关闭事件
  356. /// </summary>
  357. /// <param name="sender"></param>
  358. /// <param name="e"></param>
  359. private void F_MST_1601_FormClosed(object sender, FormClosedEventArgs e)
  360. {
  361. _instance = null;
  362. }
  363. #endregion
  364. #region 私有方法
  365. /// <summary>
  366. /// 根据界面查询条件获取数据集
  367. /// </summary>
  368. private DataSet GetSearchData()
  369. {
  370. try
  371. {
  372. ClientRequestEntity cre = new ClientRequestEntity();
  373. cre.NameSpace = "F_MST_1601";
  374. cre.Name = "GetCustomer";
  375. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  376. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  377. {
  378. return sre.Data;
  379. }
  380. return null;
  381. }
  382. catch (Exception ex)
  383. {
  384. throw ex;
  385. }
  386. }
  387. #endregion
  388. private void dgvRpt2_ColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e)
  389. {
  390. if (this.dgvOrder.SelectedIndex == 0)
  391. {
  392. this.tsbtnAdd.Enabled = true;
  393. }
  394. if (this.dgvOrder.SelectedIndex == 1)
  395. {
  396. this.tsbtnAdd.Enabled = false;
  397. }
  398. }
  399. private void chkCreateTimes_CheckedChanged(object sender, EventArgs e)
  400. {
  401. this.dtpGroutingDateStart.Enabled = this.chkCreateTimes.Checked;
  402. this.dtpGroutingDateEnd.Enabled = this.chkCreateTimes.Checked;
  403. if (!this.chkCreateTimes.Checked)
  404. {
  405. this.dtpGroutingDateStart.Value = DateTime.Now.Date;
  406. this.dtpGroutingDateEnd.Value = DateTime.Now.Date;
  407. }
  408. }
  409. }
  410. }