F_MST_1602.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. using Dongke.IBOSS.PRD.Basics.BaseControls;
  2. using Dongke.IBOSS.PRD.Basics.BaseResources;
  3. using Dongke.IBOSS.PRD.Client.CommonModule;
  4. using Dongke.IBOSS.PRD.WCF.DataModels;
  5. using Dongke.IBOSS.PRD.WCF.Proxys;
  6. using System;
  7. using System.Collections;
  8. using System.Windows.Forms;
  9. namespace Dongke.IBOSS.PRD.Client.SystemModule
  10. {
  11. public partial class F_MST_1602 : Form
  12. {
  13. #region 成员变量
  14. private string OrderCodeOne;
  15. // 编辑状态
  16. private Constant.FormMode _editStatus;
  17. //table1 还是 table2
  18. private int Orders;
  19. //保存详细订单数据
  20. ArrayList arrayList1 = new ArrayList();
  21. #endregion
  22. #region 构造函数
  23. public F_MST_1602()
  24. {
  25. InitializeComponent();
  26. }
  27. public F_MST_1602(Constant.FormMode frmStatus, ArrayList arrayList, int Order)
  28. {
  29. InitializeComponent();
  30. _editStatus = frmStatus;
  31. arrayList1 = arrayList;
  32. // 设置窗口标题,当为新建状态时显示新建用户,当为编辑状态时显示编辑用户
  33. if (frmStatus == Constant.FormMode.Add)
  34. {
  35. FromStatus = "Add";
  36. this.Text = "新建";
  37. }
  38. else if (frmStatus == Constant.FormMode.Edit)
  39. {
  40. FromStatus = "Edit";
  41. this.Text = "编辑";
  42. this.txtOrderCode.Enabled = true;
  43. Orders = Order;
  44. string OrderCode = arrayList[0].ToString();
  45. if (!string.IsNullOrEmpty(OrderCode))
  46. {
  47. this.txtNumbers.Visible = true;
  48. this.c_Label2.Visible = true;
  49. OrderCodeOne = OrderCode;
  50. ClientRequestEntity cre = new ClientRequestEntity();
  51. cre.NameSpace = "F_MST_1601";
  52. if (OrderCode == "1")
  53. {
  54. cre.Name = "GetOrder";
  55. }
  56. else
  57. {
  58. cre.Name = "GetOrderDetails";
  59. }
  60. cre.Properties["ORDERCODE"] = "";
  61. cre.Properties["GOODSCODE"] = "";
  62. cre.Properties["GOODSNAME"] = "";
  63. cre.Properties["ORDERSNAME"] = "";
  64. cre.Properties["VALUEFLAG"] = "";
  65. cre.Properties["ORDERSDETAILID"] = OrderCode;
  66. cre.Properties["CUSTOMERNAME"] = "";
  67. cre.Properties["LAYOUTNAME"] = "";
  68. cre.Properties["CreateTimeStart"] = "";
  69. cre.Properties["CreateTimeStartEnd"] = "";
  70. cre.Properties["ENTRUCKINGCODE"] = "";
  71. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  72. if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
  73. {
  74. if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
  75. {
  76. //订单号
  77. this.txtOrderCode.Text = sre.Data.Tables[0].Rows[0]["ORDERSCODE"].ToString();
  78. //数量
  79. this.txtNumbers.Text = sre.Data.Tables[0].Rows[0]["NUMBERS"].ToString();
  80. //有效标识
  81. if (sre.Data.Tables[0].Rows[0]["VALUEFLAG"].ToString() == "是")
  82. {
  83. this.ccbvalueflag.SelectedIndex = 0;
  84. }
  85. else if (sre.Data.Tables[0].Rows[0]["VALUEFLAG"].ToString() == "否")
  86. {
  87. this.ccbvalueflag.SelectedIndex = 1;
  88. }
  89. this.txtCustomerCode.Text = sre.Data.Tables[0].Rows[0]["CUSTOMERCODE"].ToString();
  90. this.txtLayoutCode.Text = sre.Data.Tables[0].Rows[0]["LAYOUTCODE"].ToString();
  91. ////备注
  92. //this.txtRemarks.Text = sre.Data.Tables[0].Rows[0]["REMARKS"].ToString();
  93. if (Order == 2)
  94. {
  95. this.txtNumbers.Enabled = false;
  96. this.txtNumbers.Text = sre.Data.Tables[0].Rows[0]["NUMBERS"].ToString();
  97. this.txtNumbers.Text = sre.Data.Tables[0].Rows[0]["NUMBERS"].ToString();
  98. }
  99. else
  100. {
  101. txtCustomerCode.Visible = false;
  102. lblMAC.Visible = false;
  103. c_Label1.Visible = false;
  104. txtLayoutCode.Visible = false;
  105. }
  106. }
  107. else
  108. {
  109. // 提示未查找到数据
  110. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  111. MessageBoxButtons.OK, MessageBoxIcon.Information);
  112. }
  113. }
  114. }
  115. }
  116. // 工具栏按钮文本赋值
  117. this.btnSave.Text = ButtonText.BTN_SAVE;
  118. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  119. }
  120. #endregion
  121. #region 属性
  122. /// <summary>
  123. /// 页面状态
  124. /// </summary>
  125. public string FromStatus
  126. {
  127. get;
  128. set;
  129. }
  130. #endregion
  131. #region 事件
  132. private void c_Label3_Click(object sender, EventArgs e)
  133. {
  134. }
  135. //保存事件
  136. private void btnSave_Click(object sender, EventArgs e)
  137. {
  138. try
  139. {
  140. if (Orders == 2)
  141. {
  142. //客户编码
  143. if (string.IsNullOrEmpty(this.txtCustomerCode.Text.ToString()))
  144. {
  145. //必须输入
  146. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "客户编码"),
  147. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  148. this.txtCustomerCode.Focus();
  149. return;
  150. }
  151. //版面编码
  152. if (string.IsNullOrEmpty(this.txtLayoutCode.Text.ToString()))
  153. {
  154. //必须输入
  155. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "版面编码"),
  156. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  157. this.txtLayoutCode.Focus();
  158. return;
  159. }
  160. //有效标识
  161. if (this.ccbvalueflag.SelectedItem == null)
  162. {
  163. //必须输入
  164. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "有效标识"),
  165. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  166. this.ccbvalueflag.Focus();
  167. return;
  168. }
  169. //数量
  170. if (string.IsNullOrEmpty(this.txtNumbers.Text.ToString()))
  171. {
  172. //必须输入
  173. MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "数量"),
  174. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  175. this.txtNumbers.Focus();
  176. return;
  177. }
  178. }
  179. //int returnCustomerID = Constant.INT_IS_ZERO;
  180. //_CustomerEntity = this.SetCustomerEntity();
  181. if (_editStatus == Constant.FormMode.Add)
  182. {
  183. // 新建用户,返回新建的用户ID
  184. this.btnSave.Enabled = false;
  185. this.btnCancel.Enabled = false;
  186. this.AddOrderInfo();
  187. this.Clear();
  188. }
  189. if (_editStatus == Constant.FormMode.Edit)
  190. {
  191. this.btnSave.Enabled = false;
  192. this.btnCancel.Enabled = false;
  193. this.EditOrder();
  194. this.Close();
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. // 对异常进行共通处理
  200. ExceptionManager.HandleEventException(this.ToString(),
  201. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  202. }
  203. }
  204. #endregion
  205. #region 私有方法
  206. //保存方法
  207. private void AddOrderInfo()
  208. {
  209. int valueflag = 1;
  210. ClientRequestEntity cre = new ClientRequestEntity();
  211. cre.NameSpace = "F_MST_1601";
  212. cre.Name = "AddOrderInfo";
  213. cre.Properties["CUSTOMERCODE"] = this.txtCustomerCode.Text;
  214. cre.Properties["ORDERSCODE"] = this.txtOrderCode.Text;
  215. cre.Properties["LAYOUTCODE"] = this.txtLayoutCode.Text;
  216. cre.Properties["NUMBERS"] = this.txtNumbers.Text;
  217. cre.Properties["GOODSNAME"] = "";
  218. if (this.ccbvalueflag.SelectedIndex == 0)
  219. {
  220. valueflag = 1;
  221. }
  222. if (this.ccbvalueflag.SelectedIndex == 1)
  223. {
  224. valueflag = 0;
  225. }
  226. cre.Properties["VALUEFLAG"] = valueflag;
  227. cre.Properties["FromStatus"] = FromStatus.ToString();
  228. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  229. this.btnSave.Enabled = true;
  230. this.btnCancel.Enabled = true;
  231. if (sre.OtherStatus > 0)
  232. {
  233. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  234. return;
  235. }
  236. else if (Convert.ToInt32(sre.OtherStatus) == -1001)
  237. {
  238. MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
  239. "存在相同订单"),
  240. "",
  241. MessageBoxButtons.OK,
  242. MessageBoxIcon.Warning);
  243. return;
  244. }
  245. }
  246. //编辑方法
  247. private void EditOrder()
  248. {
  249. if (Orders == 2)
  250. {
  251. int valueflag = 1;
  252. ClientRequestEntity cre = new ClientRequestEntity();
  253. cre.NameSpace = "F_MST_1601";
  254. cre.Name = "AddOrderInfo";
  255. if (this.ccbvalueflag.SelectedIndex == 0)
  256. {
  257. valueflag = 1;
  258. }
  259. if (this.ccbvalueflag.SelectedIndex == 1)
  260. {
  261. valueflag = 0;
  262. }
  263. cre.Properties["VALUEFLAG"] = valueflag;
  264. cre.Properties["FromStatus"] = FromStatus.ToString();
  265. cre.Properties["ORDERS"] = Orders;
  266. cre.Properties["ORDERSDETAILID"] = arrayList1[0].ToString();
  267. cre.Properties["ORDERSCODE"] = this.txtOrderCode.Text;
  268. cre.Properties["CUSTOMERCODE"] = this.txtCustomerCode.Text;
  269. cre.Properties["LAYOUTCODE"] = this.txtLayoutCode.Text;
  270. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  271. this.btnSave.Enabled = true;
  272. this.btnCancel.Enabled = true;
  273. if (sre.OtherStatus > 0)
  274. {
  275. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  276. return;
  277. }
  278. }
  279. else if (Orders == 1)
  280. {
  281. int valueflag = 1;
  282. ClientRequestEntity cre = new ClientRequestEntity();
  283. cre.NameSpace = "F_MST_1601";
  284. cre.Name = "AddOrderInfo";
  285. if (this.ccbvalueflag.SelectedIndex == 0)
  286. {
  287. valueflag = 1;
  288. }
  289. if (this.ccbvalueflag.SelectedIndex == 1)
  290. {
  291. valueflag = 0;
  292. }
  293. cre.Properties["VALUEFALG"] = valueflag;
  294. cre.Properties["FromStatus"] = FromStatus.ToString();
  295. cre.Properties["ORDERS"] = Orders;
  296. cre.Properties["ORDERSCODE"] = this.txtOrderCode.Text;
  297. cre.Properties["ORDERCODEONE"] = OrderCodeOne;
  298. cre.Properties["NUMBERS"] = this.txtNumbers.Text;
  299. ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
  300. this.btnSave.Enabled = true;
  301. this.btnCancel.Enabled = true;
  302. if (sre.OtherStatus > 0)
  303. {
  304. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  305. return;
  306. }
  307. }
  308. }
  309. private void Clear()
  310. {
  311. this.txtOrderCode.Clear();
  312. this.txtLayoutCode.Clear();
  313. this.txtCustomerCode.Clear();
  314. this.txtNumbers.Clear();
  315. this.ccbvalueflag.SelectedText = "";
  316. }
  317. #endregion
  318. private void F_MST_1602_Load(object sender, EventArgs e)
  319. {
  320. }
  321. private void txtCustomerCode_TextChanged(object sender, EventArgs e)
  322. {
  323. }
  324. private void lblMAC_Click(object sender, EventArgs e)
  325. {
  326. }
  327. }
  328. }