F_MST_1601.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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["ORDERSNAME"] = txtOrdersName.Text;
  95. cre.Properties["GOODSCODE"] = txtProductModel.Text;
  96. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  97. {
  98. cre.Properties["VALUEFLAG"] = "";
  99. }
  100. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  101. {
  102. cre.Properties["VALUEFLAG"] = 1;
  103. }
  104. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  105. {
  106. cre.Properties["VALUEFLAG"] = 0;
  107. }
  108. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  109. {
  110. cre.Properties["VALUEFLAG"] = 2;
  111. }
  112. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  113. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  114. {
  115. this.DataSource = sre.Data;
  116. if (this.DataSource != null)
  117. {
  118. if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0)
  119. {
  120. this.dgvRpt.DataSource = this.DataSource.Tables[0];
  121. }
  122. else
  123. {
  124. // 清空明细中的数据
  125. this.dgvRpt.DataSource = null;
  126. // 提示未查找到数据
  127. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  128. MessageBoxButtons.OK, MessageBoxIcon.Information);
  129. }
  130. }
  131. }
  132. else
  133. {
  134. // 清空明细中的数据
  135. this.dgvRpt.DataSource = null;
  136. // 提示未查找到数据
  137. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  138. MessageBoxButtons.OK, MessageBoxIcon.Information);
  139. }
  140. }
  141. else if (this.dgvOrder.SelectedIndex == 1)
  142. {
  143. this.dgvRpt2.DataSource = null;
  144. ClientRequestEntity cre = new ClientRequestEntity();
  145. cre.NameSpace = "F_MST_1601";
  146. cre.Name = "GetOrderDetails";
  147. cre.Properties["ORDERCODE"] = txtOrdersCode.Text;
  148. cre.Properties["GOODSCODE"] = txtProductModel.Text;
  149. if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true)
  150. {
  151. cre.Properties["VALUEFLAG"] = "";
  152. }
  153. else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false)
  154. {
  155. cre.Properties["VALUEFLAG"] = 1;
  156. }
  157. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true)
  158. {
  159. cre.Properties["VALUEFLAG"] = 0;
  160. }
  161. else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false)
  162. {
  163. cre.Properties["VALUEFLAG"] = 2;
  164. }
  165. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  166. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  167. {
  168. this.DataSource = sre.Data;
  169. if (this.DataSource != null)
  170. {
  171. this.dgvRpt2.DataSource = this.DataSource.Tables[0];
  172. }
  173. }
  174. }
  175. }
  176. catch (Exception ex)
  177. {
  178. this.btnSearch.Enabled = true;
  179. this.btnClearCondition.Enabled = true;
  180. // 对异常进行共通处理
  181. ExceptionManager.HandleEventException(this.ToString(),
  182. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  183. }
  184. finally
  185. {
  186. _init = false;
  187. }
  188. }
  189. /// <summary>
  190. /// 清空按钮
  191. /// </summary>
  192. /// <param name="sender"></param>
  193. /// <param name="e"></param>
  194. private void btnClearCondition_Click(object sender, EventArgs e)
  195. {
  196. this.txtOrdersCode.Text = null;
  197. this.txtOrdersName.Text = null;
  198. this.txtProductModel.Text = null;
  199. }
  200. /// <summary>
  201. /// 自适应列宽
  202. /// </summary>
  203. /// <param name="sender"></param>
  204. /// <param name="e"></param>
  205. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  206. {
  207. this.dgvRpt.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  208. this.dgvRpt2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  209. }
  210. /// <summary>
  211. /// 退出
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. private void tsbtnClose_Click(object sender, EventArgs e)
  216. {
  217. this.Close();
  218. }
  219. /// <summary>
  220. /// 编辑
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void tsbtnEdit_Click(object sender, EventArgs e)
  225. {
  226. try
  227. {
  228. if (this.dgvRpt.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 0)
  229. {
  230. arraylist.Add(this.dgvRpt.SelectedRows[0].Cells["ORDERSCODES"].Value.ToString());
  231. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 1);
  232. DialogResult dialogresult = frmFPC1602.ShowDialog();
  233. btnSearch_Click(sender, null);
  234. arraylist.Clear();
  235. }
  236. if (this.dgvRpt2.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 1)
  237. {
  238. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSCODE"].Value.ToString());
  239. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["BARCODE"].Value.ToString());
  240. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSDETAILID"].Value.ToString());
  241. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 2);
  242. DialogResult dialogresult = frmFPC1602.ShowDialog();
  243. btnSearch_Click(sender, null);
  244. arraylist.Clear();
  245. }
  246. }
  247. catch (Exception ex)
  248. {
  249. // 对异常进行共通处理
  250. ExceptionManager.HandleEventException(this.ToString(),
  251. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  252. }
  253. }
  254. /// <summary>
  255. /// 新建
  256. /// </summary>
  257. /// <param name="sender"></param>
  258. /// <param name="e"></param>
  259. private void tsbtnAdd_Click(object sender, EventArgs e)
  260. {
  261. try{
  262. if(this.dgvOrder.SelectedIndex == 0){
  263. F_MST_1602 frmMST1602 = new F_MST_1602(Constant.FormMode.Add, arraylist,0);
  264. DialogResult dialogResult = frmMST1602.ShowDialog();
  265. // 重新加载GridView
  266. btnSearch_Click(sender, null);
  267. }
  268. }
  269. catch (Exception ex)
  270. {
  271. // 对异常进行共通处理
  272. ExceptionManager.HandleEventException(this.ToString(),
  273. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  274. }
  275. }
  276. /// <summary>
  277. /// 窗体关闭事件
  278. /// </summary>
  279. /// <param name="sender"></param>
  280. /// <param name="e"></param>
  281. private void F_MST_1601_FormClosed(object sender, FormClosedEventArgs e)
  282. {
  283. _instance = null;
  284. }
  285. #endregion
  286. #region 私有方法
  287. /// <summary>
  288. /// 根据界面查询条件获取数据集
  289. /// </summary>
  290. private DataSet GetSearchData()
  291. {
  292. try
  293. {
  294. ClientRequestEntity cre = new ClientRequestEntity();
  295. cre.NameSpace = "F_MST_1601";
  296. cre.Name = "GetCustomer";
  297. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  298. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  299. {
  300. return sre.Data;
  301. }
  302. return null;
  303. }
  304. catch (Exception ex)
  305. {
  306. throw ex;
  307. }
  308. }
  309. #endregion
  310. private void dgvRpt2_ColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e)
  311. {
  312. if (this.dgvOrder.SelectedIndex == 0)
  313. {
  314. this.tsbtnAdd.Enabled = true;
  315. }
  316. if (this.dgvOrder.SelectedIndex == 1)
  317. {
  318. this.tsbtnAdd.Enabled = false;
  319. }
  320. }
  321. }
  322. }