FilmsSelectionReservationSmallForm.cs 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Collections;
  10. using LYFZ.Software.MainBusiness.DoorCityProcess;
  11. namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
  12. {
  13. public partial class FilmsSelectionReservationSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.FilmsSelectionReservationSmallForm
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
  17. LYFZ.BLL.BLL_ErpSystemConfigure scbll = new LYFZ.BLL.BLL_ErpSystemConfigure();
  18. LYFZ.BLL.BLL_ErpOrderWorkAnPaiRecord ordwr = new BLL.BLL_ErpOrderWorkAnPaiRecord();
  19. public FilmsSelectionReservationSmallForm()
  20. {
  21. this.Shown += FilmsSelectionReservationSmallForm_Shown;
  22. this.dtpcdgv.Leave += dtpcdgv_Leave;
  23. this.dtpcdgv.ValueChanged += Dtpcdgv_ValueChanged;
  24. this.btnSave.Click += btnSave_Click;
  25. this.lstTextQuery.MouseDoubleClick += lstTextQuery_MouseDoubleClick;
  26. this.lstTextQuery.KeyDown += lstTextQuery_KeyDown;
  27. this.txtTextQuery.EventTextBoxEx_TextChanged += txtTextQuery_EventTextBoxEx_TextChanged;
  28. this.txtTextQuery.Enter += txtTextQuery_Enter;
  29. this.txtTextQuery.KeyDown += txtTextQuery_KeyDown;
  30. this.txtTextQuery.Leave += txtTextQuery_Leave;
  31. this.btnQuery.Click += btnQuery_Click;
  32. this.btnSet.Click += btnSet_Click;
  33. this.btnSelectPerson.Click += btnSelectPerson_Click;
  34. this.cmbtreevPhotographName.ComboBoxTree_NodeMouseClick += cmbtreevPhotographName_ComboBoxTree_NodeMouseClick;
  35. this.cmbtreevStoreName.ComboBoxTree_NodeMouseClick += cmbtreevStoreName_ComboBoxTree_NodeMouseClick;
  36. if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
  37. {
  38. this.mskdgv.ReadOnly = true;
  39. }
  40. else {
  41. this.mskdgv.ReadOnly = false;
  42. }
  43. this.btnSelectTime.Click += BtnSelectTime_Click;
  44. if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
  45. {
  46. this.btnSelectTime.Show();
  47. this.labelEx13.Hide();
  48. this.txtOrderQuantity.Hide();
  49. this.btnSet.Hide();
  50. }
  51. else {
  52. this.btnSelectTime.Hide();
  53. this.mskdgv.ReadOnly = false;
  54. this.labelEx13.Show();
  55. this.txtOrderQuantity.Show();
  56. this.btnSet.Show();
  57. }
  58. }
  59. Model.CameraTimeTemplate currentSelectCameraTime = null;
  60. /// <summary>
  61. /// 当前选择的档期
  62. /// </summary>
  63. public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
  64. private void Dtpcdgv_ValueChanged(object sender, EventArgs e)
  65. {
  66. if (this.currentSelectCameraTime != null)
  67. {
  68. this.mskdgv.Text = "";
  69. }
  70. if (this.TimeTemplateKeyValue != null)
  71. {
  72. if (this.dtpcdgv.DateValue != this.TimeTemplateKeyValue.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd())
  73. {
  74. this.mskdgv.Text = "";
  75. this.TimeTemplateKeyValue = null;
  76. }
  77. }
  78. }
  79. private void cmbtreevStoreName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  80. {
  81. string tempShopID = "";
  82. if (!String.IsNullOrWhiteSpace(this.cmbtreevStoreName.Text))
  83. {
  84. if (this.cmbtreevStoreName.Tag != null)
  85. {
  86. tempShopID = this.cmbtreevStoreName.Tag.ToString();
  87. }
  88. }
  89. if (this.TimeTemplateKeyValue != null)
  90. {
  91. if (tempShopID != this.TimeTemplateKeyValue.DayTemplate.ShopID)
  92. {
  93. this.mskdgv.Text = "";
  94. this.TimeTemplateKeyValue = null;
  95. }
  96. }
  97. }
  98. Model.CameraTimeTemplate TimeTemplateKeyValue = null;
  99. private void BtnSelectTime_Click(object sender, EventArgs e)
  100. {
  101. DateTime dayDate = SDateTime.Now;
  102. string shopID = "";
  103. if (!String.IsNullOrWhiteSpace(dtpcdgv.DateValue))
  104. {
  105. dayDate = Convert.ToDateTime(dtpcdgv.DateValue);
  106. }
  107. if (this.cmbtreevStoreName.Tag!=null)
  108. {
  109. shopID = this.cmbtreevStoreName.Tag.ToString();
  110. }
  111. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
  112. {
  113. if (String.IsNullOrWhiteSpace(this.cmbtreevStoreName.Text))
  114. {
  115. MessageBoxCustom.Show("需要先选择要预约的门店");
  116. return;
  117. }
  118. }
  119. if (String.IsNullOrWhiteSpace(dtpcdgv.DateValue))
  120. {
  121. MessageBoxCustom.Show("需要先选择拍照日期");
  122. return;
  123. }
  124. Model.CameraTimeTemplate cameraTime =PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.选片客人, this.GetCameraOrderType());
  125. if (cameraTime != null)
  126. {
  127. this.TimeTemplateKeyValue = cameraTime;
  128. this.mskdgv.Text = cameraTime.CameraTime;
  129. }
  130. }
  131. public int OrderType = 0;
  132. /// <summary>
  133. /// 主订单号
  134. /// </summary>
  135. public string OrdNumber = "";
  136. /// <summary>
  137. /// 数码编号
  138. /// </summary>
  139. public string OrdViceNumber = "";
  140. /// <summary>
  141. /// 是否保存
  142. /// </summary>
  143. public bool IsSave = false;
  144. /// <summary>
  145. /// 首次运行 true是,false不是
  146. /// </summary>
  147. bool IsFirstRun = true;
  148. Model.CameraOrderType GetCameraOrderType()
  149. {
  150. return (Model.CameraOrderType)OrderType;
  151. }
  152. /// <summary>
  153. /// 窗体加载事件
  154. /// </summary>
  155. /// <param name="sender"></param>
  156. /// <param name="e"></param>
  157. void FilmsSelectionReservationSmallForm_Shown( object sender, EventArgs e )
  158. {
  159. if (this.currentSelectCameraTime != null)
  160. {
  161. this.lbSelectDateInfo.Text = this.currentSelectCameraTime.GetCameraTimeInfo(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID), String.Format("{0} {1}", this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd(), this.currentSelectCameraTime.CameraTime));
  162. }
  163. else
  164. {
  165. this.lbSelectDateInfo.Text = "";
  166. }
  167. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindStoreNameALL( this.cmbtreevStoreName, IsShowAllText: false );
  168. this.btnSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_AnPaiQuantitySet );
  169. #region 获取数据
  170. this.GetDayRemind();
  171. #endregion
  172. #region 预约查询
  173. if ( this.OrdViceNumber.Length > 0 || this.OrdNumber.Length > 0 )
  174. {
  175. this.panelEx3.Visible = false;
  176. this.panelEx4.Height = this.panelEx1.Size.Height - 4;
  177. this.cmbtreevPhotographName.Enabled = false;
  178. this.GetOrdNumberGetData();
  179. this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPaiUpdate );
  180. }
  181. else
  182. {
  183. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData( this.lblName1, this.lblName2 );
  184. this.DataRemind();
  185. this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPai );
  186. }
  187. this.panelEx2.Visible = true;
  188. #endregion
  189. this.IsFirstRun = false;
  190. }
  191. /// <summary>
  192. /// 获取每日可安排订单量
  193. /// </summary>
  194. void GetDayRemind()
  195. {
  196. if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
  197. {
  198. this.txtOrderQuantity.Text = "9999999";
  199. }
  200. else
  201. {
  202. LYFZ.Model.Model_ErpSystemConfigure model = scbll.GetModel("Sconfig_Code", "DayRemind");
  203. if (model.ID > 0 && !string.IsNullOrEmpty(model.Sconfig_Value))
  204. {
  205. string[] StrArray = model.Sconfig_Value.Trim().Split('|');
  206. this.txtOrderQuantity.Text = StrArray[1].Trim();
  207. }
  208. }
  209. }
  210. /// <summary>
  211. /// 日期离开事件
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. void dtpcdgv_Leave( object sender, EventArgs e )
  216. {
  217. if ( !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) && !string.IsNullOrEmpty( this.txtSelectionFilmName.Text.Trim() ) )
  218. {
  219. if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.txtSelectionFilmName.Tag.ToString().Trim() ) )
  220. {
  221. MessageBoxCustom.Show( this.txtSelectionFilmName.Text.Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
  222. this.dtpcdgv.DateValue = "";
  223. return;
  224. }
  225. }
  226. if (this.currentSelectCameraTime != null)
  227. {
  228. if (this.dtpcdgv.DateValue.Trim() == "")
  229. {
  230. this.mskdgv.Text = "";
  231. }
  232. }
  233. this.DataRemind( this.dtpcdgv.DateValue.Trim() );
  234. }
  235. /// <summary>
  236. /// 拍照名称
  237. /// </summary>
  238. /// <param name="sender"></param>
  239. /// <param name="e"></param>
  240. void cmbtreevPhotographName_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e )
  241. {
  242. DataTable tbl = orbll.GetView_Custom( "tb_ErpOrderDigital Left Join tb_ErpOrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber", StrWhere: "Ordv_ViceNumber = '" + this.cmbtreevPhotographName.Tag.ToString().Trim() + "'", ShowColumnName: "Ordv_ReservationFilmSelectionTime,Ordv_ReservationFilmSelectionName,Ords_ProductPickupStatus,Ordv_ReservationFilmSelectionDividedShop,Ordv_IntoBottomQuantity,Ordv_IntoRegisterQuantity").Tables[0];
  243. this.dtpcdgv.DateValue = LYFZ.Command.Command_Validate.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionTime"] );
  244. string Strtime = LYFZ.Command.Command_Validate.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionTime"], "HH:mm" );
  245. this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime;
  246. this.txtSelectionFilmName.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName( tbl.Rows[0]["Ordv_ReservationFilmSelectionName"] );
  247. this.txtSelectionFilmName.Tag = tbl.Rows[0]["Ordv_ReservationFilmSelectionName"].ToString().Trim();
  248. if (tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"]!=null&&!String.IsNullOrWhiteSpace(tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"].ToString().Trim()))
  249. {
  250. this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"].ToString().Trim()));
  251. }
  252. this.tx_rdrc.Text = string.Format("{0}\\{1}", tbl.Rows[0]["Ordv_IntoBottomQuantity"].ToString().Trim(), tbl.Rows[0]["Ordv_IntoRegisterQuantity"].ToString().Trim());
  253. if ( tbl.Rows[0]["Ordv_ReservationFilmSelectionName"].ToString().Trim().Length > 0 || LYFZ.BLL.OtherCommonModel.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionName"] ).Trim().Length > 0 )
  254. {
  255. this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPaiUpdate );
  256. }
  257. else
  258. {
  259. this.btnSave.Enabled = true;
  260. }
  261. if ( tbl.Rows[0]["Ords_ProductPickupStatus"].ToString().Trim() == "OK" )
  262. {
  263. MessageBoxCustom.Show( "'" + this.cmbtreevPhotographName.Text.Trim() + "'取件已完成!" );
  264. this.cmbtreevPhotographName.SetTextAndTag_ValueNull();
  265. }
  266. if (this.currentSelectCameraTime != null)
  267. {
  268. if (String.IsNullOrWhiteSpace(this.dtpcdgv.Text) || String.IsNullOrWhiteSpace(this.mskdgv.Text))
  269. {
  270. this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID));
  271. this.dtpcdgv.DateValue = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
  272. this.mskdgv.Text = this.currentSelectCameraTime.CameraTime;
  273. }
  274. }
  275. }
  276. LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData();
  277. /// <summary>
  278. /// 保存
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. void btnSave_Click( object sender, EventArgs e )
  283. {
  284. if ( this.txtOrderNumber.Text.Trim() != "" )
  285. {
  286. if ( this.dtpcdgv.DateValue.Trim() != "" )
  287. {
  288. if ( this.mskdgv.Text.Trim() != ":" )
  289. {
  290. try { DateTime ssa = Convert.ToDateTime( SDateTime.Now.ToString( "yyyy-MM-dd" ) + " " + this.mskdgv.Text ); }
  291. catch { MessageBoxCustom.Show( "选片时间不是有效时间格式" ); this.mskdgv.Text = ""; return; }
  292. }
  293. }
  294. if (!LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
  295. {
  296. if (this.dgvData.Rows.Count >= Convert.ToInt32(this.txtOrderQuantity.Text))
  297. {
  298. if (!LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetMagess())
  299. {
  300. return;
  301. }
  302. }
  303. else if (MessageBoxCustom.Show("您确定要保存此操作吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  304. {
  305. return;
  306. }
  307. }
  308. else {
  309. if (MessageBoxCustom.Show("您确定要保存此操作吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  310. {
  311. return;
  312. }
  313. }
  314. List<Model.ReservtionParameter> cameraParameterList = new List<Model.ReservtionParameter>();
  315. DateTime StrTime = SDateTime.Now;
  316. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  317. List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  318. LYFZ.Model.Model_ErpOrderDigital model = new Model.Model_ErpOrderDigital();
  319. LYFZ.Model.Model_ErpOrderDigital modelnew = new Model.Model_ErpOrderDigital();
  320. if ( this.cmbtreevPhotographName.Nodes.Count >= 1 )
  321. {
  322. if ( this.cmbtreevPhotographName.Text.Trim().Length <= 0 )
  323. {
  324. MessageBoxCustom.Show( "请选择要安排的拍摄名称" ); return;
  325. }
  326. model = odbll.GetModel( "Ordv_ViceNumber", this.cmbtreevPhotographName.Tag.ToString().Trim() );
  327. modelnew = odbll.GetModel( "Ordv_ViceNumber", this.cmbtreevPhotographName.Tag.ToString().Trim() );
  328. }
  329. else
  330. {
  331. model = odbll.GetModel( "Ordv_Number", this.OrdNumber );
  332. modelnew = odbll.GetModel( "Ordv_Number", this.OrdNumber );
  333. }
  334. if ( !string.IsNullOrEmpty( this.txtSelectionFilmName.Text.Trim() ) )
  335. {
  336. model.Ordv_ReservationFilmSelectionName = this.txtSelectionFilmName.Tag.ToString().Trim();
  337. }
  338. else
  339. {
  340. model.Ordv_ReservationFilmSelectionName = "";
  341. }
  342. if ( this.dtpcdgv.DateValue.Trim() != "" && this.mskdgv.Text.Trim() != ":" )
  343. {
  344. model.Ordv_ReservationFilmSelectionTime = Convert.ToDateTime( this.dtpcdgv.DateValue.Trim() + " " + this.mskdgv.Text.Trim() + ":00" );
  345. }
  346. else if ( this.dtpcdgv.DateValue.Trim() != "" )
  347. {
  348. model.Ordv_ReservationFilmSelectionTime = Convert.ToDateTime( this.dtpcdgv.DateValue.Trim() ); this.mskdgv.Text = "";
  349. }
  350. else
  351. {
  352. model.Ordv_ReservationFilmSelectionTime = null; this.mskdgv.Text = "";
  353. }
  354. ////if (string.IsNullOrEmpty(model.Ordv_ReservationFilmSelectionDividedShop))
  355. //{ model.Ordv_ReservationFilmSelectionDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); }
  356. if ( !string.IsNullOrEmpty( this.cmbtreevStoreName.Tag.ToString().Trim() ) )
  357. {
  358. model.Ordv_ReservationFilmSelectionDividedShop = this.cmbtreevStoreName.Tag.ToString().Trim();
  359. }
  360. else
  361. {
  362. model.Ordv_ReservationFilmSelectionDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  363. }
  364. model.Ordv_FilmSelectionDispatchTime = StrTime;
  365. model.Ordv_FilmSelectionDispatcher = strUserID;
  366. clist.Add( odbll.GetUpdateCommandInfo( model ) );
  367. #region 设置模板预约
  368. cameraParameterList.Add(new Model.ReservtionParameter
  369. {
  370. ShopID = model.Ordv_ReservationFilmSelectionDividedShop
  371. ,
  372. DayDate = this.dtpcdgv.DateValue.Trim()
  373. ,
  374. Time = this.mskdgv.Text.Trim()
  375. ,
  376. VID = model.Ordv_ViceNumber
  377. });
  378. #endregion
  379. if ( !modelnew.Ordv_ReservationFilmSelectionName.Equals( model.Ordv_ReservationFilmSelectionName ) ||
  380. !modelnew.Ordv_ReservationFilmSelectionTime.Equals( model.Ordv_ReservationFilmSelectionTime ) ||
  381. !modelnew.Ordv_ReservationFilmSelectionDividedShop.Equals( model.Ordv_ReservationFilmSelectionDividedShop ) )
  382. {
  383. string storaRecord = "";
  384. if ( !string.IsNullOrEmpty( this.cmbtreevStoreName.Tag.ToString().Trim() ) )
  385. {
  386. storaRecord = "门店:" + this.cmbtreevStoreName.Text.Trim() + " ";
  387. }
  388. LYFZ.Model.Model_ErpOrderWorkAnPaiRecord modelRecord = new Model.Model_ErpOrderWorkAnPaiRecord();
  389. modelRecord.Ordwr_Number = "OWPR_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  390. modelRecord.Ordwr_WorkNumber = model.Ordv_ViceNumber;
  391. modelRecord.Ordwr_OrdNumber = model.Ordv_Number;
  392. modelRecord.Ordwr_ViceNumber = model.Ordv_ViceNumber;
  393. modelRecord.Ordwr_ModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选片客人.ToString();
  394. DataTable dtName = orbll.GetView_Custom( "tb_ErpOrderDigitalStatus", StrWhere: "Ords_ViceNumber = '" + model.Ordv_ViceNumber + "'", ShowColumnName: "Ords_SightsName" ).Tables[0];
  395. if ( dtName.Rows.Count > 0 )
  396. {
  397. modelRecord.Ordwr_UpdateOrderName = dtName.Rows[0]["Ords_SightsName"].ToString().Trim();
  398. }
  399. else
  400. {
  401. modelRecord.Ordwr_UpdateOrderName = "";
  402. }
  403. modelRecord.Ordwr_UpdateAgoPerson = model.Ordv_FilmSelectionDispatcher;
  404. modelRecord.Ordwr_UpdateAgoTime = model.Ordv_FilmSelectionDispatchTime;
  405. modelRecord.Ordwr_UpdateAgoData = storaRecord + "选片时间:" + LYFZ.BLL.OtherCommonModel.DateTimeToString( model.Ordv_ReservationFilmSelectionTime ) + " 选片师:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( model.Ordv_ReservationFilmSelectionName );
  406. modelRecord.Ordwr_CreateDatetime = StrTime;
  407. modelRecord.Ordwr_CreateName = strUserID;
  408. clist.Add( ordwr.GetAddCommandInfo( modelRecord ) );
  409. }
  410. if ( clist.Count > 0 )
  411. {
  412. string retErrorMsg = "";
  413. if (!this.timeDataBll.UpdateReservationTimeDataCommandInfoList(model.Ordv_Number, this.txtOrderNumber.Text, Model.CameraType.选片客人, this.GetCameraOrderType(), cameraParameterList, ref clist, ref retErrorMsg))
  414. {
  415. MessageBoxCustom.Show(String.Format("保存预约失败:{0}", retErrorMsg));
  416. return;
  417. }
  418. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) > 0 )
  419. {
  420. this.IsSave = true;
  421. if ( model.Ordv_ReservationFilmSelectionTime != null && !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( model.Ordv_ReservationFilmSelectionTime ) ) )
  422. {
  423. Model.SMSParameters sparameters = new Model.SMSParameters();
  424. LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
  425. sparameters.OrderNumber = this.OrdNumber;
  426. sparameters.AppointmentPhotographingTime = Convert.ToDateTime( model.Ordv_ReservationFilmSelectionTime );
  427. try
  428. {
  429. smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.客人预约选片后X分钟, sparameters );
  430. }
  431. catch { }
  432. }
  433. MessageBoxCustom.Show( "保存成功" );
  434. this.FilmsSelectionReservationSmallForm_Shown( this, null );
  435. }
  436. else
  437. {
  438. MessageBoxCustom.Show( "保存失败" ); return;
  439. }
  440. }
  441. }
  442. }
  443. /// <summary>
  444. /// 选择工作人员
  445. /// </summary>
  446. /// <param name="sender"></param>
  447. /// <param name="e"></param>
  448. void btnSelectPerson_Click( object sender, EventArgs e )
  449. {
  450. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
  451. frm.StrTime = this.dtpcdgv.DateValue;
  452. frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.选片师;
  453. frm.ShowDialog();
  454. if ( frm.IsSaveed )
  455. {
  456. this.txtSelectionFilmName.Text = frm.StrPersonName;
  457. this.txtSelectionFilmName.Tag = frm.StrPersonNumber;
  458. }
  459. }
  460. /// <summary>
  461. /// 设置
  462. /// </summary>
  463. /// <param name="sender"></param>
  464. /// <param name="e"></param>
  465. void btnSet_Click( object sender, EventArgs e )
  466. {
  467. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ControlSetSuperSmallForm frm = new SuperSmallForm.ControlSetSuperSmallForm();
  468. frm.enumControlSet = SuperSmallForm.ControlSetSuperSmallForm.ControlSet.选片客人;
  469. frm.ShowDialog();
  470. if ( frm.IsSaveed )
  471. {
  472. this.GetDayRemind();
  473. }
  474. }
  475. /// <summary>
  476. /// 加载当日已预约的客人
  477. /// </summary>
  478. /// <param name="StrTime"></param>
  479. /// <param name="StrType"></param>
  480. void DataRemind( string StrTime = "" )
  481. {
  482. string StrWhere = "";
  483. if ( !string.IsNullOrEmpty( this.OrdNumber ) )
  484. {
  485. StrWhere += " and Ordv_ViceNumber != '" + this.OrdViceNumber + "'";
  486. }
  487. int Top = 0;
  488. if ( StrTime != "" )
  489. {
  490. Top = -1;
  491. StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime( "Ordv_ReservationFilmSelectionTime", StrTime, StrTime );
  492. }
  493. StrWhere += " And Ordv_ReservationFilmSelectionDividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() + "' ";
  494. DataTable dt = LYFZ.BLL.BLL_ErpOrderView.GetData_CameraControlBookFilmSelectionRemind( StrWhere, Top );
  495. this.dgvData.Rows.Clear();
  496. if ( this.dgvData.Columns.Count <= 0 )
  497. {
  498. this.dgvData.DataColumns( dt.Columns, strHideField: "Ordv_ViceNumber" );
  499. this.dgvData.Columns["订单号"].Width = 110;
  500. this.dgvData.Columns["选片时间"].Width = 110;
  501. }
  502. for ( int i = 0; i < dt.Rows.Count; i++ )
  503. {
  504. DataGridViewRow dgvr = new DataGridViewRow();
  505. DataGridViewCell cell = null;
  506. for ( int j = 0; j < dt.Columns.Count; j++ )
  507. {
  508. cell = new DataGridViewTextBoxCell();
  509. if ( dt.Columns[j].ColumnName.Trim().Equals( "选片时间" ) )
  510. {
  511. cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString( dt.Rows[i][dt.Columns[j].ColumnName.Trim()] );
  512. }
  513. else
  514. {
  515. cell.Value = dt.Rows[i][dt.Columns[j].ColumnName.Trim()].ToString().Trim();
  516. }
  517. dgvr.Cells.Add( cell );
  518. }
  519. this.dgvData.Rows.Add( dgvr );
  520. }
  521. if (!LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
  522. {
  523. if ( !this.btnSet.Enabled )
  524. {
  525. if ( this.dgvData.Rows.Count >= Convert.ToInt32( this.txtOrderQuantity.Text ) )
  526. {
  527. MessageBoxCustom.Show( "今日订单的安排已满,若要继续安排需要授权!" );
  528. }
  529. }
  530. }
  531. }
  532. /// <summary>
  533. /// 列表事件双击
  534. /// </summary>
  535. /// <param name="sender"></param>
  536. /// <param name="e"></param>
  537. void lstTextQuery_MouseDoubleClick( object sender, MouseEventArgs e )
  538. {
  539. if ( this.lstTextQuery.Items.Count > 0 )
  540. {
  541. if ( ((ListItem)this.lstTextQuery.SelectedItem) != null )
  542. {
  543. this.OrdNumber = ((ListItem)this.lstTextQuery.SelectedItem).StrValue.ToString().Trim();
  544. this.OrdViceNumber = "";
  545. this.GetOrdNumberGetData();
  546. this.txtTextQuery.Text = ((ListItem)this.lstTextQuery.SelectedItem).StrText;
  547. }
  548. }
  549. this.lstTextQuery.Visible = false;
  550. }
  551. /// <summary>
  552. /// 回车键
  553. /// </summary>
  554. /// <param name="sender"></param>
  555. /// <param name="e"></param>
  556. void lstTextQuery_KeyDown( object sender, KeyEventArgs e )
  557. {
  558. if ( e.KeyCode == Keys.Enter )
  559. {
  560. this.lstTextQuery_MouseDoubleClick( this, null );
  561. }
  562. }
  563. /// <summary>
  564. /// 输入值变化
  565. /// </summary>
  566. /// <param name="sender"></param>
  567. /// <param name="e"></param>
  568. void txtTextQuery_EventTextBoxEx_TextChanged( object sender, EventArgs e )
  569. {
  570. if ( !this.IsFirstRun )
  571. {
  572. if ( this.txtTextQuery.Text.Trim() == "" )
  573. {
  574. this.lstTextQuery.Visible = true;
  575. }
  576. }
  577. }
  578. /// <summary>
  579. /// 点击输入框
  580. /// </summary>
  581. /// <param name="sender"></param>
  582. /// <param name="e"></param>
  583. void txtTextQuery_Enter( object sender, EventArgs e )
  584. {
  585. this.txtTextQuery_EventTextBoxEx_TextChanged( null, null );
  586. }
  587. /// <summary>
  588. /// 查询
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. void btnQuery_Click( object sender, EventArgs e )
  593. {
  594. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery ,cameraType: Model.CameraType.选片客人);
  595. }
  596. /// <summary>
  597. /// 按键盘上的下健时
  598. /// </summary>
  599. /// <param name="sender"></param>
  600. /// <param name="e"></param>
  601. void txtTextQuery_KeyDown( object sender, KeyEventArgs e )
  602. {
  603. if ( e.KeyCode == Keys.Down || e.KeyCode == Keys.Up )
  604. {
  605. if (this.lstTextQuery.Items.Count > 0)
  606. {
  607. this.lstTextQuery.SelectedIndex = 0;
  608. this.lstTextQuery.Focus();
  609. }
  610. }
  611. else if ( e.KeyCode == Keys.Enter )
  612. {
  613. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.选片客人);
  614. }
  615. }
  616. /// <summary>
  617. /// 查询文本框离开事件
  618. /// </summary>
  619. /// <param name="sender"></param>
  620. /// <param name="e"></param>
  621. void txtTextQuery_Leave( object sender, EventArgs e )
  622. {
  623. if ( !this.lstTextQuery.Focused )
  624. {
  625. this.lstTextQuery.Visible = false;
  626. }
  627. }
  628. /// <summary>
  629. /// 查询获取订单信息
  630. /// </summary>
  631. /// <param name="StrNumber"></param>
  632. void GetOrdNumberGetData()
  633. {
  634. string StrWhere = " Where ";
  635. if ( this.OrdViceNumber.Length > 0 )
  636. {
  637. StrWhere += "Ordv_ViceNumber = '" + this.OrdViceNumber + "'";
  638. }
  639. else
  640. {
  641. StrWhere += "Ord_Number = '" + this.OrdNumber + "'";
  642. }
  643. string StrTableName = "select Ord_DividedShop," +
  644. "Ord_Number," +
  645. "Ordv_ViceNumber, " +
  646. "Company_Name," +
  647. "Company_DividedShop," +
  648. "Ordv_ReservationFilmSelectionName," +
  649. "Ordv_ReservationFilmSelectionTime," +
  650. "Cus_Name," +
  651. "Cus_Sex_cs," +
  652. "Ord_SinceOrderNumber," +
  653. "Ord_SeriesName," +
  654. "Ord_SeriesPrice," +
  655. "Ordv_IntoRegisterQuantity," +
  656. "Ordv_IntoBottomQuantity," +
  657. "Ord_Type," +
  658. "Ord_OrderPersonName," +
  659. "Ords_SightsName," +
  660. "Ords_ProductPickupStatus " +
  661. "from tb_ErpOrderDigital " +
  662. "Left Join tb_ErpOrder ON Ord_Number = Ordv_Number " +
  663. "Left join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
  664. "Left join OrderPhotographyData on OrderPhotographyData.Ords_ViceNumber = Ordv_ViceNumber " +
  665. "Left join OrderDigital on OrderDigital.Ords_ViceNumber = Ordv_ViceNumber " +
  666. "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ordv_ReservationFilmSelectionDividedShop " + StrWhere + " Order By Ordv_DigitalNumber";
  667. StrTableName = @"with OrderPhotographyData as (
  668. select distinct
  669. Ordpg_Number,
  670. Ordpg_ViceNumber as Ords_ViceNumber,
  671. STUFF(
  672. (
  673. SELECT ',' + Ordpg_Sights
  674. FROM[dbo].tb_ErpOrdersPhotography
  675. WHERE Ordpg_ViceNumber = A.Ordpg_ViceNumber
  676. FOR XML PATH('')
  677. )
  678. ,1,1,''
  679. )AS Ords_SightsName
  680. from
  681. tb_ErpOrdersPhotography as A
  682. group by Ordpg_Number,Ordpg_ViceNumber,Ordpg_PhotographyStatus,Ordpg_PhotographyTime
  683. )
  684. ,asOrderProductPickupStatus as
  685. (
  686. select
  687. max(OPlist_OrderNumber) as orderNumber,
  688. max(convert(varchar(50),OPlist_IsExpedited)) as IsExpedited,
  689. max(OPlist_ExpeditedTime) as ExpeditedTime,
  690. OPlist_ViceNumber as VOrderNumber,
  691. sum(CONVERT(int,[OPlist_PickupStatus])) as PickupStatus,
  692. count(id) productCount
  693. from [tb_ErpOrderProductList]
  694. where OPlist_Type ='2'
  695. group by OPlist_ViceNumber
  696. )
  697. ,OrderDigital as
  698. (
  699. select Ordv_Number as ords_OrdNumber,Ordv_ViceNumber as Ords_ViceNumber,
  700. (case
  701. when PickupStatus = productCount and productCount>0 then 2
  702. when PickupStatus >0 then 1
  703. else 0
  704. end) as Ords_ProductPickupStatus
  705. from tb_ErpOrderDigital
  706. left join asOrderProductPickupStatus
  707. on Ordv_ViceNumber=asOrderProductPickupStatus.VOrderNumber
  708. )
  709. " + StrTableName;
  710. DataTable tbl = orbll.GetView_Custom( StrTableName ).Tables[0];
  711. if ( tbl.Rows.Count > 0 )
  712. {
  713. if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
  714. {
  715. if (this.currentSelectCameraTime != null)
  716. {
  717. if (Convert.ToInt32(tbl.Rows[0]["Ord_Type"].ToString().Trim()) != this.currentSelectCameraTime.DayTemplate.OrderType)
  718. {
  719. MessageBoxCustom.Show(this.currentSelectCameraTime.GetPromptInfo());
  720. return;
  721. }
  722. }
  723. }
  724. this.OrderType = Convert.ToInt32(tbl.Rows[0]["Ord_Type"].ToString().Trim());
  725. this.txtOrderNumber.Text = tbl.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim();
  726. this.txtSeriesName.Text = tbl.Rows[0]["Ord_SeriesName"].ToString().Trim();
  727. this.txtOrdersPerson.Text = tbl.Rows[0]["Ord_OrderPersonName"].ToString().Trim();
  728. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData( this.txtName1, this.txtName2, lblName1, lblName2, tbl.Rows[0]["Ord_Type"].ToString().Trim(), tbl.Rows[0]["Cus_Name"].ToString().Trim(), tbl.Rows[0]["Cus_Sex_cs"].ToString().Trim() );
  729. this.cmbtreevPhotographName.Nodes.Clear();
  730. TreeNode root = null;
  731. DataRow dataRow = null;
  732. for ( int i = 0; i < tbl.Rows.Count; i++ )
  733. {
  734. root = new TreeNode();
  735. root.Name = tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim();
  736. root.Text = tbl.Rows[i]["Ords_SightsName"].ToString().Trim();
  737. root.Tag = tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim();
  738. this.cmbtreevPhotographName.Nodes.Add( root );
  739. string strDate2 = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[i]["Ordv_ReservationFilmSelectionTime"]);
  740. string Strtime2 = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[i]["Ordv_ReservationFilmSelectionTime"], "HH:mm");
  741. if (tbl.Rows[i]["Ords_ProductPickupStatus"].ToString().Trim() != "2"&&(String.IsNullOrWhiteSpace(strDate2) || String.IsNullOrWhiteSpace(Strtime2)))
  742. {
  743. if (dataRow == null)
  744. {
  745. if (this.OrdViceNumber != tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim())
  746. {
  747. dataRow = tbl.Rows[i];
  748. }
  749. }
  750. }
  751. }
  752. if (dataRow == null)
  753. {
  754. dataRow = tbl.Rows[0];
  755. }
  756. this.cmbtreevPhotographName.TagFindText(dataRow["Ordv_ViceNumber"].ToString().Trim() );
  757. if (!String.IsNullOrWhiteSpace(dataRow["Company_Name"].ToString().Trim()))
  758. {
  759. this.cmbtreevStoreName.TextFindTag(dataRow["Company_Name"].ToString().Trim());
  760. }
  761. this.OrdViceNumber = dataRow["Ordv_ViceNumber"].ToString().Trim();
  762. this.OrdNumber = dataRow["Ord_Number"].ToString().Trim();
  763. this.tx_serial_price.Text = dataRow["Ord_SeriesPrice"].ToString().Trim();
  764. this.tx_rdrc.Text = string.Format( "{0}\\{1}", dataRow["Ordv_IntoBottomQuantity"].ToString().Trim(), dataRow["Ordv_IntoRegisterQuantity"].ToString().Trim() );
  765. string strDate = LYFZ.Command.Command_Validate.DateTimeToString(dataRow["Ordv_ReservationFilmSelectionTime"] );
  766. this.dtpcdgv.DateValue = strDate;
  767. this.DataRemind( strDate );
  768. string Strtime = LYFZ.Command.Command_Validate.DateTimeToString(dataRow["Ordv_ReservationFilmSelectionTime"], "HH:mm" );
  769. this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime;
  770. this.txtSelectionFilmName.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(dataRow["Ordv_ReservationFilmSelectionName"] );
  771. this.txtSelectionFilmName.Tag = dataRow["Ordv_ReservationFilmSelectionName"].ToString().Trim();
  772. if (this.currentSelectCameraTime != null)
  773. {
  774. if (String.IsNullOrWhiteSpace(this.dtpcdgv.Text) || String.IsNullOrWhiteSpace(this.mskdgv.Text))
  775. {
  776. this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID));
  777. this.dtpcdgv.DateValue = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
  778. this.mskdgv.Text = this.currentSelectCameraTime.CameraTime;
  779. }
  780. }
  781. if (dataRow["Ords_ProductPickupStatus"].ToString().Trim() == "2" )
  782. {
  783. string StrMaengd = dataRow["Ords_SightsName"].ToString().Trim();
  784. if ( string.IsNullOrEmpty( StrMaengd ) )
  785. {
  786. StrMaengd = "订单取件已完成!";
  787. }
  788. else
  789. {
  790. StrMaengd = "'" + dataRow["Ords_SightsName"].ToString().Trim() + "'取件已完成!";
  791. }
  792. MessageBoxCustom.Show( StrMaengd );
  793. }
  794. if (dataRow["Ord_DividedShop"].ToString().Trim() != LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() )
  795. {
  796. if ( MessageBoxCustom.Show( "'" + dataRow["Ord_SinceOrderNumber"].ToString().Trim() + "'订单不属于本店所开,是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.No )
  797. {
  798. return;
  799. }
  800. }
  801. }
  802. }
  803. }
  804. }