ReservationMaturityWarningFormMain.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.CameraControlBook
  11. {
  12. public partial class ReservationMaturityWarningFormMain : LYFZ.Software.UI.CameraControlBook.ReservationMaturityWarningFormMain
  13. {
  14. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  15. public ReservationMaturityWarningFormMain()
  16. {
  17. this.Load += ReservationMaturityWarningFormMain_Load;
  18. this.Shown += ReservationMaturityWarningFormMain_Shown;
  19. this.tabControlEx1.SelectedIndexChanged += tabControlEx1_SelectedIndexChanged;
  20. this.btnQuery.Click += btnQuery_Click;
  21. this.btnSet.Click += btnSet_Click;
  22. this.btnExport.Click += btnExport_Click;
  23. this.btnColseed.Click += btnColseed_Click;
  24. this.dgvData.RowsAdded += dgvData_RowsAdded;
  25. this.txtSelectionFilm.KeyPress += txtSelectionFilm_KeyPress;
  26. this.txtLookDesign.KeyPress += txtLookDesign_KeyPress;
  27. this.txtPickup.KeyPress += txtPickup_KeyPress;
  28. this.txtSelectionFilm.Leave += txtSelectionFilm_Leave;
  29. this.txtLookDesign.Leave += txtLookDesign_Leave;
  30. this.txtPickup.Leave += txtPickup_Leave;
  31. this.txtSelectionFilm.KeyDown += txtSelectionFilm_KeyDown;
  32. this.txtLookDesign.KeyDown += txtLookDesign_KeyDown;
  33. this.txtPickup.KeyDown += txtPickup_KeyDown;
  34. }
  35. private string StrValueType = "OriginalFilm";
  36. /// <summary>
  37. /// 员工编号
  38. /// </summary>
  39. string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  40. /// <summary>
  41. /// 窗体加载事件
  42. /// </summary>
  43. /// <param name="sender"></param>
  44. /// <param name="e"></param>
  45. void ReservationMaturityWarningFormMain_Load(object sender, EventArgs e)
  46. {
  47. this.txtSelectionFilm.Text = "0";
  48. this.txtLookDesign.Text = "0";
  49. this.txtPickup.Text = "0";
  50. DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'ReservationDateBeforeRemind'", ShowColumnName: "ID,Sconfig_Value").Tables[0];
  51. if (dt.Rows.Count > 0)
  52. {
  53. DataTable tbl = new Json.JsontoDataTable().toObject(dt.Rows[0]["Sconfig_Value"].ToString().Trim());
  54. for (int i = 0; i < tbl.Rows.Count; i++)
  55. {
  56. switch (tbl.Rows[i]["StrCode"].ToString().Trim())
  57. {
  58. case "SelectionFilm":
  59. this.txtSelectionFilm.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
  60. this.StrValueType = tbl.Rows[i]["StrValueType"].ToString().Trim();
  61. break;
  62. case "LookDesign":
  63. this.txtLookDesign.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
  64. break;
  65. case "Pickup":
  66. this.txtPickup.Text = tbl.Rows[i]["StrValue"].ToString().Trim();
  67. break;
  68. }
  69. }
  70. }
  71. }
  72. /// <summary>
  73. /// 窗体加载事件
  74. /// </summary>
  75. /// <param name="sender"></param>
  76. /// <param name="e"></param>
  77. void ReservationMaturityWarningFormMain_Shown(object sender, EventArgs e)
  78. {
  79. this.dgvData.DataColumns("订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格,初修状态,选片状态,预约选片日期,已过几天未完");
  80. this.PublicFunctionRows();
  81. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.客服中心预约预警提醒);
  82. if (!b)
  83. {
  84. this.Close();
  85. }
  86. }
  87. /// <summary>
  88. /// 选项卡选择事件
  89. /// </summary>
  90. /// <param name="sender"></param>
  91. /// <param name="e"></param>
  92. void tabControlEx1_SelectedIndexChanged(object sender, EventArgs e)
  93. {
  94. this.panelSelectionFilm.Visible = false;
  95. this.panelLookDesign.Visible = false;
  96. this.panelPickup.Visible = false;
  97. switch (this.tabControlEx1.SelectedTab.Name.Trim())
  98. {
  99. case "tabPage_ReservationFilmSelectionNotImportedPhoto":
  100. this.panelSelectionFilm.Visible = true;
  101. break;
  102. case "tabPage_ReservationLookDesignNotImportedPhoto":
  103. this.panelLookDesign.Visible = true;
  104. break;
  105. case "tabPage_ReservationPickupNotBackPhoto":
  106. this.panelPickup.Visible = true;
  107. break;
  108. }
  109. this.PublicFunctionRows();
  110. }
  111. /// <summary>
  112. /// 查询
  113. /// </summary>
  114. /// <param name="sender"></param>
  115. /// <param name="e"></param>
  116. void btnQuery_Click(object sender, EventArgs e)
  117. {
  118. this.PublicFunctionRows();
  119. }
  120. /// <summary>
  121. /// 设置
  122. /// </summary>
  123. /// <param name="sender"></param>
  124. /// <param name="e"></param>
  125. void btnSet_Click(object sender, EventArgs e)
  126. {
  127. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.AlertSettingSuperSmallForm frm = new SuperSmallForm.AlertSettingSuperSmallForm();
  128. frm.ShowDialog();
  129. if (frm.IsSaveed)
  130. {
  131. this.ReservationMaturityWarningFormMain_Load(this, null);
  132. this.PublicFunctionRows();
  133. }
  134. }
  135. /// <summary>
  136. /// 导出
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. void btnExport_Click(object sender, EventArgs e)
  141. {
  142. this.dgvData.ExportDataTable();
  143. }
  144. /// <summary>
  145. /// 关闭
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. void btnColseed_Click(object sender, EventArgs e)
  150. {
  151. this.Close();
  152. }
  153. /// <summary>
  154. /// 添加行
  155. /// </summary>
  156. /// <param name="sender"></param>
  157. /// <param name="e"></param>
  158. void dgvData_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
  159. {
  160. if (this.dgvData.Columns.Contains("预约选片日期"))
  161. { this.dgvData.Rows[e.RowIndex].Cells["预约选片日期"].Value = LYFZ.Command.Command_Validate.DateTimeToString2(this.dgvData.Rows[e.RowIndex].Cells["预约选片日期"].Value); }
  162. if (this.dgvData.Columns.Contains("预约看样日期"))
  163. { this.dgvData.Rows[e.RowIndex].Cells["预约看样日期"].Value = LYFZ.Command.Command_Validate.DateTimeToString2(this.dgvData.Rows[e.RowIndex].Cells["预约看样日期"].Value); }
  164. if (this.dgvData.Columns.Contains("预约取件日期"))
  165. { this.dgvData.Rows[e.RowIndex].Cells["预约取件日期"].Value = LYFZ.Command.Command_Validate.DateTimeToString2(this.dgvData.Rows[e.RowIndex].Cells["预约取件日期"].Value); }
  166. }
  167. /// <summary>
  168. /// 输入限制
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. void txtSelectionFilm_KeyPress(object sender, KeyPressEventArgs e)
  173. {
  174. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  175. { e.Handled = true; }
  176. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  177. { e.Handled = true; }
  178. }
  179. /// <summary>
  180. /// 输入限制
  181. /// </summary>
  182. /// <param name="sender"></param>
  183. /// <param name="e"></param>
  184. void txtLookDesign_KeyPress(object sender, KeyPressEventArgs e)
  185. {
  186. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  187. { e.Handled = true; }
  188. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  189. { e.Handled = true; }
  190. }
  191. /// <summary>
  192. /// 输入限制
  193. /// </summary>
  194. /// <param name="sender"></param>
  195. /// <param name="e"></param>
  196. void txtPickup_KeyPress(object sender, KeyPressEventArgs e)
  197. {
  198. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  199. { e.Handled = true; }
  200. if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
  201. { e.Handled = true; }
  202. }
  203. /// <summary>
  204. /// 离开事件
  205. /// </summary>
  206. /// <param name="sender"></param>
  207. /// <param name="e"></param>
  208. void txtSelectionFilm_Leave(object sender, EventArgs e)
  209. {
  210. try { this.txtSelectionFilm.Text = Convert.ToInt32(this.txtSelectionFilm.Text.Trim()).ToString(); }
  211. catch
  212. { }
  213. }
  214. /// <summary>
  215. /// 离开事件
  216. /// </summary>
  217. /// <param name="sender"></param>
  218. /// <param name="e"></param>
  219. void txtLookDesign_Leave(object sender, EventArgs e)
  220. {
  221. try { this.txtLookDesign.Text = Convert.ToInt32(this.txtLookDesign.Text.Trim()).ToString(); }
  222. catch
  223. { }
  224. }
  225. /// <summary>
  226. /// 离开事件
  227. /// </summary>
  228. /// <param name="sender"></param>
  229. /// <param name="e"></param>
  230. void txtPickup_Leave(object sender, EventArgs e)
  231. {
  232. try { this.txtPickup.Text = Convert.ToInt32(this.txtPickup.Text.Trim()).ToString(); }
  233. catch
  234. { }
  235. }
  236. /// <summary>
  237. /// 输入后回车事件
  238. /// </summary>
  239. /// <param name="sender"></param>
  240. /// <param name="e"></param>
  241. void txtSelectionFilm_KeyDown(object sender, KeyEventArgs e)
  242. {
  243. if (e.KeyCode == Keys.Enter)
  244. { this.PublicFunctionRows(); }
  245. }
  246. /// <summary>
  247. /// 输入后回车事件
  248. /// </summary>
  249. /// <param name="sender"></param>
  250. /// <param name="e"></param>
  251. void txtLookDesign_KeyDown(object sender, KeyEventArgs e)
  252. {
  253. if (e.KeyCode == Keys.Enter)
  254. { this.PublicFunctionRows(); }
  255. }
  256. /// <summary>
  257. /// 输入后回车事件
  258. /// </summary>
  259. /// <param name="sender"></param>
  260. /// <param name="e"></param>
  261. void txtPickup_KeyDown(object sender, KeyEventArgs e)
  262. {
  263. if (e.KeyCode == Keys.Enter)
  264. { this.PublicFunctionRows(); }
  265. }
  266. /// <summary>
  267. /// 分页前数据,便于展开时用来查询订单的子数据
  268. /// </summary>
  269. DataTable tblMianSelectData = new DataTable();
  270. /// <summary>
  271. /// 创建行
  272. /// </summary>
  273. private void PublicFunctionRows()
  274. {
  275. string StrSql = "";
  276. DataTable newTable = new DataTable();
  277. this.dgvData.dgvUserEmployeeID = this.StrUserID;
  278. if (string.IsNullOrEmpty(this.txtSelectionFilm.Text))
  279. {
  280. this.txtSelectionFilm.Text = "0";
  281. return;
  282. }
  283. switch (this.tabControlEx1.SelectedTab.Name.Trim())
  284. {
  285. case "tabPage_ReservationFilmSelectionNotImportedPhoto":
  286. switch (this.StrValueType.Trim())
  287. {
  288. case "OriginalFilm":
  289. StrSql = "with " +
  290. @"photographStatus as (
  291. select[Ordpg_Number]
  292. ,[Ordpg_ViceNumber]
  293. , STUFF((SELECT ','+Ordpg_Sights
  294. FROM tb_ErpOrdersPhotography a
  295. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  296. FOR XML PATH('') )
  297. ,1,1,''
  298. )AS Ordpg_Sights
  299. , STUFF( (SELECT ',' + Ordpg_Photographer
  300. FROM tb_ErpOrdersPhotography a
  301. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  302. FOR XML PATH('') )
  303. ,1,1,''
  304. )AS Ordpg_Photographer
  305. , sum(case Ordpg_PhotographyStatus when '0' then 0 when '1' then 2 else 1 end) as totalStatusValue,
  306. count(Ordpg_PhotographyStatus)*2 as totalCount
  307. from tb_ErpOrdersPhotography b
  308. group by[Ordpg_Number],[Ordpg_ViceNumber]
  309. )
  310. , tb_OrderDigitalStatus as
  311. (
  312. select
  313. [Ordpg_Number],[Ordpg_ViceNumber] as Ords_ViceNumber,Ordpg_Sights as Ords_SightsName,Ordpg_Photographer as Ords_Photographer,
  314. (case when totalStatusValue = totalCount and totalStatusValue>0 then 2 when totalStatusValue<totalCount and totalStatusValue>0 then 1 else 0 end) as Ords_PhotographIntStatus
  315. from
  316. photographStatus
  317. )
  318. ,t AS (" +
  319. "select Ord_Number," +
  320. "Ordv_ViceNumber," +
  321. "Ord_SinceOrderNumber AS 订单号," +
  322. "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
  323. "Cus_Name AS 客户姓名," +
  324. "Cus_Sex_cs AS 客户性别," +
  325. "Cus_Telephone AS 客户电话," +
  326. "Ord_OrderPersonName AS 接单人," +
  327. "Ord_SeriesName AS 套系名称," +
  328. "Ord_SeriesPrice AS 套系价格," +
  329. "Ords_SightsName AS 拍摄名称," +
  330. "(case Ords_PhotographIntStatus when 0 then '未拍' when 1 then '拍摄中' else 'OK' end ) AS 拍照状态," +
  331. "Ords_Photographer AS 摄影师,"+
  332. "dbo.fn_CheckOrderFilmSelectionStatus(Ordv_FilmSelectionStatus) AS 选片状态," +
  333. "dbo.fn_CheckDateTime(Ordv_ReservationFilmSelectionTime) AS 预约选片日期," +
  334. "DATEDIFF(day, GETDATE(), Ordv_ReservationFilmSelectionTime) AS 预约前N天 " +
  335. "from dbo.tb_ErpOrder " +
  336. "Left Join tb_ErpOrderDigital on Ord_Number = Ordv_Number " +
  337. "Left Join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
  338. "Left Join tb_OrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber " +
  339. "where Ordv_FilmSelectionStatus = '0' And Ordv_ReservationFilmSelectionTime is not null And Ords_PhotographIntStatus in (0,1) " +
  340. ")" +
  341. "select * from t where (预约前N天 >= 0 And 预约前N天 <= '" + Convert.ToInt32(this.txtSelectionFilm.Text.Trim()) + "') Order by 预约前N天";
  342. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  343. {
  344. newTable = orbll.GetView_Custom(StrSql).Tables[0];
  345. });
  346. DataTable userDt = LYFZ.DAL.DAL_ErpUser.GetCompanyDepartmentDataTable;
  347. foreach (DataRow dr in newTable.Rows)
  348. {
  349. dr["摄影师"] = LYFZ.DAL.DAL_ErpUser.GetCompanyDepartmentUserString(dr["摄影师"].ToString_s(), userDt);
  350. }
  351. this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格,拍摄名称,拍照状态,摄影师,选片状态,预约选片日期,预约前N天";
  352. this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber";
  353. this.dgvData.StrValueNullColumn = "订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格";
  354. break;
  355. case "EarlyRepair":
  356. StrSql = "with " +
  357. @"photographStatus as (
  358. select[Ordpg_Number]
  359. ,[Ordpg_ViceNumber]
  360. , STUFF((SELECT ','+Ordpg_Sights
  361. FROM tb_ErpOrdersPhotography a
  362. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  363. FOR XML PATH('') )
  364. ,1,1,''
  365. )AS Ordpg_Sights
  366. , STUFF( (SELECT ',' + Ordpg_Photographer
  367. FROM tb_ErpOrdersPhotography a
  368. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  369. FOR XML PATH('') )
  370. ,1,1,''
  371. )AS Ordpg_Photographer
  372. , sum(case Ordpg_PhotographyStatus when '0' then 0 when '1' then 2 else 1 end) as totalStatusValue,
  373. count(Ordpg_PhotographyStatus)*2 as totalCount
  374. from tb_ErpOrdersPhotography b
  375. group by[Ordpg_Number],[Ordpg_ViceNumber]
  376. )
  377. , tb_OrderDigitalStatus as
  378. (
  379. select
  380. [Ordpg_Number],[Ordpg_ViceNumber] as Ords_ViceNumber,Ordpg_Sights as Ords_SightsName,Ordpg_Photographer as Ords_Photographer,
  381. (case when totalStatusValue = totalCount and totalStatusValue>0 then 2 when totalStatusValue<totalCount and totalStatusValue>0 then 1 else 0 end) as Ords_PhotographIntStatus
  382. from
  383. photographStatus
  384. )
  385. ,t AS (" +
  386. "select Ord_Number," +
  387. "Ordv_ViceNumber," +
  388. "Ord_SinceOrderNumber AS 订单号," +
  389. "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
  390. "Cus_Name AS 客户姓名," +
  391. "Cus_Sex_cs AS 客户性别," +
  392. "Cus_Telephone AS 客户电话," +
  393. "Ord_OrderPersonName AS 接单人," +
  394. "Ord_SeriesName AS 套系名称," +
  395. "Ord_SeriesPrice AS 套系价格," +
  396. "Ords_SightsName AS 拍摄名称," +
  397. "dbo.fn_CheckOrderEarlyRepairStatus(Ordv_EarlyRepairStatus) AS 初修状态," +
  398. "dbo.fn_CheckOrderFilmSelectionStatus(Ordv_FilmSelectionStatus) AS 选片状态," +
  399. "dbo.fn_CheckDateTime(Ordv_ReservationFilmSelectionTime) AS 预约选片日期," +
  400. "DATEDIFF(day, GETDATE(), Ordv_ReservationFilmSelectionTime) AS 预约前N天 " +
  401. "from dbo.tb_ErpOrder " +
  402. "Left Join tb_ErpOrderDigital on Ord_Number = Ordv_Number " +
  403. "Left Join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
  404. "Left Join tb_OrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber " +
  405. "where Ordv_FilmSelectionStatus = '0' And Ordv_EarlyRepairStatus <> '2' And Ordv_ReservationFilmSelectionTime is not null " +
  406. ")" +
  407. "select * from t where (预约前N天 >= 0 And 预约前N天 <= '" + Convert.ToInt32(this.txtSelectionFilm.Text.Trim()) + "') Order by 预约前N天";
  408. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  409. {
  410. newTable = orbll.GetView_Custom(StrSql).Tables[0];
  411. });
  412. this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格,拍摄名称,初修状态,选片状态,预约选片日期,预约前N天";
  413. this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber";
  414. this.dgvData.StrValueNullColumn = "订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格";
  415. break;
  416. }
  417. break;
  418. case "tabPage_ReservationLookDesignNotImportedPhoto":
  419. StrSql = "with " +
  420. @"photographStatus as (
  421. select[Ordpg_Number]
  422. ,[Ordpg_ViceNumber]
  423. , STUFF((SELECT ','+Ordpg_Sights
  424. FROM tb_ErpOrdersPhotography a
  425. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  426. FOR XML PATH('') )
  427. ,1,1,''
  428. )AS Ordpg_Sights
  429. , STUFF( (SELECT ',' + Ordpg_Photographer
  430. FROM tb_ErpOrdersPhotography a
  431. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  432. FOR XML PATH('') )
  433. ,1,1,''
  434. )AS Ordpg_Photographer
  435. , sum(case Ordpg_PhotographyStatus when '0' then 0 when '1' then 2 else 1 end) as totalStatusValue,
  436. count(Ordpg_PhotographyStatus)*2 as totalCount
  437. from tb_ErpOrdersPhotography b
  438. group by[Ordpg_Number],[Ordpg_ViceNumber]
  439. )
  440. , tb_OrderDigitalStatus as
  441. (
  442. select
  443. [Ordpg_Number],[Ordpg_ViceNumber] as Ords_ViceNumber,Ordpg_Sights as Ords_SightsName,Ordpg_Photographer as Ords_Photographer,
  444. (case when totalStatusValue = totalCount and totalStatusValue>0 then 2 when totalStatusValue<totalCount and totalStatusValue>0 then 1 else 0 end) as Ords_PhotographIntStatus
  445. from
  446. photographStatus
  447. )
  448. ,t AS (" +
  449. "select Ord_Number," +
  450. "Ordv_ViceNumber," +
  451. "Ord_SinceOrderNumber AS 订单号," +
  452. "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
  453. "Cus_Name AS 客户姓名," +
  454. "Cus_Sex_cs AS 客户性别," +
  455. "Cus_Telephone AS 客户电话," +
  456. "Ord_OrderPersonName AS 接单人," +
  457. "Ord_SeriesName AS 套系名称," +
  458. "Ord_SeriesPrice AS 套系价格," +
  459. "Ords_SightsName AS 拍摄名称," +
  460. "dbo.fn_CheckOrderDesignerStatus(Ordv_DesignerStatus) AS 设计状态," +
  461. "dbo.fn_CheckOrderLookDesignStatus(Ordv_LookDesignStatus) AS 看样状态," +
  462. "dbo.fn_CheckDateTime(Ordv_ReservationLookDesignTime) AS 预约看样日期," +
  463. "DATEDIFF(day, GETDATE(), Ordv_ReservationLookDesignTime) AS 预约前N天 " +
  464. "from dbo.tb_ErpOrder " +
  465. "Left Join dbo.tb_ErpOrderDigital on Ord_Number = Ordv_Number " +
  466. "Left Join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
  467. "Left Join tb_OrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber " +
  468. "where Ordv_FilmSelectionStatus = '0' And Ordv_EarlyRepairStatus <> '2' And Ordv_ReservationLookDesignTime is not null " +
  469. ")" +
  470. "select * from t where (预约前N天 >= 0 And 预约前N天 <= '" + Convert.ToInt32(this.txtLookDesign.Text.Trim()) + "') Order by 预约前N天";
  471. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  472. {
  473. newTable = orbll.GetView_Custom(StrSql).Tables[0];
  474. });
  475. this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格,拍摄名称,设计状态,看样状态,预约看样日期,预约前N天";
  476. this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber";
  477. this.dgvData.StrValueNullColumn = "订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格";
  478. break;
  479. case "tabPage_ReservationPickupNotBackPhoto":
  480. StrSql = "with " +
  481. @"photographStatus as (
  482. select[Ordpg_Number]
  483. ,[Ordpg_ViceNumber]
  484. , STUFF((SELECT ','+Ordpg_Sights
  485. FROM tb_ErpOrdersPhotography a
  486. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  487. FOR XML PATH('') )
  488. ,1,1,''
  489. )AS Ordpg_Sights
  490. , STUFF( (SELECT ',' + Ordpg_Photographer
  491. FROM tb_ErpOrdersPhotography a
  492. WHERE b.Ordpg_ViceNumber = a.Ordpg_ViceNumber
  493. FOR XML PATH('') )
  494. ,1,1,''
  495. )AS Ordpg_Photographer
  496. , sum(case Ordpg_PhotographyStatus when '0' then 0 when '1' then 2 else 1 end) as totalStatusValue,
  497. count(Ordpg_PhotographyStatus)*2 as totalCount
  498. from tb_ErpOrdersPhotography b
  499. group by[Ordpg_Number],[Ordpg_ViceNumber]
  500. )
  501. , tb_OrderDigitalStatus as
  502. (
  503. select
  504. [Ordpg_Number],[Ordpg_ViceNumber] as Ords_ViceNumber,Ordpg_Sights as Ords_SightsName,Ordpg_Photographer as Ords_Photographer,
  505. (case when totalStatusValue = totalCount and totalStatusValue>0 then 2 when totalStatusValue<totalCount and totalStatusValue>0 then 1 else 0 end) as Ords_PhotographIntStatus
  506. from
  507. photographStatus
  508. )
  509. ,t AS (" +
  510. "select Ord_Number," +
  511. "Ordv_ViceNumber," +
  512. "Ord_SinceOrderNumber AS 订单号," +
  513. "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
  514. "Cus_Name AS 客户姓名," +
  515. "Cus_Sex_cs AS 客户性别," +
  516. "Cus_Telephone AS 客户电话," +
  517. "Ord_OrderPersonName AS 接单人," +
  518. "Ord_SeriesName AS 套系名称," +
  519. "Ord_SeriesPrice AS 套系价格," +
  520. "Ords_SightsName AS 拍摄名称," +
  521. "OPlist_ProdName AS 商品名称," +
  522. "dbo.fn_CheckProductCompletedStatus(OPlist_CompletedStatus) AS 回片状态," +
  523. "dbo.fn_CheckProductTakePiecesStatus(OPlist_PickupStatus) AS 取件状态," +
  524. "dbo.fn_CheckDateTime(OPlist_ReservationTakeTime) AS 预约取件日期," +
  525. "DATEDIFF(day, GETDATE(), OPlist_ReservationTakeTime) AS 预约前N天 " +
  526. "from tb_ErpOrderProductList " +
  527. "Left Join tb_ErpOrder on Ord_Number = OPlist_OrderNumber " +
  528. "Left Join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
  529. "Left Join tb_ErpOrderDigital on Ordv_ViceNumber = OPlist_ViceNumber " +
  530. "Left Join tb_OrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber " +
  531. "Where OPlist_Type = '2' And OPlist_ReservationTakeTime is not null And OPlist_PickupStatus = '0' And OPlist_CompletedStatus = '0' " +
  532. ")" +
  533. "select * from t where (预约前N天 >= 0 And 预约前N天 <= '" + Convert.ToInt32(this.txtPickup.Text.Trim()) + "') Order by 预约前N天";
  534. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  535. {
  536. newTable = orbll.GetView_Custom(StrSql).Tables[0];
  537. });
  538. this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格,拍摄名称,回片状态,取件状态,预约取件日期,预约前N天";
  539. this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber";
  540. this.dgvData.StrValueNullColumn = "订单号,订单类型,客户姓名,客户性别,客户电话,接单人,套系名称,套系价格";
  541. this.dgvData.StrSecondStageNull = "拍摄名称";
  542. break;
  543. }
  544. if (newTable.Rows.Count > 0)
  545. { this.dgvData.DataSource(newTable, StrSecondStageNull: this.dgvData.StrSecondStageNull); }
  546. else
  547. { this.dgvData.Rows.Clear(); this.dgvData.DataColumns(this.dgvData.dgvCurrentColumnOriginalSet, strHideField: this.dgvData.dgvFixedHideColumn); }
  548. this.dgvData.FillLastColumn(true);
  549. if (this.dgvData.Columns.Contains("客户姓名"))
  550. { this.dgvData.Columns["客户姓名"].Frozen = true; }
  551. for (int i = 0; i < this.dgvData.Columns.Count; i++)
  552. {
  553. if (this.dgvData.Columns[i].Name.Trim().IndexOf("日期") != -1)
  554. { this.dgvData.Columns[i].Width = 110; }
  555. }
  556. Hashtable htData = new Hashtable();
  557. for (int i = 0; i < tblMianSelectData.Rows.Count; i++)
  558. { htData[tblMianSelectData.Rows[i]["Ord_Number"].ToString().Trim()] = tblMianSelectData.Rows[i]["Ord_Number"].ToString().Trim(); }
  559. this.dataGridViewStatisticsCount1.LocationX = this.dgvData.RowHeadersWidth;
  560. this.dataGridViewStatisticsCount1.CurrenQuantity = htData.Count;
  561. this.dataGridViewStatisticsCount1.TotalQuantity = htData.Count;
  562. }
  563. }
  564. }