F_MST_1601.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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.Close();
  197. }
  198. /// <summary>
  199. /// 自适应列宽
  200. /// </summary>
  201. /// <param name="sender"></param>
  202. /// <param name="e"></param>
  203. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  204. {
  205. this.dgvRpt.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  206. this.dgvRpt2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  207. }
  208. /// <summary>
  209. /// 退出
  210. /// </summary>
  211. /// <param name="sender"></param>
  212. /// <param name="e"></param>
  213. private void tsbtnClose_Click(object sender, EventArgs e)
  214. {
  215. this.Close();
  216. }
  217. /// <summary>
  218. /// 编辑
  219. /// </summary>
  220. /// <param name="sender"></param>
  221. /// <param name="e"></param>
  222. private void tsbtnEdit_Click(object sender, EventArgs e)
  223. {
  224. try
  225. {
  226. if (this.dgvRpt.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 0)
  227. {
  228. arraylist.Add(this.dgvRpt.SelectedRows[0].Cells["ORDERSCODES"].Value.ToString());
  229. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 1);
  230. DialogResult dialogresult = frmFPC1602.ShowDialog();
  231. btnSearch_Click(sender, null);
  232. arraylist.Clear();
  233. }
  234. if (this.dgvRpt2.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 1)
  235. {
  236. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSCODE"].Value.ToString());
  237. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["BARCODE"].Value.ToString());
  238. arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSDETAILID"].Value.ToString());
  239. F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 2);
  240. DialogResult dialogresult = frmFPC1602.ShowDialog();
  241. btnSearch_Click(sender, null);
  242. arraylist.Clear();
  243. }
  244. }
  245. catch (Exception ex)
  246. {
  247. // 对异常进行共通处理
  248. ExceptionManager.HandleEventException(this.ToString(),
  249. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  250. }
  251. }
  252. /// <summary>
  253. /// 新建
  254. /// </summary>
  255. /// <param name="sender"></param>
  256. /// <param name="e"></param>
  257. private void tsbtnAdd_Click(object sender, EventArgs e)
  258. {
  259. try{
  260. if(this.dgvOrder.SelectedIndex == 0){
  261. F_MST_1602 frmMST1602 = new F_MST_1602(Constant.FormMode.Add, arraylist,0);
  262. DialogResult dialogResult = frmMST1602.ShowDialog();
  263. // 重新加载GridView
  264. btnSearch_Click(sender, null);
  265. }
  266. }
  267. catch (Exception ex)
  268. {
  269. // 对异常进行共通处理
  270. ExceptionManager.HandleEventException(this.ToString(),
  271. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  272. }
  273. }
  274. /// <summary>
  275. /// 窗体关闭事件
  276. /// </summary>
  277. /// <param name="sender"></param>
  278. /// <param name="e"></param>
  279. private void F_MST_1601_FormClosed(object sender, FormClosedEventArgs e)
  280. {
  281. _instance = null;
  282. }
  283. #endregion
  284. #region 私有方法
  285. /// <summary>
  286. /// 根据界面查询条件获取数据集
  287. /// </summary>
  288. private DataSet GetSearchData()
  289. {
  290. try
  291. {
  292. ClientRequestEntity cre = new ClientRequestEntity();
  293. cre.NameSpace = "F_MST_1601";
  294. cre.Name = "GetCustomer";
  295. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  296. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  297. {
  298. return sre.Data;
  299. }
  300. return null;
  301. }
  302. catch (Exception ex)
  303. {
  304. throw ex;
  305. }
  306. }
  307. #endregion
  308. private void dgvRpt2_ColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e)
  309. {
  310. if (this.dgvOrder.SelectedIndex == 0)
  311. {
  312. this.tsbtnAdd.Enabled = true;
  313. }
  314. if (this.dgvOrder.SelectedIndex == 1)
  315. {
  316. this.tsbtnAdd.Enabled = false;
  317. }
  318. }
  319. }
  320. }