123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- using HttpFileTransfer;
- using LYFZ.ComponentLibrary;
- using LYFZ.PhotoSelectSystem;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.NewDressSystem
- {
- public class frmAddDress : LYFZ.Software.NewDressSystem.frmAddDress
- {
- public frmAddDress()
- {
- /* RequestParameter parameter = new RequestParameter("http://192.168.1.19:8090", "E33111416591824337");
- parameter.DomainUrl = "http://e33111416591824337.bjb10.lyfz.net:8000";
- ResultData resultData = HttpFileTransferClient.UploadFile(parameter, "2018", "Preview_011.jpg", @"E:\测试相片\Preview_011.jpg", UploadProgress);
- */
- this.txtDressNumber.Multiline = true;
- initialization();
- BindFieldClickEvent();
- this.likAllSelect.Click += LikAllSelect_Click;
- this.likNoAllSelect.Click += LikNoAllSelect_Click;
- this.Shown += FrmAddDress_Shown;
- this.listViewImage.DoubleClick += ListViewImage_DoubleClick;
- this.txtDressNumber.KeyUp += TxtDressNumber_KeyUp;
- this.btnSave.Click += BtnSave_Click;
- this.btnClose.Click += BtnClose_Click;
- this.dtpDressBuyDate.Value = SDateTime.Now;
- this.btnSetJingHuoChuangJia.Click += BtnSetJingHuoChuangJia_Click;
- this.btnSetLiFuLeiBei.Click += BtnSetLiFuLeiBei_Click;
- this.btnSetBaiFangQuYu.Click += BtnSetBaiFangQuYu_Click;
- this.btnSetYuanShe.Click += BtnSetYuanShe_Click;
- this.btnSetFengGe.Click += BtnSetFengGe_Click;
- this.btnSetYuangShi.Click += BtnSetYuangShi_Click;
- this.btnSetXiuChuang.Click += BtnSetXiuChuang_Click;
- this.btnSetQunChuang.Click += BtnSetQunChuang_Click;
- this.btnSetLiFuChiChun.Click += BtnSetLiFuChiChun_Click;
- this.btnSetQiTa.Click += BtnSetQiTa_Click;
- }
- private void BtnSetQiTa_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服其它);
- }
- private void BtnSetLiFuChiChun_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服尺寸);
- }
- private void BtnSetQunChuang_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服裙长);
- }
- private void BtnSetXiuChuang_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服袖长);
- }
- private void BtnSetYuangShi_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服颜色);
- }
- private void BtnSetFengGe_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服风格);
- }
- private void BtnSetYuanShe_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服颜色);
- }
- private void BtnSetBaiFangQuYu_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服摆放区域);
- }
- private void BtnSetLiFuLeiBei_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服类别);
- }
- private void BtnSetJingHuoChuangJia_Click(object sender, EventArgs e)
- {
- SetFrmSystemSet(BLL.SysTemCategoryCodeType.礼服进货厂家);
- }
- /// <summary>
- /// 重新加载所有系统类别
- /// </summary>
- public static void LoadAllSystemCategory()
- {
- LYFZ.BLL.WageStatisticsProcess.LoadAllSystemCategory();
- }
- void SetFrmSystemSet(BLL.SysTemCategoryCodeType sysTemCategory)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(sysTemCategory).ToUpper();
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- LoadAllSystemCategory();
- });
-
- switch (sysTemCategory)
- {
- case BLL.SysTemCategoryCodeType.礼服进货厂家:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服进货厂家, this.cbxJingHuoChuangJia.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服类别:
- this.cbxJingHuoChuangJia.Text = "";
- BindTreeView(BLL.SysTemCategoryCodeType.礼服类别, this.cbxLiFuLeiBei.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服摆放区域:
- this.cbxBaiFangQuYu.Text = "";
- BindTreeView(BLL.SysTemCategoryCodeType.礼服摆放区域, this.cbxBaiFangQuYu.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服颜色:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服颜色, this.cbxYuangShi.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服风格:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服风格, this.cbxFengGe.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服样式:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服样式, this.cbxYuangShi.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服袖长:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服袖长, this.cbxXiuChuang.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服裙长:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服裙长, this.cbxQunChuang.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服尺寸:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服尺寸, this.cbxLiFuChiChun.TreeView, isExpandAll: false);
- break;
- case BLL.SysTemCategoryCodeType.礼服其它:
- BindTreeView(BLL.SysTemCategoryCodeType.礼服其它, this.cbxQiTa.TreeView, isExpandAll: false);
- break;
- }
- }
- }
- private void BtnClose_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- }
- private void BtnSave_Click(object sender, EventArgs e)
- {
- List<string> LiFuSerialNumberList=GetLiFuSerialNumberList();
- this.txtDressNumber.Text = String.Join(",", LiFuSerialNumberList);
- TxtDressNumber_KeyUp(null,null);
- string verificationMsg = "";
- if (VerificationControlValue(ref verificationMsg))
- {
- if (this.Read_ErpDressFrom(_DressFromModel))
- {
- }
- }
- else {
- MessageBoxCustom.Show(verificationMsg);
- }
- }
- Model.Model_ErpDressFrom _DressFromModel = new Model.Model_ErpDressFrom();
- /// <summary>
- ///
- /// </summary>
- /// <param name="_DressModel"></param>
- bool Read_ErpDressFrom(Model.Model_ErpDressFrom _DressModel)
- {
- if (VerificationControlValue())
- {
- try
- {
- _DressModel.Dsfm_DressName = this.txtDressName.Text.Trim();
- _DressModel.Dsfm_DressBuyDate = this.dtpDressBuyDate.Value;
- _DressModel.Dsfm_ScrapDate = this.GetDateTimeToLong(this.dtpDressChuShouDate);
- _DressModel.Dsfm_ScrapDate= this.GetDateTimeToLong(this.dtpDressBaoFeiDate);
- _DressModel.Dsfm_PurchasePrice = this.nudGuoMaiJiaGe.Value;
- _DressModel.Dsfm_CostPrice = this.nudChenBenJiaGe.Value;
- _DressModel.Dsfm_SalePrice = this.nudChuShouJiage.Value;
- _DressModel.Dsfm_RentPrice = this.nudChuZhuJiage.Value;
- _DressModel.Dsfm_CustomizePrice = this.nudDingZhiJiage.Value;
- _DressModel.Dsfm_DressRemark = this.txtRemark.Text.Trim();
- _DressModel.Dsfm_DressIntroduce = this.txtLiFuMiaoShu.Text.Trim();
- _DressModel.Dsfm_DressQuantity = 1;
- _DressModel.Dsfm_IsEnabled = this.rdoShuangJia.Checked ? "1" : "0";
- _DressModel.Dsfm_DressStatus = this.GetLiFuZhuangTai();
- _DressModel.Dsfm_DressType = this.cbxLiFuLeiBei.GetSelectedNodeName().Trim();//BFAFDBAIEIFBDECH
- _DressModel.Dsfm_PlacedRegion = this.cbxBaiFangQuYu.GetSelectedNodeName().Trim();//BGBBCJBGEIEHHHFBD 白纱区
-
- return true;
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format(ex.Message));
- }
- }
- return false;
- }
- long GetDateTimeToLong(ComponentLibrary.DateTimePickerEx dateTime)
- {
- return String.IsNullOrWhiteSpace(dateTime.DateValue.Trim()) ? 0 : dateTime.Value.ToJavaScriptTimeStamp();
- }
- /// <summary>
- /// 获取礼服状态
- /// </summary>
- /// <returns></returns>
- int GetLiFuZhuangTai()
- {
- foreach (Control con in this.plLiFuZhuangTai.Controls)
- {
- if (con.GetType() == typeof(ComponentLibrary.RadioButtonEx))
- {
- ComponentLibrary.RadioButtonEx radioButton = (ComponentLibrary.RadioButtonEx)con;
- if (radioButton.Checked)
- {
- return Convert.ToInt32(radioButton.Tag);
- }
- }
- }
- return 0;
- }
- /// <summary>
- /// 设置礼服状态
- /// </summary>
- /// <param name="status"></param>
- void SetLiFuZhuangTai(int status)
- {
- foreach (Control con in this.plLiFuZhuangTai.Controls)
- {
- if (con.GetType() == typeof(ComponentLibrary.RadioButtonEx))
- {
- ComponentLibrary.RadioButtonEx radioButton = (ComponentLibrary.RadioButtonEx)con;
- if (Convert.ToInt32(radioButton.Tag)==status)
- {
- radioButton.Checked = true;
- }
- }
- }
- }
- /// <summary>
- /// 验证必填控件的值是否已输入值
- /// </summary>
- /// <returns></returns>
- bool VerificationControlValue()
- {
- string verificationMsg = "";
- return VerificationControlValue(ref verificationMsg);
- }
- /// <summary>
- /// 验证必填控件的值是否已输入值
- /// </summary>
- /// <returns></returns>
- bool VerificationControlValue(ref string msg)
- {
- bool isBl = true;
- if (String.IsNullOrWhiteSpace(this.txtDressNumber.Text.Trim()))
- {
- isBl = false;
- msg = "礼服编号不能为空";
- }
- else if (String.IsNullOrWhiteSpace(this.txtDressName.Text.Trim()))
- {
- isBl = false;
- msg = "礼服名称不能为空";
- }
- else if (String.IsNullOrWhiteSpace(this.dtpDressBuyDate.DateValue.Trim()))
- {
- isBl = false;
- msg = "购买日期不能为空";
- }
- else if (String.IsNullOrWhiteSpace(this.cbxLiFuLeiBei.Text.Trim()))
- {
- isBl = false;
- msg = "礼服类别不能为空";
- }
- else if (String.IsNullOrWhiteSpace(this.cbxBaiFangQuYu.Text.Trim()))
- {
- isBl = false;
- msg = "礼服摆放区域不能为空";
- }
- return isBl;
- }
- private void TxtDressNumber_KeyUp(object sender, KeyEventArgs e)
- {
- int tempHeight = 14 * this.txtDressNumber.lines.Length + 27;
- if (tempHeight <= 41)
- {
- tempHeight = 41;
- }
- if (this.txtDressNumber.Height != tempHeight)
- {
- this.txtDressNumber.Height = tempHeight;
- this.groupLiFuInfo.Location = new Point(this.groupLiFuInfo.Location.X, this.txtDressNumber.Location.Y + this.txtDressNumber.Height + 3);
- }
- this.lbLiFuCount.Text = GetLiFuSerialNumberList().Count.ToString();
- }
- private void ListViewImage_DoubleClick(object sender, EventArgs e)
- {
- if (this.listViewImage.SelectedItems != null)
- {
- System.Drawing.Brush brush = System.Drawing.Brushes.Black;
- frmFullScreenPlay frmFull = new frmFullScreenPlay(getPhotoPathList(), brush);
- frmFull.IsAutoplayMovie = false;
- frmFull.CurrentIndex = 0;
- if (listViewImage.SelectedItems != null && listViewImage.SelectedItems.Count > 0)
- {
- frmFull.CurrentIndex = listViewImage.SelectedItems[0].Index;
- }
- // frmFull.CurrentIndex = getPhotoCurrentIndex();//lstvData.SelectedItems[lstvData.SelectedItems.Count - 1].Index;
- frmFull.ShowDialog();
- frmFull.Dispose();
- }
-
- }
- /// <summary>
- /// 获取要全屏显示的图片路径集合
- /// </summary>
- /// <returns></returns>
- List<string> getPhotoPathList()
- {
- List<string> photoPathList = new List<string>();
- /*for (int i = 0; i < this.listViewImage.Items.Count; i++)
- {
- if (this.listViewImage.Items[i].Tag != null)
- {
- photoPathList.Add(this.listViewImage.Items[i].Tag.ToString());
- }
- else
- {
- MessageBoxCustom.Show("相片加载出错!");
- break;
- }
- }*/
- photoPathList.Add(@"E:\测试相片\Preview_010.jpg");
- return photoPathList;
- }
- bool isEdit = false;
- private void FrmAddDress_Shown(object sender, EventArgs e)
- {
- if (isEdit)
- {
- this.txtDressNumber.Enabled = false;
- }
- else {
- this.txtDressNumber.Enabled = true;
- }
- SetEditInitialization();
- InitializationDropDownList();
- BindImageList();
- // this.cbxLiFuLeiBei.SetNodeNameToSelectItme("BFAFDBAIEIFBDECH");
- // this.cbxBaiFangQuYu.SetNodeTextToSelectItme("白纱区");
- }
- /// <summary>
- /// 初始化下拉列表
- /// </summary>
- void InitializationDropDownList()
- {
- BindTreeView(BLL.SysTemCategoryCodeType.礼服进货厂家, this.cbxJingHuoChuangJia.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服类别, this.cbxLiFuLeiBei.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服摆放区域, this.cbxBaiFangQuYu.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服颜色, this.cbxYuangShi.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服风格, this.cbxFengGe.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服样式, this.cbxYuangShi.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服袖长, this.cbxXiuChuang.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服裙长, this.cbxQunChuang.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服尺寸, this.cbxLiFuChiChun.TreeView, isExpandAll: false);
- BindTreeView(BLL.SysTemCategoryCodeType.礼服其它, this.cbxQiTa.TreeView, isExpandAll: false);
- }
- void BindTreeView(BLL.SysTemCategoryCodeType sysTemCategory, TreeView tvw, bool isExpandAll = true, string ExclusionsList = "", bool IsFirstNodeNull = false, BLL.SysTemCategoryCodeType codeType = BLL.SysTemCategoryCodeType.未知类别)
- {
- FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(sysTemCategory).ToUpper(), tvw, isExpandAll: false,ExclusionsList: ExclusionsList,IsFirstNodeNull:IsFirstNodeNull,codeType:codeType);
- }
- List<string> GetLiFuSerialNumberList()
- {
- List<string> serialNumberList = new List<string>();
- string serialNumberString = this.txtDressNumber.Text.Trim()
- .Replace(",", ",")
- .Replace("+", ",")
- .Replace(":", ":")
- .Replace(".", ":")
- .Replace(" ", ",")
- .Replace(";",",")
- .Replace(System.Environment.NewLine, ",")
- .Trim(',').Trim(',');
- if (!String.IsNullOrWhiteSpace(serialNumberString))
- {
- serialNumberList.AddRange(serialNumberString.Split(',').ToList().FindAll(s=>!String.IsNullOrWhiteSpace(s)).Distinct());
- }
- return serialNumberList;
- }
- void SetEditInitialization()
- {
- if (isEdit && GetLiFuSerialNumberList().Count > 1)
- {
- this.likAllSelect.Show();
- this.likNoAllSelect.Show();
- }
- else {
- this.likAllSelect.Hide();
- this.likNoAllSelect.Hide();
- }
- }
- /// <summary>
- /// 显示相片集合
- /// </summary>
- ImageList LiFuImageList = new ImageList();
- void initialization()
- {
- this.LiFuImageList.Images.Clear();
- this.LiFuImageList.ColorDepth = ColorDepth.Depth32Bit;
- this.LiFuImageList.ImageSize = new Size(170, 180);
- this.LiFuImageList.Images.Add(new Bitmap(@"E:\测试相片\Preview_010.jpg"));
- this.LiFuImageList.Images.Add(LYFZ.PhotoSelectSystem.MainPhotoSelect.ImageJPGE);
-
- this.listViewImage.View = View.LargeIcon;
-
- }
- void BindImageList()
- {
- this.listViewImage.Items.Clear();
- this.listViewImage.LargeImageList = this.LiFuImageList;
- for (int i = 0; i < 4; i++)
- {
- ListViewItem lvi = new ListViewItem();
-
- lvi.Name = "vItem" + i.ToString();
- lvi.ImageIndex = 0;
- lvi.Text = lvi.Name;
- lvi.Tag = "";
- lvi.ToolTipText = lvi.Text;
- // lvi.SubItems.Add(index.ToString());
- //lvi.SubItems.Add(PhotoPath);
- this.listViewImage.Items.Add(lvi);
- }
- }
- private void LikNoAllSelect_Click(object sender, EventArgs e)
- {
- foreach (Control con in this.groupLiFuInfo.Controls)
- {
- if (con.GetType() == typeof(LabelEx))
- {
- if (con.Cursor == Cursors.Hand)
- {
- LabelEx labelEx = (LabelEx)con;
- labelEx.BorderStyle = BorderStyle.None;
- labelEx.BackColor = plExMainContainer.BackColor;
- }
- }
- }
- }
- private void LikAllSelect_Click(object sender, EventArgs e)
- {
- foreach (Control con in this.groupLiFuInfo.Controls)
- {
- if (con.GetType() == typeof(LabelEx))
- {
- if (con.Cursor == Cursors.Hand)
- {
- LabelEx labelEx = (LabelEx)con;
- labelEx.BorderStyle = BorderStyle.FixedSingle;
- labelEx.BackColor = System.Drawing.Color.LightPink;
- }
- }
- }
- }
- void BindFieldClickEvent()
- {
- foreach (Control con in this.groupLiFuInfo.Controls)
- {
- if (con.GetType() == typeof(LabelEx))
- {
- if (con.Cursor == Cursors.Hand)
- {
- con.Click += Con_Click;
- }
- }
- }
- }
- private void Con_Click(object sender, EventArgs e)
- {
- if (isEdit)
- {
- if (GetLiFuSerialNumberList().Count > 1)
- {
- LabelEx labelEx = (LabelEx)sender;
- if (labelEx.BorderStyle == BorderStyle.None)
- {
- labelEx.BorderStyle = BorderStyle.FixedSingle;
- labelEx.BackColor = System.Drawing.Color.LightPink;
- }
- else
- {
- labelEx.BorderStyle = BorderStyle.None;
- labelEx.BackColor = plExMainContainer.BackColor;
- }
- }
- }
- }
- void UploadProgress(UploadFileReport report)
- {
- if (report.UploadFileCompleted && report.UploadStatus)
- {
- Console.WriteLine(String.Format("已上传成功\r\n"));
- }
- else if (report.UploadFileCompleted && !report.UploadStatus)
- {
- Console.WriteLine(String.Format("上传失败:{0} {1}\r\n", report.ErrorMsg, report.GetReportMsgInfo()));
- }
- else
- {
- Console.WriteLine(String.Format("{0}\r\n", report.GetReportMsgInfo()));
- }
- }
- }
- }
|