SelectDressConfirmSmallForm.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
  10. {
  11. public partial class SelectDressConfirmSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.SelectDressConfirmSmallForm
  12. {
  13. public SelectDressConfirmSmallForm()
  14. {
  15. this.btnSelect.Click += btnSelect_Click;
  16. }
  17. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  18. LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
  19. /// <summary>
  20. /// 副订单号
  21. /// </summary>
  22. public string strViceNumber;
  23. /// <summary>
  24. /// 是否保存过
  25. /// </summary>
  26. public bool IsSave = false;
  27. /// <summary>
  28. /// 是否安排(只供本月提醒调用)
  29. /// </summary>
  30. public bool IsAnPai = false;
  31. /// <summary>
  32. /// 窗体加载事件
  33. /// </summary>
  34. /// <param name="sender"></param>
  35. /// <param name="e"></param>
  36. protected override void SelectDressConfirmSmallForm_Load(object sender, EventArgs e)
  37. {
  38. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_SelectDress))
  39. { this.btnSaveed.Enabled = false; }
  40. #region 获取数据
  41. //部门人员绑定
  42. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevdgv, true);
  43. TreeNode root = new TreeNode();
  44. root.Text = "OK";
  45. root.Tag = "1";
  46. this.cmbtreevStatus.Nodes.Add(root);
  47. root = new TreeNode();
  48. root.Text = "未选";
  49. root.Tag = "0";
  50. this.cmbtreevStatus.Nodes.Add(root);
  51. if (this.IsAnPai)
  52. {
  53. this.cmbtreevdgv.TagFindText(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID);
  54. this.cmbtreevStatus.TagFindText("1");
  55. this.cmbtreevdgv.Enabled = false;
  56. this.cmbtreevStatus.Enabled = false;
  57. }
  58. #endregion
  59. this.GetOrdNumberGetData();
  60. }
  61. /// <summary>
  62. /// 查询获取订单信息
  63. /// </summary>
  64. /// <param name="StrNumber"></param>
  65. void GetOrdNumberGetData()
  66. {
  67. if (!string.IsNullOrEmpty(this.strViceNumber))
  68. {
  69. string strViewName = "tb_ErpOrder Left Join dbo.tb_ErpOrderDigital ON Ord_Number = Ordv_Number left join dbo.tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber Left Join CView_OrderPickupStatusVice on OPlist_ViceNumber = Ordv_ViceNumber";
  70. string strColumnName = "Ordv_ClothingStatus,Ordv_ClothingNumber,Ordv_ClothingName,Ordv_ClothingTime,Ordv_ClothingRemark,Cus_Name,Cus_Sex_cs,CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS ShowOrdNumber,"+
  71. "Ord_SeriesName,Ord_Type,(select stuff((select ',' + dbo.fn_CheckUserIDGetUserName( OrdPe_OrdersPerson) from tb_ErpOrdersPerson where OrdPe_OrderNumber=Ord_Number for xml path('')),1,1,'')) as OrdPe_OrdersPerson,Ordv_ViceNumber,"+
  72. "Case when Ord_Type = '1' then (select top 1 Ordpg_Sights from dbo.tb_ErpOrdersPhotography where Ordpg_Number = Ordv_Number and Ordpg_ViceNumber = Ordv_ViceNumber) else '' end AS Ordpg_Sights,取件状态,"+
  73. "'内景:' + CONVERT(varchar(10),isnull((select Sum(Ordpg_ApparelQuantity) from tb_ErpOrdersPhotography where Ordpg_ViceNumber = Ordv_ViceNumber And Ordpg_SightsType = '0'), 0)) + "+
  74. "' 外景:' + CONVERT(varchar(10),isnull((select Sum(Ordpg_ApparelQuantity) from tb_ErpOrdersPhotography where Ordpg_ViceNumber = Ordv_ViceNumber And Ordpg_SightsType = '1'), 0)) AS 服装套数";
  75. DataTable tbl = orbll.GetView_Custom(strViewName, StrWhere: "Ordv_ViceNumber = '" + this.strViceNumber + "'", filedOrder: "Ordv_DigitalNumber ASC", ShowColumnName: strColumnName).Tables[0];
  76. if (tbl.Rows.Count > 0)
  77. {
  78. this.txtOrderNumber.Text = tbl.Rows[0]["ShowOrdNumber"].ToString().Trim();
  79. this.txtSeriesName.Text = tbl.Rows[0]["Ord_SeriesName"].ToString().Trim();
  80. this.txtOrdersPerson.Text = tbl.Rows[0]["OrdPe_OrdersPerson"].ToString().Trim();
  81. this.txtClothingCount.Text = tbl.Rows[0]["服装套数"].ToString().Trim();
  82. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData(this.txtName1, this.txtName2, lblName1, lblName2, tbl.Rows[0]["Ord_Type"].ToString().Trim(), tbl.Rows[0]["Cus_Name"].ToString().Trim(), tbl.Rows[0]["Cus_Sex_cs"].ToString().Trim());
  83. if (tbl.Rows.Count > 0)
  84. {
  85. string strDate = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[0]["Ordv_ClothingTime"]);
  86. this.dtpcdgv.DateValue = strDate;
  87. string Strtime = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[0]["Ordv_ClothingTime"], "HH:mm");
  88. this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime;
  89. this.cmbtreevdgv.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(tbl.Rows[0]["Ordv_ClothingName"]);
  90. this.cmbtreevdgv.Tag = tbl.Rows[0]["Ordv_ClothingName"].ToString().Trim();
  91. this.cmbtreevStatus.TagFindText(tbl.Rows[0]["Ordv_ClothingStatus"]);
  92. this.txtdgv.Text = tbl.Rows[0]["Ordv_ClothingRemark"].ToString().Trim();
  93. this.txtDressNumber.Text = tbl.Rows[0]["Ordv_ClothingNumber"].ToString().Trim();
  94. if (tbl.Rows[0]["取件状态"].ToString().Trim() == "OK")
  95. {
  96. string StrMaengd = tbl.Rows[0]["Ordpg_Sights"].ToString().Trim();
  97. if (string.IsNullOrEmpty(StrMaengd))
  98. { StrMaengd = "订单取件已完成!"; }
  99. else
  100. { StrMaengd = "'" + tbl.Rows[0]["Ordpg_Sights"].ToString().Trim() + "'取件已完成!"; }
  101. MessageBoxCustom.Show(StrMaengd);
  102. this.btnSaveed.Enabled = false;
  103. }
  104. else
  105. { this.btnSaveed.Enabled = true; }
  106. }
  107. }
  108. }
  109. }
  110. /// <summary>
  111. /// 保存
  112. /// </summary>
  113. /// <param name="sender"></param>
  114. /// <param name="e"></param>
  115. protected override void btnSaveed_Click(object sender, EventArgs e)
  116. {
  117. if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) != DialogResult.No)
  118. {
  119. DateTime strTime = SDateTime.Now;
  120. if (this.dtpcdgv.DateValue.Trim() != "")
  121. {
  122. if (this.mskdgv.Text.Trim() != ":")
  123. {
  124. try { DateTime ssa = Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd") + " " + this.mskdgv.Text); }
  125. catch { MessageBoxCustom.Show("选片时间不是有效时间格式"); this.mskdgv.Text = ""; return; }
  126. }
  127. }
  128. LYFZ.Model.Model_ErpOrderDigital model = odbll.GetModel("Ordv_ViceNumber", this.strViceNumber);
  129. model.Ordv_ClothingNumber = this.txtDressNumber.Text.Trim();
  130. model.Ordv_ClothingName = this.cmbtreevdgv.Tag.ToString();
  131. model.Ordv_ClothingStatus = this.cmbtreevStatus.Tag.ToString();
  132. if (this.dtpcdgv.DateValue.Trim() != "" && this.mskdgv.Text.Trim() != ":")
  133. { model.Ordv_ClothingTime = Convert.ToDateTime(this.dtpcdgv.DateValue.Trim() + " " + this.mskdgv.Text.Trim() + ":00"); }
  134. else if (this.dtpcdgv.DateValue.Trim() != "")
  135. { model.Ordv_ClothingTime = Convert.ToDateTime(this.dtpcdgv.DateValue.Trim()); this.mskdgv.Text = ""; }
  136. else { model.Ordv_ClothingTime = null; this.mskdgv.Text = ""; }
  137. if(model.Ordv_ClothingStatus=="1")
  138. {
  139. model.Ordv_ClothingShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID;
  140. }
  141. model.Ordv_ClothingRemark = this.txtdgv.Text.Trim();
  142. model.Ordv_UpdateDateTime = strTime;
  143. model.Ordv_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  144. if (odbll.Update(model))
  145. { MessageBoxCustom.Show("保存成功"); this.IsSave = true; this.Close(); }
  146. else { MessageBoxCustom.Show("保存失败"); return; }
  147. }
  148. }
  149. /// <summary>
  150. /// 选择
  151. /// </summary>
  152. /// <param name="sender"></param>
  153. /// <param name="e"></param>
  154. void btnSelect_Click(object sender, EventArgs e)
  155. {
  156. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectDressSuperSmallForm frm = new SuperSmallForm.SelectDressSuperSmallForm();
  157. frm.StrValue = this.txtDressNumber.Text.Trim();
  158. frm.ShowDialog();
  159. if (frm.IsSaveed)
  160. { this.txtDressNumber.Text = frm.StrValue; }
  161. }
  162. /// <summary>
  163. /// 取消
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. protected override void btnCancel_Click(object sender, EventArgs e)
  168. { this.Close(); }
  169. }
  170. }