FrmSelectProductPic.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace LYFZ.Software.MainBusiness.InitialSet.Product
  6. {
  7. public class FrmSelectProductPic : LYFZ.Software.UI.InitialSet.Product.FrmSelectProductPic
  8. {
  9. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  10. LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
  11. /// <summary>
  12. /// 获取选片文件路径集合
  13. /// </summary>
  14. List<string> picList = new List<string>();
  15. string OrdvNumber = "";
  16. string OrdvViceNumber = "";
  17. string proName = "";
  18. string unCode = "";
  19. /// <summary>
  20. /// 初始化图片数据
  21. /// </summary>
  22. /// <param name="_OrdvNumber"></param>
  23. /// <param name="_OrdvViceNumber"></param>
  24. /// <param name="_proName"></param>
  25. public FrmSelectProductPic(string _OrdvNumber, string _OrdvViceNumber, string _proName, string _unCode)
  26. {
  27. OrdvNumber = _OrdvNumber;
  28. OrdvViceNumber = _OrdvViceNumber;
  29. proName = _proName.Split('(')[0];
  30. unCode = _unCode;
  31. this.Load += FrmSelectProductPic_Load;
  32. this.btn_org.Click += Btn_org_Click;
  33. this.btn_early.Click += Btn_early_Click;
  34. this.btn_refine.Click += Btn_refine_Click;
  35. this.btn_Design.Click += Btn_Design_Click;
  36. this.btn_DownPage.Click += Btn_DownPage_Click;
  37. this.btn_UpPage.Click += Btn_UpPage_Click;
  38. this.chk_ShowDesignPic.Click += Chk_ShowDesignPic_Click;
  39. }
  40. private void Chk_ShowDesignPic_Click(object sender, EventArgs e)
  41. {
  42. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  43. {
  44. if (btn_Design.Enabled == false)
  45. {
  46. ShowProductListData(Model.Model_ErpOrder.DirectoryType.DesignPiece);
  47. }
  48. else if (btn_org.Enabled == false)
  49. {
  50. ShowProductListData(Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
  51. }
  52. else if (btn_early.Enabled == false)
  53. {
  54. ShowProductListData(Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
  55. }
  56. else if (btn_refine.Enabled == false)
  57. {
  58. ShowProductListData(Model.Model_ErpOrder.DirectoryType.FineRetouch);
  59. }
  60. });
  61. }
  62. private void Btn_Design_Click(object sender, EventArgs e)
  63. {
  64. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  65. {
  66. this.btn_refine.Enabled = true;
  67. this.btn_org.Enabled = true;
  68. this.btn_early.Enabled = true;
  69. this.btn_Design.Enabled = false;
  70. ShowProductListData(Model.Model_ErpOrder.DirectoryType.DesignPiece);
  71. });
  72. }
  73. /// <summary>
  74. /// 上一页
  75. /// </summary>
  76. /// <param name="sender"></param>
  77. /// <param name="e"></param>
  78. private void Btn_UpPage_Click(object sender, EventArgs e)
  79. {
  80. if(lab_StartNum.Text!="0"&&Convert.ToInt32(lab_StartNum.Text)>1)
  81. {
  82. lab_StartNum.Text = (Convert.ToInt32(lab_StartNum.Text) - 1).ToString();
  83. ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
  84. if(lab_StartNum.Text=="1")
  85. {
  86. btn_UpPage.Enabled = false;
  87. btn_DownPage.Enabled = true;
  88. }
  89. else
  90. {
  91. btn_UpPage.Enabled = true;
  92. btn_DownPage.Enabled = true;
  93. }
  94. }
  95. }
  96. /// <summary>
  97. /// 下一页
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void Btn_DownPage_Click(object sender, EventArgs e)
  102. {
  103. if (lab_StartNum.Text != "0" && Convert.ToInt32(lab_StartNum.Text) < Convert.ToInt32(lab_TotalNum.Text))
  104. {
  105. lab_StartNum.Text = (Convert.ToInt32(lab_StartNum.Text) + 1).ToString();
  106. ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
  107. if (lab_StartNum.Text == lab_TotalNum.Text)
  108. {
  109. btn_UpPage.Enabled = true;
  110. btn_DownPage.Enabled = false;
  111. }
  112. else
  113. {
  114. btn_UpPage.Enabled = true;
  115. btn_DownPage.Enabled = true;
  116. }
  117. }
  118. }
  119. /// <summary>
  120. /// 查看精修图片
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void Btn_refine_Click(object sender, EventArgs e)
  125. {
  126. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  127. {
  128. this.btn_refine.Enabled = false;
  129. this.btn_org.Enabled = true;
  130. this.btn_early.Enabled = true;
  131. this.btn_Design.Enabled = true;
  132. ShowProductListData(Model.Model_ErpOrder.DirectoryType.FineRetouch);
  133. });
  134. }
  135. /// <summary>
  136. /// 查看初修图片
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. private void Btn_early_Click(object sender, EventArgs e)
  141. {
  142. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  143. {
  144. this.btn_refine.Enabled = true;
  145. this.btn_org.Enabled = true;
  146. this.btn_early.Enabled = false;
  147. this.btn_Design.Enabled = true;
  148. ShowProductListData(Model.Model_ErpOrder.DirectoryType.EarlyRetouch);
  149. });
  150. }
  151. /// <summary>
  152. /// 查看原片图片
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void Btn_org_Click(object sender, EventArgs e)
  157. {
  158. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  159. {
  160. this.btn_refine.Enabled = true;
  161. this.btn_org.Enabled = false;
  162. this.btn_early.Enabled = true;
  163. this.btn_Design.Enabled = true;
  164. ShowProductListData(Model.Model_ErpOrder.DirectoryType.PrimitivePicture);
  165. });
  166. }
  167. private void FrmSelectProductPic_Load(object sender, EventArgs e)
  168. {
  169. lab_ProName.Text = proName;
  170. Btn_org_Click(null, null);
  171. }
  172. /// <summary>
  173. /// 获取图片数据
  174. /// </summary>
  175. /// <param name="directoryType"></param>
  176. void ShowProductListData(Model.Model_ErpOrder.DirectoryType directoryType)
  177. {
  178. LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", OrdvViceNumber);
  179. LYFZ.Model.Model_ErpOrder OrderModel = orbll.GetModel(OrdvNumber);
  180. BLL.SelectPhotoHandling currentSelectPhotoHandling = new BLL.SelectPhotoHandling(OrderModel, vmodel);
  181. BLL.ProductSelectedPhotoInfo CurrentSelectPhotoInfo = new BLL.ProductSelectedPhotoInfo(vmodel.Ordv_SelectionFilm, directoryType);
  182. string sightName = "";
  183. if (OrderModel.Ord_Type == "1")
  184. {
  185. LYFZ.BLL.BLL_ErpOrdersPhotography eopbll = new BLL.BLL_ErpOrdersPhotography();
  186. Model.Model_ErpOrdersPhotography modelPhotograph = eopbll.GetModel("Ordpg_ViceNumber", OrdvViceNumber);
  187. sightName = modelPhotograph.Ordpg_Sights;
  188. picList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(directoryType, BLL.SelectPhotoHandling.PhotoType.Preview, sightName);
  189. }
  190. else
  191. {
  192. picList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(directoryType, BLL.SelectPhotoHandling.PhotoType.Preview, sightName);
  193. }
  194. if ((!chk_ShowDesignPic.Checked)||(chk_ShowDesignPic.Checked&&btn_Design.Enabled))
  195. {
  196. BLL.ProductSelectedInfo proSelectInfo = CurrentSelectPhotoInfo.ProductSelectedList.Find(p => p.ProductName == proName && p.UniquelyIdentity == unCode);
  197. if (proSelectInfo != null && proSelectInfo.SelectedPhotoIList.Count > 0)
  198. {
  199. lab_StartNum.Text = "1";
  200. btn_UpPage.Enabled = false;
  201. btn_DownPage.Enabled = true;
  202. List<string> totalSelectList = new List<string>();
  203. if (directoryType != Model.Model_ErpOrder.DirectoryType.DesignPiece)
  204. {
  205. foreach (string selePic in proSelectInfo.SelectedPhotoIList)
  206. {
  207. string tempPic = picList.Find(p => p.ToLower().IndexOf(selePic.ToLower()) >= 1);
  208. if (!string.IsNullOrEmpty(tempPic))
  209. {
  210. totalSelectList.Add(tempPic);
  211. }
  212. }
  213. }
  214. else
  215. {
  216. foreach (string selePic in picList)
  217. {
  218. string tempSelePic = LYFZ.BLL.SelectPhotoHandling.GetDesignConfirmName(selePic, sightName);
  219. if (string.IsNullOrEmpty(tempSelePic))
  220. {
  221. continue;
  222. }
  223. if (proSelectInfo.SelectedPhotoIList.Find(p => p.ToLower() == tempSelePic.ToLower()) != null)
  224. {
  225. totalSelectList.Add(selePic);
  226. }
  227. }
  228. }
  229. picList = totalSelectList;
  230. if (picList.Count > 0)
  231. {
  232. ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
  233. lab_TotalNum.Text = picList.Count.ToString();
  234. }
  235. else
  236. {
  237. pictureBoxEx1.Image = null;
  238. lab_StartNum.Text = "0";
  239. lab_TotalNum.Text = "0";
  240. btn_UpPage.Enabled = false;
  241. btn_DownPage.Enabled = false;
  242. }
  243. }
  244. else
  245. {
  246. pictureBoxEx1.Image = null;
  247. lab_StartNum.Text = "0";
  248. lab_TotalNum.Text = "0";
  249. btn_UpPage.Enabled = false;
  250. btn_DownPage.Enabled = false;
  251. }
  252. }
  253. else
  254. {
  255. lab_StartNum.Text = "1";
  256. btn_UpPage.Enabled = false;
  257. btn_DownPage.Enabled = true;
  258. picList = picList.Where(p=>p.IndexOf(proName)!=-1).ToList();
  259. if (picList.Count > 0)
  260. {
  261. ShowNetworkImageFile(picList[Convert.ToInt32(lab_StartNum.Text) - 1]);
  262. lab_TotalNum.Text = picList.Count.ToString();
  263. }
  264. else
  265. {
  266. pictureBoxEx1.Image = null;
  267. lab_StartNum.Text = "0";
  268. lab_TotalNum.Text = "0";
  269. btn_UpPage.Enabled = false;
  270. btn_DownPage.Enabled = false;
  271. }
  272. }
  273. }
  274. void ShowNetworkImageFile(string urlPath)
  275. {
  276. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, System.ComponentModel.BackgroundWorker backgroundWorker)
  277. {
  278. System.Drawing.Image O_Image = System.Drawing.Image.FromStream(System.Net.WebRequest.Create(urlPath).GetResponse().GetResponseStream());
  279. pictureBoxEx1.Image = O_Image;
  280. });
  281. }
  282. }
  283. }