123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace LYFZ.Software.MainBusiness.InitialSet.Product
- {
- public class FrmSelectProductPic : LYFZ.Software.UI.InitialSet.Product.FrmSelectProductPic
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
- /// <summary>
- /// 获取选片文件路径集合
- /// </summary>
- List<string> picList = new List<string>();
- string OrdvNumber = "";
- string OrdvViceNumber = "";
- string proName = "";
- string unCode = "";
- /// <summary>
- /// 初始化图片数据
- /// </summary>
- /// <param name="_OrdvNumber"></param>
- /// <param name="_OrdvViceNumber"></param>
- /// <param name="_proName"></param>
- public FrmSelectProductPic(string _OrdvNumber, string _OrdvViceNumber, string _proName, string _unCode)
- {
- OrdvNumber = _OrdvNumber;
- OrdvViceNumber = _OrdvViceNumber;
- proName = _proName.Split('(')[0];
- unCode = _unCode;
- this.Load += FrmSelectProductPic_Load;
- this.btn_org.Click += Btn_org_Click;
- this.btn_early.Click += Btn_early_Click;
- this.btn_refine.Click += Btn_refine_Click;
- this.btn_Design.Click += Btn_Design_Click;
- this.btn_DownPage.Click += Btn_DownPage_Click;
- this.btn_UpPage.Click += Btn_UpPage_Click;
- this.chk_ShowDesignPic.Click += Chk_ShowDesignPic_Click;
- }
- private void Chk_ShowDesignPic_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- if (btn_Design.Enabled == false)
- {
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.DesignPiece);
- }
- else if (btn_org.Enabled == false)
- {
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
- }
- else if (btn_early.Enabled == false)
- {
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
- }
- else if (btn_refine.Enabled == false)
- {
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.FineRetouch);
- }
- });
- }
- private void Btn_Design_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- this.btn_refine.Enabled = true;
- this.btn_org.Enabled = true;
- this.btn_early.Enabled = true;
- this.btn_Design.Enabled = false;
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.DesignPiece);
-
- });
- }
- /// <summary>
- /// 上一页
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_UpPage_Click(object sender, EventArgs e)
- {
- if(lab_StartNum.Text!="0"&&Convert.ToInt32(lab_StartNum.Text)>1)
- {
- lab_StartNum.Text = (Convert.ToInt32(lab_StartNum.Text) - 1).ToString();
- ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
- if(lab_StartNum.Text=="1")
- {
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = true;
- }
- else
- {
- btn_UpPage.Enabled = true;
- btn_DownPage.Enabled = true;
- }
- }
- }
- /// <summary>
- /// 下一页
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_DownPage_Click(object sender, EventArgs e)
- {
- if (lab_StartNum.Text != "0" && Convert.ToInt32(lab_StartNum.Text) < Convert.ToInt32(lab_TotalNum.Text))
- {
- lab_StartNum.Text = (Convert.ToInt32(lab_StartNum.Text) + 1).ToString();
- ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
- if (lab_StartNum.Text == lab_TotalNum.Text)
- {
- btn_UpPage.Enabled = true;
- btn_DownPage.Enabled = false;
- }
- else
- {
- btn_UpPage.Enabled = true;
- btn_DownPage.Enabled = true;
- }
- }
- }
- /// <summary>
- /// 查看精修图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_refine_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- this.btn_refine.Enabled = false;
- this.btn_org.Enabled = true;
- this.btn_early.Enabled = true;
- this.btn_Design.Enabled = true;
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.FineRetouch);
-
- });
- }
- /// <summary>
- /// 查看初修图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_early_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- this.btn_refine.Enabled = true;
- this.btn_org.Enabled = true;
- this.btn_early.Enabled = false;
- this.btn_Design.Enabled = true;
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
-
- });
- }
- /// <summary>
- /// 查看原片图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_org_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- this.btn_refine.Enabled = true;
- this.btn_org.Enabled = false;
- this.btn_early.Enabled = true;
- this.btn_Design.Enabled = true;
- ShowProductListData(Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
-
- });
- }
-
- private void FrmSelectProductPic_Load(object sender, EventArgs e)
- {
- lab_ProName.Text = proName;
- Btn_org_Click(null, null);
- }
- /// <summary>
- /// 获取图片数据
- /// </summary>
- /// <param name="directoryType"></param>
- void ShowProductListData(Model.Model_ErpOrder.DirectoryType directoryType)
- {
-
- LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", OrdvViceNumber);
- LYFZ.Model.Model_ErpOrder OrderModel = orbll.GetModel(OrdvNumber);
- BLL.SelectPhotoHandling currentSelectPhotoHandling = new BLL.SelectPhotoHandling(OrderModel, vmodel);
- BLL.ProductSelectedPhotoInfo CurrentSelectPhotoInfo = new BLL.ProductSelectedPhotoInfo(vmodel.Ordv_SelectionFilm, directoryType);
- string sightName = "";
- if (OrderModel.Ord_Type == "1")
- {
-
- LYFZ.BLL.BLL_ErpOrdersPhotography eopbll = new BLL.BLL_ErpOrdersPhotography();
- Model.Model_ErpOrdersPhotography modelPhotograph = eopbll.GetModel("Ordpg_ViceNumber", OrdvViceNumber);
- sightName = modelPhotograph.Ordpg_Sights;
- picList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(directoryType, BLL.SelectPhotoHandling.PhotoType.Preview, sightName);
- }
- else
- {
- picList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(directoryType, BLL.SelectPhotoHandling.PhotoType.Preview, sightName);
- }
- if ((!chk_ShowDesignPic.Checked)||(chk_ShowDesignPic.Checked&&btn_Design.Enabled))
- {
- BLL.ProductSelectedInfo proSelectInfo = CurrentSelectPhotoInfo.ProductSelectedList.Find(p => p.ProductName == proName && p.UniquelyIdentity == unCode);
- if (proSelectInfo != null && proSelectInfo.SelectedPhotoIList.Count > 0)
- {
- lab_StartNum.Text = "1";
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = true;
- List<string> totalSelectList = new List<string>();
- if (directoryType != Model.Model_ErpOrder.DirectoryType.DesignPiece)
- {
- foreach (string selePic in proSelectInfo.SelectedPhotoIList)
- {
- string tempPic = picList.Find(p => p.ToLower().IndexOf(selePic.ToLower()) >= 1);
- if (!string.IsNullOrEmpty(tempPic))
- {
- totalSelectList.Add(tempPic);
- }
- }
- }
- else
- {
- foreach (string selePic in picList)
- {
- string tempSelePic = LYFZ.BLL.SelectPhotoHandling.GetDesignConfirmName(selePic, sightName);
- if (string.IsNullOrEmpty(tempSelePic))
- {
- continue;
- }
- if (proSelectInfo.SelectedPhotoIList.Find(p => p.ToLower() == tempSelePic.ToLower()) != null)
- {
- totalSelectList.Add(selePic);
- }
- }
- }
- picList = totalSelectList;
- if (picList.Count > 0)
- {
- ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
- lab_TotalNum.Text = picList.Count.ToString();
- }
- else
- {
- pictureBoxEx1.Image = null;
- lab_StartNum.Text = "0";
- lab_TotalNum.Text = "0";
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = false;
- }
- }
- else
- {
- pictureBoxEx1.Image = null;
- lab_StartNum.Text = "0";
- lab_TotalNum.Text = "0";
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = false;
- }
- }
- else
- {
- lab_StartNum.Text = "1";
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = true;
- picList = picList.Where(p=>p.IndexOf(proName)!=-1).ToList();
- if (picList.Count > 0)
- {
- ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
- lab_TotalNum.Text = picList.Count.ToString();
- }
- else
- {
- pictureBoxEx1.Image = null;
- lab_StartNum.Text = "0";
- lab_TotalNum.Text = "0";
- btn_UpPage.Enabled = false;
- btn_DownPage.Enabled = false;
- }
-
- }
- }
- void ShowNetworkImageFile(string urlPath)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
- {
- System.Drawing.Image O_Image = System.Drawing.Image.FromStream(System.Net.WebRequest.Create(urlPath).GetResponse().GetResponseStream());
- pictureBoxEx1.Image = O_Image;
- });
- }
- }
- }
|