123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.Dresses.SetSmallForm
- {
- public partial class ToolboxDressSamllForm : LYFZ.Software.UI.Dresses.SetSmallForm.ToolboxDressSamllForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- public ToolboxDressSamllForm()
- {
- this.Load += ToolboxDressSamllForm_Load;
- this.Shown += ToolboxDressSamllForm_Shown;
- this.Resize += ToolboxDressSamllForm_Resize;
- this.lblTotalDressCount.Click += lblTotalDressCount_Click;
- this.listViewData_Source.Click += listViewData_Source_Click;
- this.listViewData_Source.MouseDoubleClick += listViewData_Source_MouseDoubleClick;
- this.listViewData_Selected.MouseDoubleClick += listViewData_Selected_MouseDoubleClick;
- this.listViewData_Source.MouseDown += listViewData_Source_MouseDown;
- this.listViewData_Selected.MouseDown += listViewData_Selected_MouseDown;
- this.dtTakeDressTime.TextChanged += dtTakeDressTime_TextChanged;
- this.btnQuery.Click += btnQuery_Click;
- this.btnOK.Click += btnOK_Click;
- this.btnCancel.Click += btnCancel_Click;
- this.btnSaveDay.Click += btnSaveDay_Click;
- this.txtDayNumber.KeyPress += txtDayNumber_KeyPress;
- this.panelLoadMore.Click += panelLoadMore_Click;
- this.lblLoadMore.Click += panelLoadMore_Click;
- }
- /// <summary>
- /// 礼服订单号
- /// </summary>
- public string StrDreesOrdNumber = "";
- /// <summary>
- /// 取衣时间
- /// </summary>
- public string StrTakeDressTime = "";
- /// <summary>
- /// 还衣时间
- /// </summary>
- public string strReturnDressTime = "";
- /// <summary>
- /// 已选择的礼服编号
- /// </summary>
- public List<string> listSelect = new List<string>();
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 相片集合_可选择的礼服
- /// </summary>
- ImageList mlistImage_Source = new ImageList();
- /// <summary>
- /// 相片集合_已选中的礼服
- /// </summary>
- ImageList mlistImage_Small = new ImageList();
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void ToolboxDressSamllForm_Load(object sender, EventArgs e)
- {
- this.GetDressPageCount();
- this.mlistImage_Source.ImageSize = new Size(95, 100);
- this.mlistImage_Source.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData_Source.LargeImageList = this.mlistImage_Source;
- this.listViewData_Selected.View = View.Details;
- this.listViewData_Selected.GridLines = true;
- string[] StrColumns = ("礼服编号,礼服名称").Split(',');
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- switch (StrColumns[i].Trim())
- {
- case "礼服编号": ch.Width = 120; break;
- case "礼服名称": ch.Width = 150; break;
- }
- ch.TextAlign = HorizontalAlignment.Left;
- this.listViewData_Selected.Columns.Add(ch);
- }
- this.mlistImage_Small.ImageSize = new Size(25, 25);
- this.mlistImage_Small.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData_Selected.SmallImageList = mlistImage_Small;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void ToolboxDressSamllForm_Shown(object sender, EventArgs e)
- {
- DataTable dt = sgbll.GetList("Sconfig_Code='AlsoClothesDay'").Tables[0];
- if (dt.Rows.Count > 0)
- { this.txtDayNumber.Text = dt.Rows[0]["Sconfig_Value"].ToString(); }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEAJBGADDCBAHFFA", this.cmbtreevDressType, IsFirstNodeNull: true, IsFirstNodeName: "全部");
- this.cmbtreevDressType.TextFindTag("全部");
- if (!string.IsNullOrEmpty(this.StrTakeDressTime))
- {
- this.dtTakeDressTime.DateValue = this.StrTakeDressTime;
- this.dtTakeDressTime.Enabled = false;
- if (this.StrTakeDressTime.Trim() == SDateTime.Now.ToString("yyyy-MM-dd"))
- { this.dtTakeDressTime_TextChanged(this, null); }
- }
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void ToolboxDressSamllForm_Resize(object sender, EventArgs e)
- {
- 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);
- }
- /// <summary>
- /// 设置每页加载条数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void lblTotalDressCount_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressPageCountSamllForm frm = new DressPageCountSamllForm();
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.GetDressPageCount(); }
- }
- /// <summary>
- /// 获取每页条数
- /// </summary>
- void GetDressPageCount()
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: "Sconfig_Code = 'DressPageCount'", ShowColumnName: "*").Tables[0];
- if (dt.Rows.Count > 0)
- { this.binRowsMaxCount = Convert.ToInt32(dt.Rows[0]["Sconfig_Value"]); }
- }
- /// <summary>
- /// 供选择的礼服点击查看详情
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Source_Click(object sender, EventArgs e)
- {
- string StrTextTip = "";
- if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
- {
- DataRow dtRow = (DataRow)this.listViewData_Source.SelectedItems[0].Tag;
- string StrText = "";
- for (int i = 0; i < dtRow.Table.Columns.Count; i++)
- {
- switch (dtRow.Table.Columns[i].ColumnName.Trim())
- {
- case "礼服编号":
- case "相片名称": break;
- case "礼服尺寸":
- StrText += "\r\n" + dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim();
- break;
- case "礼服备注":
- StrText += "\r\n" + dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim();
- break;
- default:
- StrText += dtRow.Table.Columns[i].ColumnName.Trim() + ":" + dtRow[i].ToString().Trim() + " ";
- break;
- }
- }
- this.lblDressDetails.Text = StrText;
- string StrWhere = "";
- if (!string.IsNullOrEmpty(this.StrDreesOrdNumber))
- { StrWhere += " And Dsro_Number != '" + this.StrDreesOrdNumber + "'"; }
- string StrTableName = "tb_ErpDressSaleRentalDetail Left Join tb_ErpDressSaleRentalOrder on Dsro_Number = Dsrd_Number";
- 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 还衣日期";
- 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];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- if (i < 9)
- {
- if (i == 4)
- { StrTextTip += "\r\n"; }
- string SText = "";
- if (!string.IsNullOrEmpty(dt.Rows[i]["还衣日期"].ToString().Trim()))
- { SText = ",还衣:" + dt.Rows[i]["还衣日期"].ToString().Trim(); }
- StrTextTip += (i + 1) + ". " + dt.Rows[i]["类型"].ToString().Trim() + "(取衣:" + dt.Rows[i]["取衣日期"].ToString().Trim() + SText + ") ";
- }
- }
- if (dt.Rows.Count > 4)
- { this.lblPrompt.Location = new Point(104, 4); }
- else
- { this.lblPrompt.Location = new Point(104, 19); }
- }
- this.lblPrompt.Text = StrTextTip;
- if (!string.IsNullOrEmpty(this.lblPrompt.Text.Trim()))
- { this.lblPrompt.Visible = true; }
- else
- { this.lblPrompt.Visible = false; }
- }
- /// <summary>
- /// 可选择的礼服双击选中
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Source_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (this.listViewData_Source.Items.Count > 0 && this.listViewData_Source.SelectedItems.Count > 0)
- {
- ListViewItem SelectItem = this.listViewData_Source.SelectedItems[0];
- DataRow dtRow = (DataRow)SelectItem.Tag;
- bool IsFind = false;
- for (int i = 0; i < this.listViewData_Selected.Items.Count; i++)
- {
- if (this.listViewData_Selected.Items[i].Text.Trim() == dtRow["礼服编号"].ToString().Trim())
- { IsFind = true; return; }
- }
- string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
- if (StrArrayList[0].Trim().Length > 0)
- {
- if (mlistImage_Small.Images[StrArrayList[0].Trim()] == null)
- { mlistImage_Small.Images.Add(StrArrayList[0].Trim(), mlistImage_Source.Images[StrArrayList[0].Trim()]); }
- }
- else
- { mlistImage_Small.Images.Add("NULL", mlistImage_Source.Images["NULL"]); }
- if (!IsFind)
- {
- ListViewItem lvItem = new ListViewItem();
- if (StrArrayList[0].Trim().Length > 0)
- { lvItem.ImageKey = StrArrayList[0].Trim(); }
- else
- { lvItem.ImageKey = "NULL"; }
- lvItem.Tag = dtRow;
- lvItem.Text = dtRow["自定义编号"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服名称";
- ListSubItem.Text = dtRow["礼服名称"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- this.listViewData_Selected.Items.Add(lvItem);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Selected);
- }
- this.listViewData_Source.Items.Remove(SelectItem);
- }
- }
- /// <summary>
- /// 已选择的礼服双击移除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Selected_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- if (this.listViewData_Selected.Items.Count > 0 && this.listViewData_Selected.SelectedItems.Count > 0)
- {
- ListViewItem SelectItem = this.listViewData_Selected.SelectedItems[0];
- DataRow dtRow = (DataRow)SelectItem.Tag;
- string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
- ListViewItem lvi = new ListViewItem();
- if (StrArrayList[0].Trim().Length > 0)
- { lvi.ImageKey = StrArrayList[0].Trim(); }
- else
- { lvi.ImageKey = "NULL"; }
- lvi.Tag = dtRow;
- lvi.Text = "编号:" + dtRow["自定义编号"].ToString().Trim() + "\r\n名称:" + dtRow["礼服名称"].ToString().Trim();
- this.listViewData_Source.Items.Add(lvi);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Selected);
- this.listViewData_Selected.Items.Remove(SelectItem);
- }
- }
- /// <summary>
- /// 右键显示菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Source_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- if (this.listViewData_Source.SelectedItems.Count > 0)
- {
- LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ComponentLibrary.ContextMenuStripEx();
- contextmenu.ItemClicked += contextmenu_ItemClicked;
- //弹出操作菜单
- contextmenu.Items.Clear();
- contextmenu.Show(MousePosition.X, MousePosition.Y);
- DataRow dtRow = (DataRow)this.listViewData_Source.SelectedItems[0].Tag;
- if (!string.IsNullOrEmpty(dtRow["相片名称"].ToString().Trim()))
- {
- ToolStripMenuItem item = new ToolStripMenuItem();
- item.Text = "放大(" + dtRow["礼服名称"].ToString().Trim() + ")";
- item.Name = "ZoomView";
- item.Tag = dtRow["相片名称"].ToString().Trim();
- contextmenu.Items.Add(item);
- contextmenu.Show();
- }
- }
- }
- }
- /// <summary>
- /// 右键显示菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Selected_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- if (this.listViewData_Selected.SelectedItems.Count > 0)
- {
- LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ComponentLibrary.ContextMenuStripEx();
- contextmenu.ItemClicked += contextmenu_ItemClicked;
- //弹出操作菜单
- contextmenu.Items.Clear();
- contextmenu.Show(MousePosition.X, MousePosition.Y);
- DataRow dtRow = (DataRow)this.listViewData_Selected.SelectedItems[0].Tag;
- if (!string.IsNullOrEmpty(dtRow["相片名称"].ToString().Trim()))
- {
- ToolStripMenuItem item = new ToolStripMenuItem();
- item.Text = "放大(" + dtRow["礼服名称"].ToString().Trim() + ")";
- item.Name = "ZoomView";
- item.Tag = dtRow["相片名称"].ToString().Trim();
- contextmenu.Items.Add(item);
- contextmenu.Show();
- }
- }
- }
- }
- /// <summary>
- /// 右键菜单选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void contextmenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- ToolStripItem item = e.ClickedItem;
- if (!string.IsNullOrEmpty(item.Text.Trim()))
- {
- switch (item.Name.Trim())
- {
- case "ZoomView":
- string[] StrArrayList = item.Tag.ToString().Trim().Split('|');
- if (!string.IsNullOrEmpty(StrArrayList[0].Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Original(StrArrayList[0].Trim());
- if (img != null)
- {
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = img;
- frm.ShowDialog();
- }));
- }
- catch
- { }
- }
- }
- //DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: "Prod_Number = '" + item.Tag.ToString().Trim() + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
- //if (tbl.Rows.Count > 0)
- //{
- // if (!string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()))
- // {
- // LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- // frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
- // frm.ShowDialog();
- // }
- // else
- // { MessageBoxCustom.Show("产品未上传相片!"); return; }
- //}
- break;
- }
- }
- }
- /// <summary>
- /// 选择礼服时间查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dtTakeDressTime_TextChanged(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue.Trim()))
- {
- try { Convert.ToDateTime(this.dtTakeDressTime.DateValue); }
- catch { return; }
- this.btnQuery_Click(this, null);
- }
- }
- List<DataRow> listdtRow = new List<DataRow>();
- int listdtRowsIndex = 0;
- int binRowsMaxCount = 50;
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- this.listdtRow = new List<DataRow>();
- this.listdtRowsIndex = 0;
- this.listViewData_Source.Items.Clear();
- string StrWhere = "Dsfm_IsEnabled='1' and Dsfm_DressQuantity > 0";
- if (!string.IsNullOrEmpty(cmbtreevDressType.Text) && cmbtreevDressType.Text != "全部")
- { StrWhere += " and Dsfm_DressType='" + cmbtreevDressType.Tag.ToString() + "' "; }
- if (!string.IsNullOrEmpty(this.txtQuery.Text.Trim()))
- { StrWhere += " and (Dsfm_DressName like '%" + this.txtQuery.Text.Trim() + "%' or dbo.fn_ChineseToSpell(Dsfm_DressName) like '%" + this.txtQuery.Text.Trim() + "%')"; }
- if (String.IsNullOrEmpty(strReturnDressTime))
- {
- strReturnDressTime = SDateTime.Now.AddYears(100).ToYYYY_MM_dd_HH_mm_ss();
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- 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";
- 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];
- if (dt.Rows.Count > 0)
- {
- 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];
- 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];
- #region 读取数据
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- bool IsFind = false;
- if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue) && dtSaleRental.Rows.Count > 0)
- {
- DataRow[] row_DSRD = dtSaleRental.Select("Dsrd_DressNumber='" + dt.Rows[i]["礼服编号"].ToString().Trim() + "' ");
- for (int t = 0; t < row_DSRD.Length; t++)
- {
- if (
- (Convert.ToDateTime(this.dtTakeDressTime.DateValue) >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) &&Convert.ToDateTime(this.dtTakeDressTime.DateValue) <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"])) ||
- (Convert.ToDateTime(strReturnDressTime) >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && Convert.ToDateTime(strReturnDressTime) <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]))
- )
- {
- IsFind = true;
- }
- }
- }
- if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue) && dtSendWash.Rows.Count > 0 && !IsFind)
- {
- DataRow[] row_sw = dtSendWash.Select("Dswd_DressNumber='" + dt.Rows[i]["礼服编号"].ToString().Trim() + "' ");
- for (int t = 0; t < row_sw.Length; t++)
- {
- if (
- (Convert.ToDateTime(this.dtTakeDressTime.DateValue) >= Convert.ToDateTime(row_sw[t]["还衣天数取衣日期"]) && Convert.ToDateTime(this.dtTakeDressTime.DateValue) <= Convert.ToDateTime(row_sw[t]["还衣天数加还衣日期"])) ||
- (Convert.ToDateTime(strReturnDressTime) >= Convert.ToDateTime(row_sw[t]["还衣天数取衣日期"]) && Convert.ToDateTime(strReturnDressTime) <= Convert.ToDateTime(row_sw[t]["还衣天数加还衣日期"]))
- )
- {
- IsFind = true;
- }
- }
- }
- if (!IsFind)
- {
- //string[] StrArrayList = dt.Rows[i]["相片名称"].ToString().Trim().Split('|');
- //if (!this.mlistImage_Source.Images.Keys.Contains(dt.Rows[i]["礼服编号"].ToString().Trim()))
- //{
- // Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- // this.mlistImage_Source.Images.Add(dt.Rows[i]["礼服编号"].ToString().Trim(), img);
- //}
- listdtRow.Add(dt.Rows[i]);
- }
- }
- #endregion
- }
- });
- this.bindListViewRows();
- }
- /// <summary>
- /// 绑定ListViewRow
- /// </summary>
- void bindListViewRows()
- {
- int forCount = 1;
- for (int i = this.listdtRowsIndex; i < this.listdtRow.Count; i++)
- {
- if (forCount > this.binRowsMaxCount)
- { break; }
- DataRow dtRow = this.listdtRow[i];
- string[] StrArrayList = dtRow["相片名称"].ToString().Trim().Split('|');
- if (StrArrayList[0].Trim().Length > 0)
- {
- if (!this.mlistImage_Source.Images.Keys.Contains(StrArrayList[0].Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- this.mlistImage_Source.Images.Add(StrArrayList[0].Trim(), img);
- }
- }
- else
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- this.mlistImage_Source.Images.Add("NULL", img);
- }
- ListViewItem lvi = new ListViewItem();
- if (StrArrayList[0].Trim().Length > 0)
- { lvi.ImageKey = StrArrayList[0].Trim(); }
- else
- { lvi.ImageKey = "NULL"; }
- lvi.Tag = dtRow;//图片名称
- lvi.Text = "编号:" + dtRow["自定义编号"].ToString().Trim() + "\r\n名称:" + dtRow["礼服名称"].ToString().Trim();
- this.listViewData_Source.Items.Add(lvi);
- this.listViewData_Source.Items[this.listViewData_Source.Items.Count - 1].EnsureVisible();
- forCount++;
- this.listdtRowsIndex++;
- }
- if (this.listdtRow.Count > this.listdtRowsIndex)
- { this.panelLoadMore.Visible = true; }
- else
- {
- this.panelLoadMore.Visible = false;
- this.binRowsMaxCount = this.listdtRow.Count;
- }
- this.lblTotalDressCount.Text = "礼服数:总数量(" + this.listdtRow.Count.ToString().Trim() + ") 当前显示(" + this.listViewData_Source.Items.Count + ")";
- }
- /// <summary>
- /// 加载更多
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void panelLoadMore_Click(object sender, EventArgs e)
- { this.bindListViewRows(); }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnOK_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Selected.Items.Count > 0)
- {
- for (int i = 0; i < this.listViewData_Selected.Items.Count; i++)
- {
- ListViewItem SelectItem = this.listViewData_Selected.Items[i];
- DataRow dtRow = (DataRow)SelectItem.Tag;
- listSelect.Add(dtRow["礼服编号"].ToString().Trim());// this.listViewData_Selected.Items[i].ImageKey.Trim());
- }
- this.IsSaveed = true;
- this.btnCancel_Click(this, null);
- }
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 保存还衣天数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSaveDay_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txtDayNumber.Text.Trim()))
- { MessageBoxCustom.Show("回衣天数不能为空!"); return; }
- LYFZ.Model.Model_ErpSystemConfigure Model = sgbll.GetModel("Sconfig_Code", "AlsoClothesDay");
- if (Model.ID <= 0)
- {
- Model = new LYFZ.Model.Model_ErpSystemConfigure();
- Model.Sconfig_Code = "AlsoClothesDay";
- Model.Sconfig_Name = "回衣天数";
- Model.Sconfig_Value = this.txtDayNumber.Text.Trim();
- Model.Sconfig_IsEnabled = true;
- Model.Sconfig_Remark = "礼服管理衣服还回天数设置";
- Model.Sconfig_Type = "";
- Model.Sconfig_Order = 1;
- Model.Sconfig_CreateDatetime = SDateTime.Now;
- sgbll.Add(Model);
- }
- else
- {
- Model.Sconfig_Value = this.txtDayNumber.Text.Trim();
- sgbll.Update(Model);
- }
- MessageBoxCustom.Show("保存成功!");
- }
- /// <summary>
- /// 回衣天数限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtDayNumber_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- }
- }
|