123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- using LYFZ.ComponentLibrary;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.Dresses
- {
- public partial class FrmDressManagement : LYFZ.Software.UI.Dresses.FrmDressManagement
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new LYFZ.BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpDressFrom dfbll = new BLL.BLL_ErpDressFrom();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- LYFZ.BLL.BLL_ErpDressSaleRentalDetail dsrfbll = new BLL.BLL_ErpDressSaleRentalDetail();
- public FrmDressManagement()
- {
- this.Load += FrmDressManagement_Load;
- this.listViewData.MouseClick += listViewData_MouseClick;
- }
- ImageList mlistImage = new ImageList();
- public string Type = "";
- public string TakeTimeClothes;
- public string Qd = "";
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FrmDressManagement_Load(object sender, EventArgs e)
- {
- this.mlistImage.ImageSize = new Size(95, 100);
- this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData.LargeImageList = this.mlistImage;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void FrmDressManagement_Shown(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEAJBGADDCBAHFFA", this.cmbtreevDressType, IsFirstNodeNull: true, IsFirstNodeName: "全部");
- //获取回衣天数
- this.BindAlsoClothes();
- this.btnPreselection.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Preselection);
- // 礼服租售
- this.btnRental.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental);
- this.btnRentalManagement.Enabled = this.btnRental.Enabled;
- this.btnSaleManagement.Enabled = this.btnRental.Enabled;
- // 礼服送洗
- this.btnValet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Valet);
- this.btnValetMangstar.Enabled = this.btnValet.Enabled;
- this.BindPic();
- if (Type == "Update")
- {
- this.btnDetermine.Visible = true;
- this.btnPreselection.Visible = false;
- this.btnRental.Visible = false;
- this.btnValet.Visible = false;
- this.btnRentalManagement.Visible = false;
- this.btnSaleManagement.Visible = false;
- this.btnValetMangstar.Visible = false;
- this.txtDayNumber.Visible = false;
- this.btnSaveDay.Visible = false;
- this.labelEx13.Visible = false;
- this.panelEx4.Visible = false;
- this.panelEx5.Visible = false;
- this.dtTakeDressTime.Text = this.TakeTimeClothes;
- MessageBoxCustom.Show("请选择取衣时间,查询礼服,已免礼服撞期!");
- }
- }
- /// <summary>
- /// 获取回衣天数
- /// </summary>
- public void BindAlsoClothes()
- {
- DataTable dt = sgbll.GetList("Sconfig_Code='AlsoClothesDay'").Tables[0];
- if (dt.Rows.Count > 0)
- { this.txtDayNumber.Text = dt.Rows[0]["Sconfig_Value"].ToString(); }
- else
- { this.txtDayNumber.Text = "0"; }
- }
- /// <summary>
- /// 绑定图片
- /// </summary>
- public void BindPic()
- {
- if (string.IsNullOrEmpty(this.dtTakeDressTime.DateValue.Trim()))
- { this.listViewData.CheckBoxes = false; }
- else
- { this.listViewData.CheckBoxes = true; }
- this.listViewData.Items.Clear();
- this.lblPreselected.Text = "";
- string StrWhere = "Dsfm_IsEnabled='1' and Dsfm_DressQuantity > 0";
- if (!string.IsNullOrEmpty(cmbtreevDressType.Text) && cmbtreevDressType.Text != "全部")
- { StrWhere += " and Dsfm_DressType='" + cmbtreevDressType.Tag.ToString() + "' "; }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpDressFrom", StrWhere: StrWhere, ShowColumnName: "Dsfm_DressNumber,Dsfm_DressCustomNumber,Dsfm_DressName,Dsfm_DressPhotoNames").Tables[0];
- if (dt.Rows.Count > 0)
- {
- DataTable dt_DressSaleRentalDetail = orbll.GetView_Custom("View_DressSaleRentalDetail", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3'", ShowColumnName: "Dsrd_DressNumber,还衣天数取衣日期,还衣天数加还衣日期").Tables[0];
- #region 读取数据
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- bool IsFind = false;
- if (!string.IsNullOrEmpty(this.dtTakeDressTime.DateValue))
- {
- DateTime TakeClothesTime = Convert.ToDateTime(this.dtTakeDressTime.DateValue);//选择取衣时间
- DataRow[] row_DSRD = dt_DressSaleRentalDetail.Select(" Dsrd_DressNumber='" + dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim() + "' ");
- for (int t = 0; t < row_DSRD.Length; t++)
- {
- DateTime StarTime = Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]);
- DateTime StarEnd = Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]);
- if (TakeClothesTime >= StarTime && TakeClothesTime <= StarEnd)
- { IsFind = true; }
- }
- }
- if (!IsFind)
- {
- string[] StrArrayList = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim().Split('|');
- if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- { this.mlistImage.Images.Add(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim(), img); }));
- }
- catch
- { }
- }
- ListViewItem lvi = new ListViewItem();
- lvi.ImageKey = dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim();
- lvi.Tag = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim();//图片名称
- lvi.Text = "编号:" + dt.Rows[i]["Dsfm_DressCustomNumber"].ToString().Trim() + "\r\n名称:" + dt.Rows[i]["Dsfm_DressName"].ToString().Trim();
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- this.listViewData.Items.Add(lvi);
- }));
- }
- catch
- { }
- }
- }
- #endregion
- }
- });
- }
- /// <summary>
- /// 图片单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void lstPic_Click(object sender, EventArgs e)
- {
- if (this.listViewData.SelectedItems.Count <= 0)
- { this.panelEx1.Visible = false; }
- else
- {
- DataTable dt = orbll.GetView_Custom("BView_DressManaged", StrWhere: "Dsfm_DressNumber='" + this.listViewData.SelectedItems[0].ImageKey.ToString().Trim() + "'", ShowColumnName: "Dsfm_DressCustomNumber AS 礼服编号,Dsfm_DressType AS 礼服类别,Dsfm_DressName AS 礼服名称,Dsfm_DressBrand AS 礼服品牌,Dsfm_DressSize AS 礼服尺寸,Dsfm_PlacedRegion AS 摆放区域,Dsfm_RentPrice AS 出租价格,Dsfm_SalePrice AS 出售价格,Dsfm_DressRemark AS 礼服备注").Tables[0];
- if (dt.Rows.Count > 0)
- {
- this.panelEx1.Visible = true;
- string StrText = "";
- string StrRemark = "";
- for (int i = 0; i < dt.Columns.Count; i++)
- {
- switch (dt.Columns[i].ColumnName.Trim())
- {
- case "礼服备注":
- StrText += dt.Columns[i].ColumnName.Trim() + ":";
- StrRemark = dt.Rows[0][i].ToString().Trim();
- break;
- default:
- StrText += dt.Columns[i].ColumnName.Trim() + ":" + dt.Rows[0][i].ToString().Trim() + "\r\n\r\n";
- break;
- }
- }
- this.lblDressDetails.Text = StrText;
- this.txtDressRemark.Text = StrRemark;
- this.txtDressRemark.Location = new Point(this.lblDressDetails.Location.X + 3, this.lblDressDetails.Location.Y + this.lblDressDetails.Height + 5);
- this.txtDressRemark.Height = this.panelEx1.Height - this.txtDressRemark.Location.Y - 5;
- }
- }
- }
- /// <summary>
- /// 图片单击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_MouseClick(object sender, MouseEventArgs e)
- {
- this.lstPic_Click(this, null);
- }
- /// <summary>
- /// 选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void lstPic_ItemChecked(object sender, ItemCheckedEventArgs e)
- {
- string Check = "";
- if (this.listViewData.CheckedItems.Count > 0)
- {
- this.txtok.Text = "";
- this.txtok.Text = this.listViewData.CheckedItems[0].ImageKey.ToString().Trim();
- for (int i = 0; i < this.listViewData.CheckedItems.Count; i++)
- {
- Check += this.listViewData.CheckedItems[i].ImageKey.ToString().Trim() + ",";
- }
- this.txtok.Text = Check.TrimEnd(',');
- }
- else
- { this.txtok.Text = ""; }
- }
- /// <summary>
- /// 查看详情隐藏
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void lstPic_MouseUp(object sender, MouseEventArgs e)
- {
- if (this.listViewData.SelectedItems.Count <= 0)
- { this.panelEx1.Visible = false; }
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void toolCancel_Click(object sender, EventArgs e)
- {
- if (this.listViewData.SelectedItems.Count > 0)
- {
- for (int i = 0; i < this.listViewData.SelectedItems.Count; i++)
- {
- this.listViewData.SelectedItems[i].Checked = false;
- }
- }
- if (this.listViewData.CheckedItems.Count > 0)
- {
- string Check = "";
- for (int i = 0; i < this.listViewData.CheckedItems.Count; i++)
- {
- Check += this.listViewData.CheckedItems[i].ImageKey.ToString().Trim() + ",";
- }
- this.txtok.Text = Check.TrimEnd(',');
- }
- else
- { this.txtok.Text = ""; }
- }
- /// <summary>
- /// 选中
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void toolSelected_Click(object sender, EventArgs e)
- {
- if (this.listViewData.SelectedItems.Count > 0)
- {
- for (int i = 0; i < this.listViewData.SelectedItems.Count; i++)
- { this.listViewData.SelectedItems[i].Checked = true; }
- }
- if (this.listViewData.CheckedItems.Count > 0)
- {
- string Check = "";
- for (int i = 0; i < this.listViewData.CheckedItems.Count; i++)
- { Check += this.listViewData.CheckedItems[i].ImageKey.ToString().Trim() + ","; }
- this.txtok.Text = Check.TrimEnd(',');
- }
- else
- { this.txtok.Text = ""; }
- }
- /// <summary>
- /// 预选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnPreselection_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmPreselection set = new DressManagement.FrmPreselection();
- set.Dsfm_DressNumber = this.txtok.Text;
- if (set.ShowDialog() == DialogResult.OK)
- { this.BindPic(); }
- // 预选选择
- if (set.list.Count > 0)
- {
- if (this.listViewData.Items.Count > 0)
- {
- #region 清空数据
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- {
- this.listViewData.Items[i].Checked = false;
- }
- #endregion
- #region 赋值
- for (int t = 0; t < set.list.Count; t++)
- {
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- {
- if (set.list[t] == this.listViewData.Items[i].Tag.ToString())
- {
- this.listViewData.Items[i].Checked = true;
- }
- }
- }
- #endregion
- this.lblPreselected.Text = "";
- this.lblPreselected.Text = set.PreselectedNumber;
- this.cmbtreevDressType.Text = "";
- }
- }
- this.dtTakeDressTime.DateValue = "";
- }
- /// <summary>
- /// 出租/出售
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnRental_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.dtTakeDressTime.DateValue))
- {
- MessageBoxCustom.Show("取衣时间不能为空!");
- return;
- }
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmDressRental set = new DressManagement.Rental.FrmDressRental();
- set.Dsfm_DressNumber = this.txtok.Text;
- set.PreselectedNumber_OK = this.lblPreselected.Text;
- if (set.ShowDialog() == DialogResult.OK)
- { this.BindPic(); }
- }
- /// <summary>
- /// 送洗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnValet_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.dtTakeDressTime.DateValue))
- {
- MessageBoxCustom.Show("取衣时间不能为空!");
- return;
- }
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Valet.FrmDressValet set = new DressManagement.Valet.FrmDressValet();
- set.Dsfm_DressNumber = this.txtok.Text;
- if (set.ShowDialog() == DialogResult.OK)
- {
- this.BindPic();
- }
- }
- /// <summary>
- /// 输入框设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void txtDayNumber_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
- /// <summary>
- /// 保存还衣天数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSaveDay_Click(object sender, EventArgs e)
- {
- LYFZ.Model.Model_ErpSystemConfigure Model = new Model.Model_ErpSystemConfigure();
- DataTable dt = sgbll.GetList("Sconfig_Code='AlsoClothesDay'").Tables[0];
- if ((dt.Rows.Count == 0))
- {
- #region 增加
- 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 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
- sgbll.Add(Model);
- #endregion
- }
- else
- {
- #region 修改
- sgbll.UpdateErpSystemConfigure("Sconfig_Value='" + this.txtDayNumber.Text.Trim() + "'", "AlsoClothesDay");
- #endregion
- }
- MessageBoxCustom.Show("保存成功!");
- this.BindAlsoClothes();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSlect_Click(object sender, EventArgs e)
- {
- this.BindPic();
- }
- /// <summary>
- /// 查看原图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void toolpic_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0)
- {
- if (this.listViewData.SelectedItems.Count > 0)
- {
- string[] StrArrayList = this.listViewData.SelectedItems[0].Tag.ToString().Trim().Split('|');
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- frm.ShowDialog();
- }
- }
- }
- /// <summary>
- /// 双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void lstPic_DoubleClick(object sender, EventArgs e)
- {
- this.toolpic_Click(this, null);
- }
- /// <summary>
- /// 出租管理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnRentalManagement_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmRentalManagement set = new DressManagement.Rental.FrmRentalManagement();
- set.ShowDialog();
- }
- /// <summary>
- /// 出售管理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnSaleManagement_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmSaleManagement set = new DressManagement.Rental.FrmSaleManagement();
- set.ShowDialog();
- }
- /// <summary>
- /// 送洗管理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnValetMangstar_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.Valet.FrmValetManagement set = new DressManagement.Valet.FrmValetManagement();
- set.ShowDialog();
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnDetermine_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmPreselectedUpdate set = new DressManagement.FrmPreselectedUpdate();
- if (string.IsNullOrEmpty(this.txtok.Text))
- {
- MessageBoxCustom.Show("请选择礼服!");
- return;
- }
- this.Qd = this.txtok.Text;
- this.Close();
- }
- }
- }
|