OrderInfoTwoControlsEx.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Collections;
  10. using LYFZ.Model.API;
  11. namespace LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls
  12. {
  13. public partial class OrderInfoTwoControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderInfoTwoControlsEx
  14. {
  15. public OrderInfoTwoControlsEx(object obj = null)
  16. {
  17. this.txtSinceOrderNumber.ImeMode = System.Windows.Forms.ImeMode.Disable;
  18. this.txtTaoXiPrice.KeyPress += txtTaoXiPrice_KeyPress;
  19. this.txtSinceOrderNumber.KeyPress += txtSinceOrderNumber_KeyPress;
  20. this.txtTaoXiPrice.Leave += txtTaoXiPrice_Leave;
  21. this.btnOrderClsssSet.Click += btnOrderClsssSet_Click;
  22. //this.btn_PickUpSet.Click += btn_PickUpSet_Click;
  23. //CheckAndCreatePickUpClass();
  24. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGAHBFDGCABAJIH", this.cmbtreevOrderClass);
  25. //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAQJFS", this.cmbtreevPickup);
  26. this.SetOrderPanel(obj);
  27. }
  28. //void btn_PickUpSet_Click(object sender, EventArgs e)
  29. //{
  30. // LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  31. // frm.TypeName = "AAAAQJFS";
  32. // frm.Version = "Version";
  33. // if (frm.ShowDialog() == DialogResult.OK)
  34. // { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAQJFS", this.cmbtreevPickup); }
  35. //}
  36. private string _strCustomPrefix;
  37. /// <summary>
  38. /// 自定义订单号前缀
  39. /// </summary>
  40. public string StrCustomPrefix
  41. {
  42. get
  43. {
  44. _strCustomPrefix = this.lblCustomPrefix.Text.Trim();
  45. return _strCustomPrefix;
  46. }
  47. set
  48. {
  49. _strCustomPrefix = value;
  50. this.lblCustomPrefix.Text = value;
  51. }
  52. }
  53. private LYFZ.Model.Model_ErpOrder _modelOrder;
  54. /// <summary>
  55. /// 当前选中的订单
  56. /// </summary>
  57. public LYFZ.Model.Model_ErpOrder modelOrder
  58. {
  59. get { return _modelOrder; }
  60. set { _modelOrder = value; }
  61. }
  62. private bool _IsShowSinceOrderNumber;
  63. /// <summary>
  64. /// 是否显示自定义订单号
  65. /// </summary>
  66. public bool IsShowSinceOrderNumber
  67. {
  68. get { return _IsShowSinceOrderNumber; }
  69. set { _IsShowSinceOrderNumber = value; }
  70. }
  71. /// <summary>
  72. /// 套系价格限制输入
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. void txtTaoXiPrice_KeyPress(object sender, KeyPressEventArgs e)
  77. {
  78. if (Convert.ToString(e.KeyChar) == ".")
  79. {
  80. if (this.txtTaoXiPrice.Text.Trim().IndexOf('.') != -1 || string.IsNullOrEmpty(this.txtTaoXiPrice.Text.Trim()))
  81. { e.Handled = true; }
  82. return;
  83. }
  84. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  85. { e.Handled = true; }
  86. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  87. { e.Handled = true; }
  88. }
  89. /// <summary>
  90. /// 自定义单号限制输入
  91. /// </summary>
  92. /// <param name="sender"></param>
  93. /// <param name="e"></param>
  94. void txtSinceOrderNumber_KeyPress(object sender, KeyPressEventArgs e)
  95. {
  96. if (Convert.ToString(e.KeyChar) == "-" || Convert.ToString(e.KeyChar) == "_")
  97. { }
  98. else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar))
  99. { e.Handled = true; }
  100. }
  101. /// <summary>
  102. /// 套系金额离开事件
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. void txtTaoXiPrice_Leave(object sender, EventArgs e)
  107. {
  108. if (!string.IsNullOrEmpty(this.txtTaoXiPrice.Text.Trim()))
  109. {
  110. try
  111. {
  112. if (!LYFZ.Command.Command_Validate.IsNumeric(this.txtTaoXiPrice.Text.Trim()))
  113. { this.txtTaoXiPrice.Text = ""; }
  114. }
  115. catch
  116. { this.txtTaoXiPrice.Text = ""; }
  117. }
  118. }
  119. /// <summary>
  120. /// 检查和创建新的取件方式
  121. /// </summary>
  122. void CheckAndCreatePickUpClass()
  123. {
  124. LYFZ.BLL.BLL_ErpSystemCategory bllCategory = new BLL.BLL_ErpSystemCategory();
  125. Model.Model_ErpSystemCategory model = new Model.Model_ErpSystemCategory();
  126. DataTable dt = bllCategory.GetList(" Sc_ClassCode = 'AAAAQJFS' ").Tables[0];
  127. if(dt.Rows.Count==0)
  128. {
  129. model.Sc_ClassCode = "AAAAQJFS";
  130. model.Sc_ClassName = "取件方式";
  131. model.Sc_ClassParentID = 0;
  132. model.Sc_IsReadOnly = true;
  133. model.Sc_IsDisable = false;
  134. model.Sc_IsDelete = true;
  135. model.Sc_IsEnabledURL = false;
  136. bllCategory.Add(model);
  137. }
  138. }
  139. /// <summary>
  140. /// 订单类别设置
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. void btnOrderClsssSet_Click(object sender, EventArgs e)
  145. {
  146. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  147. frm.TypeName = "BFAGAHBFDGCABAJIH";
  148. frm.Version = "Version";
  149. if (frm.ShowDialog() == DialogResult.OK)
  150. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGAHBFDGCABAJIH", this.cmbtreevOrderClass); }
  151. }
  152. /// <summary>
  153. /// 设置自己义单号和订单号是否显示
  154. /// </summary>
  155. /// <param name="obj"></param>
  156. public void SetOrderPanel(object obj)
  157. {
  158. if (obj != null)
  159. {
  160. Hashtable htData = (Hashtable)obj;
  161. this.lblCustomPrefix.Text = htData["StrPrefix"].ToString().Trim();
  162. this.txtOrderNumber.Text = htData["IsOrderNumber"].ToString();
  163. this.panelOrderNumber.Visible = false;
  164. if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim()))
  165. {
  166. this.panelSinceOrderNumber.Visible = true;
  167. }
  168. else
  169. {
  170. this.panelSinceOrderNumber.Visible = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsCustomOrderNumber;
  171. }
  172. this.IsShowSinceOrderNumber = this.panelSinceOrderNumber.Visible;
  173. }
  174. }
  175. public void BindApiData(Api_ErpOrderModel erpModel)
  176. {
  177. erpModel.strOrderClass = this.cmbtreevOrderClass.Text;
  178. erpModel.bIsShowSinceOrderNumber = this.IsShowSinceOrderNumber;
  179. if (this.IsShowSinceOrderNumber)
  180. {
  181. erpModel.SinceOrderNumber = this.txtSinceOrderNumber.Text;
  182. }
  183. erpModel.strRemark = this.txtRemark.Text;
  184. erpModel.strHotelInfo = "";
  185. erpModel.strParentTaoXiName = "服务套系";
  186. erpModel.strTaoXiName = "服务套系";
  187. if (this.txtTaoXiPrice.Text.Trim() == "")
  188. { erpModel.strTaoXiPrice = "0"; }
  189. else
  190. { erpModel.strTaoXiPrice = this.txtTaoXiPrice.Text.Trim(); }
  191. //erpModel.strPickUpType = this.cmbtreevPickup.Text;
  192. //erpModel.strPickUpTypeCode = this.cmbtreevPickup.Tag == null ? "" : (this.cmbtreevPickup.Tag).ToString();
  193. //erpModel.IsMagess = this.IsMagess;
  194. }
  195. /// <summary>
  196. /// 获取订单资料
  197. /// </summary>
  198. public LYFZ.Model.Model_ErpOrder GetOrderValue(string StrNewOrderNumber, string StrOrderType, string StrLovedStyle, string StrCustomerSource, string StrClass, string StrInfoID, DateTime StrTime, string StrUserID, bool IsMagess = true)
  199. {
  200. if (IsMagess)
  201. {
  202. if (this.IsShowSinceOrderNumber)
  203. {
  204. if (this.txtSinceOrderNumber.Text.Trim() == "")
  205. { MessageBoxCustom.Show("自定单号不能为空!"); return null; }
  206. }
  207. if (this.txtTaoXiPrice.Text.Trim() == "")
  208. { MessageBoxCustom.Show("套系价格不能为空!"); return null; }
  209. }
  210. if (this.txtRemark.Text.Trim().Length > 300)
  211. { MessageBoxCustom.Show("订单备注不能超过300字!"); return null; }
  212. LYFZ.Model.Model_ErpOrder model = null;
  213. if (this.modelOrder != null)
  214. {
  215. model = this.modelOrder;
  216. model.Ord_Number = this.txtOrderNumber.Text.Trim();
  217. model.Ord_UpdateDateTime = StrTime;
  218. model.Ord_UpdateName = StrUserID;
  219. }
  220. else
  221. {
  222. model = new Model.Model_ErpOrder();
  223. //model.ID = -1;
  224. model.Ord_Number = StrNewOrderNumber;
  225. model.Ord_Type = StrOrderType;
  226. model.Ord_CreateDateTime = StrTime;
  227. model.Ord_CreateName = StrUserID;
  228. }
  229. //model.Ord_SinceOrderNumber = "";
  230. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsCustomOrderNumber)
  231. {
  232. string strCustomNumber = this.txtSinceOrderNumber.Text;
  233. if (this.lblCustomPrefix.Tag != null)
  234. {
  235. if ((bool)this.lblCustomPrefix.Tag)
  236. {
  237. strCustomNumber = this.lblCustomPrefix.Text + strCustomNumber;
  238. }
  239. }
  240. model.Ord_SinceOrderNumber = strCustomNumber;
  241. DataTable tblCount = new DataTable();
  242. if (!string.IsNullOrEmpty(model.Ord_Number))
  243. { tblCount = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpOrder", StrWhere: "Ord_SinceOrderNumber = '" + model.Ord_SinceOrderNumber + "' and Ord_Number != '" + model.Ord_Number.Trim() + "'", ShowColumnName: "ID").Tables[0]; }
  244. else
  245. { tblCount = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpOrder", StrWhere: "Ord_SinceOrderNumber = '" + model.Ord_SinceOrderNumber + "' ", ShowColumnName: "ID").Tables[0]; }
  246. if (tblCount.Rows.Count > 0)
  247. { MessageBoxCustom.Show("自定义单已被使用,不能重复使用!"); return null; }
  248. }
  249. else
  250. {
  251. //if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim()))
  252. //{ model.Ord_SinceOrderNumber = this.lblCustomPrefix.Text + this.txtSinceOrderNumber.Text; }
  253. //else
  254. //{ model.Ord_SinceOrderNumber = StrNewOrderNumber; }
  255. model.Ord_SinceOrderNumber = this.modelOrder.Ord_SinceOrderNumber;
  256. }
  257. if (model.Ord_DividedShop == null || string.IsNullOrEmpty(model.Ord_DividedShop.Trim()))
  258. { model.Ord_DividedShop = StrInfoID; }
  259. model.Ord_Class = StrClass;
  260. if (StrClass == "1" && string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(model.Ord_SaveOrderDateTime)))
  261. { model.Ord_SaveOrderDateTime = StrTime; }
  262. model.Ord_CustomerSource = StrCustomerSource;
  263. model.Ord_LovedStyle = StrLovedStyle;
  264. model.Ord_PhotographyCategory = "服务套系";
  265. model.Ord_SeriesName = "服务套系";
  266. if (this.txtTaoXiPrice.Text.Trim() == "")
  267. { model.Ord_SeriesPrice = 0; }
  268. else
  269. { model.Ord_SeriesPrice = Convert.ToDecimal(this.txtTaoXiPrice.Text.Trim()); }
  270. model.Ord_OrderClass = this.cmbtreevOrderClass.Text.Trim();
  271. model.Ord_Remark = this.txtRemark.Text;
  272. model.Ord_HotelInfo = "";
  273. return model;
  274. }
  275. /// <summary>
  276. /// 设置订单资料
  277. /// </summary>
  278. public void SetOrderValue(LYFZ.Model.Model_ErpOrder model)
  279. {
  280. string StrCustomNumber = model.Ord_SinceOrderNumber;
  281. //if (!string.IsNullOrEmpty(this.lblCustomPrefix.Text.Trim()))
  282. //{
  283. // if (!string.IsNullOrEmpty(model.Ord_SinceOrderNumber))
  284. // {
  285. // if (model.Ord_SinceOrderNumber.IndexOf(this.lblCustomPrefix.Text.Trim()) != -1)
  286. // { StrCustomNumber = model.Ord_SinceOrderNumber.Substring(this.lblCustomPrefix.Text.Trim().Length, model.Ord_SinceOrderNumber.Length - this.lblCustomPrefix.Text.Trim().Length); }// model.Ord_SinceOrderNumber.Replace(this.lblCustomPrefix.Text.Trim(), ""); }
  287. // }
  288. //}
  289. if (!string.IsNullOrEmpty(StrCustomNumber))
  290. {
  291. this.lblCustomPrefix.Visible = false;
  292. this.txtSinceOrderNumber.Location = new Point(84, 0);
  293. this.txtSinceOrderNumber.Width = 200;
  294. this.lblCustomPrefix.Tag = false;
  295. }
  296. else
  297. {
  298. this.lblCustomPrefix.Tag = true;
  299. }
  300. this.txtSinceOrderNumber.Text = StrCustomNumber;
  301. if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim()))
  302. { this.txtSinceOrderNumber.ReadOnly = true; }
  303. if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim()))
  304. { this.panelOrderNumber.Visible = true; }
  305. this.txtOrderNumber.Text = model.Ord_Number;
  306. string strSeriesName = model.Ord_SeriesName.Trim();
  307. if (strSeriesName == "")
  308. { strSeriesName = model.Ord_PhotographyCategory.Trim(); }
  309. this.cmbtreevOrderClass.TextFindTag(model.Ord_OrderClass);
  310. //this.cmbtreevPickup.TextFindTag(model.Ord_PickUpType);
  311. this.txtTaoXiPrice.Text = model.Ord_SeriesPrice.ToString();
  312. this.txtRemark.Text = model.Ord_Remark;
  313. this.modelOrder = model;
  314. if (!model.Ord_Number.Equals(model.Ord_SinceOrderNumber))
  315. {
  316. this.panelSinceOrderNumber.Visible = true;
  317. this.IsShowSinceOrderNumber = this.panelSinceOrderNumber.Visible;
  318. this.Height = 158;
  319. }
  320. }
  321. }
  322. }