LookDesignReservationSmallForm.cs 38 KB

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