123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.DoorCityProcess
- {
- public class frmCloudSelectionFilm : LYFZ.Software.UI.DoorCityProcess.frmCloudSelectionFilm
- {
- static string domainNameUrl =EnumPublic.CloudSelectionDmainNameUrl;
- public frmCloudSelectionFilm()
- {
- this.Shown += frmCloudSelectionFilm_Shown;
- this.btnSendSms.Click += btnSendSms_Click;
- this.btnUpLoad.Click += btnUpLoad_Click;
- this.btnYuanP.Click += btnYuanP_Click;
- this.btnXiuP.Click += btnXiuP_Click;
- this.btnSheJiP.Click += btnSheJiP_Click;
- this.lbphotoType.Text = "还未加载相片";
- this.contextMenuStripEx1.ItemClicked += contextMenuStripEx1_ItemClicked;
- this.btnDown.Click += btnDown_Click;
- this.btnDaochu.Click += btnDaochu_Click;
- this.btnTongBu.Click += btnTongBu_Click;
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- this.btnQ.Click += btnQ_Click;
- this.tbList.SelectedIndexChanged += tbList_SelectedIndexChanged;
- this.Load += frmCloudSelectionFilm_Load;
- this.lkbtnAllselect.Click += lkbtnAllselect_Click;
- this.lkbtnAllselectNo.Click += lkbtnAllselectNo_Click;
- this.btnSelectionChoice.Click += btnSelectionChoice_Click;
- this.cbxStatus.SelectedIndex = 1;
- this.dtpTimeStar.Value = DateTime.Now;
- this.dtpTimeEnd.Value = DateTime.Now;
- }
-
- void btnSelectionChoice_Click(object sender, EventArgs e)
- {
- string reseOrderPostData = "unique_id=" + this.unique_id
- + "&is_removed_photo=0"
- + "&is_removed_product=0";
- dynamic ResultObj = null;
- string retMsg = "";
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在重置云选片状态...");
- //重置订单云选片状态 或 删除产品和相片
- retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(reseOrderUrl, reseOrderPostData);
- if (retMsg.Contains("\"status\":"))
- {
- ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
- if (ResultObj.status == 0)
- {
- backgroundWorker.ReportProgress(0, "重置云选片状态完成...");
- MessageBoxCustom.Show("已重置云选片状态", backgroundWorker: backgroundWorker);
- }
- else
- {
- MessageBoxCustom.Show("重置云选片状态失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
- }
- }
- else
- {
- MessageBoxCustom.Show("重置云选片状态失败:" + retMsg, backgroundWorker: backgroundWorker);
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show("重置云选片状态出错:" + ex.Message, backgroundWorker: backgroundWorker);
- }
- });
- }
- void lkbtnAllselectNo_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.chkSPList.Items.Count; i++)
- {
- this.chkSPList.SetItemChecked(i, false);
- this.chkSPList.SelectedItems.Clear();
- }
- }
- void lkbtnAllselect_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.chkSPList.Items.Count; i++)
- {
- this.chkSPList.SetItemChecked(i, true);
- this.chkSPList.SelectedItem = this.chkSPList.Items[i];
- }
- }
- LYFZ.BLL.BLL_ErpSystemConfigure configBll = new BLL.BLL_ErpSystemConfigure();
- bool UpdateCloudSelectionUrl(string sUrl)
- {
- bool retBl = false;
- LYFZ.Model.Model_ErpSystemConfigure scModel = configBll.GetModel("CloudSelectionUrl");
- if (scModel != null && scModel.ID > 0)
- {
- scModel.Sconfig_Value = sUrl;
- retBl = configBll.Update(scModel);
- }
- else
- {
- scModel.Sconfig_Code = "CloudSelectionUrl";
- scModel.Sconfig_Value = sUrl;
- scModel.Sconfig_Name = "云选片接口地址";
- scModel.Sconfig_IsEnabled = true;
- scModel.Sconfig_CreateName = "";
- scModel.Sconfig_CreateDatetime = DateTime.Now;
- retBl = configBll.Add(scModel);
- }
- return retBl;
- }
- static bool isCloudSelectionUrlOK = false;
- string GetNewCloudSelectionUrl()
- {
- string retUrl = "";
- string retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestGET("http://wx.lyfz.net/WeiXinAPP/NetIPInterface.aspx?CloudSelectionUrl=1");
- if (retMsg.Split('.').Length >= 3 && retMsg.Split('.').Length<=4&&retMsg.Length<=96)
- {
- retUrl = retMsg;
- if (!domainNameUrl.ToUpper().Contains(retMsg.ToUpper()))
- {
- isCloudSelectionUrlOK = UpdateCloudSelectionUrl(retUrl);
- }
- else {
- isCloudSelectionUrlOK = true;
- }
- }
- return retUrl;
- }
- void frmCloudSelectionFilm_Load(object sender, EventArgs e)
- {
-
-
- if (this._CloudType == 0)
- {
- this.Text = "云选片";
- }
- else {
- this.Text = "云看样";
- this.chkPhotoRandomShuffle.Hide();
- this.chkdelcommodity.Hide();
- this.btnSelectionChoice.Text = "重置云看样状态";
- }
- try
- {
- this.chkPhotoRandomShuffle.Checked = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsSelectionFilmsDisruptOrder;
- }
- catch { }
- }
- int _ShowType = -1;
- /// <summary>
- /// 显示类型 0 为上传云选 1 为下载云选结果
- /// </summary>
- public int ShowType
- {
- get { return _ShowType; }
- set { _ShowType = value; }
- }
- void tbList_SelectedIndexChanged(object sender, EventArgs e)
- {
- btnQ_Click(null, null);
- }
- //上传订单接口地址
- string uploadOrderInfoUrl = domainNameUrl + "/order/push";
- //上传商品接口地址
- string uploadProductUrl = domainNameUrl + "/product/push";
- //上传相片接口地址
- string uploadPhototUrl = domainNameUrl + "/photo/upload";
- //获取已选片信息接口地址
- string getSelectPhotoInfoUrl = domainNameUrl + "/order/get_customer_pick";
- //获取看样信息接口地址
- string getLookSampleUrl = domainNameUrl + "/order/get_sample_pick";
- /// <summary>
- /// 重置订单接口
- /// </summary>
- string reseOrderUrl = domainNameUrl + "/order/reset";
- void SetDomainNameUrl(string url)
- {
- domainNameUrl = "http://" + url;
- //上传订单接口地址
- uploadOrderInfoUrl = domainNameUrl + "/order/push";
- //上传商品接口地址
- uploadProductUrl = domainNameUrl + "/product/push";
- //上传相片接口地址
- uploadPhototUrl = domainNameUrl + "/photo/upload";
- //获取已选片信息接口地址
- getSelectPhotoInfoUrl = domainNameUrl + "/order/get_customer_pick";
- //获取看样信息接口地址
- getLookSampleUrl = domainNameUrl + "/order/get_sample_pick";
- // 重置订单接口
- reseOrderUrl = domainNameUrl + "/order/reset";
- }
- void frmCloudSelectionFilm_Shown(object sender, EventArgs e)
- {
- try
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- LYFZ.Model.Model_ErpSystemConfigure scModel = configBll.GetModel("CloudSelectionUrl");
- if (scModel != null && scModel.ID > 0)
- {
- if (scModel.Sconfig_Value.Trim() == "121.42.170.207")
- {
- UpdateCloudSelectionUrl("yxp.lyfz.net");
- }
- else {
- SetDomainNameUrl(scModel.Sconfig_Value);
- }
- }
-
- });
- }
- catch { }
- try
- {
-
- if (this.CloudType == 1)
- {
- this.panelPhotoList.Hide();
- this.dType = Model.Model_ErpOrder.DirectoryType.DesignPiece;
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(ex.Message);
- this.Close();
- return;
- }
- initializationInfo();
- }
- void btnQ_Click(object sender, EventArgs e)
- {
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.Bind();
- }
- #region 画分页
- /// <summary>
- /// 画分页
- /// </summary>
- /// <param name="e"></param>
- /// <returns></returns>
- private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- DataTable dt = new DataTable();
- string CloudLookStatus = "1=1 ";
- string FieldName = "";
- if (this._CloudType == 0)
- {
- FieldName = "Ordv_CloudSelectFilmStatus";
- }
- else
- {
- FieldName = "Ordv_CloudLookStatus";
- }
- switch (this.cbxStatus.SelectedIndex)
- {
- case 0:
- CloudLookStatus = String.Format("{0}>0 ", FieldName);
- break;
- case 1:
- CloudLookStatus =String.Format("{0}=1 ",FieldName);
- break;
- case 2:
- CloudLookStatus = String.Format("{0}=2 ", FieldName);
- break;
- }
-
- string whereStr = CloudLookStatus;
- if (this.chkTime.Checked)
- {
- string fieldTimeName = "";
- if (this._CloudType == 0)
- {
- fieldTimeName = "Ordv_CloudSelectFilmTime";
- }
- else
- {
- fieldTimeName = "Ordv_CloudLookTime";
- }
- long TimeStar = Convert.ToDateTime(String.Format("{0} 00:00:00", this.dtpTimeStar.Value.ToYYYY_MM_dd())).ToJavaScriptTimeStamp();
- long TimeEnd = Convert.ToDateTime(String.Format("{0} 23:59:59", this.dtpTimeEnd.Value.ToYYYY_MM_dd())).ToJavaScriptTimeStamp();
- whereStr = String.Format("{0} and ({1}>={2} and {1}<={3}) ", CloudLookStatus, fieldTimeName, TimeStar, TimeEnd);
- }
- if (this.chkTime.Checked)
- {
-
- }
- if (txtKeyword.Text.Trim().Length > 0)
- {
- 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() + "%') ";
- }
- pageData.TableName = "Vw_CloudSelectList";
- pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- pageData.PageSize = this.ucPagerEx1.PageSize;
- pageData.QueryCondition = whereStr;
- pageData.QueryFieldName = "[ID]"
- + ",[Ordv_Number]"
- + ",[Ord_SinceOrderNumber]"
- + ",[Ordv_ViceNumber]"
- + ",[Ordv_DigitalNumber]"
- + ",[Ordv_SelectedPhotoType]"
- + ",[Ordv_FilmSelectionStatus]"
- + ",[Ordv_SelectionFilm]"
- + ",[Ordv_SelectionDesign]"
- + ",[Ordv_CloudSelectFilmStatus]"
- + ",[Ordv_CloudLookStatus]"
- + ",[Ordv_CloudSelectFilmTime]"
- + ",[Ordv_CloudLookTime]"
- + ",[Ordv_CloudUniquelyIdentify]"
- + ",[Ordv_CloudDesignUniquelyIdentify]"
- +",Cus_Name"
- +",Cus_Name_py"
- +",Cus_Sex_cs"
- +",Cus_Telephone"
- + ",Ordpg_Sights";
- LYFZ.ComponentLibrary.DataGridViewEx.SortedColumnModel sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudSelectFilmStatus", ListSortDirection.Ascending);
- if (this._CloudType == 0)
- {
- sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudSelectFilmStatus", ListSortDirection.Ascending);
- }
- else
- {
- sortModel= this.dgvList.GetSortedColumnModel("Ordv_CloudLookStatus", ListSortDirection.Ascending);
- }
-
- pageData.OrderStr = sortModel.OrderStr.TrimStart();
- this.dgvList.Rows.Clear();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
-
- DataSet da = pageData.QueryDataTable();
- dt = da.Tables[0];
- });
- if (dt.Rows.Count > 0)
- {
- for (int t = 0; t < dt.Rows.Count; t++)
- {
- DataRow drow = dt.Rows[t];
- DataGridViewRow row = new DataGridViewRow();
- row.CreateCells(this.dgvList);
- row.Cells[0].Value = drow["Ordv_Number"];
- if (drow["Ord_SinceOrderNumber"] != null && drow["Ord_SinceOrderNumber"].ToString().Trim().Length > 0)
- {
- row.Cells[0].Value = drow["Ord_SinceOrderNumber"];
- }
- row.Cells[1].Value = drow["Ordpg_Sights"];
- row.Cells[2].Value = drow["Cus_Name"];
- row.Cells[3].Value = drow["Cus_Telephone"];
- int cloudStatus = 0;
- long timeLong = 0;
- if (this._CloudType == 0)
- {
- cloudStatus = Convert.ToInt32(drow["Ordv_CloudSelectFilmStatus"]);
- timeLong = Convert.ToInt64(drow["Ordv_CloudSelectFilmTime"]);
- }
- else {
- cloudStatus = Convert.ToInt32(drow["Ordv_CloudLookStatus"]);
- timeLong = Convert.ToInt64(drow["Ordv_CloudLookTime"]);
- }
- row.Cells[4].Value = getCloudSelectStatus(cloudStatus);
- if (timeLong > 0)
- {
- row.Cells[5].Value = timeLong.JavaScriptTimeStampToDateTime();
- }
- else {
- row.Cells[5].Value = "";
- }
- if (cloudStatus == 2)
- {
- row.Cells[6].Value = "已同步到订单";
- row.Cells[7].Value = "已同步到订单";
- }
- else {
- row.Cells[6].Value = "";
- row.Cells[7].Value = "";
- }
- row.Tag = drow;
- this.dgvList.Rows.Add(row);
-
- }
- }
- try
- {
- this.ucPagerEx1.TbDataSource = dt;
- }
- catch { }
- return pageData.TotalCount;
- }
- string getCloudSelectStatus(int status)
- {
- string remsg = "";
- switch (status)
- {
- case 0:
- remsg = "未上传";
- break;
- case 1:
- remsg = "已上传待选";
- break;
- case 2:
- remsg = "已完成云选";
- break;
- }
- return remsg;
- }
- #endregion
- void contextMenuStripEx1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- string tagValue = e.ClickedItem.Tag.ToString();
- switch (tagValue)
- {
- case "select":
- foreach (ListViewItem vItem in this.listPhotoView.SelectedItems)
- {
- vItem.Checked = true;
- }
- break;
- case "allselect":
- foreach (ListViewItem vItem in this.listPhotoView.Items)
- {
- vItem.Checked = true;
- }
- break;
- case "no":
- foreach (ListViewItem vItem in this.listPhotoView.SelectedItems)
- {
- vItem.Checked = false;
- }
- break;
- case "allno":
- foreach (ListViewItem vItem in this.listPhotoView.CheckedItems)
- {
- vItem.Checked = false;
- }
- break;
- }
- }
- LYFZ.BLL.BLL_ErpOrderDigital bllOrderDigital = new BLL.BLL_ErpOrderDigital();
- void btnSheJiP_Click(object sender, EventArgs e)
- {
- // if (this.dType != Model.Model_ErpOrder.DirectoryType.DesignPiece)
- {
- this.dType = Model.Model_ErpOrder.DirectoryType.DesignPiece;
-
- if (this.BindPhotoList()) {
- this.lbphotoType.Text = "设计片";
- }
- }
- }
- void btnXiuP_Click(object sender, EventArgs e)
- {
- // if (this.dType != Model.Model_ErpOrder.DirectoryType.EarlyRetouch)
- {
- this.dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
- if (this.BindPhotoList())
- {
- this.lbphotoType.Text = "初修片";
- }
- }
- }
- void btnYuanP_Click(object sender, EventArgs e)
- {
- // if (this.dType != Model.Model_ErpOrder.DirectoryType.PrimitivePicture)
- {
- this.dType = Model.Model_ErpOrder.DirectoryType.PrimitivePicture;
- if (this.BindPhotoList())
- {
- this.lbphotoType.Text = "原片";
- }
- }
- }
-
- /// <summary>
- /// 获取在线选片或看样接Url地址
- /// </summary>
- /// <param name="md5Unique"></param>
- /// <returns></returns>
- string GetCloudLinkUrl(string md5Unique)
- {
- return domainNameUrl + md5Unique;
- }
- LYFZ.BLL.BLL_ErpCompanyInfo CompanyInfoBll = new LYFZ.BLL.BLL_ErpCompanyInfo();
- LYFZ.Model.Model_ErpCompanyInfo companyModel = new Model.Model_ErpCompanyInfo();
- /// <summary>
- /// 同步
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnTongBu_Click(object sender, EventArgs e)
- {
- if (this.dgvList.SelectedRows != null && this.dgvList.SelectedRows.Count > 0)
- {
- if (MessageBoxCustom.Show("同步云选结果将会用从云服务器上的客户已选信息替换订单中的已选信息,是否确定要同步?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- int isTongBuOkCount = 0;
- foreach (DataGridViewRow gRow in this.dgvList.SelectedRows)
- {
- if (gRow.Cells["CloudsSelectInfo"].Tag != null)
- {
- CloudsSelectedResult cResult = (CloudsSelectedResult)gRow.Cells["CloudsSelectInfo"].Tag;
- bool isTongBuOK = false;
- DataRow dRow = (DataRow)gRow.Tag;
- if (this._CloudType == 0)
- {
- string Ordv_SelectionFilm = "";
- if (dRow["Ordv_SelectionFilm"] != null)
- {
- Ordv_SelectionFilm = dRow["Ordv_SelectionFilm"].ToString();
- }
- Model.Model_ErpOrder.DirectoryType _dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
- if (dRow["Ordv_SelectedPhotoType"] != null)
- {
- if (dRow["Ordv_SelectedPhotoType"].ToString().Trim().Length > 1)
- {
- _dType = (Model.Model_ErpOrder.DirectoryType)Enum.Parse(typeof(Model.Model_ErpOrder.DirectoryType), dRow["Ordv_SelectedPhotoType"].ToString());
- }
- }
- isTongBuOK = TongBuCloudsSelectedPhoto(cResult, dRow["Ordv_Number"].ToString(), dRow["Ordv_ViceNumber"].ToString(), Ordv_SelectionFilm, _dType);
- }
- else {
- string Ordv_SelectionDesign = "";
- if (dRow["Ordv_SelectionDesign"] != null)
- {
- Ordv_SelectionDesign = dRow["Ordv_SelectionDesign"].ToString();
- }
- isTongBuOK = TongBuCloudsLookDesign(cResult, dRow["Ordv_Number"].ToString(), dRow["Ordv_ViceNumber"].ToString(), Ordv_SelectionDesign);
- }
- if (isTongBuOK)
- {
- isTongBuOkCount++;
- gRow.Cells["Status"].Value = "已同步完成";
- gRow.Cells["selectTime"].Value = SDateTime.Now.ToYYYY_MM_dd_HH_mm_ss();
- }
- else {
- gRow.Cells["Status"].Value = "同步失败";
- MessageBoxCustom.Show("订单“" + gRow.Cells["Ordv_Number"].Value.ToString() + "”同步失败");
- }
- }
- else {
- MessageBoxCustom.Show("选择订单“" + gRow.Cells["Ordv_Number"].Value.ToString() + "”中没有云选信息");
- break;
- }
-
- }
- if (isTongBuOkCount > 0)
- {
- MessageBoxCustom.Show("已成功同步 "+isTongBuOkCount.ToString()+" 个订单");
- }
- }
- }
- else {
- MessageBoxCustom.Show("请选择要同步云选结果的订单");
- }
- }
- /// <summary>
- /// 同步去选片结果
- /// </summary>
- /// <param name="cResult"></param>
- /// <returns></returns>
- bool TongBuCloudsSelectedPhoto(CloudsSelectedResult cResult, string Ordv_Number, string Ordv_ViceNumber, string Ordv_SelectionFilm, Model.Model_ErpOrder.DirectoryType _dType)
- {
- bool retOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0,"正在同步云选结果...");
- LYFZ.BLL.ProductSelectedPhotoInfo CurrentSelectPhotoInfo = new BLL.ProductSelectedPhotoInfo(Ordv_SelectionFilm, _dType); //读取当前订单已选片信息
- if (!string.IsNullOrEmpty(cResult.General_require))
- {
- CurrentSelectPhotoInfo.CustomerRequest = cResult.General_require;
- }
- foreach (SelectProduct sProduct in cResult.SelectProductList)
- {
- LYFZ.BLL.ProductSelectedInfo sPinfo = CurrentSelectPhotoInfo.GetSpecifyProductSelectedInfo(sProduct.Product_id);
- if (sPinfo == null)
- {
- sPinfo = new BLL.ProductSelectedInfo(sProduct.Product_name + "?" + sProduct.Product_id, CurrentSelectPhotoInfo);
- CurrentSelectPhotoInfo.AddProduct(sPinfo);
- }
- sPinfo.ClearOpenVirtualDesign();
- try
- {
- sPinfo.DelAllExplainPhoto();
- }
- catch { }
- sPinfo.SelectedPhotoIList.Clear();
- sPinfo.SelectPageList.Clear();
- sPinfo.SelectedPhotoIList.AddRange(sProduct.Photo_list);
-
- }
- 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);
-
- if (retOK)
- {
- retOK = bllOrderDigital.UpadateCloudSelectFilmStatus(Ordv_ViceNumber, 2, this._CloudType);
- }
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(EnumPublic.SystemLogsType.选片操作日志,
- "" + LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "同步了云选片结果[订单号:" + Ordv_Number + "(" + Ordv_ViceNumber + ")]" + this.CurrentSightsName,
- LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID,
- LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
-
- });
- return retOK;
- }
- /// <summary>
- /// 同步去看样结果
- /// </summary>
- /// <param name="cResult"></param>
- /// <returns></returns>
- bool TongBuCloudsLookDesign(CloudsSelectedResult cResult, string Ordv_Number, string Ordv_ViceNumber, string Ordv_SelectionFilm)
- {
- bool retOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0, "正在同步云选结果...");
- LYFZ.BLL.ProductSelectedPhotoInfo CurrentSelectDesignPieceInfo = new BLL.ProductSelectedPhotoInfo(Ordv_SelectionFilm, Model.Model_ErpOrder.DirectoryType.DesignPiece);
- // 看设计确认OK Text
- string lookDesignOKText = "设计确认OK";
- // 看设计要修改项的Text
- string lookDesignModifyText = "设计需要修改";
- #region 初始化
- LYFZ.BLL.ProductSelectedInfo lookDesignPinfo = CurrentSelectDesignPieceInfo.GetSpecifyProductSelectedInfo(lookDesignOKText);
- if (lookDesignPinfo == null)
- {
- lookDesignPinfo = new BLL.ProductSelectedInfo(lookDesignOKText, CurrentSelectDesignPieceInfo);
- }
- CurrentSelectDesignPieceInfo.AddProduct(lookDesignPinfo);
- LYFZ.BLL.ProductSelectedInfo lookDesignModifyPinfo = CurrentSelectDesignPieceInfo.GetSpecifyProductSelectedInfo(lookDesignModifyText);
- if (lookDesignModifyPinfo == null)
- {
- lookDesignModifyPinfo = new BLL.ProductSelectedInfo(lookDesignModifyText, CurrentSelectDesignPieceInfo);
- }
- CurrentSelectDesignPieceInfo.AddProduct(lookDesignModifyPinfo);
- #endregion
- CurrentSelectDesignPieceInfo.CustomerRequest = cResult.General_require;
- int lookDesignModifyCount = 0;
- lookDesignPinfo.SelectedPhotoIList.Clear();
- lookDesignModifyPinfo.SelectedPhotoIList.Clear();
- lookDesignModifyPinfo.DelAllExplainPhoto();
-
- foreach (PhotoLookDesign LookDesign in cResult.PhotoLookDesignList)
- {
- if (LookDesign.Modify == 1)
- {
- lookDesignPinfo.AddPhoto(LookDesign.PhotoName);
- }
- else
- {
- CurrentSelectDesignPieceInfo.AddPhotoRequest(LookDesign.PhotoName, LookDesign.Modify_note);
- lookDesignModifyPinfo.AddPhoto(LookDesign.PhotoName);
- lookDesignModifyCount++;
- }
- }
- LYFZ.Model.Model_ErpOrderDigital cDigModel = new Model.Model_ErpOrderDigital();
- cDigModel.Ordv_Number = Ordv_Number;
- cDigModel.Ordv_ViceNumber = Ordv_ViceNumber;
- cDigModel.Ordv_LookDesignName = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- if (lookDesignModifyCount == 0)
- {
- cDigModel.Ordv_LookDesignStatus = "1";
- }
- else
- {
- cDigModel.Ordv_LookDesignStatus = "2";
- }
- cDigModel.Ordv_LookDesignTime = SDateTime.Now;
- cDigModel.Ordv_LookDesignClaim = CurrentSelectDesignPieceInfo.CustomerRequest;
- cDigModel.Ordv_DesignValidation = CurrentSelectDesignPieceInfo.ProductSelectedPhotoInfoString;
- cDigModel.Ordv_LookDesignDispatchTime = SDateTime.Now;
- if (bllOrderDigital.SetLookDesignStatus(cDigModel))
- {
- retOK = bllOrderDigital.UpadateCloudSelectFilmStatus(Ordv_ViceNumber, 2, this._CloudType);
- }
- LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(EnumPublic.SystemLogsType.选片操作日志,
- "" + LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "同步了云看样结果[订单号:" + Ordv_Number + "(" + Ordv_ViceNumber + ")]" + this.CurrentSightsName,
- LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID,
- LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
- });
- return retOK;
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDaochu_Click(object sender, EventArgs e)
- {
- this.dgvList.ExportDataTable();
- }
- /// <summary>
- /// 下载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDown_Click(object sender, EventArgs e)
- {
- if (this.dgvList.SelectedRows != null && this.dgvList.SelectedRows.Count > 0)
- {
- List<CloudsSelectedResult> CloudsSelectedResultList = new List<CloudsSelectedResult>();
- foreach (DataGridViewRow gRow in this.dgvList.SelectedRows)
- {
- DataRow dRow = (DataRow)gRow.Tag;
-
- if (this._CloudType == 0)
- {
- CloudsSelectedResultList.Add(new CloudsSelectedResult(dRow["Ordv_CloudUniquelyIdentify"].ToString(), getSelectPhotoInfoUrl, dRow["Ordv_Number"].ToString(), gRow));
- }
- else {
- CloudsSelectedResultList.Add(new CloudsSelectedResult(dRow["Ordv_CloudDesignUniquelyIdentify"].ToString(), getLookSampleUrl, dRow["Ordv_Number"].ToString(), gRow));
- }
- }
- bool isDownOK = false;//是否有下载成功的
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0,"正在准备下载...");
- int sumCount = CloudsSelectedResultList.Count;
- int downCount=1;
-
- foreach (CloudsSelectedResult cResult in CloudsSelectedResultList)
- {
- backgroundWorker.ReportProgress(0, "正在下载第 " + downCount.ToString() + "/" + sumCount.ToString() + "个...");
- string getSelectPhotoInfoData = "access_path=" + cResult.Access_path;
- string retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(cResult.GetUrl, getSelectPhotoInfoData,Encoding.UTF8);
- dynamic ResultObj = null;
- if (retMsg.Contains("\"status\":"))
- {
- ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
- if (ResultObj.status == 0)
- {
- cResult.IsDownOK = true;
- if (this._CloudType == 0)
- {
- cResult.HandleFilmSelection(ResultObj);
- }
- else {
- cResult.HandleLookDesignSelection(ResultObj);
- }
- isDownOK = true;
- }
- else {
- MessageBoxCustom.Show("下载订单“" + cResult.Ordv_Number + "”的云结果失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
- }
- }
- else {
- if (!isCloudSelectionUrlOK)
- {
- string newUrl = GetNewCloudSelectionUrl();
- if (newUrl.Trim().Length > 0)
- {
- SetDomainNameUrl(newUrl);
- }
- }
- MessageBoxCustom.Show("下载订单“" + cResult.Ordv_Number + "”的云结果失败[域名:" + domainNameUrl.Replace("http://", "") + "]:" + retMsg, backgroundWorker: backgroundWorker);
- return;
- }
- downCount++;
- }
-
- });
- if (isDownOK)
- {
- foreach (CloudsSelectedResult cResult in CloudsSelectedResultList)
- {
- if (this._CloudType == 0)
- {
- cResult.GRow.Cells["CloudsSelectInfo"].Value = cResult.GetSelectProductListToString();
- }
- else {
- cResult.GRow.Cells["CloudsSelectInfo"].Value = cResult.GetPhotoLookDesignListToString();
- }
- cResult.GRow.Cells["CloudsSelectInfo"].Tag = cResult;
- cResult.GRow.Cells["CustomerRequest"].Value = cResult.General_require;
- if (cResult.CloudsSelectedStatus)
- {
- if (this._CloudType == 0)
- {
- cResult.GRow.Cells["Status"].Value = "【已完成选片】待同步";
- }
- else {
- cResult.GRow.Cells["Status"].Value = "【已完成确认】待同步";
- }
- }
- else {
- if ((cResult.GRow.Cells["CloudsSelectInfo"].Value != null && cResult.GRow.Cells["CloudsSelectInfo"].Value.ToString().Length > 0) || cResult.General_require.Trim().Length>0)
- {
- if (this._CloudType == 0)
- {
- cResult.GRow.Cells["Status"].Value = "【选片中】";
- }
- else
- {
- cResult.GRow.Cells["Status"].Value = "【看样中】";
- }
- }
-
- }
-
- }
- }
- }
- else {
- MessageBoxCustom.Show("请选择要下载的云选结果的订单");
- }
- }
- int GetCheckToInt(ComponentLibrary.CheckBoxEx chk)
- {
- if (chk.Checked)
- {
- return 1;
- }
- else {
- return 0;
- }
- }
- LYFZ.BLL.BLL_SMSTemplates smsBLL = new BLL.BLL_SMSTemplates();
- LYFZ.Model.Model_SMSTemplates GetSmsSMSTemplatesModel()
- {
- List<LYFZ.Model.Model_SMSTemplates> smsModelList = null;
- string ST_SendEvent = "";
- if (this.CloudType == 0)
- {
- ST_SendEvent = ((int)EnumPublic.SmsSendEvent.客户云选片完成后发通知短信).ToString();
- }
- else
- {
- ST_SendEvent = ((int)EnumPublic.SmsSendEvent.客户云看样完成后发通知短信).ToString();
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- 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 + " ");
- });
- if (smsModelList != null && smsModelList.Count > 0)
- {
- return smsModelList[0];
- }
- else
- {
- return null;
- }
- }
- /// <summary>
- /// 获取短信内容
- /// </summary>
- /// <param name="smsTemp"></param>
- /// <returns></returns>
- string GetSMSContent(LYFZ.Model.Model_SMSTemplates smsTemp)
- {
- // [Description("说明:XXX 为客户姓名;XXZ 为订单号;XXN 为套系名称;XXT 为选片完成时间")]
- string retContent = smsTemp.ST_SMSContent.Replace("XXX", this.lbCName.Text.Trim()).Replace("xxx", this.lbCName.Text.Trim())
- .Replace("XXZ", this.OrderModel.Ord_Number).Replace("xxz", this.OrderModel.Ord_Number)
- .Replace("XXN", this.OrderModel.Ord_Number).Replace("xxn", this.OrderModel.Ord_Number);
- return retContent;
- }
- void btnUpLoad_Click(object sender, EventArgs e)
- {
- //上传订单信息
- /*1.unique_id M 全局唯一标识
- 2.order_num M 订单编号
- 3.source O 上传选片订单时不传,上传选样订单时必传且值为sample
- 4.customer_name O 顾客姓名
- 5.customer_phone O 顾客联系电话
- 6.studio_name O 影楼名称
- 7.studio_phone O 影楼电话
- 8.scene_name O 套系/景点名称
- */
- if (this.OrderDigital.Ordv_CloudSelectFilmStatus > 0)
- {
- if (MessageBoxCustom.Show("当前订单已经上传过云选片信息,您确定要重新上传并重置云选片状态吗?", msgBoxButton: MessageBoxButtons.YesNo)!= System.Windows.Forms.DialogResult.Yes)
- {
- return;
- }
- }
- string sampleValue="";
- string product_list = "";
- if (this.CloudType == 1)
- {
- sampleValue = "sample";
- }
- else {
- if (this.chkSPList.SelectedItems.Count <= 0)
- {
- MessageBoxCustom.Show("请选择要上传的商品");
- return;
- }
- else {
- product_list = GetProduct_listToJson();
- }
- }
- List<string> uploadPhotoList = new List<string>();
- if (this.listPhotoView.CheckedItems.Count <= 0)
- {
- MessageBoxCustom.Show("请选择要上传的相片");
- return;
- }
- else
- {
- foreach (ListViewItem vItem in this.listPhotoView.CheckedItems)
- {
- string photoPath = LYFZ.BLL.SelectPhotoHandling.SmallPathToPreviewPath(vItem.Tag.ToString());
- string photoName = vItem.Text.Trim();
- uploadPhotoList.Add(photoPath + "|" + photoName);
- }
- }
- string message_account = "";
- string message_password = "";
- string notify_tels = "";
- string message_content = "";
- LYFZ.Model.Model_SMSTemplates SMSTemplatesModel = GetSmsSMSTemplatesModel();
- if (SMSManagement.frmSMSTemplateSet.CurrentSmsAccount != null&& SMSTemplatesModel!=null)
- {
- message_account = SMSManagement.frmSMSTemplateSet.CurrentSmsAccount.Smsa_AccountNumber;
- message_password= SMSManagement.frmSMSTemplateSet.CurrentSmsAccount.Smsa_Password;
- notify_tels = SMSTemplatesModel.ST_ReceiveObjects;
- message_content = GetSMSContent(SMSTemplatesModel);
- }
- /*
- notify_tels, 通知人
- message_account,短信账号
- message_password,短信密码
- message_content 短信内容 XXT替换成时间
- */
- string uploadOrderInfoData = "unique_id=" + this.unique_id
- + "&order_num=" + UrlEncod_UTF8(this.OrderModel.Ord_Number)
- + "&source=" + UrlEncod_UTF8(sampleValue)
- + "&customer_name=" + UrlEncod_UTF8(this.lbCName.Text.Trim())
- + "&customer_phone=" + UrlEncod_UTF8(GetCustomerTelephone())
- + "&studio_name=" + UrlEncod_UTF8(this.companyModel.Company_Name)
- + "&studio_phone=" + this.companyModel.Company_Telephone
- + "&is_shuffle=" + this.chkPhotoRandomShuffle.Checked.BoolToInt().ToString()
- + "&scene_name=" + UrlEncod_UTF8(this.lbName.Text)
- + "&message_account=" + UrlEncod_UTF8(message_account)
- + "&message_password=" + UrlEncod_UTF8(message_password)
- + "¬ify_tels=" + UrlEncod_UTF8(notify_tels)
- + "&message_content=" + UrlEncod_UTF8(message_content);
-
- string reseOrderPostData = "unique_id="+this.unique_id
- + "&is_removed_photo=" + this.chkdelPhoto.Checked.BoolToInt().ToString()
- + "&is_removed_product=" + this.chkdelcommodity.Checked.BoolToInt().ToString();
- dynamic ResultObj = null;
- string retMsg = "";
- string uploadOrderAccess_Path = "";//订单信息上传成功后返回的唯一标识ID
- bool isUploadOK = false;//是否上传成功
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在上传订单信息...");
- //重置订单云选片状态 或 删除产品和相片
- retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(reseOrderUrl, reseOrderPostData);
- retMsg =LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(uploadOrderInfoUrl, uploadOrderInfoData);
- if (retMsg.Contains("\"status\":"))
- {
- ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
- if (ResultObj.status == 0)
- {
- uploadOrderAccess_Path = ResultObj.data;
- //如果是在线选片时上传商品
- if (this._CloudType == 0)
- {
-
- string uploadProductData = "unique_id=" + this.unique_id
- + "&product_list=" + product_list;
- backgroundWorker.ReportProgress(0, "正在上传产品...");
- retMsg = LYFZ.WinAPI.CustomPublicMethod.HttpWebRequestPOST(uploadProductUrl, uploadProductData);
- if (retMsg.Contains("\"status\":"))
- {
- ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
- if (ResultObj.status != 0)
- {
- MessageBoxCustom.Show("上传产品失败:" + ResultObj.data, backgroundWorker: backgroundWorker);
- return;
- }
- }
- else
- {
- MessageBoxCustom.Show("上传产品失败:" + retMsg, backgroundWorker: backgroundWorker);
- return;
- }
- }
- //上传相片
- isUploadOK = true;
- int uploadCount=0;
-
- foreach (string photoItem in uploadPhotoList)
- {
- string photoPath =photoItem.Split('|')[0];
- Bitmap bmp= LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(photoPath,640,960);
- photoPath= LYFZ.ImageFunction.ThumbImgae.SaveTemporaryCompressionImage(bmp, System.IO.Path.GetFileName(photoPath));
- string photoName = photoItem.Split('|')[1];
- uploadCount++;
- if (UploadPhoto(photoPath, photoName))
- {
- backgroundWorker.ReportProgress(0, "正在上传相片[" + uploadCount.ToString() + "/" + uploadPhotoList.Count.ToString() + "]...");
- LYFZ.ImageFunction.ThumbImgae.DeleteTemporaryCompressionImage(photoPath);
- }
- else {
- isUploadOK = false;
- retMsg = "上传" + photoName + "相片时失败";
- // MessageBoxCustom.Show("上传" + photoName + "相片时失败", backgroundWorker: backgroundWorker);
- return;
- }
- }
- backgroundWorker.ReportProgress(0, "上传完成...");
- }
- else
- {
- MessageBoxCustom.Show("上传订单信息失败:" + ResultObj.msg, backgroundWorker: backgroundWorker);
- }
- }
- else {
- if (!isCloudSelectionUrlOK)
- {
- string newUrl = GetNewCloudSelectionUrl();
- if (newUrl.Trim().Length > 0)
- {
- SetDomainNameUrl(newUrl);
- }
- }
- MessageBoxCustom.Show("上传订单信息失败[域名:" + domainNameUrl.Replace("http://","") + "]:" + retMsg, backgroundWorker: backgroundWorker);
- }
- }
- catch(Exception ex) {
- retMsg = ex.Message;
- isUploadOK = false;
- }
- });
- if (isUploadOK)
- {
- this.lbState.Text = "已上传";
- CreateCode_Choose(uploadOrderAccess_Path);
- if (this._CloudType == 0)
- {
- this.OrderDigital.Ordv_CloudSelectFilmStatus = 1;
- this.OrderDigital.Ordv_CloudUniquelyIdentify = uploadOrderAccess_Path;
- this.OrderDigital.Ordv_CloudSelectFilmTime = SDateTime.Now.ToJavaScriptTimeStamp();
- }
- else
- {
- this.OrderDigital.Ordv_CloudLookStatus = 1;
- this.OrderDigital.Ordv_CloudDesignUniquelyIdentify = uploadOrderAccess_Path;
- this.OrderDigital.Ordv_CloudLookTime = SDateTime.Now.ToJavaScriptTimeStamp();
- }
- bllOrderDigital.UpadateCloudSelectFilmStatus(this.OrderDigital.Ordv_ViceNumber, this.OrderDigital);
- MessageBoxCustom.Show("上传成功");
- }
- else {
- MessageBoxCustom.Show("失败:" + retMsg);
- }
-
- }
- bool UploadPhoto(string photo, string photoMark, BackgroundWorker backgroundWorker=null)
- {
- bool ret = false;
- /* 1.unique_id M 全局唯一标识
- 2. img M 照片数据
- 3.img_name M 照片名称
- 4.scene_name O 套系/景点名称*/
- System.Collections.Specialized.NameValueCollection Nvalues = new System.Collections.Specialized.NameValueCollection();
- Nvalues.Add("unique_id", this.unique_id);
- Nvalues.Add("img_name", photoMark);
- Nvalues.Add("scene_name", "");
- List<LYFZ.WinAPI.UploadFile> ufileList = new List<WinAPI.UploadFile>();
- LYFZ.WinAPI.UploadFile ufile = new WinAPI.UploadFile();
- ufile.Name = "img";
- ufile.Filename = photo;
- ufile.Data = GetImageByte(photo);
- ufileList.Add(ufile);
- dynamic ResultObj = null;
- string retMsg = LYFZ.WinAPI.CustomPublicMethod.FormOrDataPost(uploadPhototUrl, ufileList,Nvalues,Encoding.UTF8);
- if (retMsg.Contains("\"status\":"))
- {
- ResultObj = Codeplex.Data.DynamicJson.Parse(retMsg);
- if (ResultObj.status == 0)
- {
- ret = true;
- }
- else {
- MessageBoxCustom.Show("上传相片失败:" + ResultObj.data, backgroundWorker: backgroundWorker);
- }
- }
- else
- {
- MessageBoxCustom.Show("上传相片时失败:" + retMsg, backgroundWorker: backgroundWorker);
- }
- return ret;
- }
- /// <summary>
- /// 水印文字
- /// </summary>
- string WatermarkText = "";
- byte[] GetImageByte(string photo)
- {
- byte[] imageData = null;
- Bitmap uImage = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(photo);
- Bitmap sImage = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(uImage,1024,768);
- DrawingWatermarkText(sImage,WatermarkText);
- string fileFullPath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + "Temp\\UploadFile\\" + System.IO.Path.GetFileName(photo);
- if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(fileFullPath)))
- {
- try
- {
- System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(fileFullPath));
- }
- catch { }
- }
- LYFZ.ImageFunction.ThumbImgae.SaveIamge(sImage, 80, fileFullPath);
- sImage.Dispose();
- uImage.Dispose();
- imageData = File.ReadAllBytes(fileFullPath);
- if (System.IO.File.Exists(fileFullPath))
- {
- System.IO.File.Delete(fileFullPath);
- }
- return imageData;
- }
- /// <summary>
- /// 画水印文字
- /// </summary>
- /// <param name="img"></param>
- /// <param name="watermark"></param>
- void DrawingWatermarkText(Bitmap img, string watermark)
- {
- using (Graphics g = Graphics.FromImage(img))
- {
- Brush brush = Brushes.Gray;
- float fsiz =Convert.ToSingle(img.Width * 0.03);
- Font font = new Font("微软雅黑", fsiz);
- SizeF fsize = g.MeasureString(watermark, font);
- g.DrawString(watermark, font, brush, new PointF(img.Width - fsize.Width - 10, img.Height - fsiz-20));
- Brush brush2 = Brushes.WhiteSmoke;
- g.DrawString(watermark, font, brush2, new PointF(img.Width - fsize.Width - 12, img.Height - fsiz - 22));
- }
- }
- string GetProduct_listToJson() {
- string retJson = "";
- /* 1.unique_id M 全局唯一标识
- 2.product_list M json字符串格式的商品列表,其中每个商品信息包含的字段 如下
- 2.1 product_id M 商品id
- 2.2 name M 商品名称
- 2.3 num M 商品数量
- 2.4 unit_price O 商品单价
- 2.5 OptionalNumber M 商品最大可选相片张数 -1 为不限制张数 0 - 9999??? 为限制的张数
- */
- /*dynamic tMParameters = new System.Dynamic.ExpandoObject();
- tMParameters.product_id = product.OPlist_UniquelyIdentity;
- tMParameters.name = product.OPlist_ProdName;
- tMParameters.num = product.OPlist_ProdQuantity.ToString();
- tMParameters.unit_price = product.OPlist_ProdSoldPrice.ToString("n2");*/
- List<dynamic> ProductList = new List<dynamic>();
- foreach (ItemValue item in this.chkSPList.CheckedItems)
- {
- int OptionalNumber =Convert.ToInt32(item.Tag.ToString());
- LYFZ.Model.Model_ErpOrderProductList product = (LYFZ.Model.Model_ErpOrderProductList)item.Value;
-
- dynamic tMParameters = new {
- product_id = UrlEncod_UTF8(product.OPlist_UniquelyIdentity),//(1+product.ID).ToString(),
- name = UrlEncod_UTF8(product.OPlist_ProdName),
- num = product.OPlist_ProdQuantity.ToString(),
- unit_price = product.OPlist_ProdSoldPrice.ToString("0.00"),
- OptionalNumber= OptionalNumber
- };
- ProductList.Add(tMParameters);
- }
- retJson = Codeplex.Data.DynamicJson.Serialize(ProductList);
- return retJson;
- }
- public static string UrlEncod_UTF8(string unicodeString)
- {
- /* UTF8Encoding utf8 = new UTF8Encoding();
- Byte[] encodedBytes = utf8.GetBytes(unicodeString);
- String decodedString = utf8.GetString(encodedBytes);*/
- if (!String.IsNullOrEmpty(unicodeString))
- {
- return System.Web.HttpUtility.UrlEncode(unicodeString, Encoding.UTF8);
- }
- else {
- return "";
- }
- }
- LYFZ.BLL.BLL_ErpCustomerGroup bllCGroup = new LYFZ.BLL.BLL_ErpCustomerGroup();
- LYFZ.BLL.BLL_ErpCustomerGroupMembers bllGmember = new LYFZ.BLL.BLL_ErpCustomerGroupMembers();
- LYFZ.BLL.BLL_ErpCustomer cusBll = new BLL.BLL_ErpCustomer();
- string GetCustomerTelephone()
- {
- string User_Telephone = "";
- LYFZ.Model.Model_ErpCustomerGroup cgroupModel = bllCGroup.GetModel("GP_OrderNumber", OrderModel.Ord_Number.Trim());
- if (cgroupModel.ID > 0)
- {
- List<LYFZ.Model.Model_ErpCustomerGroupMembers> GmemberModelList = bllGmember.GetModelList("GM_CustomerGroupID='" + cgroupModel.GP_CustomerGroupID + "'");
- foreach (LYFZ.Model.Model_ErpCustomerGroupMembers gmemberModel in GmemberModelList)
- {
- LYFZ.Model.Model_ErpCustomer modelCustomer = (LYFZ.Model.Model_ErpCustomer)cusBll.GetModelObject("Cus_CustomerNumber", gmemberModel.GM_CustomerID);
- if (modelCustomer != null && modelCustomer.ID > 0 && modelCustomer.Cus_Telephone.Length >= 11)
- {
- User_Telephone += modelCustomer.Cus_Telephone.Trim() + ",";
- }
- }
- }
- return User_Telephone.Trim(',');
- }
- void btnSendSms_Click(object sender, EventArgs e)
- {
- string User_Telephone = GetCustomerTelephone();
- LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms sendSms = new LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms();
- /* LYFZ.Model.Model_ErpCustomerGroup cgroupModel = bllCGroup.GetModel("GP_OrderNumber", OrderModel.Ord_Number.Trim());
- if (cgroupModel.ID > 0)
- {
- List<LYFZ.Model.Model_ErpCustomerGroupMembers> GmemberModelList = bllGmember.GetModelList("GM_CustomerGroupID='" + cgroupModel.GP_CustomerGroupID + "'");
- foreach (LYFZ.Model.Model_ErpCustomerGroupMembers gmemberModel in GmemberModelList)
- {
- LYFZ.Model.Model_ErpCustomer modelCustomer = (LYFZ.Model.Model_ErpCustomer)cusBll.GetModelObject("Cus_CustomerNumber", gmemberModel.GM_CustomerID);
- if (modelCustomer != null && modelCustomer.ID > 0 && modelCustomer.Cus_Telephone.Length >= 11)
- {
- User_Telephone+=modelCustomer.Cus_Telephone.Trim()+",";
-
- }
- }
- }*/
- string tempLawfulPhone = "";
- LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(User_Telephone.Trim(','), ref tempLawfulPhone);
- if (tempLawfulPhone.Trim().Length >= 11)
- {
- sendSms.Phone = tempLawfulPhone.Trim(',');
- string tempTypeStr = "选片";
- if (this._CloudType == 0)
- {
- tempTypeStr = "选片";
- }
- else
- {
- tempTypeStr = "看样";
- }
- string smsText = this.lbCName.Text + "您好,您的在线" + tempTypeStr + "地址是:" + GetCloudLinkUrl(CloudUniquelyIdentify);
- sendSms.SetDefaultSmsText(smsText);
- sendSms.ShowDialog();
- }
- else {
- MessageBoxCustom.Show("系统检测到客户手机号不正确" + User_Telephone.Trim(','));
- }
- }
-
-
- LYFZ.EnumPublic.OrderType currentOrderType = EnumPublic.OrderType.婚纱订单;
- /// <summary>
- /// 当前订单类型
- /// </summary>
- public LYFZ.EnumPublic.OrderType CurrentOrderType
- {
- get { return currentOrderType; }
- set { currentOrderType = value; }
- }
- string _MainOrderNumber = "";
- public string MainOrderNumber
- {
- get { return _MainOrderNumber; }
- set { _MainOrderNumber = value; }
- }
- string _ViceOrderNumber = "";
- /// <summary>
- ///
- /// </summary>
- public string ViceOrderNumber
- {
- get { return _ViceOrderNumber; }
- set { _ViceOrderNumber = value; }
- }
-
- string CurrentSightsName = "";
- string CloudUniquelyIdentify = "";
- void initializationInfo()
- {
- if (ShowType > 0)
- {
- this.tbList.TabPages.Remove(this.tbUpload);
- return;
- }
- else {
- if (ShowType == 0)
- {
- this.tbList.TabPages.Remove(this.tbDown);
- }
- }
- if (MainOrderNumber.Trim().Length <= 0 || ViceOrderNumber.Trim().Length<=0)
- {
- MessageBoxCustom.Show("订单号不能为空!");
- this.Close();
- return;
- }
- bool isLoad = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- OrderModel = currentOrderBll.GetModel("Ord_Number", MainOrderNumber);
- OrderDigital = bllOrderDigital.GetModel("Ordv_ViceNumber", ViceOrderNumber);
- isLoad = true;
- }
- catch {
- MessageBoxCustom.Show("加载订单信息失败");
- return;
- }
- this.CurrentOrderType = (LYFZ.EnumPublic.OrderType)Convert.ToInt32(this.OrderModel.Ord_Type);
- this.CurrentSelectPhotoHandling = new BLL.SelectPhotoHandling(this.OrderModel, this.OrderDigital);
- InitializedSelectionFilmInfo();
- if (CurrentOrderType == EnumPublic.OrderType.儿童订单)
- {
- //摄影表
- LYFZ.BLL.BLL_ErpOrdersPhotography photoBll = new BLL.BLL_ErpOrdersPhotography();
- List<LYFZ.Model.Model_ErpOrdersPhotography> photoModelList = photoBll.GetViceNumberToModel(this.OrderDigital.Ordv_ViceNumber);
- this.CurrentSightsName = photoModelList[0].Ordpg_Sights;
- }
- DataTable dt = CompanyInfoBll.GetList("Company_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "'").Tables[0];
- if (dt.Rows.Count > 0)
- {
- companyModel = CompanyInfoBll.DataRowToModel(dt.Rows[0]);
- }
- });
- if (!isLoad)
- {
- this.Close();
- return;
- }
- 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);
- this.lbOrderNum.Text = MainOrderNumber.Trim();
- if (OrderModel.Ord_SinceOrderNumber.Trim().Length > 0)
- {
- this.lbOrderNum.Text = OrderModel.Ord_SinceOrderNumber.Trim();
- }
- this.WatermarkText = this.companyModel.Company_Name;
- string ordTypeStr = "";
- switch (OrderModel.Ord_Type)
- {
- case "0": ordTypeStr = "婚纱"; break;
- case "1": ordTypeStr = "儿童[" + this.CurrentSightsName + "]"; break;
- case "2": ordTypeStr = "写真"; break;
- case "3": ordTypeStr = "服务"; break;
- case "4": ordTypeStr = "婚庆"; break;
- }
- this.lbName.Text = ordTypeStr;
- this.lbCName.Text = cusBll.GetCustomerNameList(this.OrderModel.Ord_Number, ",");
- this.lbTXName.Text = this.OrderModel.Ord_SeriesName;
- string stateStr = "";
- int cloudState = this.OrderDigital.Ordv_CloudSelectFilmStatus;
- CloudUniquelyIdentify = this.OrderDigital.Ordv_CloudUniquelyIdentify;
- if (this._CloudType == 1)
- {
- cloudState = this.OrderDigital.Ordv_CloudLookStatus;
- CloudUniquelyIdentify = this.OrderDigital.Ordv_CloudDesignUniquelyIdentify;
- }
- switch (cloudState)
- {
- case 0:
- stateStr = "未上传";
- break;
- case 1:
- stateStr = "已上传";
- break;
- case 2:
- stateStr = "已完成";
- break;
- }
- if (cloudState > 0)
- {
- this.chkdelPhoto.Show();
- if (this._CloudType == 0)
- {
- this.chkdelcommodity.Show();
- }
- }
- else {
- this.chkdelPhoto.Hide();
- this.chkdelcommodity.Hide();
- }
- this.lbState.Text = stateStr;
- CreateCode_Choose(CloudUniquelyIdentify);
-
- BindProductList();
- if (this._CloudType == 1)
- {
- BindPhotoList();
- }
- }
- List<LYFZ.Model.Model_ErpOrderProductList> currentOrderProductList = new List<Model.Model_ErpOrderProductList>();
- /// <summary>
- /// 获取当前订单制作商品集合
- /// </summary>
- public List<LYFZ.Model.Model_ErpOrderProductList> CurrentOrderProductList
- {
- get { return currentOrderProductList; }
- set { currentOrderProductList = value; }
- }
- LYFZ.BLL.BLL_ErpOrder currentOrderBll = new BLL.BLL_ErpOrder();
- /// <summary>
- /// 当前订单业务处理类
- /// </summary>
- public LYFZ.BLL.BLL_ErpOrder CurrentOrderBll
- {
- get { return currentOrderBll; }
- set { currentOrderBll = value; }
- }
- LYFZ.BLL.SelectPhotoHandling currentSelectPhotoHandling = null;
- /// <summary>
- /// 当前订单选片处理对象
- /// </summary>
- public LYFZ.BLL.SelectPhotoHandling CurrentSelectPhotoHandling
- {
- get { return currentSelectPhotoHandling; }
- set { currentSelectPhotoHandling = value; }
- }
-
- /// <summary>
- /// 当前选择的选片类型
- /// </summary>
- Model.Model_ErpOrder.DirectoryType _dType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
- /// <summary>
- /// 当前选择的选片类型
- /// </summary>
- public Model.Model_ErpOrder.DirectoryType dType
- {
- get { return _dType; }
- set { _dType = value; }
- }
- /// <summary>
- /// 初始化选片信息
- /// </summary>
- void InitializedSelectionFilmInfo()
- {
- this.CurrentOrderProductList = this.CurrentOrderBll.GetOrderProductList(this._OrderDigital.Ordv_Number, this._OrderDigital.Ordv_ViceNumber, DAL.OrderProductType.制作商品); //读取当前订单已选片信息
- }
- /// <summary>
- /// 绑定产品
- /// </summary>
- void BindProductList()
- {
- if (this.CloudType == 0)
- {
- foreach (LYFZ.Model.Model_ErpOrderProductList productModel in this.CurrentOrderProductList)
- {
- ItemValue itemProduct = new ItemValue(productModel, productModel.OPlist_ProdName);
- itemProduct.Tag = -1;
- this.chkSPList.Items.Add(itemProduct);
- }
-
- LYFZ.Model.Model_ErpOrderProductList IntoFilmModel = new Model.Model_ErpOrderProductList();
- IntoFilmModel.ID = Int32.MaxValue;
- IntoFilmModel.OPlist_ProdName = LYFZ.BLL.SelectPhotoHandling.IntoFilmText;
- IntoFilmModel.OPlist_UniquelyIdentity = IntoFilmModel.OPlist_ProdName;
- ItemValue itemProductIntoFilm = new ItemValue(IntoFilmModel, IntoFilmModel.OPlist_ProdName);
- itemProductIntoFilm.Tag = OrderDigital.Ordv_IntoBottomQuantity;
- this.chkSPList.Items.Add(itemProductIntoFilm);
- LYFZ.Model.Model_ErpOrderProductList IntoBookModel = new Model.Model_ErpOrderProductList();
- IntoBookModel.ID = Int32.MaxValue - 1;
- IntoBookModel.OPlist_ProdName = LYFZ.BLL.SelectPhotoHandling.IntoBookText;
- IntoBookModel.OPlist_UniquelyIdentity = IntoBookModel.OPlist_ProdName;
- ItemValue itemProductIntoBook = new ItemValue(IntoBookModel, IntoBookModel.OPlist_ProdName);
- itemProductIntoBook.Tag = OrderDigital.Ordv_IntoRegisterQuantity;
- this.chkSPList.Items.Add(itemProductIntoBook);
-
- }
- else {
- this.grpSP.Hide();
- }
- }
- /// <summary>
- /// 是否用本地缓存相片进行选片?
- /// </summary>
- bool isLocalPhoto = false;
- List<string> smallPhotoFileList = new List<string>();
- /// <summary>
- /// 缩略图文件路径集合
- /// </summary>
- public List<string> SmallPhotoFileList
- {
- get
- {
- return smallPhotoFileList;
- }
- set { smallPhotoFileList = value; }
- }
- /// <summary>
- /// 加载的缩略图 ImageList
- /// </summary>
- ImageList SmallImagelist = new ImageList();
- /// <summary>
- /// 绑定相片
- /// </summary>
- bool BindPhotoList()
- {
- try
- {
- //检查当前订单是否存在本地缓存相片
- bool isCheckingLocalCache = this.CurrentSelectPhotoHandling.CheckingLocalCache(dType, this.OrderModel.Ord_Number, this.CurrentSightsName, this.OrderModel.Ord_SinceOrderNumber);
- if (isCheckingLocalCache)
- {
- if (ExMessageBoxCustom.Show("发现本地缓存相片,是否用本地缓存相片进行选片?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- isLocalPhoto = true;
- }
- }
- this.SmallPhotoFileList.Clear();
- this.SmallPhotoFileList = currentSelectPhotoHandling.GetSpecifyTypePhotoList(dType, BLL.SelectPhotoHandling.PhotoType.Small, this.CurrentSightsName, isLocalPhoto);
- if (this.SmallPhotoFileList.Count <= 0)
- {
- switch (this.dType)
- {
- case Model.Model_ErpOrder.DirectoryType.PrimitivePicture:
- ExMessageBoxCustom.Show("没有找到原片!");
- break;
- case Model.Model_ErpOrder.DirectoryType.EarlyRetouch:
- ExMessageBoxCustom.Show("没有找到初修片!");
- break;
- case Model.Model_ErpOrder.DirectoryType.DesignPiece:
- ExMessageBoxCustom.Show("没有找到设计片!");
- break;
- default:
- ExMessageBoxCustom.Show("没有找到相关相片!");
- break;
- }
- return false;
- }
- this.listPhotoView.View = View.LargeIcon;
- this.listPhotoView.Items.Clear();
- this.SmallImagelist.Images.Clear();
- this.SmallImagelist.ImageSize = new System.Drawing.Size(86, 86);
- this.SmallImagelist.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
- this.listPhotoView.LargeImageList = this.SmallImagelist;
- for (int i = 0; i < this.SmallPhotoFileList.Count; i++)
- {
- string imageFile = this.SmallPhotoFileList[i];
-
- ListViewItem vItem = new ListViewItem();
- //相片名
- string imgName = System.IO.Path.GetFileName(LYFZ.BLL.SelectPhotoHandling.SmallNameToOriginalName(System.IO.Path.GetFileName(imageFile))).ToUpper();
- if (this.dType == Model.Model_ErpOrder.DirectoryType.DesignPiece)
- {
- imgName = GetDesignConfirmName(imageFile);
- }
- Image smallImage = LYFZ.ImageFunction.ImageOperation.GetNewBitmap(imageFile, true);
- this.SmallImagelist.Images.Add(imgName.ToLower(), smallImage);
- vItem.Name = "vItem" + i.ToString();
- vItem.Text = imgName.ToUpper();
- vItem.Tag = imageFile;
- vItem.ImageIndex = i;
-
- this.listPhotoView.Items.Add(vItem);
- }
- this.listPhotoView.Sort();
- return true;
- }
- catch (Exception ex)
- {
- ExMessageBoxCustom.Show("加载相片出错!错误原因:" + ex.Message);
- return false;
- }
- }
- /// <summary>
- /// 根据完全相片名获取设计版确认标记名
- /// </summary>
- /// <param name="photoFullFileName">相片完全路径名</param>
- /// <returns></returns>
- string GetDesignConfirmName(string photoFullFileName)
- {
- return LYFZ.BLL.SelectPhotoHandling.GetDesignConfirmName(photoFullFileName);
- }
- void CreateCode_Choose(string md5Unique)
- {
- this.CloudUniquelyIdentify = md5Unique;
-
- if (CloudUniquelyIdentify.Trim().Length > 1)
- {
- this.pictureBoxImage.Image = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CreateCode_Choose(GetCloudLinkUrl(md5Unique), "Byte", "M", 8, 4);
- this.btnSendSms.Enabled = true;
- }
- else
- {
- this.btnSendSms.Enabled = false;
- }
- }
- string unique_id = "";
- /// <summary>
- ///
- /// </summary>
- public string Unique_id
- {
- get { return unique_id; }
- }
- LYFZ.Model.Model_ErpOrder _OrderModel = null;
- public LYFZ.Model.Model_ErpOrder OrderModel
- {
- get { return _OrderModel; }
- set { _OrderModel = value; }
- }
- LYFZ.Model.Model_ErpOrderDigital _OrderDigital = null;
- public LYFZ.Model.Model_ErpOrderDigital OrderDigital
- {
- get { return _OrderDigital; }
- set { _OrderDigital = value; }
- }
- /// <summary>
- /// 0 为云选片 1 为云看样
- /// </summary>
- int _CloudType = 0;
- /// <summary>
- /// 类型 0 为云选片 1 为云看样
- /// </summary>
- public int CloudType
- {
- get { return _CloudType; }
- set { _CloudType = value; }
- }
- }
- public class CloudsSelectedResult
- {
- public CloudsSelectedResult() {
-
- }
- public CloudsSelectedResult(string aPath, string gUrl, string ordNo, DataGridViewRow row)
- {
- this.access_path = aPath;
- this.getUrl = gUrl;
- this.Ordv_Number = ordNo;
- this.gRow = row;
- }
- string _Ordv_Number = "";
- /// <summary>
- /// 订单号
- /// </summary>
- public string Ordv_Number
- {
- get { return _Ordv_Number; }
- set { _Ordv_Number = value; }
- }
- string access_path = "";
- /// <summary>
- ///
- /// </summary>
- public string Access_path
- {
- get { return access_path; }
- set { access_path = value; }
- }
- List<SelectProduct> _SelectProductList = new List<SelectProduct>();
- /// <summary>
- /// 选片结果
- /// </summary>
- public List<SelectProduct> SelectProductList
- {
- get { return _SelectProductList; }
- set { _SelectProductList = value; }
- }
- public string GetSelectProductListToString()
- {
- string retMsg = "";
- foreach (SelectProduct p in SelectProductList)
- {
- retMsg += p.Product_name + ":";
- foreach (string photo in p.Photo_list)
- {
- retMsg += photo+",";
- }
- retMsg = retMsg.Trim(',') + "|";
- }
- return retMsg.Trim('|');
- }
- bool _CloudsSelectedStatus = false;
- /// <summary>
- /// 云选状态 false 为未完成 true 为已完成
- /// </summary>
- public bool CloudsSelectedStatus
- {
- get { return _CloudsSelectedStatus; }
- set { _CloudsSelectedStatus = value; }
- }
- /// <summary>
- /// 处理选片结果
- /// </summary>
- /// <param name="jsonData"></param>
- public void HandleFilmSelection(dynamic jsonData)
- {
- dynamic ProductList = jsonData.data.pick_list;
- foreach (dynamic product in ProductList)
- {
- SelectProduct sProduct = new SelectProduct();
- sProduct.Product_id = product.product_id;
- sProduct.Product_name = product.name;
- sProduct.Photo_list.AddRange(product.photo_list.ToString().ToUpper().Split('|'));
- SelectProductList.Add(sProduct);
- }
- this.General_require = jsonData.data.modify_content;
- if (jsonData.data.last_modify_time.ToString() != "")
- {
- this.last_modify_time = Convert.ToDateTime(jsonData.data.last_modify_time);
- }
- try
- {
- if (jsonData.data.order_status.ToString() == "1")
- {
- this._CloudsSelectedStatus = true;
- }
- else {
- this._CloudsSelectedStatus = false;
- }
- }
- catch { }
- }
- List<PhotoLookDesign> _PhotoLookDesignList = new List<PhotoLookDesign>();
- /// <summary>
- /// 云看样结果
- /// </summary>
- public List<PhotoLookDesign> PhotoLookDesignList
- {
- get { return _PhotoLookDesignList; }
- set { _PhotoLookDesignList = value; }
- }
- public string GetPhotoLookDesignListToString() {
- string retMsg = "";
- foreach (PhotoLookDesign p in PhotoLookDesignList)
- {
- retMsg += p.PhotoName + ":"+p.Modify.ToString()+":"+p.Modify_note+"|";
- }
- return retMsg.Trim('|');
- }
- /// <summary>
- /// 处理看样结果
- /// </summary>
- /// <param name="jsonData"></param>
- public void HandleLookDesignSelection(dynamic jsonData)
- {
- dynamic samplePhoto_list = jsonData.data.sample_list;
- foreach (dynamic samplePhoto in samplePhoto_list)
- {
- PhotoLookDesign sPhoto = new PhotoLookDesign();
- sPhoto.Modify =Convert.ToInt32(samplePhoto.modify);
- sPhoto.Modify_note = samplePhoto.modify_note;
- sPhoto.PhotoName = samplePhoto.photo_name.ToUpper();
- PhotoLookDesignList.Add(sPhoto);
- }
- this.General_require = jsonData.data.general_require;
- if (jsonData.data.last_modify_time.ToString() != "")
- {
- this.last_modify_time = Convert.ToDateTime(jsonData.data.last_modify_time);
- }
- try
- {
- if (jsonData.data.order_status.ToString() == "1")
- {
- this._CloudsSelectedStatus = true;
- }
- else
- {
- this._CloudsSelectedStatus = false;
- }
- }
- catch { }
- }
- string getUrl = "";
- /// <summary>
- /// 下载请求地址
- /// </summary>
- public string GetUrl
- {
- get { return getUrl; }
- set { getUrl = value; }
- }
- bool isDownOK = false;
- /// <summary>
- /// 云选结果是否成功
- /// </summary>
- public bool IsDownOK
- {
- get { return isDownOK; }
- set { isDownOK = value; }
- }
- DateTime last_modify_time;
- /// <summary>
- /// 最后云选时间
- /// </summary>
- public DateTime Last_modify_time
- {
- get { return last_modify_time; }
- set { last_modify_time = value; }
- }
- string general_require = "";
- /// <summary>
- /// 客户修改要求
- /// </summary>
- public string General_require
- {
- get { return general_require; }
- set { general_require = value; }
- }
- DataGridViewRow gRow = null;
- public DataGridViewRow GRow
- {
- get { return gRow; }
- set { gRow = value; }
- }
-
- }
- public class SelectProduct {
- public SelectProduct() {
-
- }
- List<string> photo_list = new List<string>();
- /// <summary>
- /// 相片集合
- /// </summary>
- public List<string> Photo_list
- {
- get { return photo_list; }
- set { photo_list = value; }
- }
- int num = 0;
- public int Num
- {
- get { return num; }
- set { num = value; }
- }
- string product_id = "";
- /// <summary>
- /// 商品Id
- /// </summary>
- public string Product_id
- {
- get { return product_id; }
- set { product_id = value; }
- }
- string product_name = "";
- /// <summary>
- /// 商品名
- /// </summary>
- public string Product_name
- {
- get { return product_name; }
- set { product_name = value; }
- }
- }
- public class PhotoLookDesign
- {
- public PhotoLookDesign() {
-
- }
- string photoName = "";
- /// <summary>
- /// 相片名
- /// </summary>
- public string PhotoName
- {
- get { return photoName; }
- set { photoName = value; }
- }
- int modify = 1;
- /// <summary>
- /// 确认状态 1表示已确认状态,为2表示需要修改
- /// </summary>
- public int Modify
- {
- get { return modify; }
- set { modify = value; }
- }
- string modify_note = "";
- /// <summary>
- /// 当前相片的修改要求
- /// </summary>
- public string Modify_note
- {
- get { return modify_note; }
- set { modify_note = value; }
- }
- }
- }
|