A_EmployeeScheduleSmallFlighting.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Globalization;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.TimeAndAttendance
  11. {
  12. public class A_EmployeeScheduleSmallFlighting : LYFZ.Software.UI.TimeAndAttendance.A_EmployeeScheduleSmallFlighting
  13. {
  14. public DataSet dtSet = new DataSet();
  15. public DataSet dtSet1 = new DataSet();
  16. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  17. public A_EmployeeScheduleSmallFlighting()
  18. {
  19. this.Load += A_EmployeeScheduleSmallFlighting_Load;
  20. this.btnReservation.Click += btnReservation_Click;
  21. this.btnClose.Click += btnClose_Click;
  22. }
  23. /// <summary>
  24. /// 工作内容ID串
  25. /// </summary>
  26. public string StrJobsID = "";
  27. /// <summary>
  28. /// 工作项目串
  29. /// </summary>
  30. public string StrJobsText = "";
  31. /// <summary>
  32. /// 选择的要显示内容
  33. /// </summary>
  34. public string StrShowText = "";
  35. /// <summary>
  36. /// 选择的日期
  37. /// </summary>
  38. public string StrDateTime = "";
  39. /// <summary>
  40. /// 是否保存
  41. /// </summary>
  42. public bool IsSaveed = false;
  43. /// <summary>
  44. /// 窗体加载事件
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. void A_EmployeeScheduleSmallFlighting_Load(object sender, EventArgs e)
  49. {
  50. if (!string.IsNullOrEmpty(this.StrJobsID))
  51. {
  52. string[] StrArrayJobsID = this.StrJobsID.Trim().Split(',');
  53. string[] StrArrayJobsText = this.StrJobsText.Trim().Split(',');
  54. Hashtable htDataGroupCount = new Hashtable();
  55. for (int i = 0; i < StrArrayJobsText.Length; i++)
  56. {
  57. if (htDataGroupCount.ContainsKey(StrArrayJobsText[i].Trim()))
  58. {
  59. int intCount = Convert.ToInt32(htDataGroupCount[StrArrayJobsText[i].Trim()].ToString().Trim()) + 1;
  60. htDataGroupCount[StrArrayJobsText[i].Trim()] = intCount;
  61. }
  62. else
  63. { htDataGroupCount[StrArrayJobsText[i].Trim()] = 1; }
  64. }
  65. string StrGroupJobsText = "";
  66. foreach (DictionaryEntry item in htDataGroupCount)
  67. {
  68. StrGroupJobsText += item.Key.ToString().Trim() + ":" + item.Value.ToString().Trim() + "组;";
  69. }
  70. labelEx1.Text = this.StrShowText.Trim() + " " + StrGroupJobsText;
  71. string strColumn = "订单编号,景点,时间,订单号,订单类型,套系名称,客户姓名,性别,电话,QQ,负责";
  72. this.dgvData.DataColumns(strColumn, strHideField: "订单编号");
  73. this.dgvData.Columns["时间"].Width = 110;
  74. DataTable dt = new DataTable();
  75. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  76. {
  77. string StrWhere = LYFZ.BLL.OtherCommonModel.GetDateTime("Ordpg_ReservationPhotographyTime", this.StrDateTime, this.StrDateTime, ConnectWord: "");
  78. string StrArray = "";
  79. for (int i = 0; i < StrArrayJobsID.Length; i++)
  80. {
  81. if (!string.IsNullOrEmpty(StrArrayJobsID[i].Trim()))
  82. { StrArray += "'" + StrArrayJobsID[i].Trim() + "',"; }
  83. }
  84. if (!string.IsNullOrEmpty(StrArray.Trim()))
  85. { StrWhere += " And tb_ErpOrder.ID in (" + StrArray.TrimEnd(',') + ")"; }
  86. dt = orbll.GetView_Custom("tb_ErpOrder Left Join tempTB_AggregationCustomer on GP_OrderNumber = Ord_Number Left Join tb_ErpOrdersPhotography on Ordpg_Number = Ord_Number", StrWhere: StrWhere, ShowColumnName: "tb_ErpOrder.ID,Ord_Number,Ord_SinceOrderNumber,dbo.fn_CheckOrderType(Ord_Type) AS Ord_Type,Ord_SeriesName,Cus_Name,M_Cus_Sex_cs,M_Cus_Telephone,M_Cus_QQ,Ordpg_Sights,Ordpg_ReservationPhotographyTime", filedOrder: "Ordpg_ReservationPhotographyTime,Ord_Number").Tables[0];
  87. });
  88. DataGridViewRow dgvr = null;
  89. DataGridViewCell cell = null;
  90. bool IsTrue = true;
  91. for (int i = 0; i < dt.Rows.Count; i++)
  92. {
  93. dgvr = new DataGridViewRow();
  94. cell = new DataGridViewTextBoxCell();
  95. cell.Value = dt.Rows[i]["Ord_Number"].ToString().Trim();
  96. dgvr.Cells.Add(cell);
  97. cell = new DataGridViewTextBoxCell();
  98. cell.Value = dt.Rows[i]["Ordpg_Sights"].ToString().Trim();
  99. dgvr.Cells.Add(cell);
  100. cell = new DataGridViewTextBoxCell();
  101. cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString(dt.Rows[i]["Ordpg_ReservationPhotographyTime"]);
  102. dgvr.Cells.Add(cell);
  103. bool IsFind = false;
  104. if (i > 0)
  105. {
  106. if (dt.Rows[i]["Ord_Number"].ToString().Trim() == dt.Rows[i - 1]["Ord_Number"].ToString().Trim())
  107. { IsFind = true; }
  108. }
  109. else
  110. { dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Single(); }
  111. if (!IsFind)
  112. {
  113. if (IsTrue)
  114. {
  115. dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Double();
  116. IsTrue = false;
  117. }
  118. else
  119. {
  120. dgvr.DefaultCellStyle.BackColor = this.dgvData.DataGridViewRowsBackColor_Single();
  121. IsTrue = true;
  122. }
  123. cell = new DataGridViewTextBoxCell();
  124. cell.Value = dt.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
  125. dgvr.Cells.Add(cell);
  126. cell = new DataGridViewTextBoxCell();
  127. cell.Value = dt.Rows[i]["Ord_Type"].ToString().Trim();
  128. dgvr.Cells.Add(cell);
  129. cell = new DataGridViewTextBoxCell();
  130. cell.Value = dt.Rows[i]["Ord_SeriesName"].ToString().Trim();
  131. dgvr.Cells.Add(cell);
  132. cell = new DataGridViewTextBoxCell();
  133. cell.Value = dt.Rows[i]["Cus_Name"].ToString().Trim();
  134. dgvr.Cells.Add(cell);
  135. cell = new DataGridViewTextBoxCell();
  136. cell.Value = dt.Rows[i]["M_Cus_Sex_cs"].ToString().Trim();
  137. dgvr.Cells.Add(cell);
  138. cell = new DataGridViewTextBoxCell();
  139. cell.Value = dt.Rows[i]["M_Cus_Telephone"].ToString().Trim();
  140. dgvr.Cells.Add(cell);
  141. cell = new DataGridViewTextBoxCell();
  142. cell.Value = dt.Rows[i]["M_Cus_QQ"].ToString().Trim();
  143. dgvr.Cells.Add(cell);
  144. string JobsText = "";
  145. for (int j = 0; j < StrArrayJobsID.Length; j++)
  146. {
  147. if (StrArrayJobsID[j].Trim() == dt.Rows[i]["ID"].ToString().Trim())
  148. { JobsText = StrArrayJobsText[j].TrimEnd(); break; }
  149. }
  150. cell = new DataGridViewTextBoxCell();
  151. cell.Value = JobsText.Trim();
  152. dgvr.Cells.Add(cell);
  153. }
  154. else
  155. {
  156. dgvr.DefaultCellStyle.BackColor = this.dgvData.Rows[this.dgvData.Rows.Count - 1].DefaultCellStyle.BackColor;
  157. for (int j = 0; j < 8; j++)
  158. {
  159. cell = new DataGridViewTextBoxCell();
  160. cell.Value = "";
  161. dgvr.Cells.Add(cell);
  162. }
  163. }
  164. this.dgvData.Rows.Add(dgvr);
  165. }
  166. }
  167. }
  168. /// <summary>
  169. /// 安排预约
  170. /// </summary>
  171. /// <param name="sender"></param>
  172. /// <param name="e"></param>
  173. void btnReservation_Click(object sender, EventArgs e)
  174. {
  175. if (this.dgvData.SelectedRows.Count > 0)
  176. {
  177. MakeAnAppointment frm = new MakeAnAppointment();
  178. frm.ShowDialog();
  179. if (frm.IsSaveed)
  180. { this.IsSaveed = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.LoadForm(frm.StrSelectType, this.dgvData.SelectedRows[0].Cells["订单编号"].Value.ToString().Trim()); }
  181. }
  182. else
  183. { MessageBoxCustom.Show("请选择你要安排的订单!"); }
  184. }
  185. /// <summary>
  186. /// 关闭
  187. /// </summary>
  188. /// <param name="sender"></param>
  189. /// <param name="e"></param>
  190. void btnClose_Click(object sender, EventArgs e)
  191. { this.Close(); }
  192. }
  193. }