ToolboxDressSamllForm.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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.Dresses.SetSmallForm
  10. {
  11. public partial class ToolboxDressSamllForm : LYFZ.Software.UI.Dresses.SetSmallForm.ToolboxDressSamllForm
  12. {
  13. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  14. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  15. public ToolboxDressSamllForm()
  16. {
  17. this.Load += ToolboxDressSamllForm_Load;
  18. this.Shown += ToolboxDressSamllForm_Shown;
  19. this.Resize += ToolboxDressSamllForm_Resize;
  20. this.lblTotalDressCount.Click += lblTotalDressCount_Click;
  21. this.listViewData_Source.Click += listViewData_Source_Click;
  22. this.listViewData_Source.MouseDoubleClick += listViewData_Source_MouseDoubleClick;
  23. this.listViewData_Selected.MouseDoubleClick += listViewData_Selected_MouseDoubleClick;
  24. this.listViewData_Source.MouseDown += listViewData_Source_MouseDown;
  25. this.listViewData_Selected.MouseDown += listViewData_Selected_MouseDown;
  26. this.dtTakeDressTime.TextChanged += dtTakeDressTime_TextChanged;
  27. this.btnQuery.Click += btnQuery_Click;
  28. this.btnOK.Click += btnOK_Click;
  29. this.btnCancel.Click += btnCancel_Click;
  30. this.btnSaveDay.Click += btnSaveDay_Click;
  31. this.txtDayNumber.KeyPress += txtDayNumber_KeyPress;
  32. this.panelLoadMore.Click += panelLoadMore_Click;
  33. this.lblLoadMore.Click += panelLoadMore_Click;
  34. }
  35. /// <summary>
  36. /// 礼服订单号
  37. /// </summary>
  38. public string StrDreesOrdNumber = "";
  39. /// <summary>
  40. /// 取衣时间
  41. /// </summary>
  42. public string StrTakeDressTime = "";
  43. /// <summary>
  44. /// 还衣时间
  45. /// </summary>
  46. public string strReturnDressTime = "";
  47. /// <summary>
  48. /// 已选择的礼服编号
  49. /// </summary>
  50. public List<string> listSelect = new List<string>();
  51. /// <summary>
  52. /// 是否保存
  53. /// </summary>
  54. public bool IsSaveed = false;
  55. /// <summary>
  56. /// 相片集合_可选择的礼服
  57. /// </summary>
  58. ImageList mlistImage_Source = new ImageList();
  59. /// <summary>
  60. /// 相片集合_已选中的礼服
  61. /// </summary>
  62. ImageList mlistImage_Small = new ImageList();
  63. /// <summary>
  64. /// 窗体加载事件
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. void ToolboxDressSamllForm_Load(object sender, EventArgs e)
  69. {
  70. this.GetDressPageCount();
  71. this.mlistImage_Source.ImageSize = new Size(95, 100);
  72. this.mlistImage_Source.ColorDepth = ColorDepth.Depth32Bit;
  73. this.listViewData_Source.LargeImageList = this.mlistImage_Source;
  74. this.listViewData_Selected.View = View.Details;
  75. this.listViewData_Selected.GridLines = true;
  76. string[] StrColumns = ("礼服编号,礼服名称").Split(',');
  77. for (int i = 0; i < StrColumns.Length; i++)
  78. {
  79. ColumnHeader ch = new ColumnHeader();
  80. ch.Text = StrColumns[i].Trim();
  81. switch (StrColumns[i].Trim())
  82. {
  83. case "礼服编号": ch.Width = 120; break;
  84. case "礼服名称": ch.Width = 150; break;
  85. }
  86. ch.TextAlign = HorizontalAlignment.Left;
  87. this.listViewData_Selected.Columns.Add(ch);
  88. }
  89. this.mlistImage_Small.ImageSize = new Size(25, 25);
  90. this.mlistImage_Small.ColorDepth = ColorDepth.Depth32Bit;
  91. this.listViewData_Selected.SmallImageList = mlistImage_Small;
  92. }
  93. /// <summary>
  94. /// 窗体加载事件
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. void ToolboxDressSamllForm_Shown(object sender, EventArgs e)
  99. {
  100. DataTable dt = sgbll.GetList("Sconfig_Code='AlsoClothesDay'").Tables[0];
  101. if (dt.Rows.Count > 0)
  102. { this.txtDayNumber.Text = dt.Rows[0]["Sconfig_Value"].ToString(); }
  103. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEAJBGADDCBAHFFA", this.cmbtreevDressType, IsFirstNodeNull: true, IsFirstNodeName: "全部");
  104. this.cmbtreevDressType.TextFindTag("全部");
  105. if (!string.IsNullOrEmpty(this.StrTakeDressTime))
  106. {
  107. this.dtTakeDressTime.DateValue = this.StrTakeDressTime;
  108. this.dtTakeDressTime.Enabled = false;
  109. if (this.StrTakeDressTime.Trim() == SDateTime.Now.ToString("yyyy-MM-dd"))
  110. { this.dtTakeDressTime_TextChanged(this, null); }
  111. }
  112. }
  113. /// <summary>
  114. /// 窗体大小发生变化
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. void ToolboxDressSamllForm_Resize(object sender, EventArgs e)
  119. {
  120. this.panelLoadMore.Location = new Point((this.listViewData_Source.Width - this.panelLoadMore.Width) / 2, (this.listViewData_Source.Location.Y + this.listViewData_Source.Height) - this.panelLoadMore.Height - 5);
  121. }
  122. /// <summary>
  123. /// 设置每页加载条数
  124. /// </summary>
  125. /// <param name="sender"></param>
  126. /// <param name="e"></param>
  127. void lblTotalDressCount_Click(object sender, EventArgs e)
  128. {
  129. LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressPageCountSamllForm frm = new DressPageCountSamllForm();
  130. frm.ShowDialog();
  131. if (frm.IsSaveed)
  132. { this.GetDressPageCount(); }
  133. }
  134. /// <summary>
  135. /// 获取每页条数
  136. /// </summary>
  137. void GetDressPageCount()
  138. {
  139. DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'DressPageCount'", ShowColumnName: "*").Tables[0];
  140. if (dt.Rows.Count > 0)
  141. { this.binRowsMaxCount = Convert.ToInt32(dt.Rows[0]["Sconfig_Value"]); }
  142. }
  143. /// <summary>
  144. /// 供选择的礼服点击查看详情
  145. /// </summary>
  146. /// <param name="sender"></param>
  147. /// <param name="e"></param>
  148. void listViewData_Source_Click(object sender, EventArgs e)
  149. {
  150. string StrTextTip = "";
  151. if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
  152. {
  153. DataRow dtRow = (DataRow)this.listViewData_Source.SelectedItems[0].Tag;
  154. string StrText = "";
  155. for (int i = 0; i < dtRow.Table.Columns.Count; i++)
  156. {
  157. switch (dtRow.Table.Columns[i].ColumnName.Trim())
  158. {
  159. case "礼服编号":
  160. case "相片名称": break;
  161. case "礼服尺寸":
  162. StrText += "\r\n" + dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim();
  163. break;
  164. case "礼服备注":
  165. StrText += "\r\n" + dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim();
  166. break;
  167. default:
  168. StrText += dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim() + " ";
  169. break;
  170. }
  171. }
  172. this.lblDressDetails.Text = StrText;
  173. string StrWhere = "";
  174. if (!string.IsNullOrEmpty(this.StrDreesOrdNumber))
  175. { StrWhere += " And Dsro_Number != '" + this.StrDreesOrdNumber + "'"; }
  176. string StrTableName = "tb_ErpDressSaleRentalDetail Left Join tb_ErpDressSaleRentalOrder on Dsro_Number = Dsrd_Number";
  177. string StrColumnName = "case Dsro_Type when 0 then '出租' when 1 then '出售' end AS 类型,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Dsro_TakeDressTime)) AS 取衣日期,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Dsro_ReservationBackTime)) AS 还衣日期";
  178. DataTable dt = orbll.GetView_Custom(StrTableName, StrWhere: "Dsro_Type in ('1','0') And Dsrd_DressNumber = '" + dtRow["礼服编号"].ToString().Trim() + "' And Dsrd_BackTime is null" + StrWhere, ShowColumnName: StrColumnName, filedOrder: "Dsrd_TakeDressTime DESC").Tables[0];
  179. for (int i = 0; i < dt.Rows.Count; i++)
  180. {
  181. if (i < 9)
  182. {
  183. if (i == 4)
  184. { StrTextTip += "\r\n"; }
  185. string SText = "";
  186. if (!string.IsNullOrEmpty(dt.Rows[i]["还衣日期"].ToString().Trim()))
  187. { SText = ",还衣:" + dt.Rows[i]["还衣日期"].ToString().Trim(); }
  188. StrTextTip += (i + 1) + ". " + dt.Rows[i]["类型"].ToString().Trim() + "(取衣:" + dt.Rows[i]["取衣日期"].ToString().Trim() + SText + ") ";
  189. }
  190. }
  191. if (dt.Rows.Count > 4)
  192. { this.lblPrompt.Location = new Point(104, 4); }
  193. else
  194. { this.lblPrompt.Location = new Point(104, 19); }
  195. }
  196. this.lblPrompt.Text = StrTextTip;
  197. if (!string.IsNullOrEmpty(this.lblPrompt.Text.Trim()))
  198. { this.lblPrompt.Visible = true; }
  199. else
  200. { this.lblPrompt.Visible = false; }
  201. }
  202. /// <summary>
  203. /// 可选择的礼服双击选中
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. void listViewData_Source_MouseDoubleClick(object sender, MouseEventArgs e)
  208. {
  209. if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
  210. {
  211. ListViewItem SelectItem = this.listViewData_Source.SelectedItems[0];
  212. DataRow dtRow = (DataRow)SelectItem.Tag;
  213. bool IsFind = false;
  214. for (int i = 0; i < this.listViewData_Selected.Items.Count; i++)
  215. {
  216. if (this.listViewData_Selected.Items[i].Text.Trim() == dtRow["礼服编号"].ToString().Trim())
  217. { IsFind = true; return; }
  218. }
  219. string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
  220. if (StrArrayList[0].Trim().Length > 0)
  221. {
  222. if (mlistImage_Small.Images[StrArrayList[0].Trim()] == null)
  223. { mlistImage_Small.Images.Add(StrArrayList[0].Trim(), mlistImage_Source.Images[StrArrayList[0].Trim()]); }
  224. }
  225. else
  226. { mlistImage_Small.Images.Add("NULL", mlistImage_Source.Images["NULL"]); }
  227. if (!IsFind)
  228. {
  229. ListViewItem lvItem = new ListViewItem();
  230. if (StrArrayList[0].Trim().Length > 0)
  231. { lvItem.ImageKey = StrArrayList[0].Trim(); }
  232. else
  233. { lvItem.ImageKey = "NULL"; }
  234. lvItem.Tag = dtRow;
  235. lvItem.Text = dtRow["自定义编号"].ToString().Trim();
  236. ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
  237. ListSubItem.Name = "礼服名称";
  238. ListSubItem.Text = dtRow["礼服名称"].ToString().Trim();
  239. lvItem.SubItems.Add(ListSubItem);
  240. this.listViewData_Selected.Items.Add(lvItem);
  241. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Selected);
  242. }
  243. this.listViewData_Source.Items.Remove(SelectItem);
  244. }
  245. }
  246. /// <summary>
  247. /// 已选择的礼服双击移除
  248. /// </summary>
  249. /// <param name="sender"></param>
  250. /// <param name="e"></param>
  251. void listViewData_Selected_MouseDoubleClick(object sender, MouseEventArgs e)
  252. {
  253. if (this.listViewData_Selected.Items.Count > 0 && this.listViewData_Selected.SelectedItems.Count > 0)
  254. {
  255. ListViewItem SelectItem = this.listViewData_Selected.SelectedItems[0];
  256. DataRow dtRow = (DataRow)SelectItem.Tag;
  257. string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
  258. ListViewItem lvi = new ListViewItem();
  259. if (StrArrayList[0].Trim().Length > 0)
  260. { lvi.ImageKey = StrArrayList[0].Trim(); }
  261. else
  262. { lvi.ImageKey = "NULL"; }
  263. lvi.Tag = dtRow;
  264. lvi.Text = "编号:" + dtRow["自定义编号"].ToString().Trim() + "\r\n名称:" + dtRow["礼服名称"].ToString().Trim();
  265. this.listViewData_Source.Items.Add(lvi);
  266. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Selected);
  267. this.listViewData_Selected.Items.Remove(SelectItem);
  268. }
  269. }
  270. /// <summary>
  271. /// 右键显示菜单
  272. /// </summary>
  273. /// <param name="sender"></param>
  274. /// <param name="e"></param>
  275. void listViewData_Source_MouseDown(object sender, MouseEventArgs e)
  276. {
  277. if (e.Button == MouseButtons.Right)
  278. {
  279. if (this.listViewData_Source.SelectedItems.Count > 0)
  280. {
  281. LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ComponentLibrary.ContextMenuStripEx();
  282. contextmenu.ItemClicked += contextmenu_ItemClicked;
  283. //弹出操作菜单
  284. contextmenu.Items.Clear();
  285. contextmenu.Show(MousePosition.X, MousePosition.Y);
  286. DataRow dtRow = (DataRow)this.listViewData_Source.SelectedItems[0].Tag;
  287. if (!string.IsNullOrEmpty(dtRow["相片名称"].ToString().Trim()))
  288. {
  289. ToolStripMenuItem item = new ToolStripMenuItem();
  290. item.Text = "放大(" + dtRow["礼服名称"].ToString().Trim() + ")";
  291. item.Name = "ZoomView";
  292. item.Tag = dtRow["相片名称"].ToString().Trim();
  293. contextmenu.Items.Add(item);
  294. contextmenu.Show();
  295. }
  296. }
  297. }
  298. }
  299. /// <summary>
  300. /// 右键显示菜单
  301. /// </summary>
  302. /// <param name="sender"></param>
  303. /// <param name="e"></param>
  304. void listViewData_Selected_MouseDown(object sender, MouseEventArgs e)
  305. {
  306. if (e.Button == MouseButtons.Right)
  307. {
  308. if (this.listViewData_Selected.SelectedItems.Count > 0)
  309. {
  310. LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ComponentLibrary.ContextMenuStripEx();
  311. contextmenu.ItemClicked += contextmenu_ItemClicked;
  312. //弹出操作菜单
  313. contextmenu.Items.Clear();
  314. contextmenu.Show(MousePosition.X, MousePosition.Y);
  315. DataRow dtRow = (DataRow)this.listViewData_Selected.SelectedItems[0].Tag;
  316. if (!string.IsNullOrEmpty(dtRow["相片名称"].ToString().Trim()))
  317. {
  318. ToolStripMenuItem item = new ToolStripMenuItem();
  319. item.Text = "放大(" + dtRow["礼服名称"].ToString().Trim() + ")";
  320. item.Name = "ZoomView";
  321. item.Tag = dtRow["相片名称"].ToString().Trim();
  322. contextmenu.Items.Add(item);
  323. contextmenu.Show();
  324. }
  325. }
  326. }
  327. }
  328. /// <summary>
  329. /// 右键菜单选择事件
  330. /// </summary>
  331. /// <param name="sender"></param>
  332. /// <param name="e"></param>
  333. void contextmenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  334. {
  335. ToolStripItem item = e.ClickedItem;
  336. if (!string.IsNullOrEmpty(item.Text.Trim()))
  337. {
  338. switch (item.Name.Trim())
  339. {
  340. case "ZoomView":
  341. string[] StrArrayList = item.Tag.ToString().Trim().Split('|');
  342. if (!string.IsNullOrEmpty(StrArrayList[0].Trim()))
  343. {
  344. Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Original(StrArrayList[0].Trim());
  345. if (img != null)
  346. {
  347. try
  348. {
  349. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  350. {
  351. LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
  352. frm.FrmImage = img;
  353. frm.ShowDialog();
  354. }));
  355. }
  356. catch
  357. { }
  358. }
  359. }
  360. //DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: "Prod_Number = '" + item.Tag.ToString().Trim() + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
  361. //if (tbl.Rows.Count > 0)
  362. //{
  363. // if (!string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()))
  364. // {
  365. // LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
  366. // frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
  367. // frm.ShowDialog();
  368. // }
  369. // else
  370. // { MessageBoxCustom.Show("产品未上传相片!"); return; }
  371. //}
  372. break;
  373. }
  374. }
  375. }
  376. /// <summary>
  377. /// 选择礼服时间查询
  378. /// </summary>
  379. /// <param name="sender"></param>
  380. /// <param name="e"></param>
  381. void dtTakeDressTime_TextChanged(object sender, EventArgs e)
  382. {
  383. if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue.Trim()))
  384. {
  385. try { Convert.ToDateTime(this.dtTakeDressTime.DateValue); }
  386. catch { return; }
  387. this.btnQuery_Click(this, null);
  388. }
  389. }
  390. List<DataRow> listdtRow = new List<DataRow>();
  391. int listdtRowsIndex = 0;
  392. int binRowsMaxCount = 50;
  393. /// <summary>
  394. /// 查询
  395. /// </summary>
  396. /// <param name="sender"></param>
  397. /// <param name="e"></param>
  398. void btnQuery_Click(object sender, EventArgs e)
  399. {
  400. this.listdtRow = new List<DataRow>();
  401. this.listdtRowsIndex = 0;
  402. this.listViewData_Source.Items.Clear();
  403. string StrWhere = "Dsfm_IsEnabled='1' and Dsfm_DressQuantity > 0";
  404. if (!string.IsNullOrEmpty(cmbtreevDressType.Text) && cmbtreevDressType.Text != "全部")
  405. { StrWhere += " and Dsfm_DressType='" + cmbtreevDressType.Tag.ToString() + "' "; }
  406. if (!string.IsNullOrEmpty(this.txtQuery.Text.Trim()))
  407. { StrWhere += " and (Dsfm_DressName like '%" + this.txtQuery.Text.Trim() + "%' or dbo.fn_ChineseToSpell(Dsfm_DressName) like '%" + this.txtQuery.Text.Trim() + "%')"; }
  408. if (String.IsNullOrEmpty(strReturnDressTime))
  409. {
  410. strReturnDressTime = SDateTime.Now.AddYears(100).ToYYYY_MM_dd_HH_mm_ss();
  411. }
  412. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  413. {
  414. string StrTable = "tb_ErpDressFrom Left Join tb_ErpSystemCategory AS tb_DressType on tb_DressType.Sc_ClassCode = Dsfm_DressType Left Join tb_ErpSystemCategory AS tb_PlacedRegion on tb_PlacedRegion.Sc_ClassCode = Dsfm_PlacedRegion";
  415. DataTable dt = orbll.GetView_Custom(StrTable, StrWhere: StrWhere, ShowColumnName: "Dsfm_DressNumber AS 礼服编号,Dsfm_DressCustomNumber AS 自定义编号,tb_DressType.Sc_ClassName AS 礼服类别,Dsfm_DressName AS 礼服名称,Dsfm_DressBrand AS 礼服品牌,Dsfm_DressSize AS 礼服尺寸,tb_PlacedRegion.Sc_ClassName AS 摆放区域,Dsfm_RentPrice AS 出租价格,Dsfm_SalePrice AS 出售价格,Dsfm_DressRemark AS 礼服备注,Dsfm_DressPhotoNames AS 相片名称").Tables[0];
  416. if (dt.Rows.Count > 0)
  417. {
  418. DataTable dtSaleRental = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail Left Join tb_ErpDressSaleRentalOrder on Dsrd_Number = Dsro_Number", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3'", ShowColumnName: "Dsrd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_TakeDressTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dsrd_DressNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime").Tables[0];
  419. DataTable dtSendWash = orbll.GetView_Custom("tb_ErpDressSendWashOrder Left Join tb_ErpDressSendWashDetail on Dswd_Number = Dswo_Number", StrWhere: "Dswd_BackStatus='3'", ShowColumnName: "Dswd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_SendWashTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dswd_DressNumber,Dswo_SendWashTime,Dswo_ReservationBackTime").Tables[0];
  420. #region 读取数据
  421. for (int i = 0; i < dt.Rows.Count; i++)
  422. {
  423. bool IsFind = false;
  424. if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue) && dtSaleRental.Rows.Count > 0)
  425. {
  426. DataRow[] row_DSRD = dtSaleRental.Select("Dsrd_DressNumber='" + dt.Rows[i]["礼服编号"].ToString().Trim() + "' ");
  427. for (int t = 0; t < row_DSRD.Length; t++)
  428. {
  429. if (
  430. (Convert.ToDateTime(this.dtTakeDressTime.DateValue) >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) &&Convert.ToDateTime(this.dtTakeDressTime.DateValue) <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"])) ||
  431. (Convert.ToDateTime(strReturnDressTime) >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && Convert.ToDateTime(strReturnDressTime) <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]))
  432. )
  433. {
  434. IsFind = true;
  435. }
  436. }
  437. }
  438. if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue) && dtSendWash.Rows.Count > 0 && !IsFind)
  439. {
  440. DataRow[] row_sw = dtSendWash.Select("Dswd_DressNumber='" + dt.Rows[i]["礼服编号"].ToString().Trim() + "' ");
  441. for (int t = 0; t < row_sw.Length; t++)
  442. {
  443. if (
  444. (Convert.ToDateTime(this.dtTakeDressTime.DateValue) >= Convert.ToDateTime(row_sw[t]["还衣天数取衣日期"]) && Convert.ToDateTime(this.dtTakeDressTime.DateValue) <= Convert.ToDateTime(row_sw[t]["还衣天数加还衣日期"])) ||
  445. (Convert.ToDateTime(strReturnDressTime) >= Convert.ToDateTime(row_sw[t]["还衣天数取衣日期"]) && Convert.ToDateTime(strReturnDressTime) <= Convert.ToDateTime(row_sw[t]["还衣天数加还衣日期"]))
  446. )
  447. {
  448. IsFind = true;
  449. }
  450. }
  451. }
  452. if (!IsFind)
  453. {
  454. //string[] StrArrayList = dt.Rows[i]["相片名称"].ToString().Trim().Split('|');
  455. //if (!this.mlistImage_Source.Images.Keys.Contains(dt.Rows[i]["礼服编号"].ToString().Trim()))
  456. //{
  457. // Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
  458. // this.mlistImage_Source.Images.Add(dt.Rows[i]["礼服编号"].ToString().Trim(), img);
  459. //}
  460. listdtRow.Add(dt.Rows[i]);
  461. }
  462. }
  463. #endregion
  464. }
  465. });
  466. this.bindListViewRows();
  467. }
  468. /// <summary>
  469. /// 绑定ListViewRow
  470. /// </summary>
  471. void bindListViewRows()
  472. {
  473. int forCount = 1;
  474. for (int i = this.listdtRowsIndex; i < this.listdtRow.Count; i++)
  475. {
  476. if (forCount > this.binRowsMaxCount)
  477. { break; }
  478. DataRow dtRow = this.listdtRow[i];
  479. string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
  480. if (StrArrayList[0].Trim().Length > 0)
  481. {
  482. if (!this.mlistImage_Source.Images.Keys.Contains(StrArrayList[0].Trim()))
  483. {
  484. Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
  485. this.mlistImage_Source.Images.Add(StrArrayList[0].Trim(), img);
  486. }
  487. }
  488. else
  489. {
  490. Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
  491. this.mlistImage_Source.Images.Add("NULL", img);
  492. }
  493. ListViewItem lvi = new ListViewItem();
  494. if (StrArrayList[0].Trim().Length > 0)
  495. { lvi.ImageKey = StrArrayList[0].Trim(); }
  496. else
  497. { lvi.ImageKey = "NULL"; }
  498. lvi.Tag = dtRow;//图片名称
  499. lvi.Text = "编号:" + dtRow["自定义编号"].ToString().Trim() + "\r\n名称:" + dtRow["礼服名称"].ToString().Trim();
  500. this.listViewData_Source.Items.Add(lvi);
  501. this.listViewData_Source.Items[this.listViewData_Source.Items.Count - 1].EnsureVisible();
  502. forCount++;
  503. this.listdtRowsIndex++;
  504. }
  505. if (this.listdtRow.Count > this.listdtRowsIndex)
  506. { this.panelLoadMore.Visible = true; }
  507. else
  508. {
  509. this.panelLoadMore.Visible = false;
  510. this.binRowsMaxCount = this.listdtRow.Count;
  511. }
  512. this.lblTotalDressCount.Text = "礼服数:总数量(" + this.listdtRow.Count.ToString().Trim() + ") 当前显示(" + this.listViewData_Source.Items.Count + ")";
  513. }
  514. /// <summary>
  515. /// 加载更多
  516. /// </summary>
  517. /// <param name="sender"></param>
  518. /// <param name="e"></param>
  519. void panelLoadMore_Click(object sender, EventArgs e)
  520. { this.bindListViewRows(); }
  521. /// <summary>
  522. /// 确定
  523. /// </summary>
  524. /// <param name="sender"></param>
  525. /// <param name="e"></param>
  526. void btnOK_Click(object sender, EventArgs e)
  527. {
  528. if (this.listViewData_Selected.Items.Count > 0)
  529. {
  530. for (int i = 0; i < this.listViewData_Selected.Items.Count; i++)
  531. {
  532. ListViewItem SelectItem = this.listViewData_Selected.Items[i];
  533. DataRow dtRow = (DataRow)SelectItem.Tag;
  534. listSelect.Add(dtRow["礼服编号"].ToString().Trim());// this.listViewData_Selected.Items[i].ImageKey.Trim());
  535. }
  536. this.IsSaveed = true;
  537. this.btnCancel_Click(this, null);
  538. }
  539. }
  540. /// <summary>
  541. /// 取消
  542. /// </summary>
  543. /// <param name="sender"></param>
  544. /// <param name="e"></param>
  545. void btnCancel_Click(object sender, EventArgs e)
  546. {
  547. this.Close();
  548. }
  549. /// <summary>
  550. /// 保存还衣天数
  551. /// </summary>
  552. /// <param name="sender"></param>
  553. /// <param name="e"></param>
  554. void btnSaveDay_Click(object sender, EventArgs e)
  555. {
  556. if (string.IsNullOrEmpty(this.txtDayNumber.Text.Trim()))
  557. { MessageBoxCustom.Show("回衣天数不能为空!"); return; }
  558. LYFZ.Model.Model_ErpSystemConfigure Model = sgbll.GetModel("Sconfig_Code", "AlsoClothesDay");
  559. if (Model.ID <= 0)
  560. {
  561. Model = new LYFZ.Model.Model_ErpSystemConfigure();
  562. Model.Sconfig_Code = "AlsoClothesDay";
  563. Model.Sconfig_Name = "回衣天数";
  564. Model.Sconfig_Value = this.txtDayNumber.Text.Trim();
  565. Model.Sconfig_IsEnabled = true;
  566. Model.Sconfig_Remark = "礼服管理衣服还回天数设置";
  567. Model.Sconfig_Type = "";
  568. Model.Sconfig_Order = 1;
  569. Model.Sconfig_CreateDatetime = SDateTime.Now;
  570. sgbll.Add(Model);
  571. }
  572. else
  573. {
  574. Model.Sconfig_Value = this.txtDayNumber.Text.Trim();
  575. sgbll.Update(Model);
  576. }
  577. MessageBoxCustom.Show("保存成功!");
  578. }
  579. /// <summary>
  580. /// 回衣天数限制输入
  581. /// </summary>
  582. /// <param name="sender"></param>
  583. /// <param name="e"></param>
  584. void txtDayNumber_KeyPress(object sender, KeyPressEventArgs e)
  585. {
  586. if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
  587. { e.Handled = true; }
  588. }
  589. }
  590. }