frmCloudSelectionFilm.cs 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.DoorCityProcess
  11. {
  12. public class frmCloudSelectionFilm : LYFZ.Software.UI.DoorCityProcess.frmCloudSelectionFilm
  13. {
  14. static string domainNameUrl =EnumPublic.CloudSelectionDmainNameUrl;
  15. public frmCloudSelectionFilm()
  16. {
  17. this.Shown += frmCloudSelectionFilm_Shown;
  18. this.btnSendSms.Click += btnSendSms_Click;
  19. this.btnUpLoad.Click += btnUpLoad_Click;
  20. this.btnYuanP.Click += btnYuanP_Click;
  21. this.btnXiuP.Click += btnXiuP_Click;
  22. this.btnSheJiP.Click += btnSheJiP_Click;
  23. this.lbphotoType.Text = "还未加载相片";
  24. this.contextMenuStripEx1.ItemClicked += contextMenuStripEx1_ItemClicked;
  25. this.btnDown.Click += btnDown_Click;
  26. this.btnDaochu.Click += btnDaochu_Click;
  27. this.btnTongBu.Click += btnTongBu_Click;
  28. this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
  29. this.btnQ.Click += btnQ_Click;
  30. this.tbList.SelectedIndexChanged += tbList_SelectedIndexChanged;
  31. this.Load += frmCloudSelectionFilm_Load;
  32. this.lkbtnAllselect.Click += lkbtnAllselect_Click;
  33. this.lkbtnAllselectNo.Click += lkbtnAllselectNo_Click;
  34. this.btnSelectionChoice.Click += btnSelectionChoice_Click;
  35. this.cbxStatus.SelectedIndex = 1;
  36. this.dtpTimeStar.Value = DateTime.Now;
  37. this.dtpTimeEnd.Value = DateTime.Now;
  38. }
  39. void btnSelectionChoice_Click(object sender, EventArgs e)
  40. {
  41. string reseOrderPostData = "unique_id=" + this.unique_id
  42. + "&is_removed_photo=0"
  43. + "&is_removed_product=0";
  44. dynamic ResultObj = null;
  45. string retMsg = "";
  46. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  47. {
  48. try
  49. {
  50. backgroundWorker.ReportProgress(0, "正在重置云选片状态...");
  51. //重置订单云选片状态 或 删除产品和相片
  52. retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(reseOrderUrl, reseOrderPostData);
  53. if (retMsg.Contains("\"status\":"))
  54. {
  55. ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
  56. if (ResultObj.status == 0)
  57. {
  58. backgroundWorker.ReportProgress(0, "重置云选片状态完成...");
  59. MessageBoxCustom.Show("已重置云选片状态", backgroundWorker: backgroundWorker);
  60. }
  61. else
  62. {
  63. MessageBoxCustom.Show("重置云选片状态失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
  64. }
  65. }
  66. else
  67. {
  68. MessageBoxCustom.Show("重置云选片状态失败:" + retMsg, backgroundWorker: backgroundWorker);
  69. }
  70. }
  71. catch (Exception ex)
  72. {
  73. MessageBoxCustom.Show("重置云选片状态出错:" + ex.Message, backgroundWorker: backgroundWorker);
  74. }
  75. });
  76. }
  77. void lkbtnAllselectNo_Click(object sender, EventArgs e)
  78. {
  79. for (int i = 0; i < this.chkSPList.Items.Count; i++)
  80. {
  81. this.chkSPList.SetItemChecked(i, false);
  82. this.chkSPList.SelectedItems.Clear();
  83. }
  84. }
  85. void lkbtnAllselect_Click(object sender, EventArgs e)
  86. {
  87. for (int i = 0; i < this.chkSPList.Items.Count; i++)
  88. {
  89. this.chkSPList.SetItemChecked(i, true);
  90. this.chkSPList.SelectedItem = this.chkSPList.Items[i];
  91. }
  92. }
  93. LYFZ.BLL.BLL_ErpSystemConfigure configBll = new BLL.BLL_ErpSystemConfigure();
  94. bool UpdateCloudSelectionUrl(string sUrl)
  95. {
  96. bool retBl = false;
  97. LYFZ.Model.Model_ErpSystemConfigure scModel = configBll.GetModel("CloudSelectionUrl");
  98. if (scModel != null && scModel.ID > 0)
  99. {
  100. scModel.Sconfig_Value = sUrl;
  101. retBl = configBll.Update(scModel);
  102. }
  103. else
  104. {
  105. scModel.Sconfig_Code = "CloudSelectionUrl";
  106. scModel.Sconfig_Value = sUrl;
  107. scModel.Sconfig_Name = "云选片接口地址";
  108. scModel.Sconfig_IsEnabled = true;
  109. scModel.Sconfig_CreateName = "";
  110. scModel.Sconfig_CreateDatetime = DateTime.Now;
  111. retBl = configBll.Add(scModel);
  112. }
  113. return retBl;
  114. }
  115. static bool isCloudSelectionUrlOK = false;
  116. string GetNewCloudSelectionUrl()
  117. {
  118. string retUrl = "";
  119. string retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestGET("http://wx.lyfz.net/WeiXinAPP/NetIPInterface.aspx?CloudSelectionUrl=1");
  120. if (retMsg.Split('.').Length >= 3 && retMsg.Split('.').Length<=4&&retMsg.Length<=96)
  121. {
  122. retUrl = retMsg;
  123. if (!domainNameUrl.ToUpper().Contains(retMsg.ToUpper()))
  124. {
  125. isCloudSelectionUrlOK = UpdateCloudSelectionUrl(retUrl);
  126. }
  127. else {
  128. isCloudSelectionUrlOK = true;
  129. }
  130. }
  131. return retUrl;
  132. }
  133. void frmCloudSelectionFilm_Load(object sender, EventArgs e)
  134. {
  135. if (this._CloudType == 0)
  136. {
  137. this.Text = "云选片";
  138. }
  139. else {
  140. this.Text = "云看样";
  141. this.chkPhotoRandomShuffle.Hide();
  142. this.chkdelcommodity.Hide();
  143. this.btnSelectionChoice.Text = "重置云看样状态";
  144. }
  145. try
  146. {
  147. this.chkPhotoRandomShuffle.Checked = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsSelectionFilmsDisruptOrder;
  148. }
  149. catch { }
  150. }
  151. int _ShowType = -1;
  152. /// <summary>
  153. /// 显示类型 0 为上传云选 1 为下载云选结果
  154. /// </summary>
  155. public int ShowType
  156. {
  157. get { return _ShowType; }
  158. set { _ShowType = value; }
  159. }
  160. void tbList_SelectedIndexChanged(object sender, EventArgs e)
  161. {
  162. btnQ_Click(null, null);
  163. }
  164. //上传订单接口地址
  165. string uploadOrderInfoUrl = domainNameUrl + "/order/push";
  166. //上传商品接口地址
  167. string uploadProductUrl = domainNameUrl + "/product/push";
  168. //上传相片接口地址
  169. string uploadPhototUrl = domainNameUrl + "/photo/upload";
  170. //获取已选片信息接口地址
  171. string getSelectPhotoInfoUrl = domainNameUrl + "/order/get_customer_pick";
  172. //获取看样信息接口地址
  173. string getLookSampleUrl = domainNameUrl + "/order/get_sample_pick";
  174. /// <summary>
  175. /// 重置订单接口
  176. /// </summary>
  177. string reseOrderUrl = domainNameUrl + "/order/reset";
  178. void SetDomainNameUrl(string url)
  179. {
  180. domainNameUrl = "http://" + url;
  181. //上传订单接口地址
  182. uploadOrderInfoUrl = domainNameUrl + "/order/push";
  183. //上传商品接口地址
  184. uploadProductUrl = domainNameUrl + "/product/push";
  185. //上传相片接口地址
  186. uploadPhototUrl = domainNameUrl + "/photo/upload";
  187. //获取已选片信息接口地址
  188. getSelectPhotoInfoUrl = domainNameUrl + "/order/get_customer_pick";
  189. //获取看样信息接口地址
  190. getLookSampleUrl = domainNameUrl + "/order/get_sample_pick";
  191. // 重置订单接口
  192. reseOrderUrl = domainNameUrl + "/order/reset";
  193. }
  194. void frmCloudSelectionFilm_Shown(object sender, EventArgs e)
  195. {
  196. try
  197. {
  198. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  199. {
  200. LYFZ.Model.Model_ErpSystemConfigure scModel = configBll.GetModel("CloudSelectionUrl");
  201. if (scModel != null && scModel.ID > 0)
  202. {
  203. if (scModel.Sconfig_Value.Trim() == "121.42.170.207")
  204. {
  205. UpdateCloudSelectionUrl("yxp.lyfz.net");
  206. }
  207. else {
  208. SetDomainNameUrl(scModel.Sconfig_Value);
  209. }
  210. }
  211. });
  212. }
  213. catch { }
  214. try
  215. {
  216. if (this.CloudType == 1)
  217. {
  218. this.panelPhotoList.Hide();
  219. this.dType = Model.Model_ErpOrder.DirectoryType.DesignPiece;
  220. }
  221. }
  222. catch (Exception ex)
  223. {
  224. MessageBoxCustom.Show(ex.Message);
  225. this.Close();
  226. return;
  227. }
  228. initializationInfo();
  229. }
  230. void btnQ_Click(object sender, EventArgs e)
  231. {
  232. this.ucPagerEx1.PageCurrent = 1;
  233. this.ucPagerEx1.Bind();
  234. }
  235. #region 画分页
  236. /// <summary>
  237. /// 画分页
  238. /// </summary>
  239. /// <param name="e"></param>
  240. /// <returns></returns>
  241. private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
  242. {
  243. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  244. DataTable dt = new DataTable();
  245. string CloudLookStatus = "1=1 ";
  246. string FieldName = "";
  247. if (this._CloudType == 0)
  248. {
  249. FieldName = "Ordv_CloudSelectFilmStatus";
  250. }
  251. else
  252. {
  253. FieldName = "Ordv_CloudLookStatus";
  254. }
  255. switch (this.cbxStatus.SelectedIndex)
  256. {
  257. case 0:
  258. CloudLookStatus = String.Format("{0}>0 ", FieldName);
  259. break;
  260. case 1:
  261. CloudLookStatus =String.Format("{0}=1 ",FieldName);
  262. break;
  263. case 2:
  264. CloudLookStatus = String.Format("{0}=2 ", FieldName);
  265. break;
  266. }
  267. string whereStr = CloudLookStatus;
  268. if (this.chkTime.Checked)
  269. {
  270. string fieldTimeName = "";
  271. if (this._CloudType == 0)
  272. {
  273. fieldTimeName = "Ordv_CloudSelectFilmTime";
  274. }
  275. else
  276. {
  277. fieldTimeName = "Ordv_CloudLookTime";
  278. }
  279. long TimeStar = Convert.ToDateTime(String.Format("{0} 00:00:00", this.dtpTimeStar.Value.ToYYYY_MM_dd())).ToJavaScriptTimeStamp();
  280. long TimeEnd = Convert.ToDateTime(String.Format("{0} 23:59:59", this.dtpTimeEnd.Value.ToYYYY_MM_dd())).ToJavaScriptTimeStamp();
  281. whereStr = String.Format("{0} and ({1}>={2} and {1}<={3}) ", CloudLookStatus, fieldTimeName, TimeStar, TimeEnd);
  282. }
  283. if (this.chkTime.Checked)
  284. {
  285. }
  286. if (txtKeyword.Text.Trim().Length > 0)
  287. {
  288. whereStr = CloudLookStatus + " and ([Ordv_Number] like '%" + txtKeyword.Text.Trim() + "%' or [Ord_SinceOrderNumber] like '%" + txtKeyword.Text.Trim() + "%' or [Cus_Name] like '%" + txtKeyword.Text.Trim() + "%' or [Cus_Name_py] like '%" + txtKeyword.Text.Trim() + "%' or [Cus_Telephone] like '%" + txtKeyword.Text.Trim() + "%') ";
  289. }
  290. pageData.TableName = "Vw_CloudSelectList";
  291. pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  292. pageData.PageSize = this.ucPagerEx1.PageSize;
  293. pageData.QueryCondition = whereStr;
  294. pageData.QueryFieldName = "[ID]"
  295. + ",[Ordv_Number]"
  296. + ",[Ord_SinceOrderNumber]"
  297. + ",[Ordv_ViceNumber]"
  298. + ",[Ordv_DigitalNumber]"
  299. + ",[Ordv_SelectedPhotoType]"
  300. + ",[Ordv_FilmSelectionStatus]"
  301. + ",[Ordv_SelectionFilm]"
  302. + ",[Ordv_SelectionDesign]"
  303. + ",[Ordv_CloudSelectFilmStatus]"
  304. + ",[Ordv_CloudLookStatus]"
  305. + ",[Ordv_CloudSelectFilmTime]"
  306. + ",[Ordv_CloudLookTime]"
  307. + ",[Ordv_CloudUniquelyIdentify]"
  308. + ",[Ordv_CloudDesignUniquelyIdentify]"
  309. +",Cus_Name"
  310. +",Cus_Name_py"
  311. +",Cus_Sex_cs"
  312. +",Cus_Telephone"
  313. + ",Ordpg_Sights";
  314. LYFZ.ComponentLibrary.DataGridViewEx.SortedColumnModel sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudSelectFilmStatus", ListSortDirection.Ascending);
  315. if (this._CloudType == 0)
  316. {
  317. sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudSelectFilmStatus", ListSortDirection.Ascending);
  318. }
  319. else
  320. {
  321. sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudLookStatus", ListSortDirection.Ascending);
  322. }
  323. pageData.OrderStr = sortModel.OrderStr.TrimStart();
  324. this.dgvList.Rows.Clear();
  325. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  326. {
  327. DataSet da = pageData.QueryDataTable();
  328. dt = da.Tables[0];
  329. });
  330. if (dt.Rows.Count > 0)
  331. {
  332. for (int t = 0; t < dt.Rows.Count; t++)
  333. {
  334. DataRow drow = dt.Rows[t];
  335. DataGridViewRow row = new DataGridViewRow();
  336. row.CreateCells(this.dgvList);
  337. row.Cells[0].Value = drow["Ordv_Number"];
  338. if (drow["Ord_SinceOrderNumber"] != null && drow["Ord_SinceOrderNumber"].ToString().Trim().Length > 0)
  339. {
  340. row.Cells[0].Value = drow["Ord_SinceOrderNumber"];
  341. }
  342. row.Cells[1].Value = drow["Ordpg_Sights"];
  343. row.Cells[2].Value = drow["Cus_Name"];
  344. row.Cells[3].Value = drow["Cus_Telephone"];
  345. int cloudStatus = 0;
  346. long timeLong = 0;
  347. if (this._CloudType == 0)
  348. {
  349. cloudStatus = Convert.ToInt32(drow["Ordv_CloudSelectFilmStatus"]);
  350. timeLong = Convert.ToInt64(drow["Ordv_CloudSelectFilmTime"]);
  351. }
  352. else {
  353. cloudStatus = Convert.ToInt32(drow["Ordv_CloudLookStatus"]);
  354. timeLong = Convert.ToInt64(drow["Ordv_CloudLookTime"]);
  355. }
  356. row.Cells[4].Value = getCloudSelectStatus(cloudStatus);
  357. if (timeLong > 0)
  358. {
  359. row.Cells[5].Value = timeLong.JavaScriptTimeStampToDateTime();
  360. }
  361. else {
  362. row.Cells[5].Value = "";
  363. }
  364. if (cloudStatus == 2)
  365. {
  366. row.Cells[6].Value = "已同步到订单";
  367. row.Cells[7].Value = "已同步到订单";
  368. }
  369. else {
  370. row.Cells[6].Value = "";
  371. row.Cells[7].Value = "";
  372. }
  373. row.Tag = drow;
  374. this.dgvList.Rows.Add(row);
  375. }
  376. }
  377. try
  378. {
  379. this.ucPagerEx1.TbDataSource = dt;
  380. }
  381. catch { }
  382. return pageData.TotalCount;
  383. }
  384. string getCloudSelectStatus(int status)
  385. {
  386. string remsg = "";
  387. switch (status)
  388. {
  389. case 0:
  390. remsg = "未上传";
  391. break;
  392. case 1:
  393. remsg = "已上传待选";
  394. break;
  395. case 2:
  396. remsg = "已完成云选";
  397. break;
  398. }
  399. return remsg;
  400. }
  401. #endregion
  402. void contextMenuStripEx1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  403. {
  404. string tagValue = e.ClickedItem.Tag.ToString();
  405. switch (tagValue)
  406. {
  407. case "select":
  408. foreach (ListViewItem vItem in this.listPhotoView.SelectedItems)
  409. {
  410. vItem.Checked = true;
  411. }
  412. break;
  413. case "allselect":
  414. foreach (ListViewItem vItem in this.listPhotoView.Items)
  415. {
  416. vItem.Checked = true;
  417. }
  418. break;
  419. case "no":
  420. foreach (ListViewItem vItem in this.listPhotoView.SelectedItems)
  421. {
  422. vItem.Checked = false;
  423. }
  424. break;
  425. case "allno":
  426. foreach (ListViewItem vItem in this.listPhotoView.CheckedItems)
  427. {
  428. vItem.Checked = false;
  429. }
  430. break;
  431. }
  432. }
  433. LYFZ.BLL.BLL_ErpOrderDigital bllOrderDigital = new BLL.BLL_ErpOrderDigital();
  434. void btnSheJiP_Click(object sender, EventArgs e)
  435. {
  436. // if (this.dType != Model.Model_ErpOrder.DirectoryType.DesignPiece)
  437. {
  438. this.dType = Model.Model_ErpOrder.DirectoryType.DesignPiece;
  439. if (this.BindPhotoList()) {
  440. this.lbphotoType.Text = "设计片";
  441. }
  442. }
  443. }
  444. void btnXiuP_Click(object sender, EventArgs e)
  445. {
  446. // if (this.dType != Model.Model_ErpOrder.DirectoryType.EarlyRetouch)
  447. {
  448. this.dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
  449. if (this.BindPhotoList())
  450. {
  451. this.lbphotoType.Text = "初修片";
  452. }
  453. }
  454. }
  455. void btnYuanP_Click(object sender, EventArgs e)
  456. {
  457. // if (this.dType != Model.Model_ErpOrder.DirectoryType.PrimitivePicture)
  458. {
  459. this.dType = Model.Model_ErpOrder.DirectoryType.PrimitivePicture;
  460. if (this.BindPhotoList())
  461. {
  462. this.lbphotoType.Text = "原片";
  463. }
  464. }
  465. }
  466. /// <summary>
  467. /// 获取在线选片或看样接Url地址
  468. /// </summary>
  469. /// <param name="md5Unique"></param>
  470. /// <returns></returns>
  471. string GetCloudLinkUrl(string md5Unique)
  472. {
  473. return domainNameUrl + md5Unique;
  474. }
  475. LYFZ.BLL.BLL_ErpCompanyInfo CompanyInfoBll = new LYFZ.BLL.BLL_ErpCompanyInfo();
  476. LYFZ.Model.Model_ErpCompanyInfo companyModel = new Model.Model_ErpCompanyInfo();
  477. /// <summary>
  478. /// 同步
  479. /// </summary>
  480. /// <param name="sender"></param>
  481. /// <param name="e"></param>
  482. void btnTongBu_Click(object sender, EventArgs e)
  483. {
  484. if (this.dgvList.SelectedRows != null && this.dgvList.SelectedRows.Count > 0)
  485. {
  486. if (MessageBoxCustom.Show("同步云选结果将会用从云服务器上的客户已选信息替换订单中的已选信息,是否确定要同步?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  487. {
  488. int isTongBuOkCount = 0;
  489. foreach (DataGridViewRow gRow in this.dgvList.SelectedRows)
  490. {
  491. if (gRow.Cells["CloudsSelectInfo"].Tag != null)
  492. {
  493. CloudsSelectedResult cResult = (CloudsSelectedResult)gRow.Cells["CloudsSelectInfo"].Tag;
  494. bool isTongBuOK = false;
  495. DataRow dRow = (DataRow)gRow.Tag;
  496. if (this._CloudType == 0)
  497. {
  498. string Ordv_SelectionFilm = "";
  499. if (dRow["Ordv_SelectionFilm"] != null)
  500. {
  501. Ordv_SelectionFilm = dRow["Ordv_SelectionFilm"].ToString();
  502. }
  503. Model.Model_ErpOrder.DirectoryType _dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
  504. if (dRow["Ordv_SelectedPhotoType"] != null)
  505. {
  506. if (dRow["Ordv_SelectedPhotoType"].ToString().Trim().Length > 1)
  507. {
  508. _dType = (Model.Model_ErpOrder.DirectoryType)Enum.Parse(typeof(Model.Model_ErpOrder.DirectoryType), dRow["Ordv_SelectedPhotoType"].ToString());
  509. }
  510. }
  511. isTongBuOK = TongBuCloudsSelectedPhoto(cResult, dRow["Ordv_Number"].ToString(), dRow["Ordv_ViceNumber"].ToString(), Ordv_SelectionFilm, _dType);
  512. }
  513. else {
  514. string Ordv_SelectionDesign = "";
  515. if (dRow["Ordv_SelectionDesign"] != null)
  516. {
  517. Ordv_SelectionDesign = dRow["Ordv_SelectionDesign"].ToString();
  518. }
  519. isTongBuOK = TongBuCloudsLookDesign(cResult, dRow["Ordv_Number"].ToString(), dRow["Ordv_ViceNumber"].ToString(), Ordv_SelectionDesign);
  520. }
  521. if (isTongBuOK)
  522. {
  523. isTongBuOkCount++;
  524. gRow.Cells["Status"].Value = "已同步完成";
  525. gRow.Cells["selectTime"].Value = SDateTime.Now.ToYYYY_MM_dd_HH_mm_ss();
  526. }
  527. else {
  528. gRow.Cells["Status"].Value = "同步失败";
  529. MessageBoxCustom.Show("订单“" + gRow.Cells["Ordv_Number"].Value.ToString() + "”同步失败");
  530. }
  531. }
  532. else {
  533. MessageBoxCustom.Show("选择订单“" + gRow.Cells["Ordv_Number"].Value.ToString() + "”中没有云选信息");
  534. break;
  535. }
  536. }
  537. if (isTongBuOkCount > 0)
  538. {
  539. MessageBoxCustom.Show("已成功同步 "+isTongBuOkCount.ToString()+" 个订单");
  540. }
  541. }
  542. }
  543. else {
  544. MessageBoxCustom.Show("请选择要同步云选结果的订单");
  545. }
  546. }
  547. /// <summary>
  548. /// 同步去选片结果
  549. /// </summary>
  550. /// <param name="cResult"></param>
  551. /// <returns></returns>
  552. bool TongBuCloudsSelectedPhoto(CloudsSelectedResult cResult, string Ordv_Number, string Ordv_ViceNumber, string Ordv_SelectionFilm, Model.Model_ErpOrder.DirectoryType _dType)
  553. {
  554. bool retOK = false;
  555. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  556. {
  557. backgroundWorker.ReportProgress(0,"正在同步云选结果...");
  558. LYFZ.BLL.ProductSelectedPhotoInfo CurrentSelectPhotoInfo = new BLL.ProductSelectedPhotoInfo(Ordv_SelectionFilm, _dType); //读取当前订单已选片信息
  559. if (!string.IsNullOrEmpty(cResult.General_require))
  560. {
  561. CurrentSelectPhotoInfo.CustomerRequest = cResult.General_require;
  562. }
  563. foreach (SelectProduct sProduct in cResult.SelectProductList)
  564. {
  565. LYFZ.BLL.ProductSelectedInfo sPinfo = CurrentSelectPhotoInfo.GetSpecifyProductSelectedInfo(sProduct.Product_id);
  566. if (sPinfo == null)
  567. {
  568. sPinfo = new BLL.ProductSelectedInfo(sProduct.Product_name + "?" + sProduct.Product_id, CurrentSelectPhotoInfo);
  569. CurrentSelectPhotoInfo.AddProduct(sPinfo);
  570. }
  571. sPinfo.ClearOpenVirtualDesign();
  572. try
  573. {
  574. sPinfo.DelAllExplainPhoto();
  575. }
  576. catch { }
  577. sPinfo.SelectedPhotoIList.Clear();
  578. sPinfo.SelectPageList.Clear();
  579. sPinfo.SelectedPhotoIList.AddRange(sProduct.Photo_list);
  580. }
  581. retOK = this.CurrentOrderBll.DAL.AutoSaveSelectionFilm(LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, Ordv_ViceNumber.Trim(), CurrentSelectPhotoInfo.ProductSelectedPhotoInfoString, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, null, null, null);
  582. if (retOK)
  583. {
  584. retOK = bllOrderDigital.UpadateCloudSelectFilmStatus(Ordv_ViceNumber, 2, this._CloudType);
  585. }
  586. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(EnumPublic.SystemLogsType.选片操作日志,
  587. "" + LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "同步了云选片结果[订单号:" + Ordv_Number + "(" + Ordv_ViceNumber + ")]" + this.CurrentSightsName,
  588. LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID,
  589. LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  590. });
  591. return retOK;
  592. }
  593. /// <summary>
  594. /// 同步去看样结果
  595. /// </summary>
  596. /// <param name="cResult"></param>
  597. /// <returns></returns>
  598. bool TongBuCloudsLookDesign(CloudsSelectedResult cResult, string Ordv_Number, string Ordv_ViceNumber, string Ordv_SelectionFilm)
  599. {
  600. bool retOK = false;
  601. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  602. {
  603. backgroundWorker.ReportProgress(0, "正在同步云选结果...");
  604. LYFZ.BLL.ProductSelectedPhotoInfo CurrentSelectDesignPieceInfo = new BLL.ProductSelectedPhotoInfo(Ordv_SelectionFilm, Model.Model_ErpOrder.DirectoryType.DesignPiece);
  605. // 看设计确认OK Text
  606. string lookDesignOKText = "设计确认OK";
  607. // 看设计要修改项的Text
  608. string lookDesignModifyText = "设计需要修改";
  609. #region 初始化
  610. LYFZ.BLL.ProductSelectedInfo lookDesignPinfo = CurrentSelectDesignPieceInfo.GetSpecifyProductSelectedInfo(lookDesignOKText);
  611. if (lookDesignPinfo == null)
  612. {
  613. lookDesignPinfo = new BLL.ProductSelectedInfo(lookDesignOKText, CurrentSelectDesignPieceInfo);
  614. }
  615. CurrentSelectDesignPieceInfo.AddProduct(lookDesignPinfo);
  616. LYFZ.BLL.ProductSelectedInfo lookDesignModifyPinfo = CurrentSelectDesignPieceInfo.GetSpecifyProductSelectedInfo(lookDesignModifyText);
  617. if (lookDesignModifyPinfo == null)
  618. {
  619. lookDesignModifyPinfo = new BLL.ProductSelectedInfo(lookDesignModifyText, CurrentSelectDesignPieceInfo);
  620. }
  621. CurrentSelectDesignPieceInfo.AddProduct(lookDesignModifyPinfo);
  622. #endregion
  623. CurrentSelectDesignPieceInfo.CustomerRequest = cResult.General_require;
  624. int lookDesignModifyCount = 0;
  625. lookDesignPinfo.SelectedPhotoIList.Clear();
  626. lookDesignModifyPinfo.SelectedPhotoIList.Clear();
  627. lookDesignModifyPinfo.DelAllExplainPhoto();
  628. foreach (PhotoLookDesign LookDesign in cResult.PhotoLookDesignList)
  629. {
  630. if (LookDesign.Modify == 1)
  631. {
  632. lookDesignPinfo.AddPhoto(LookDesign.PhotoName);
  633. }
  634. else
  635. {
  636. CurrentSelectDesignPieceInfo.AddPhotoRequest(LookDesign.PhotoName, LookDesign.Modify_note);
  637. lookDesignModifyPinfo.AddPhoto(LookDesign.PhotoName);
  638. lookDesignModifyCount++;
  639. }
  640. }
  641. LYFZ.Model.Model_ErpOrderDigital cDigModel = new Model.Model_ErpOrderDigital();
  642. cDigModel.Ordv_Number = Ordv_Number;
  643. cDigModel.Ordv_ViceNumber = Ordv_ViceNumber;
  644. cDigModel.Ordv_LookDesignName = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
  645. if (lookDesignModifyCount == 0)
  646. {
  647. cDigModel.Ordv_LookDesignStatus = "1";
  648. }
  649. else
  650. {
  651. cDigModel.Ordv_LookDesignStatus = "2";
  652. }
  653. cDigModel.Ordv_LookDesignTime = SDateTime.Now;
  654. cDigModel.Ordv_LookDesignClaim = CurrentSelectDesignPieceInfo.CustomerRequest;
  655. cDigModel.Ordv_DesignValidation = CurrentSelectDesignPieceInfo.ProductSelectedPhotoInfoString;
  656. cDigModel.Ordv_LookDesignDispatchTime = SDateTime.Now;
  657. if (bllOrderDigital.SetLookDesignStatus(cDigModel))
  658. {
  659. retOK = bllOrderDigital.UpadateCloudSelectFilmStatus(Ordv_ViceNumber, 2, this._CloudType);
  660. }
  661. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(EnumPublic.SystemLogsType.选片操作日志,
  662. "" + LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "同步了云看样结果[订单号:" + Ordv_Number + "(" + Ordv_ViceNumber + ")]" + this.CurrentSightsName,
  663. LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID,
  664. LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  665. });
  666. return retOK;
  667. }
  668. /// <summary>
  669. /// 导出
  670. /// </summary>
  671. /// <param name="sender"></param>
  672. /// <param name="e"></param>
  673. void btnDaochu_Click(object sender, EventArgs e)
  674. {
  675. this.dgvList.ExportDataTable();
  676. }
  677. /// <summary>
  678. /// 下载
  679. /// </summary>
  680. /// <param name="sender"></param>
  681. /// <param name="e"></param>
  682. void btnDown_Click(object sender, EventArgs e)
  683. {
  684. if (this.dgvList.SelectedRows != null && this.dgvList.SelectedRows.Count > 0)
  685. {
  686. List<CloudsSelectedResult> CloudsSelectedResultList = new List<CloudsSelectedResult>();
  687. foreach (DataGridViewRow gRow in this.dgvList.SelectedRows)
  688. {
  689. DataRow dRow = (DataRow)gRow.Tag;
  690. if (this._CloudType == 0)
  691. {
  692. CloudsSelectedResultList.Add(new CloudsSelectedResult(dRow["Ordv_CloudUniquelyIdentify"].ToString(), getSelectPhotoInfoUrl, dRow["Ordv_Number"].ToString(), gRow));
  693. }
  694. else {
  695. CloudsSelectedResultList.Add(new CloudsSelectedResult(dRow["Ordv_CloudDesignUniquelyIdentify"].ToString(), getLookSampleUrl, dRow["Ordv_Number"].ToString(), gRow));
  696. }
  697. }
  698. bool isDownOK = false;//是否有下载成功的
  699. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  700. {
  701. backgroundWorker.ReportProgress(0,"正在准备下载...");
  702. int sumCount = CloudsSelectedResultList.Count;
  703. int downCount=1;
  704. foreach (CloudsSelectedResult cResult in CloudsSelectedResultList)
  705. {
  706. backgroundWorker.ReportProgress(0, "正在下载第 " + downCount.ToString() + "/" + sumCount.ToString() + "个...");
  707. string getSelectPhotoInfoData = "access_path=" + cResult.Access_path;
  708. string retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(cResult.GetUrl, getSelectPhotoInfoData,Encoding.UTF8);
  709. dynamic ResultObj = null;
  710. if (retMsg.Contains("\"status\":"))
  711. {
  712. ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
  713. if (ResultObj.status == 0)
  714. {
  715. cResult.IsDownOK = true;
  716. if (this._CloudType == 0)
  717. {
  718. cResult.HandleFilmSelection(ResultObj);
  719. }
  720. else {
  721. cResult.HandleLookDesignSelection(ResultObj);
  722. }
  723. isDownOK = true;
  724. }
  725. else {
  726. MessageBoxCustom.Show("下载订单“" + cResult.Ordv_Number + "”的云结果失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
  727. }
  728. }
  729. else {
  730. if (!isCloudSelectionUrlOK)
  731. {
  732. string newUrl = GetNewCloudSelectionUrl();
  733. if (newUrl.Trim().Length > 0)
  734. {
  735. SetDomainNameUrl(newUrl);
  736. }
  737. }
  738. MessageBoxCustom.Show("下载订单“" + cResult.Ordv_Number + "”的云结果失败[域名:" + domainNameUrl.Replace("http://", "") + "]:" + retMsg, backgroundWorker: backgroundWorker);
  739. return;
  740. }
  741. downCount++;
  742. }
  743. });
  744. if (isDownOK)
  745. {
  746. foreach (CloudsSelectedResult cResult in CloudsSelectedResultList)
  747. {
  748. if (this._CloudType == 0)
  749. {
  750. cResult.GRow.Cells["CloudsSelectInfo"].Value = cResult.GetSelectProductListToString();
  751. }
  752. else {
  753. cResult.GRow.Cells["CloudsSelectInfo"].Value = cResult.GetPhotoLookDesignListToString();
  754. }
  755. cResult.GRow.Cells["CloudsSelectInfo"].Tag = cResult;
  756. cResult.GRow.Cells["CustomerRequest"].Value = cResult.General_require;
  757. if (cResult.CloudsSelectedStatus)
  758. {
  759. if (this._CloudType == 0)
  760. {
  761. cResult.GRow.Cells["Status"].Value = "【已完成选片】待同步";
  762. }
  763. else {
  764. cResult.GRow.Cells["Status"].Value = "【已完成确认】待同步";
  765. }
  766. }
  767. else {
  768. if ((cResult.GRow.Cells["CloudsSelectInfo"].Value != null && cResult.GRow.Cells["CloudsSelectInfo"].Value.ToString().Length > 0) || cResult.General_require.Trim().Length>0)
  769. {
  770. if (this._CloudType == 0)
  771. {
  772. cResult.GRow.Cells["Status"].Value = "【选片中】";
  773. }
  774. else
  775. {
  776. cResult.GRow.Cells["Status"].Value = "【看样中】";
  777. }
  778. }
  779. }
  780. }
  781. }
  782. }
  783. else {
  784. MessageBoxCustom.Show("请选择要下载的云选结果的订单");
  785. }
  786. }
  787. int GetCheckToInt(ComponentLibrary.CheckBoxEx chk)
  788. {
  789. if (chk.Checked)
  790. {
  791. return 1;
  792. }
  793. else {
  794. return 0;
  795. }
  796. }
  797. LYFZ.BLL.BLL_SMSTemplates smsBLL = new BLL.BLL_SMSTemplates();
  798. LYFZ.Model.Model_SMSTemplates GetSmsSMSTemplatesModel()
  799. {
  800. List<LYFZ.Model.Model_SMSTemplates> smsModelList = null;
  801. string ST_SendEvent = "";
  802. if (this.CloudType == 0)
  803. {
  804. ST_SendEvent = ((int)EnumPublic.SmsSendEvent.客户云选片完成后发通知短信).ToString();
  805. }
  806. else
  807. {
  808. ST_SendEvent = ((int)EnumPublic.SmsSendEvent.客户云看样完成后发通知短信).ToString();
  809. }
  810. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  811. {
  812. smsModelList = smsBLL.GetModelList("ST_Type=" + ((int)EnumPublic.SmsTemplateType.事件短信).ToString() + " and ST_Category=" + ((int)EnumPublic.SmsCategory.公共短信).ToString() + " and ST_DividedShop='" + LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID.Trim() + "' and ST_SendEvent=" + ST_SendEvent + " ");
  813. });
  814. if (smsModelList != null && smsModelList.Count > 0)
  815. {
  816. return smsModelList[0];
  817. }
  818. else
  819. {
  820. return null;
  821. }
  822. }
  823. /// <summary>
  824. /// 获取短信内容
  825. /// </summary>
  826. /// <param name="smsTemp"></param>
  827. /// <returns></returns>
  828. string GetSMSContent(LYFZ.Model.Model_SMSTemplates smsTemp)
  829. {
  830. // [Description("说明:XXX 为客户姓名;XXZ 为订单号;XXN 为套系名称;XXT 为选片完成时间")]
  831. string retContent = smsTemp.ST_SMSContent.Replace("XXX", this.lbCName.Text.Trim()).Replace("xxx", this.lbCName.Text.Trim())
  832. .Replace("XXZ", this.OrderModel.Ord_Number).Replace("xxz", this.OrderModel.Ord_Number)
  833. .Replace("XXN", this.OrderModel.Ord_Number).Replace("xxn", this.OrderModel.Ord_Number);
  834. return retContent;
  835. }
  836. void btnUpLoad_Click(object sender, EventArgs e)
  837. {
  838. //上传订单信息
  839. /*1.unique_id M 全局唯一标识
  840. 2.order_num M 订单编号
  841. 3.source O 上传选片订单时不传,上传选样订单时必传且值为sample
  842. 4.customer_name O 顾客姓名
  843. 5.customer_phone O 顾客联系电话
  844. 6.studio_name O 影楼名称
  845. 7.studio_phone O 影楼电话
  846. 8.scene_name O 套系/景点名称
  847. */
  848. if (this.OrderDigital.Ordv_CloudSelectFilmStatus > 0)
  849. {
  850. if (MessageBoxCustom.Show("当前订单已经上传过云选片信息,您确定要重新上传并重置云选片状态吗?", msgBoxButton: MessageBoxButtons.YesNo)!= System.Windows.Forms.DialogResult.Yes)
  851. {
  852. return;
  853. }
  854. }
  855. string sampleValue="";
  856. string product_list = "";
  857. if (this.CloudType == 1)
  858. {
  859. sampleValue = "sample";
  860. }
  861. else {
  862. if (this.chkSPList.SelectedItems.Count <= 0)
  863. {
  864. MessageBoxCustom.Show("请选择要上传的商品");
  865. return;
  866. }
  867. else {
  868. product_list = GetProduct_listToJson();
  869. }
  870. }
  871. List<string> uploadPhotoList = new List<string>();
  872. if (this.listPhotoView.CheckedItems.Count <= 0)
  873. {
  874. MessageBoxCustom.Show("请选择要上传的相片");
  875. return;
  876. }
  877. else
  878. {
  879. foreach (ListViewItem vItem in this.listPhotoView.CheckedItems)
  880. {
  881. string photoPath = LYFZ.BLL.SelectPhotoHandling.SmallPathToPreviewPath(vItem.Tag.ToString());
  882. string photoName = vItem.Text.Trim();
  883. uploadPhotoList.Add(photoPath + "|" + photoName);
  884. }
  885. }
  886. string message_account = "";
  887. string message_password = "";
  888. string notify_tels = "";
  889. string message_content = "";
  890. LYFZ.Model.Model_SMSTemplates SMSTemplatesModel = GetSmsSMSTemplatesModel();
  891. if (SMSManagement.frmSMSTemplateSet.CurrentSmsAccount != null&& SMSTemplatesModel!=null)
  892. {
  893. message_account = SMSManagement.frmSMSTemplateSet.CurrentSmsAccount.Smsa_AccountNumber;
  894. message_password= SMSManagement.frmSMSTemplateSet.CurrentSmsAccount.Smsa_Password;
  895. notify_tels = SMSTemplatesModel.ST_ReceiveObjects;
  896. message_content = GetSMSContent(SMSTemplatesModel);
  897. }
  898. /*
  899. notify_tels, 通知人
  900. message_account,短信账号
  901. message_password,短信密码
  902. message_content 短信内容 XXT替换成时间
  903. */
  904. string uploadOrderInfoData = "unique_id=" + this.unique_id
  905. + "&order_num=" + UrlEncod_UTF8(this.OrderModel.Ord_Number)
  906. + "&source=" + UrlEncod_UTF8(sampleValue)
  907. + "&customer_name=" + UrlEncod_UTF8(this.lbCName.Text.Trim())
  908. + "&customer_phone=" + UrlEncod_UTF8(GetCustomerTelephone())
  909. + "&studio_name=" + UrlEncod_UTF8(this.companyModel.Company_Name)
  910. + "&studio_phone=" + this.companyModel.Company_Telephone
  911. + "&is_shuffle=" + this.chkPhotoRandomShuffle.Checked.BoolToInt().ToString()
  912. + "&scene_name=" + UrlEncod_UTF8(this.lbName.Text)
  913. + "&message_account=" + UrlEncod_UTF8(message_account)
  914. + "&message_password=" + UrlEncod_UTF8(message_password)
  915. + "&notify_tels=" + UrlEncod_UTF8(notify_tels)
  916. + "&message_content=" + UrlEncod_UTF8(message_content);
  917. string reseOrderPostData = "unique_id="+this.unique_id
  918. + "&is_removed_photo=" + this.chkdelPhoto.Checked.BoolToInt().ToString()
  919. + "&is_removed_product=" + this.chkdelcommodity.Checked.BoolToInt().ToString();
  920. dynamic ResultObj = null;
  921. string retMsg = "";
  922. string uploadOrderAccess_Path = "";//订单信息上传成功后返回的唯一标识ID
  923. bool isUploadOK = false;//是否上传成功
  924. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  925. {
  926. try
  927. {
  928. backgroundWorker.ReportProgress(0, "正在上传订单信息...");
  929. //重置订单云选片状态 或 删除产品和相片
  930. retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(reseOrderUrl, reseOrderPostData);
  931. retMsg =LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(uploadOrderInfoUrl, uploadOrderInfoData);
  932. if (retMsg.Contains("\"status\":"))
  933. {
  934. ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
  935. if (ResultObj.status == 0)
  936. {
  937. uploadOrderAccess_Path = ResultObj.data;
  938. //如果是在线选片时上传商品
  939. if (this._CloudType == 0)
  940. {
  941. string uploadProductData = "unique_id=" + this.unique_id
  942. + "&product_list=" + product_list;
  943. backgroundWorker.ReportProgress(0, "正在上传产品...");
  944. retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(uploadProductUrl, uploadProductData);
  945. if (retMsg.Contains("\"status\":"))
  946. {
  947. ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
  948. if (ResultObj.status != 0)
  949. {
  950. MessageBoxCustom.Show("上传产品失败:" + ResultObj.data, backgroundWorker: backgroundWorker);
  951. return;
  952. }
  953. }
  954. else
  955. {
  956. MessageBoxCustom.Show("上传产品失败:" + retMsg, backgroundWorker: backgroundWorker);
  957. return;
  958. }
  959. }
  960. //上传相片
  961. isUploadOK = true;
  962. int uploadCount=0;
  963. foreach (string photoItem in uploadPhotoList)
  964. {
  965. string photoPath =photoItem.Split('|')[0];
  966. Bitmap bmp= LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(photoPath,640,960);
  967. photoPath= LYFZ.ImageFunction.ThumbImgae.SaveTemporaryCompressionImage(bmp, System.IO.Path.GetFileName(photoPath));
  968. string photoName = photoItem.Split('|')[1];
  969. uploadCount++;
  970. if (UploadPhoto(photoPath, photoName))
  971. {
  972. backgroundWorker.ReportProgress(0, "正在上传相片[" + uploadCount.ToString() + "/" + uploadPhotoList.Count.ToString() + "]...");
  973. LYFZ.ImageFunction.ThumbImgae.DeleteTemporaryCompressionImage(photoPath);
  974. }
  975. else {
  976. isUploadOK = false;
  977. retMsg = "上传" + photoName + "相片时失败";
  978. // MessageBoxCustom.Show("上传" + photoName + "相片时失败", backgroundWorker: backgroundWorker);
  979. return;
  980. }
  981. }
  982. backgroundWorker.ReportProgress(0, "上传完成...");
  983. }
  984. else
  985. {
  986. MessageBoxCustom.Show("上传订单信息失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
  987. }
  988. }
  989. else {
  990. if (!isCloudSelectionUrlOK)
  991. {
  992. string newUrl = GetNewCloudSelectionUrl();
  993. if (newUrl.Trim().Length > 0)
  994. {
  995. SetDomainNameUrl(newUrl);
  996. }
  997. }
  998. MessageBoxCustom.Show("上传订单信息失败[域名:" + domainNameUrl.Replace("http://","") + "]:" + retMsg, backgroundWorker: backgroundWorker);
  999. }
  1000. }
  1001. catch(Exception ex) {
  1002. retMsg = ex.Message;
  1003. isUploadOK = false;
  1004. }
  1005. });
  1006. if (isUploadOK)
  1007. {
  1008. this.lbState.Text = "已上传";
  1009. CreateCode_Choose(uploadOrderAccess_Path);
  1010. if (this._CloudType == 0)
  1011. {
  1012. this.OrderDigital.Ordv_CloudSelectFilmStatus = 1;
  1013. this.OrderDigital.Ordv_CloudUniquelyIdentify = uploadOrderAccess_Path;
  1014. this.OrderDigital.Ordv_CloudSelectFilmTime = SDateTime.Now.ToJavaScriptTimeStamp();
  1015. }
  1016. else
  1017. {
  1018. this.OrderDigital.Ordv_CloudLookStatus = 1;
  1019. this.OrderDigital.Ordv_CloudDesignUniquelyIdentify = uploadOrderAccess_Path;
  1020. this.OrderDigital.Ordv_CloudLookTime = SDateTime.Now.ToJavaScriptTimeStamp();
  1021. }
  1022. bllOrderDigital.UpadateCloudSelectFilmStatus(this.OrderDigital.Ordv_ViceNumber, this.OrderDigital);
  1023. MessageBoxCustom.Show("上传成功");
  1024. }
  1025. else {
  1026. MessageBoxCustom.Show("失败:" + retMsg);
  1027. }
  1028. }
  1029. bool UploadPhoto(string photo, string photoMark, BackgroundWorker backgroundWorker=null)
  1030. {
  1031. bool ret = false;
  1032. /* 1.unique_id M 全局唯一标识
  1033. 2. img M 照片数据
  1034. 3.img_name M 照片名称
  1035. 4.scene_name O 套系/景点名称*/
  1036. System.Collections.Specialized.NameValueCollection Nvalues = new System.Collections.Specialized.NameValueCollection();
  1037. Nvalues.Add("unique_id", this.unique_id);
  1038. Nvalues.Add("img_name", photoMark);
  1039. Nvalues.Add("scene_name", "");
  1040. List<LYFZ.WinAPI.UploadFile> ufileList = new List<WinAPI.UploadFile>();
  1041. LYFZ.WinAPI.UploadFile ufile = new WinAPI.UploadFile();
  1042. ufile.Name = "img";
  1043. ufile.Filename = photo;
  1044. ufile.Data = GetImageByte(photo);
  1045. ufileList.Add(ufile);
  1046. dynamic ResultObj = null;
  1047. string retMsg = LYFZ.WinAPI.CustomPublicMethod.FormOrDataPost(uploadPhototUrl, ufileList,Nvalues,Encoding.UTF8);
  1048. if (retMsg.Contains("\"status\":"))
  1049. {
  1050. ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
  1051. if (ResultObj.status == 0)
  1052. {
  1053. ret = true;
  1054. }
  1055. else {
  1056. MessageBoxCustom.Show("上传相片失败:" + ResultObj.data, backgroundWorker: backgroundWorker);
  1057. }
  1058. }
  1059. else
  1060. {
  1061. MessageBoxCustom.Show("上传相片时失败:" + retMsg, backgroundWorker: backgroundWorker);
  1062. }
  1063. return ret;
  1064. }
  1065. /// <summary>
  1066. /// 水印文字
  1067. /// </summary>
  1068. string WatermarkText = "";
  1069. byte[] GetImageByte(string photo)
  1070. {
  1071. byte[] imageData = null;
  1072. Bitmap uImage = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(photo);
  1073. Bitmap sImage = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(uImage,1024,768);
  1074. DrawingWatermarkText(sImage,WatermarkText);
  1075. string fileFullPath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + "Temp\\UploadFile\\" + System.IO.Path.GetFileName(photo);
  1076. if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(fileFullPath)))
  1077. {
  1078. try
  1079. {
  1080. System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fileFullPath));
  1081. }
  1082. catch { }
  1083. }
  1084. LYFZ.ImageFunction.ThumbImgae.SaveIamge(sImage, 80, fileFullPath);
  1085. sImage.Dispose();
  1086. uImage.Dispose();
  1087. imageData = File.ReadAllBytes(fileFullPath);
  1088. if (System.IO.File.Exists(fileFullPath))
  1089. {
  1090. System.IO.File.Delete(fileFullPath);
  1091. }
  1092. return imageData;
  1093. }
  1094. /// <summary>
  1095. /// 画水印文字
  1096. /// </summary>
  1097. /// <param name="img"></param>
  1098. /// <param name="watermark"></param>
  1099. void DrawingWatermarkText(Bitmap img, string watermark)
  1100. {
  1101. using (Graphics g = Graphics.FromImage(img))
  1102. {
  1103. Brush brush = Brushes.Gray;
  1104. float fsiz =Convert.ToSingle(img.Width * 0.03);
  1105. Font font = new Font("微软雅黑", fsiz);
  1106. SizeF fsize = g.MeasureString(watermark, font);
  1107. g.DrawString(watermark, font, brush, new PointF(img.Width - fsize.Width - 10, img.Height - fsiz-20));
  1108. Brush brush2 = Brushes.WhiteSmoke;
  1109. g.DrawString(watermark, font, brush2, new PointF(img.Width - fsize.Width - 12, img.Height - fsiz - 22));
  1110. }
  1111. }
  1112. string GetProduct_listToJson() {
  1113. string retJson = "";
  1114. /* 1.unique_id M 全局唯一标识
  1115. 2.product_list M json字符串格式的商品列表,其中每个商品信息包含的字段 如下
  1116. 2.1 product_id M 商品id
  1117. 2.2 name M 商品名称
  1118. 2.3 num M 商品数量
  1119. 2.4 unit_price O 商品单价
  1120. 2.5 OptionalNumber M 商品最大可选相片张数 -1 为不限制张数 0 - 9999??? 为限制的张数
  1121. */
  1122. /*dynamic tMParameters = new System.Dynamic.ExpandoObject();
  1123. tMParameters.product_id = product.OPlist_UniquelyIdentity;
  1124. tMParameters.name = product.OPlist_ProdName;
  1125. tMParameters.num = product.OPlist_ProdQuantity.ToString();
  1126. tMParameters.unit_price = product.OPlist_ProdSoldPrice.ToString("n2");*/
  1127. List<dynamic> ProductList = new List<dynamic>();
  1128. foreach (ItemValue item in this.chkSPList.CheckedItems)
  1129. {
  1130. int OptionalNumber =Convert.ToInt32(item.Tag.ToString());
  1131. LYFZ.Model.Model_ErpOrderProductList product = (LYFZ.Model.Model_ErpOrderProductList)item.Value;
  1132. dynamic tMParameters = new {
  1133. product_id = UrlEncod_UTF8(product.OPlist_UniquelyIdentity),//(1+product.ID).ToString(),
  1134. name = UrlEncod_UTF8(product.OPlist_ProdName),
  1135. num = product.OPlist_ProdQuantity.ToString(),
  1136. unit_price = product.OPlist_ProdSoldPrice.ToString("0.00"),
  1137. OptionalNumber= OptionalNumber
  1138. };
  1139. ProductList.Add(tMParameters);
  1140. }
  1141. retJson = Codeplex.Data.DynamicJson.Serialize(ProductList);
  1142. return retJson;
  1143. }
  1144. public static string UrlEncod_UTF8(string unicodeString)
  1145. {
  1146. /* UTF8Encoding utf8 = new UTF8Encoding();
  1147. Byte[] encodedBytes = utf8.GetBytes(unicodeString);
  1148. String decodedString = utf8.GetString(encodedBytes);*/
  1149. if (!String.IsNullOrEmpty(unicodeString))
  1150. {
  1151. return System.Web.HttpUtility.UrlEncode(unicodeString, Encoding.UTF8);
  1152. }
  1153. else {
  1154. return "";
  1155. }
  1156. }
  1157. LYFZ.BLL.BLL_ErpCustomerGroup bllCGroup = new LYFZ.BLL.BLL_ErpCustomerGroup();
  1158. LYFZ.BLL.BLL_ErpCustomerGroupMembers bllGmember = new LYFZ.BLL.BLL_ErpCustomerGroupMembers();
  1159. LYFZ.BLL.BLL_ErpCustomer cusBll = new BLL.BLL_ErpCustomer();
  1160. string GetCustomerTelephone()
  1161. {
  1162. string User_Telephone = "";
  1163. LYFZ.Model.Model_ErpCustomerGroup cgroupModel = bllCGroup.GetModel("GP_OrderNumber", OrderModel.Ord_Number.Trim());
  1164. if (cgroupModel.ID > 0)
  1165. {
  1166. List<LYFZ.Model.Model_ErpCustomerGroupMembers> GmemberModelList = bllGmember.GetModelList("GM_CustomerGroupID='" + cgroupModel.GP_CustomerGroupID + "'");
  1167. foreach (LYFZ.Model.Model_ErpCustomerGroupMembers gmemberModel in GmemberModelList)
  1168. {
  1169. LYFZ.Model.Model_ErpCustomer modelCustomer = (LYFZ.Model.Model_ErpCustomer)cusBll.GetModelObject("Cus_CustomerNumber", gmemberModel.GM_CustomerID);
  1170. if (modelCustomer != null && modelCustomer.ID > 0 && modelCustomer.Cus_Telephone.Length >= 11)
  1171. {
  1172. User_Telephone += modelCustomer.Cus_Telephone.Trim() + ",";
  1173. }
  1174. }
  1175. }
  1176. return User_Telephone.Trim(',');
  1177. }
  1178. void btnSendSms_Click(object sender, EventArgs e)
  1179. {
  1180. string User_Telephone = GetCustomerTelephone();
  1181. LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms sendSms = new LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms();
  1182. /* LYFZ.Model.Model_ErpCustomerGroup cgroupModel = bllCGroup.GetModel("GP_OrderNumber", OrderModel.Ord_Number.Trim());
  1183. if (cgroupModel.ID > 0)
  1184. {
  1185. List<LYFZ.Model.Model_ErpCustomerGroupMembers> GmemberModelList = bllGmember.GetModelList("GM_CustomerGroupID='" + cgroupModel.GP_CustomerGroupID + "'");
  1186. foreach (LYFZ.Model.Model_ErpCustomerGroupMembers gmemberModel in GmemberModelList)
  1187. {
  1188. LYFZ.Model.Model_ErpCustomer modelCustomer = (LYFZ.Model.Model_ErpCustomer)cusBll.GetModelObject("Cus_CustomerNumber", gmemberModel.GM_CustomerID);
  1189. if (modelCustomer != null && modelCustomer.ID > 0 && modelCustomer.Cus_Telephone.Length >= 11)
  1190. {
  1191. User_Telephone+=modelCustomer.Cus_Telephone.Trim()+",";
  1192. }
  1193. }
  1194. }*/
  1195. string tempLawfulPhone = "";
  1196. LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(User_Telephone.Trim(','), ref tempLawfulPhone);
  1197. if (tempLawfulPhone.Trim().Length >= 11)
  1198. {
  1199. sendSms.Phone = tempLawfulPhone.Trim(',');
  1200. string tempTypeStr = "选片";
  1201. if (this._CloudType == 0)
  1202. {
  1203. tempTypeStr = "选片";
  1204. }
  1205. else
  1206. {
  1207. tempTypeStr = "看样";
  1208. }
  1209. string smsText = this.lbCName.Text + "您好,您的在线" + tempTypeStr + "地址是:" + GetCloudLinkUrl(CloudUniquelyIdentify);
  1210. sendSms.SetDefaultSmsText(smsText);
  1211. sendSms.ShowDialog();
  1212. }
  1213. else {
  1214. MessageBoxCustom.Show("系统检测到客户手机号不正确" + User_Telephone.Trim(','));
  1215. }
  1216. }
  1217. LYFZ.EnumPublic.OrderType currentOrderType = EnumPublic.OrderType.婚纱订单;
  1218. /// <summary>
  1219. /// 当前订单类型
  1220. /// </summary>
  1221. public LYFZ.EnumPublic.OrderType CurrentOrderType
  1222. {
  1223. get { return currentOrderType; }
  1224. set { currentOrderType = value; }
  1225. }
  1226. string _MainOrderNumber = "";
  1227. public string MainOrderNumber
  1228. {
  1229. get { return _MainOrderNumber; }
  1230. set { _MainOrderNumber = value; }
  1231. }
  1232. string _ViceOrderNumber = "";
  1233. /// <summary>
  1234. ///
  1235. /// </summary>
  1236. public string ViceOrderNumber
  1237. {
  1238. get { return _ViceOrderNumber; }
  1239. set { _ViceOrderNumber = value; }
  1240. }
  1241. string CurrentSightsName = "";
  1242. string CloudUniquelyIdentify = "";
  1243. void initializationInfo()
  1244. {
  1245. if (ShowType > 0)
  1246. {
  1247. this.tbList.TabPages.Remove(this.tbUpload);
  1248. return;
  1249. }
  1250. else {
  1251. if (ShowType == 0)
  1252. {
  1253. this.tbList.TabPages.Remove(this.tbDown);
  1254. }
  1255. }
  1256. if (MainOrderNumber.Trim().Length <= 0 || ViceOrderNumber.Trim().Length<=0)
  1257. {
  1258. MessageBoxCustom.Show("订单号不能为空!");
  1259. this.Close();
  1260. return;
  1261. }
  1262. bool isLoad = false;
  1263. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  1264. {
  1265. try
  1266. {
  1267. OrderModel = currentOrderBll.GetModel("Ord_Number", MainOrderNumber);
  1268. OrderDigital = bllOrderDigital.GetModel("Ordv_ViceNumber", ViceOrderNumber);
  1269. isLoad = true;
  1270. }
  1271. catch {
  1272. MessageBoxCustom.Show("加载订单信息失败");
  1273. return;
  1274. }
  1275. this.CurrentOrderType = (LYFZ.EnumPublic.OrderType)Convert.ToInt32(this.OrderModel.Ord_Type);
  1276. this.CurrentSelectPhotoHandling = new BLL.SelectPhotoHandling(this.OrderModel, this.OrderDigital);
  1277. InitializedSelectionFilmInfo();
  1278. if (CurrentOrderType == EnumPublic.OrderType.儿童订单)
  1279. {
  1280. //摄影表
  1281. LYFZ.BLL.BLL_ErpOrdersPhotography photoBll = new BLL.BLL_ErpOrdersPhotography();
  1282. List<LYFZ.Model.Model_ErpOrdersPhotography> photoModelList = photoBll.GetViceNumberToModel(this.OrderDigital.Ordv_ViceNumber);
  1283. this.CurrentSightsName = photoModelList[0].Ordpg_Sights;
  1284. }
  1285. DataTable dt = CompanyInfoBll.GetList("Company_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "'").Tables[0];
  1286. if (dt.Rows.Count > 0)
  1287. {
  1288. companyModel = CompanyInfoBll.DataRowToModel(dt.Rows[0]);
  1289. }
  1290. });
  1291. if (!isLoad)
  1292. {
  1293. this.Close();
  1294. return;
  1295. }
  1296. this.unique_id = LYFZ.WinAPI.SDKSecurity.MD5Encrypt("BJ_V1.1" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.SoftwareInfo.LockShortID.ToString() + this._CloudType.ToString() + OrderModel.ID.ToString() + _OrderModel.Ord_Number + _OrderDigital.ID.ToString() + _OrderDigital.Ordv_ViceNumber);
  1297. this.lbOrderNum.Text = MainOrderNumber.Trim();
  1298. if (OrderModel.Ord_SinceOrderNumber.Trim().Length > 0)
  1299. {
  1300. this.lbOrderNum.Text = OrderModel.Ord_SinceOrderNumber.Trim();
  1301. }
  1302. this.WatermarkText = this.companyModel.Company_Name;
  1303. string ordTypeStr = "";
  1304. switch (OrderModel.Ord_Type)
  1305. {
  1306. case "0": ordTypeStr = "婚纱"; break;
  1307. case "1": ordTypeStr = "儿童[" + this.CurrentSightsName + "]"; break;
  1308. case "2": ordTypeStr = "写真"; break;
  1309. case "3": ordTypeStr = "服务"; break;
  1310. case "4": ordTypeStr = "婚庆"; break;
  1311. }
  1312. this.lbName.Text = ordTypeStr;
  1313. this.lbCName.Text = cusBll.GetCustomerNameList(this.OrderModel.Ord_Number, ",");
  1314. this.lbTXName.Text = this.OrderModel.Ord_SeriesName;
  1315. string stateStr = "";
  1316. int cloudState = this.OrderDigital.Ordv_CloudSelectFilmStatus;
  1317. CloudUniquelyIdentify = this.OrderDigital.Ordv_CloudUniquelyIdentify;
  1318. if (this._CloudType == 1)
  1319. {
  1320. cloudState = this.OrderDigital.Ordv_CloudLookStatus;
  1321. CloudUniquelyIdentify = this.OrderDigital.Ordv_CloudDesignUniquelyIdentify;
  1322. }
  1323. switch (cloudState)
  1324. {
  1325. case 0:
  1326. stateStr = "未上传";
  1327. break;
  1328. case 1:
  1329. stateStr = "已上传";
  1330. break;
  1331. case 2:
  1332. stateStr = "已完成";
  1333. break;
  1334. }
  1335. if (cloudState > 0)
  1336. {
  1337. this.chkdelPhoto.Show();
  1338. if (this._CloudType == 0)
  1339. {
  1340. this.chkdelcommodity.Show();
  1341. }
  1342. }
  1343. else {
  1344. this.chkdelPhoto.Hide();
  1345. this.chkdelcommodity.Hide();
  1346. }
  1347. this.lbState.Text = stateStr;
  1348. CreateCode_Choose(CloudUniquelyIdentify);
  1349. BindProductList();
  1350. if (this._CloudType == 1)
  1351. {
  1352. BindPhotoList();
  1353. }
  1354. }
  1355. List<LYFZ.Model.Model_ErpOrderProductList> currentOrderProductList = new List<Model.Model_ErpOrderProductList>();
  1356. /// <summary>
  1357. /// 获取当前订单制作商品集合
  1358. /// </summary>
  1359. public List<LYFZ.Model.Model_ErpOrderProductList> CurrentOrderProductList
  1360. {
  1361. get { return currentOrderProductList; }
  1362. set { currentOrderProductList = value; }
  1363. }
  1364. LYFZ.BLL.BLL_ErpOrder currentOrderBll = new BLL.BLL_ErpOrder();
  1365. /// <summary>
  1366. /// 当前订单业务处理类
  1367. /// </summary>
  1368. public LYFZ.BLL.BLL_ErpOrder CurrentOrderBll
  1369. {
  1370. get { return currentOrderBll; }
  1371. set { currentOrderBll = value; }
  1372. }
  1373. LYFZ.BLL.SelectPhotoHandling currentSelectPhotoHandling = null;
  1374. /// <summary>
  1375. /// 当前订单选片处理对象
  1376. /// </summary>
  1377. public LYFZ.BLL.SelectPhotoHandling CurrentSelectPhotoHandling
  1378. {
  1379. get { return currentSelectPhotoHandling; }
  1380. set { currentSelectPhotoHandling = value; }
  1381. }
  1382. /// <summary>
  1383. /// 当前选择的选片类型
  1384. /// </summary>
  1385. Model.Model_ErpOrder.DirectoryType _dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
  1386. /// <summary>
  1387. /// 当前选择的选片类型
  1388. /// </summary>
  1389. public Model.Model_ErpOrder.DirectoryType dType
  1390. {
  1391. get { return _dType; }
  1392. set { _dType = value; }
  1393. }
  1394. /// <summary>
  1395. /// 初始化选片信息
  1396. /// </summary>
  1397. void InitializedSelectionFilmInfo()
  1398. {
  1399. this.CurrentOrderProductList = this.CurrentOrderBll.GetOrderProductList(this._OrderDigital.Ordv_Number, this._OrderDigital.Ordv_ViceNumber, DAL.OrderProductType.制作商品); //读取当前订单已选片信息
  1400. }
  1401. /// <summary>
  1402. /// 绑定产品
  1403. /// </summary>
  1404. void BindProductList()
  1405. {
  1406. if (this.CloudType == 0)
  1407. {
  1408. foreach (LYFZ.Model.Model_ErpOrderProductList productModel in this.CurrentOrderProductList)
  1409. {
  1410. ItemValue itemProduct = new ItemValue(productModel, productModel.OPlist_ProdName);
  1411. itemProduct.Tag = -1;
  1412. this.chkSPList.Items.Add(itemProduct);
  1413. }
  1414. LYFZ.Model.Model_ErpOrderProductList IntoFilmModel = new Model.Model_ErpOrderProductList();
  1415. IntoFilmModel.ID = Int32.MaxValue;
  1416. IntoFilmModel.OPlist_ProdName = LYFZ.BLL.SelectPhotoHandling.IntoFilmText;
  1417. IntoFilmModel.OPlist_UniquelyIdentity = IntoFilmModel.OPlist_ProdName;
  1418. ItemValue itemProductIntoFilm = new ItemValue(IntoFilmModel, IntoFilmModel.OPlist_ProdName);
  1419. itemProductIntoFilm.Tag = OrderDigital.Ordv_IntoBottomQuantity;
  1420. this.chkSPList.Items.Add(itemProductIntoFilm);
  1421. LYFZ.Model.Model_ErpOrderProductList IntoBookModel = new Model.Model_ErpOrderProductList();
  1422. IntoBookModel.ID = Int32.MaxValue - 1;
  1423. IntoBookModel.OPlist_ProdName = LYFZ.BLL.SelectPhotoHandling.IntoBookText;
  1424. IntoBookModel.OPlist_UniquelyIdentity = IntoBookModel.OPlist_ProdName;
  1425. ItemValue itemProductIntoBook = new ItemValue(IntoBookModel, IntoBookModel.OPlist_ProdName);
  1426. itemProductIntoBook.Tag = OrderDigital.Ordv_IntoRegisterQuantity;
  1427. this.chkSPList.Items.Add(itemProductIntoBook);
  1428. }
  1429. else {
  1430. this.grpSP.Hide();
  1431. }
  1432. }
  1433. /// <summary>
  1434. /// 是否用本地缓存相片进行选片?
  1435. /// </summary>
  1436. bool isLocalPhoto = false;
  1437. List<string> smallPhotoFileList = new List<string>();
  1438. /// <summary>
  1439. /// 缩略图文件路径集合
  1440. /// </summary>
  1441. public List<string> SmallPhotoFileList
  1442. {
  1443. get
  1444. {
  1445. return smallPhotoFileList;
  1446. }
  1447. set { smallPhotoFileList = value; }
  1448. }
  1449. /// <summary>
  1450. /// 加载的缩略图 ImageList
  1451. /// </summary>
  1452. ImageList SmallImagelist = new ImageList();
  1453. /// <summary>
  1454. /// 绑定相片
  1455. /// </summary>
  1456. bool BindPhotoList()
  1457. {
  1458. try
  1459. {
  1460. //检查当前订单是否存在本地缓存相片
  1461. bool isCheckingLocalCache = this.CurrentSelectPhotoHandling.CheckingLocalCache(dType, this.OrderModel.Ord_Number, this.CurrentSightsName, this.OrderModel.Ord_SinceOrderNumber);
  1462. if (isCheckingLocalCache)
  1463. {
  1464. if (ExMessageBoxCustom.Show("发现本地缓存相片,是否用本地缓存相片进行选片?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  1465. {
  1466. isLocalPhoto = true;
  1467. }
  1468. }
  1469. this.SmallPhotoFileList.Clear();
  1470. this.SmallPhotoFileList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(dType, BLL.SelectPhotoHandling.PhotoType.Small, this.CurrentSightsName, isLocalPhoto);
  1471. if (this.SmallPhotoFileList.Count <= 0)
  1472. {
  1473. switch (this.dType)
  1474. {
  1475. case Model.Model_ErpOrder.DirectoryType.PrimitivePicture:
  1476. ExMessageBoxCustom.Show("没有找到原片!");
  1477. break;
  1478. case Model.Model_ErpOrder.DirectoryType.EarlyRetouch:
  1479. ExMessageBoxCustom.Show("没有找到初修片!");
  1480. break;
  1481. case Model.Model_ErpOrder.DirectoryType.DesignPiece:
  1482. ExMessageBoxCustom.Show("没有找到设计片!");
  1483. break;
  1484. default:
  1485. ExMessageBoxCustom.Show("没有找到相关相片!");
  1486. break;
  1487. }
  1488. return false;
  1489. }
  1490. this.listPhotoView.View = View.LargeIcon;
  1491. this.listPhotoView.Items.Clear();
  1492. this.SmallImagelist.Images.Clear();
  1493. this.SmallImagelist.ImageSize = new System.Drawing.Size(86, 86);
  1494. this.SmallImagelist.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
  1495. this.listPhotoView.LargeImageList = this.SmallImagelist;
  1496. for (int i = 0; i < this.SmallPhotoFileList.Count; i++)
  1497. {
  1498. string imageFile = this.SmallPhotoFileList[i];
  1499. ListViewItem vItem = new ListViewItem();
  1500. //相片名
  1501. string imgName = System.IO.Path.GetFileName(LYFZ.BLL.SelectPhotoHandling.SmallNameToOriginalName(System.IO.Path.GetFileName(imageFile))).ToUpper();
  1502. if (this.dType == Model.Model_ErpOrder.DirectoryType.DesignPiece)
  1503. {
  1504. imgName = GetDesignConfirmName(imageFile);
  1505. }
  1506. Image smallImage = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(imageFile, true);
  1507. this.SmallImagelist.Images.Add(imgName.ToLower(), smallImage);
  1508. vItem.Name = "vItem" + i.ToString();
  1509. vItem.Text = imgName.ToUpper();
  1510. vItem.Tag = imageFile;
  1511. vItem.ImageIndex = i;
  1512. this.listPhotoView.Items.Add(vItem);
  1513. }
  1514. this.listPhotoView.Sort();
  1515. return true;
  1516. }
  1517. catch (Exception ex)
  1518. {
  1519. ExMessageBoxCustom.Show("加载相片出错!错误原因:" + ex.Message);
  1520. return false;
  1521. }
  1522. }
  1523. /// <summary>
  1524. /// 根据完全相片名获取设计版确认标记名
  1525. /// </summary>
  1526. /// <param name="photoFullFileName">相片完全路径名</param>
  1527. /// <returns></returns>
  1528. string GetDesignConfirmName(string photoFullFileName)
  1529. {
  1530. return LYFZ.BLL.SelectPhotoHandling.GetDesignConfirmName(photoFullFileName);
  1531. }
  1532. void CreateCode_Choose(string md5Unique)
  1533. {
  1534. this.CloudUniquelyIdentify = md5Unique;
  1535. if (CloudUniquelyIdentify.Trim().Length > 1)
  1536. {
  1537. this.pictureBoxImage.Image = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CreateCode_Choose(GetCloudLinkUrl(md5Unique), "Byte", "M", 8, 4);
  1538. this.btnSendSms.Enabled = true;
  1539. }
  1540. else
  1541. {
  1542. this.btnSendSms.Enabled = false;
  1543. }
  1544. }
  1545. string unique_id = "";
  1546. /// <summary>
  1547. ///
  1548. /// </summary>
  1549. public string Unique_id
  1550. {
  1551. get { return unique_id; }
  1552. }
  1553. LYFZ.Model.Model_ErpOrder _OrderModel = null;
  1554. public LYFZ.Model.Model_ErpOrder OrderModel
  1555. {
  1556. get { return _OrderModel; }
  1557. set { _OrderModel = value; }
  1558. }
  1559. LYFZ.Model.Model_ErpOrderDigital _OrderDigital = null;
  1560. public LYFZ.Model.Model_ErpOrderDigital OrderDigital
  1561. {
  1562. get { return _OrderDigital; }
  1563. set { _OrderDigital = value; }
  1564. }
  1565. /// <summary>
  1566. /// 0 为云选片 1 为云看样
  1567. /// </summary>
  1568. int _CloudType = 0;
  1569. /// <summary>
  1570. /// 类型 0 为云选片 1 为云看样
  1571. /// </summary>
  1572. public int CloudType
  1573. {
  1574. get { return _CloudType; }
  1575. set { _CloudType = value; }
  1576. }
  1577. }
  1578. public class CloudsSelectedResult
  1579. {
  1580. public CloudsSelectedResult() {
  1581. }
  1582. public CloudsSelectedResult(string aPath, string gUrl, string ordNo, DataGridViewRow row)
  1583. {
  1584. this.access_path = aPath;
  1585. this.getUrl = gUrl;
  1586. this.Ordv_Number = ordNo;
  1587. this.gRow = row;
  1588. }
  1589. string _Ordv_Number = "";
  1590. /// <summary>
  1591. /// 订单号
  1592. /// </summary>
  1593. public string Ordv_Number
  1594. {
  1595. get { return _Ordv_Number; }
  1596. set { _Ordv_Number = value; }
  1597. }
  1598. string access_path = "";
  1599. /// <summary>
  1600. ///
  1601. /// </summary>
  1602. public string Access_path
  1603. {
  1604. get { return access_path; }
  1605. set { access_path = value; }
  1606. }
  1607. List<SelectProduct> _SelectProductList = new List<SelectProduct>();
  1608. /// <summary>
  1609. /// 选片结果
  1610. /// </summary>
  1611. public List<SelectProduct> SelectProductList
  1612. {
  1613. get { return _SelectProductList; }
  1614. set { _SelectProductList = value; }
  1615. }
  1616. public string GetSelectProductListToString()
  1617. {
  1618. string retMsg = "";
  1619. foreach (SelectProduct p in SelectProductList)
  1620. {
  1621. retMsg += p.Product_name + ":";
  1622. foreach (string photo in p.Photo_list)
  1623. {
  1624. retMsg += photo+",";
  1625. }
  1626. retMsg = retMsg.Trim(',') + "|";
  1627. }
  1628. return retMsg.Trim('|');
  1629. }
  1630. bool _CloudsSelectedStatus = false;
  1631. /// <summary>
  1632. /// 云选状态 false 为未完成 true 为已完成
  1633. /// </summary>
  1634. public bool CloudsSelectedStatus
  1635. {
  1636. get { return _CloudsSelectedStatus; }
  1637. set { _CloudsSelectedStatus = value; }
  1638. }
  1639. /// <summary>
  1640. /// 处理选片结果
  1641. /// </summary>
  1642. /// <param name="jsonData"></param>
  1643. public void HandleFilmSelection(dynamic jsonData)
  1644. {
  1645. dynamic ProductList = jsonData.data.pick_list;
  1646. foreach (dynamic product in ProductList)
  1647. {
  1648. SelectProduct sProduct = new SelectProduct();
  1649. sProduct.Product_id = product.product_id;
  1650. sProduct.Product_name = product.name;
  1651. sProduct.Photo_list.AddRange(product.photo_list.ToString().ToUpper().Split('|'));
  1652. SelectProductList.Add(sProduct);
  1653. }
  1654. this.General_require = jsonData.data.modify_content;
  1655. if (jsonData.data.last_modify_time.ToString() != "")
  1656. {
  1657. this.last_modify_time = Convert.ToDateTime(jsonData.data.last_modify_time);
  1658. }
  1659. try
  1660. {
  1661. if (jsonData.data.order_status.ToString() == "1")
  1662. {
  1663. this._CloudsSelectedStatus = true;
  1664. }
  1665. else {
  1666. this._CloudsSelectedStatus = false;
  1667. }
  1668. }
  1669. catch { }
  1670. }
  1671. List<PhotoLookDesign> _PhotoLookDesignList = new List<PhotoLookDesign>();
  1672. /// <summary>
  1673. /// 云看样结果
  1674. /// </summary>
  1675. public List<PhotoLookDesign> PhotoLookDesignList
  1676. {
  1677. get { return _PhotoLookDesignList; }
  1678. set { _PhotoLookDesignList = value; }
  1679. }
  1680. public string GetPhotoLookDesignListToString() {
  1681. string retMsg = "";
  1682. foreach (PhotoLookDesign p in PhotoLookDesignList)
  1683. {
  1684. retMsg += p.PhotoName + ":"+p.Modify.ToString()+":"+p.Modify_note+"|";
  1685. }
  1686. return retMsg.Trim('|');
  1687. }
  1688. /// <summary>
  1689. /// 处理看样结果
  1690. /// </summary>
  1691. /// <param name="jsonData"></param>
  1692. public void HandleLookDesignSelection(dynamic jsonData)
  1693. {
  1694. dynamic samplePhoto_list = jsonData.data.sample_list;
  1695. foreach (dynamic samplePhoto in samplePhoto_list)
  1696. {
  1697. PhotoLookDesign sPhoto = new PhotoLookDesign();
  1698. sPhoto.Modify =Convert.ToInt32(samplePhoto.modify);
  1699. sPhoto.Modify_note = samplePhoto.modify_note;
  1700. sPhoto.PhotoName = samplePhoto.photo_name.ToUpper();
  1701. PhotoLookDesignList.Add(sPhoto);
  1702. }
  1703. this.General_require = jsonData.data.general_require;
  1704. if (jsonData.data.last_modify_time.ToString() != "")
  1705. {
  1706. this.last_modify_time = Convert.ToDateTime(jsonData.data.last_modify_time);
  1707. }
  1708. try
  1709. {
  1710. if (jsonData.data.order_status.ToString() == "1")
  1711. {
  1712. this._CloudsSelectedStatus = true;
  1713. }
  1714. else
  1715. {
  1716. this._CloudsSelectedStatus = false;
  1717. }
  1718. }
  1719. catch { }
  1720. }
  1721. string getUrl = "";
  1722. /// <summary>
  1723. /// 下载请求地址
  1724. /// </summary>
  1725. public string GetUrl
  1726. {
  1727. get { return getUrl; }
  1728. set { getUrl = value; }
  1729. }
  1730. bool isDownOK = false;
  1731. /// <summary>
  1732. /// 云选结果是否成功
  1733. /// </summary>
  1734. public bool IsDownOK
  1735. {
  1736. get { return isDownOK; }
  1737. set { isDownOK = value; }
  1738. }
  1739. DateTime last_modify_time;
  1740. /// <summary>
  1741. /// 最后云选时间
  1742. /// </summary>
  1743. public DateTime Last_modify_time
  1744. {
  1745. get { return last_modify_time; }
  1746. set { last_modify_time = value; }
  1747. }
  1748. string general_require = "";
  1749. /// <summary>
  1750. /// 客户修改要求
  1751. /// </summary>
  1752. public string General_require
  1753. {
  1754. get { return general_require; }
  1755. set { general_require = value; }
  1756. }
  1757. DataGridViewRow gRow = null;
  1758. public DataGridViewRow GRow
  1759. {
  1760. get { return gRow; }
  1761. set { gRow = value; }
  1762. }
  1763. }
  1764. public class SelectProduct {
  1765. public SelectProduct() {
  1766. }
  1767. List<string> photo_list = new List<string>();
  1768. /// <summary>
  1769. /// 相片集合
  1770. /// </summary>
  1771. public List<string> Photo_list
  1772. {
  1773. get { return photo_list; }
  1774. set { photo_list = value; }
  1775. }
  1776. int num = 0;
  1777. public int Num
  1778. {
  1779. get { return num; }
  1780. set { num = value; }
  1781. }
  1782. string product_id = "";
  1783. /// <summary>
  1784. /// 商品Id
  1785. /// </summary>
  1786. public string Product_id
  1787. {
  1788. get { return product_id; }
  1789. set { product_id = value; }
  1790. }
  1791. string product_name = "";
  1792. /// <summary>
  1793. /// 商品名
  1794. /// </summary>
  1795. public string Product_name
  1796. {
  1797. get { return product_name; }
  1798. set { product_name = value; }
  1799. }
  1800. }
  1801. public class PhotoLookDesign
  1802. {
  1803. public PhotoLookDesign() {
  1804. }
  1805. string photoName = "";
  1806. /// <summary>
  1807. /// 相片名
  1808. /// </summary>
  1809. public string PhotoName
  1810. {
  1811. get { return photoName; }
  1812. set { photoName = value; }
  1813. }
  1814. int modify = 1;
  1815. /// <summary>
  1816. /// 确认状态 1表示已确认状态,为2表示需要修改
  1817. /// </summary>
  1818. public int Modify
  1819. {
  1820. get { return modify; }
  1821. set { modify = value; }
  1822. }
  1823. string modify_note = "";
  1824. /// <summary>
  1825. /// 当前相片的修改要求
  1826. /// </summary>
  1827. public string Modify_note
  1828. {
  1829. get { return modify_note; }
  1830. set { modify_note = value; }
  1831. }
  1832. }
  1833. }