WeddingReservationSmallForm.cs 120 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251
  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. using LYFZ.Helper;
  12. namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
  13. {
  14. public partial class WeddingReservationSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.WeddingReservationSmallForm
  15. {
  16. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  17. LYFZ.BLL.BLL_ErpProduct pdtbll = new BLL.BLL_ErpProduct();
  18. LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
  19. LYFZ.BLL.BLL_ErpPlusPickItems Pbll = new BLL.BLL_ErpPlusPickItems();
  20. LYFZ.BLL.BLL_ErpWeddingService Wbll = new BLL.BLL_ErpWeddingService();
  21. LYFZ.BLL.BLL_ErpProductIntStorage pisbll = new BLL.BLL_ErpProductIntStorage();
  22. LYFZ.BLL.BLL_ErpProductOutStorage posbll = new BLL.BLL_ErpProductOutStorage();
  23. LYFZ.BLL.BLL_ErpOrderWorkAnPaiRecord ordwr = new BLL.BLL_ErpOrderWorkAnPaiRecord();
  24. LYFZ.BLL.BLL_ErpPieceCommissionRecords pcrbll = new BLL.BLL_ErpPieceCommissionRecords();
  25. public WeddingReservationSmallForm()
  26. {
  27. this.Shown += WeddingReservationSmallForm_Shown;
  28. this.btnAddingGuests.Click += btnAddingGuests_Click;
  29. this.btnUpdate.Click += btnUpdate_Click;
  30. this.btnAddService.Click += btnAddService_Click;
  31. this.btnDelete.Click += btnDelete_Click;
  32. this.btnSave.Click += btnSave_Click;
  33. this.lstTextQuery.MouseDoubleClick += lstTextQuery_MouseDoubleClick;
  34. this.lstTextQuery.KeyDown += lstTextQuery_KeyDown;
  35. this.txtTextQuery.EventTextBoxEx_TextChanged += txtTextQuery_EventTextBoxEx_TextChanged;
  36. this.txtTextQuery.Enter += txtTextQuery_Enter;
  37. this.txtTextQuery.KeyDown += txtTextQuery_KeyDown;
  38. this.txtTextQuery.Leave += txtTextQuery_Leave;
  39. this.dgvData.CellDoubleClick += dgvData_CellDoubleClick;
  40. this.cmbtreevdgv.Leave += cmbtreevdgv_Leave;
  41. this.cmbtreevStoreName.Leave += cmbtreevStoreName_Leave;
  42. this.cmbtreevStoreName.IsNodeMouseClick = true;
  43. this.cmbtreevStoreName.AfterSelectLevelFirstNode = true;
  44. this.cmbdgv.Leave += cmbdgv_Leave;
  45. this.mskdgv.Leave += mskdgv_Leave;
  46. this.txtdgv.Leave += txtdgv_Leave;
  47. this.dtpcdgv.Leave += dtpcdgv_Leave;
  48. this.dgvData.CellMouseDown += dgvData_CellMouseDown;
  49. this.btnQuery.Click += btnQuery_Click;
  50. this.txtIntCount.Leave += txtIntCount_Leave;
  51. this.txtIntCount.KeyPress += txtIntCount_KeyPress;
  52. this.dgvData.DataGridViewConMenu_ItemClicked += dgvData_DataGridViewConMenu_ItemClicked;
  53. }
  54. Model.CameraTimeTemplate currentSelectCameraTime = null;
  55. /// <summary>
  56. /// 当前选择的档期
  57. /// </summary>
  58. public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
  59. /// <summary>
  60. /// 是否保存
  61. /// </summary>
  62. public bool IsSaveed = false;
  63. /// <summary>
  64. /// 订单号
  65. /// </summary>
  66. public string OrdNumber;
  67. private DataTable tbl_Department = new DataTable();
  68. private ArrayList listDeteleID = new ArrayList();
  69. string[] StrStatus = ("未开始,进行中,OK").Split( ',' );
  70. /// <summary>
  71. /// 首次运行 true是,false不是
  72. /// </summary>
  73. bool IsFirstRun = true;
  74. /// <summary>
  75. /// 订单类型
  76. /// </summary>
  77. string StrOrdType = "";
  78. /// <summary>
  79. /// 重新安排
  80. /// </summary>
  81. bool IsUpdateAnPai = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_PhotographClientAnPaiUpdate );
  82. /// <summary>
  83. /// 窗体加载事件
  84. /// </summary>
  85. /// <param name="sender"></param>
  86. /// <param name="e"></param>
  87. void WeddingReservationSmallForm_Shown( object sender, EventArgs e )
  88. {
  89. if (this.currentSelectCameraTime != null)
  90. {
  91. 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));
  92. }
  93. else
  94. {
  95. this.lbSelectDateInfo.Text = "";
  96. }
  97. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindStoreNameALL( this.cmbtreevStoreName, IsShowAllText: false );
  98. tbl_Department = orbll.GetView_Custom( "tb_ErpDepartment", ShowColumnName: "ID,Dt_Name" ).Tables[0];
  99. if ( !string.IsNullOrEmpty( OrdNumber ) )
  100. {
  101. this.panelEx2.Visible = false;
  102. this.panelEx4.Height = this.panelEx1.Size.Height - 4;
  103. this.btnAddingGuests.Visible = false;
  104. this.GetOrdNumberGetData();
  105. }
  106. else
  107. {
  108. this.SetClientData();
  109. this.GetOrdNumberGetData();
  110. }
  111. this.panelEx4.Visible = true;
  112. this.IsFirstRun = false;
  113. this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_ServiceClientAnPai );
  114. }
  115. /// <summary>
  116. /// 添加客人
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. void btnAddingGuests_Click( object sender, EventArgs e )
  121. {
  122. EnumPublic.OrderType orderType = LYFZ.EnumPublic.OrderType.服务订单;
  123. #if DEBUG
  124. this.OpenNewOrder( orderType, "" );
  125. #else
  126. LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01();
  127. frm.OrdType = orderType;
  128. frm.ShowDialog();
  129. if (frm.IsSaveed)
  130. {
  131. this.OrdNumber = frm.StrNumber;
  132. this.GetOrdNumberGetData();
  133. }
  134. #endif
  135. }
  136. /// <summary>
  137. /// 修改资料
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. void btnUpdate_Click( object sender, EventArgs e )
  142. {
  143. if ( !string.IsNullOrEmpty( this.OrdNumber ) )
  144. {
  145. if ( !string.IsNullOrEmpty( this.StrOrdType ) )
  146. {
  147. EnumPublic.OrderType orderType = (LYFZ.EnumPublic.OrderType)Enum.Parse( typeof( LYFZ.EnumPublic.OrderType ), this.StrOrdType );
  148. //#if DEBUG
  149. this.OpenNewOrder( orderType, this.OrdNumber );
  150. //#else
  151. // LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01();
  152. // frm.OrdType = orderType;
  153. // frm.StrNumber = this.OrdNumber;
  154. // frm.ShowDialog();
  155. // if (frm.IsSaveed)
  156. // {
  157. // this.OrdNumber = frm.StrNumber;
  158. // this.GetOrdNumberGetData();
  159. // }
  160. //#endif
  161. }
  162. }
  163. }
  164. void OpenNewOrder( EnumPublic.OrderType orderType, string _OrderNumber = "" )
  165. {
  166. frmNewOrder newOrder = new frmNewOrder();
  167. newOrder.OrderNumber = _OrderNumber;
  168. //newOrder.IsShowUcNavigationTool = false;
  169. //newOrder.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  170. //newOrder.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  171. //newOrder.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  172. newOrder.OrderType = orderType;
  173. newOrder.ShowDialog();
  174. if ( newOrder.IsSaveData )
  175. {
  176. this.OrdNumber = newOrder.OrderNumber;
  177. this.GetOrdNumberGetData();
  178. }
  179. }
  180. /// <summary>
  181. /// 添加服务
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. void btnAddService_Click( object sender, EventArgs e )
  186. {
  187. if ( string.IsNullOrEmpty( this.OrdNumber ) )
  188. {
  189. MessageBoxCustom.Show( "未选择订单!" ); return;
  190. }
  191. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm frm = new LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm();
  192. frm.LoadType = "婚庆服务";
  193. frm.ShowDialog();
  194. if ( frm.IsSaveed )
  195. {
  196. List<LYFZ.Model.Model_ErpProduct> mlist = frm.mlist;
  197. for ( int k = 0; k < this.dgvData.Rows.Count; k++ )
  198. {
  199. for ( int i = 0; i < mlist.Count; i++ )
  200. {
  201. if ( this.dgvData.Rows[k].Cells["Ws_ProdNumber"].Value.ToString().Trim() == mlist[i].Prod_Number.Trim() && this.dgvData.Rows[k].Cells["服务状态"].Value.ToString().Trim() != "OK" )
  202. {
  203. this.dgvData.Rows[k].Cells["数量"].Value = (Convert.ToInt32( this.dgvData.Rows[k].Cells["数量"].Value ) + 1).ToString().Trim();
  204. this.dgvData.Rows[k].Tag = "1";
  205. mlist.RemoveAt( i );
  206. break;
  207. }
  208. }
  209. }
  210. for ( int i = 0; i < mlist.Count; i++ )
  211. {
  212. DataGridViewRow dgvl = new DataGridViewRow();
  213. DataGridViewCell cell = null;
  214. cell = new DataGridViewTextBoxCell();
  215. cell.Value = "";
  216. dgvl.Cells.Add( cell );
  217. cell = new DataGridViewTextBoxCell();
  218. cell.Value = mlist[i].Prod_Number.Trim();
  219. dgvl.Cells.Add( cell );
  220. cell = new DataGridViewTextBoxCell();
  221. cell.Value = "2";
  222. dgvl.Cells.Add( cell );
  223. cell = new DataGridViewTextBoxCell();
  224. cell.Value = mlist[i].Prod_CostPrice;
  225. dgvl.Cells.Add( cell );
  226. cell = new DataGridViewTextBoxCell();
  227. cell.Value = mlist[i].Prod_SalesPrice;
  228. dgvl.Cells.Add( cell );
  229. cell = new DataGridViewTextBoxCell();
  230. cell.Value = mlist[i].Prod_Name.Trim();
  231. dgvl.Cells.Add( cell );
  232. cell = new DataGridViewTextBoxCell();
  233. cell.Value = "1";
  234. dgvl.Cells.Add( cell );
  235. cell = new DataGridViewTextBoxCell();
  236. DataTable dt = orbll.GetView_Custom( "select Company_DividedShop,Company_Name from tb_ErpCompanyInfo where Company_DividedShop ='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'" ).Tables[0];
  237. cell.Value = dt.Rows[0]["Company_Name"].ToLowerString().Trim();
  238. cell.Tag = dt.Rows[0]["Company_DividedShop"].ToLowerString().Trim();
  239. dgvl.Cells.Add( cell );
  240. cell = new DataGridViewTextBoxCell();
  241. cell.Value = StrStatus[0].Trim();
  242. dgvl.Cells.Add( cell );
  243. for ( int k = 0; k < 5; k++ )
  244. {
  245. cell = new DataGridViewTextBoxCell();
  246. cell.Value = "";
  247. cell.Tag = "";
  248. dgvl.Cells.Add( cell );
  249. }
  250. dgvl.Tag = "1";
  251. this.dgvData.Rows.Add( dgvl );
  252. }
  253. }
  254. }
  255. /// <summary>
  256. /// 删除服务
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. void btnDelete_Click( object sender, EventArgs e )
  261. {
  262. if ( this.dgvData.SelectedRows.Count > 0 )
  263. {
  264. if ( this.dgvData.SelectedRows.Count == 1 )
  265. {
  266. if ( this.dgvData.SelectedRows[0].Cells["ID"].Value.ToString().Trim() != "" )
  267. {
  268. if ( MessageBoxCustom.Show( "你确定要删除选择的服务?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
  269. {
  270. if ( this.dgvData.SelectedRows[0].Cells["Ws_Type"].Value.ToString().Trim() == "2" )
  271. {
  272. listDeteleID.Add( this.dgvData.SelectedRows[0].Cells["ID"].Value.ToString().Trim() );
  273. }
  274. this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[0].Index );
  275. }
  276. }
  277. else
  278. {
  279. this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[0].Index );
  280. }
  281. }
  282. else
  283. {
  284. if ( MessageBoxCustom.Show( "你确定要删除选择的服务?\r\n\r\n说明:只能删除此处添加的服务", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
  285. {
  286. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  287. {
  288. if ( this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() != "" )
  289. {
  290. if ( this.dgvData.SelectedRows[i].Cells["Ws_Type"].Value.ToString().Trim() == "2" )
  291. {
  292. listDeteleID.Add( this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() );
  293. }
  294. this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[i].Index );
  295. }
  296. else
  297. {
  298. this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[i].Index );
  299. }
  300. }
  301. }
  302. }
  303. }
  304. }
  305. LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData();
  306. /// <summary>
  307. /// 暂存预约选择的档期数据
  308. /// </summary>
  309. Dictionary<int, Model.CameraTimeTemplate> TimeTemplateKeyValues = new Dictionary<int, Model.CameraTimeTemplate>();
  310. Model.CameraOrderType GetCameraOrderType()
  311. {
  312. return (Model.CameraOrderType)Convert.ToInt32(this.StrOrdType);
  313. }
  314. /// <summary>
  315. /// 保存
  316. /// </summary>
  317. /// <param name="sender"></param>
  318. /// <param name="e"></param>
  319. void btnSave_Click( object sender, EventArgs e )
  320. {
  321. if ( this.dgvData.Rows.Count > 0 )
  322. {
  323. if ( string.IsNullOrEmpty( this.OrdNumber ) )
  324. {
  325. MessageBoxCustom.Show( "未选择订单!" ); return;
  326. }
  327. string StrName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  328. DateTime StrTime = SDateTime.Now;
  329. List<Model.ReservtionParameter> cameraParameterList = new List<Model.ReservtionParameter>();
  330. List<CommandInfo> clist = new List<CommandInfo>();
  331. bool Isbl = false;
  332. string StrServerContent = "";
  333. for ( int i = 0; i < this.dgvData.Rows.Count; i++ )
  334. {
  335. if ( this.dgvData.Rows[i].Cells["ID"].Value.ToString().Trim() == "" )
  336. {
  337. Isbl = true;
  338. StrServerContent += this.dgvData.Rows[i].Cells["服务内容"].Value.ToString().Trim() + ",";
  339. }
  340. }
  341. if ( listDeteleID.Count > 0 )
  342. {
  343. Isbl = true;
  344. }
  345. decimal dec_Amount = 0;
  346. string str_Name = "";
  347. string str_Remark = "";
  348. string str_SaleMan = "";
  349. string str_TwoSaleCategory = "";
  350. if ( Isbl )
  351. {
  352. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ServicePaymentSuperSmallForm frm = new SuperSmallForm.ServicePaymentSuperSmallForm();
  353. frm.StrServerText = StrServerContent.TrimEnd( ',' );
  354. frm.ShowDialog();
  355. if ( !frm.IsSave )
  356. {
  357. return;
  358. }
  359. dec_Amount = frm.OutAmount;
  360. str_Name = frm.OutName;
  361. str_Remark = frm.OutRemark;
  362. str_SaleMan = frm.SaleMan;
  363. str_TwoSaleCategory = frm.TwoSaleCategory;
  364. }
  365. #region 服务内容
  366. for ( int i = 0; i < listDeteleID.Count; i++ )
  367. {
  368. clist.Add( Wbll.GetDeleteCommandInfo( "ID", "=", listDeteleID[i].ToString().Trim() ) );
  369. }
  370. LYFZ.Model.Model_ErpWeddingService wm = null;
  371. Hashtable htEmssAnPai = new Hashtable();
  372. Hashtable htEmssOK = new Hashtable();
  373. for ( int i = 0; i < this.dgvData.Rows.Count; i++ )
  374. {
  375. if ( this.dgvData.Rows[i].Tag != null )
  376. {
  377. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["ID"].Value.ToString().Trim() ) )
  378. {
  379. wm = Wbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
  380. string StrRen = "";
  381. if ( this.dgvData.Rows[i].Cells["服务人员1"].Tag != null &&
  382. wm.Ws_Serviceman1.Trim() != this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim() )
  383. {
  384. StrRen += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
  385. }
  386. if ( this.dgvData.Rows[i].Cells["服务人员2"].Tag != null &&
  387. wm.Ws_Serviceman2.Trim() != this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() )
  388. {
  389. StrRen += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
  390. }
  391. if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != LYFZ.Command.Command_Validate.DateTimeToString( wm.Ws_WeddingDate ) )
  392. {
  393. if ( !string.IsNullOrEmpty( StrRen ) )
  394. {
  395. if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
  396. {
  397. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen;
  398. }
  399. else
  400. {
  401. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen;
  402. }
  403. }
  404. else
  405. {
  406. string StrRen3 = "";
  407. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() ) )
  408. {
  409. StrRen3 += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
  410. }
  411. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() ) )
  412. {
  413. StrRen3 += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
  414. }
  415. if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
  416. {
  417. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen3;
  418. }
  419. else
  420. {
  421. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen3;
  422. }
  423. }
  424. }
  425. string StrStatus = this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "未开始" ? "0" : this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "OK" ? "1" : "2";
  426. if ( this.dgvData.Rows[i].Cells["服务状态"].Tag != null )
  427. {
  428. if ( this.dgvData.Rows[i].Cells["服务状态"].Tag.ToString().Trim() == "1" && wm.Ws_Status.Trim() != StrStatus && StrStatus == "1" )
  429. {
  430. string StrRen2 = "";
  431. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() ) )
  432. {
  433. StrRen2 += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
  434. }
  435. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() ) )
  436. {
  437. StrRen2 += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
  438. }
  439. if ( htEmssOK.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
  440. {
  441. htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen2;
  442. }
  443. else
  444. {
  445. htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen2;
  446. }
  447. }
  448. }
  449. if(StrStatus!="0")
  450. {
  451. wm.Ws_ServiceShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID;
  452. }
  453. if ( this.dgvData.Rows[i].Cells["数量"].Value.ToString().Trim() != "" )
  454. {
  455. wm.Ws_ProdQuantity = Convert.ToInt32( this.dgvData.Rows[i].Cells["数量"].Value );
  456. }
  457. if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" && this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() != "" )
  458. {
  459. wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() + " " + this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() );
  460. }
  461. else if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  462. {
  463. wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() );
  464. }
  465. else
  466. {
  467. wm.Ws_WeddingDate = null; this.dgvData.Rows[i].Cells["服务时间"].Value = "";
  468. }
  469. if ( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" )
  470. {
  471. wm.Ws_Serviceman1 = this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim();
  472. }
  473. else { wm.Ws_Serviceman1 = ""; }
  474. if ( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" )
  475. {
  476. wm.Ws_Serviceman2 = this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim();
  477. }
  478. else
  479. {
  480. wm.Ws_Serviceman2 = "";
  481. }
  482. //// if (string.IsNullOrEmpty(wm.Ws_ReservationServiceDividedShop))
  483. //{ wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); }
  484. if ( this.dgvData.Rows[i].Cells["服务门店"].Tag != null )
  485. {
  486. wm.Ws_ReservationServiceDividedShop = this.dgvData.Rows[i].Cells["服务门店"].Tag.ToString();
  487. }
  488. else
  489. {
  490. wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  491. }
  492. wm.Ws_Status = StrStatus;
  493. wm.Ws_Remark = this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim();
  494. wm.Ws_WeddingDispatchDate = StrTime;
  495. wm.Ws_WeddingDispatcher = StrName;
  496. clist.AddRange( this.GetLessInventory( ref wm, StrTime, StrName ) );
  497. clist.Add( Wbll.GetUpdateCommandInfo( wm ) );
  498. #region 设置模板预约
  499. cameraParameterList.Add(new Model.ReservtionParameter
  500. {
  501. ShopID = wm.Ws_ReservationServiceDividedShop
  502. ,
  503. DayDate = this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()
  504. ,
  505. Time = this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim()
  506. ,
  507. VID = wm.ID.ToString()
  508. });
  509. #endregion
  510. LYFZ.Model.Model_ErpWeddingService modelnew = Wbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
  511. if ( !modelnew.Ws_Serviceman1.Equals( wm.Ws_Serviceman1 ) ||
  512. !modelnew.Ws_Serviceman2.Equals( wm.Ws_Serviceman2 ) ||
  513. !modelnew.Ws_WeddingDate.Equals( wm.Ws_WeddingDate ) ||
  514. !modelnew.Ws_ReservationServiceDividedShop.Equals( wm.Ws_ReservationServiceDividedShop ) )
  515. {
  516. string storaRecord = "";
  517. if ( this.dgvData.Rows[i].Cells["服务门店"].Value.ToString().Trim() != "" )
  518. {
  519. storaRecord = "门店:" + this.dgvData.Rows[i].Cells["服务门店"].Value.ToString().Trim() + " ";
  520. }
  521. LYFZ.Model.Model_ErpOrderWorkAnPaiRecord modelRecord = new Model.Model_ErpOrderWorkAnPaiRecord();
  522. modelRecord.Ordwr_Number = "OWPR_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  523. modelRecord.Ordwr_WorkNumber = wm.ID.ToString().Trim();
  524. modelRecord.Ordwr_OrdNumber = wm.Ws_Number;
  525. modelRecord.Ordwr_ViceNumber = wm.Ws_ViceNumber;
  526. modelRecord.Ordwr_ModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排服务客人.ToString();
  527. modelRecord.Ordwr_UpdateOrderName = wm.Ws_ProdName;
  528. modelRecord.Ordwr_UpdateAgoPerson = wm.Ws_WeddingDispatcher;
  529. modelRecord.Ordwr_UpdateAgoTime = wm.Ws_WeddingDispatchDate;
  530. modelRecord.Ordwr_UpdateAgoData = storaRecord + "服务时间:" + LYFZ.BLL.OtherCommonModel.DateTimeToString( wm.Ws_WeddingDate ) + " 服务人员1:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( wm.Ws_Serviceman1 ) + " 服务人员2:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( wm.Ws_Serviceman2 );
  531. modelRecord.Ordwr_CreateDatetime = StrTime;
  532. modelRecord.Ordwr_CreateName = StrName;
  533. clist.Add( ordwr.GetAddCommandInfo( modelRecord ) );
  534. }
  535. if ( LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ServiceCompletedAddPieceRate && wm.Ws_Status == "1" )
  536. {
  537. if ( !string.IsNullOrEmpty( wm.Ws_Serviceman1 ) )
  538. {
  539. LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 1, StrTime, StrName );
  540. if ( modelRecords != null )
  541. {
  542. clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
  543. }
  544. }
  545. if ( !string.IsNullOrEmpty( wm.Ws_Serviceman2 ) )
  546. {
  547. LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 2, StrTime, StrName );
  548. if ( modelRecords != null )
  549. {
  550. clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
  551. }
  552. }
  553. }
  554. else
  555. {
  556. string StrContentName = wm.Ws_Number + "_" + wm.Ws_ProdName + "_" + wm.Ws_UpdateDateTime.ToString( "yyyyMMdd HHmmssfff" );
  557. DataTable tbl = orbll.GetView_Custom( "tb_ErpPieceCommissionRecords", StrWhere: "Pcr_MarkKey = '" + StrContentName + "'", ShowColumnName: "ID" ).Tables[0];
  558. if ( tbl.Rows.Count > 0 )
  559. {
  560. clist.Add( pcrbll.GetDeleteCommandInfo( "ID", "=", tbl.Rows[0]["ID"] ) );
  561. }
  562. }
  563. }
  564. else
  565. {
  566. wm = new Model.Model_ErpWeddingService();
  567. string StrRen = "";
  568. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim() ) )
  569. {
  570. StrRen += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
  571. }
  572. if ( StrRen != this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() && !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() ) )
  573. {
  574. StrRen += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
  575. }
  576. if ( string.IsNullOrEmpty( StrRen ) )
  577. {
  578. if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
  579. {
  580. if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
  581. {
  582. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen;
  583. }
  584. else
  585. {
  586. htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen;
  587. }
  588. }
  589. }
  590. wm.Ws_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  591. wm.Ws_Number = this.OrdNumber;
  592. wm.Ws_Type = "2";
  593. wm.Ws_OrderByNumber = (i + 1);
  594. wm.Ws_ProdNumber = this.dgvData.Rows[i].Cells["Ws_ProdNumber"].Value.ToString().Trim();
  595. wm.Ws_ProdName = this.dgvData.Rows[i].Cells["服务内容"].Value.ToString().Trim();
  596. wm.Ws_ProdCostPrice = Convert.ToDecimal( this.dgvData.Rows[i].Cells["Ws_ProdCostPrice"].Value );
  597. wm.Ws_ProdSoldPrice = Convert.ToDecimal( this.dgvData.Rows[i].Cells["Ws_ProdSoldPrice"].Value );
  598. wm.Ws_ProdQuantity = Convert.ToInt32( this.dgvData.Rows[i].Cells["数量"].Value );
  599. if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  600. {
  601. if ( this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() != "" )
  602. {
  603. wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() + " " + this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() );
  604. }
  605. else
  606. {
  607. wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() );
  608. }
  609. }
  610. wm.Ws_WeddingDateLunar = "0";
  611. if ( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" )
  612. {
  613. wm.Ws_Serviceman1 = this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim();
  614. }
  615. else
  616. {
  617. wm.Ws_Serviceman1 = "";
  618. }
  619. if ( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" )
  620. {
  621. wm.Ws_Serviceman2 = this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim();
  622. }
  623. else
  624. {
  625. wm.Ws_Serviceman2 = "";
  626. }
  627. wm.Ws_Status = this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "未开始" ? "0" : this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "OK" ? "1" : "2";
  628. wm.Ws_Remark = this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim();
  629. if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() != "未开始" || this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim() != "" )
  630. {
  631. wm.Ws_WeddingDispatchDate = StrTime;
  632. wm.Ws_WeddingDispatcher = StrName;
  633. }
  634. // if (string.IsNullOrEmpty(wm.Ws_ReservationServiceDividedShop))
  635. {
  636. wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  637. }
  638. wm.Ws_UpdateDateTime = StrTime;
  639. wm.Ws_UpdateName = StrName;
  640. clist.AddRange( this.GetLessInventory( ref wm, StrTime, StrName ) );
  641. clist.Add( Wbll.GetAddCommandInfo( wm ) );
  642. if ( LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ServiceCompletedAddPieceRate && wm.Ws_Status == "1" )
  643. {
  644. if ( !string.IsNullOrEmpty( wm.Ws_Serviceman1 ) )
  645. {
  646. LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 1, StrTime, StrName );
  647. if ( modelRecords != null )
  648. {
  649. clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
  650. }
  651. }
  652. if ( !string.IsNullOrEmpty( wm.Ws_Serviceman2 ) )
  653. {
  654. LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 2, StrTime, StrName );
  655. if ( modelRecords != null )
  656. {
  657. clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
  658. }
  659. }
  660. }
  661. }
  662. }
  663. }
  664. #endregion
  665. #region 新增收款项目
  666. if ( Isbl )
  667. {
  668. LYFZ.Model.Model_ErpPlusPickItems model = new Model.Model_ErpPlusPickItems();// Obll.GetModel("Ord_Number", this.OrdNumber);
  669. model.Plu_OrdNumber = this.OrdNumber;
  670. model.Plu_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  671. model.Plu_Amount = dec_Amount;
  672. model.Plu_Goods = str_Name;
  673. model.Plu_GoodsCosts = "0";
  674. model.Plu_SourceType = "0";
  675. model.Plu_OpenSingle = str_SaleMan;
  676. model.Plu_TwoPinsCategory = str_TwoSaleCategory;
  677. model.Plu_RecordedPerson = StrName;
  678. model.Plu_CreateTime = StrTime;
  679. clist.Add( Pbll.GetAddCommandInfo( model ) );
  680. }
  681. #endregion
  682. if ( clist.Count > 0 )
  683. {
  684. string retErrorMsg = "";
  685. if (!this.timeDataBll.UpdateReservationTimeDataCommandInfoList(OrdNumber, this.txtOrderNumber.Text, Model.CameraType.服务客人, this.GetCameraOrderType(), cameraParameterList, ref clist, ref retErrorMsg))
  686. {
  687. MessageBoxCustom.Show(String.Format("保存预约失败:{0}", retErrorMsg));
  688. return;
  689. }
  690. if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) <= 0 )
  691. {
  692. MessageBoxCustom.Show( "添加收收款项目失败;" ); return;
  693. }
  694. new System.Threading.Thread( new System.Threading.ThreadStart( delegate ()
  695. {
  696. LYFZ.BLL.BLL_ErpOrderDigitalStatus.UpdateDigitalStatus( this.OrdNumber, EnumPublic.OrderDigitalStatusEnum.摄控服务 );
  697. } ) ).Start();
  698. }
  699. if ( htEmssAnPai.Count > 0 || htEmssOK.Count > 0 )
  700. {
  701. System.Threading.Thread t = new System.Threading.Thread( new System.Threading.ThreadStart( delegate ()
  702. {
  703. if ( htEmssAnPai.Count > 0 )
  704. {
  705. foreach ( DictionaryEntry item in htEmssAnPai )
  706. {
  707. if ( !string.IsNullOrEmpty( item.Key.ToString().Trim() ) )
  708. {
  709. Model.SMSParameters sparameters = new Model.SMSParameters();
  710. sparameters.OrderNumber = wm.Ws_Number;
  711. sparameters.AppointmentPhotographingTime = Convert.ToDateTime( item.Key );
  712. try
  713. {
  714. smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.服务预约后X分钟, sparameters );
  715. }
  716. catch { }
  717. }
  718. }
  719. }
  720. if ( htEmssOK.Count > 0 )
  721. {
  722. foreach ( DictionaryEntry item in htEmssOK )
  723. {
  724. if ( !string.IsNullOrEmpty( item.Key.ToString().Trim() ) )
  725. {
  726. Model.SMSParameters sparameters = new Model.SMSParameters();
  727. sparameters.OrderNumber = wm.Ws_Number;
  728. sparameters.AppointmentPhotographingTime = Convert.ToDateTime( item.Key );
  729. try
  730. {
  731. smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.服务完成后X分钟, sparameters );
  732. }
  733. catch { }
  734. }
  735. }
  736. }
  737. } ) );
  738. t.Start();
  739. }
  740. MessageBoxCustom.Show( "保存成功" );
  741. this.IsSaveed = true;
  742. this.Close();
  743. }
  744. }
  745. /// <summary>
  746. /// 减库存
  747. /// </summary>
  748. /// <param name="model"></param>
  749. /// <param name="StrTime"></param>
  750. /// <param name="StrUserID"></param>
  751. /// <returns></returns>
  752. List<Helper.CommandInfo> GetLessInventory( ref LYFZ.Model.Model_ErpWeddingService model, DateTime StrTime, string StrUserID )
  753. {
  754. List<Helper.CommandInfo> clist = new List<CommandInfo>();
  755. DataTable tblList = orbll.GetView_Custom( "tb_ErpProduct", StrWhere: "Prod_Number = '" + model.Ws_ProdNumber + "' And Prod_Availability = 1", ShowColumnName: "*" ).Tables[0];
  756. if ( tblList.Rows.Count > 0 )
  757. {
  758. LYFZ.Model.Model_ErpProduct modelpt = pdtbll.DataRowToModel( tblList.Rows[0] );
  759. if ( model.Ws_Status == "1" )
  760. {
  761. int CompletedHadLessQuantity = model.Ws_CompletedHadLessQuantity;
  762. int CompletedQuantity = model.Ws_ProdQuantity;
  763. model.Ws_CompletedHadLessQuantity = CompletedQuantity;
  764. if ( CompletedQuantity > CompletedHadLessQuantity )
  765. {
  766. modelpt.Prod_Quantity = modelpt.Prod_Quantity - (CompletedQuantity - CompletedHadLessQuantity);
  767. LYFZ.Model.Model_ErpProductOutStorage modelOutStorage = new Model.Model_ErpProductOutStorage();
  768. modelOutStorage.Pos_OutQuantity = (CompletedQuantity - CompletedHadLessQuantity);
  769. modelOutStorage.Pos_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  770. modelOutStorage.Pos_ProductCategory = modelpt.Prod_Class;
  771. modelOutStorage.Pos_ProductNumber = modelpt.Prod_Number;
  772. modelOutStorage.Pos_Remark = "服务商品,服务完成自动出库";
  773. modelOutStorage.Pos_OutTime = StrTime;
  774. modelOutStorage.Pos_OutName = StrUserID;
  775. clist.Add( posbll.GetAddCommandInfo( modelOutStorage ) );
  776. }
  777. else
  778. {
  779. modelpt.Prod_Quantity = modelpt.Prod_Quantity + (CompletedHadLessQuantity - CompletedQuantity);
  780. LYFZ.Model.Model_ErpProductIntStorage modelIntStorage = new Model.Model_ErpProductIntStorage();
  781. modelIntStorage.Pis_PurchaseQuantity = (CompletedHadLessQuantity - CompletedQuantity);
  782. modelIntStorage.Pis_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  783. modelIntStorage.Pis_ProductCategory = modelpt.Prod_Class;
  784. modelIntStorage.Pis_ProductNumber = modelpt.Prod_Number;
  785. modelIntStorage.Pis_PurchasePrice = modelpt.Prod_CostPrice;
  786. modelIntStorage.Pis_PurchaseVendor = "";
  787. modelIntStorage.Pis_Remark = "服务商品,由已完成数量" + CompletedHadLessQuantity + "修改为" + CompletedQuantity;
  788. modelIntStorage.Pis_CreateName = StrUserID;
  789. modelIntStorage.Pis_CreateDatetime = StrTime;
  790. clist.Add( pisbll.GetAddCommandInfo( modelIntStorage ) );
  791. }
  792. }
  793. else
  794. {
  795. LYFZ.Model.Model_ErpProductIntStorage modelIntStorage = new Model.Model_ErpProductIntStorage();
  796. modelpt.Prod_Quantity = modelpt.Prod_Quantity + model.Ws_CompletedHadLessQuantity;
  797. modelIntStorage.Pis_PurchaseQuantity = model.Ws_CompletedHadLessQuantity;
  798. model.Ws_CompletedHadLessQuantity = 0;
  799. modelIntStorage.Pis_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  800. modelIntStorage.Pis_ProductCategory = modelpt.Prod_Class;
  801. modelIntStorage.Pis_ProductNumber = modelpt.Prod_Number;
  802. modelIntStorage.Pis_PurchasePrice = modelpt.Prod_CostPrice;
  803. modelIntStorage.Pis_PurchaseVendor = "";
  804. modelIntStorage.Pis_Remark = "服务商品,由已完成修改为未完成自动入库之前已出库的数量";
  805. modelIntStorage.Pis_CreateName = StrUserID;
  806. modelIntStorage.Pis_CreateDatetime = StrTime;
  807. clist.Add( pisbll.GetAddCommandInfo( modelIntStorage ) );
  808. }
  809. modelpt.Prod_UpdateDateTime = StrTime;
  810. modelpt.Prod_UpdateName = StrUserID;
  811. clist.Add( pdtbll.GetUpdateCommandInfo( modelpt ) );
  812. }
  813. return clist;
  814. }
  815. /// <summary>
  816. /// 列表事件双击
  817. /// </summary>
  818. /// <param name="sender"></param>
  819. /// <param name="e"></param>
  820. void lstTextQuery_MouseDoubleClick( object sender, MouseEventArgs e )
  821. {
  822. if ( this.lstTextQuery.Items.Count > 0 )
  823. {
  824. if ( ((ListItem)this.lstTextQuery.SelectedItem) != null )
  825. {
  826. this.OrdNumber = ((ListItem)this.lstTextQuery.SelectedItem).StrValue.ToString().Trim();
  827. this.GetOrdNumberGetData();
  828. this.txtTextQuery.Text = ((ListItem)this.lstTextQuery.SelectedItem).StrText;
  829. }
  830. }
  831. this.lstTextQuery.Visible = false;
  832. }
  833. /// <summary>
  834. /// 回车键
  835. /// </summary>
  836. /// <param name="sender"></param>
  837. /// <param name="e"></param>
  838. void lstTextQuery_KeyDown( object sender, KeyEventArgs e )
  839. {
  840. if ( e.KeyCode == Keys.Enter )
  841. {
  842. this.lstTextQuery_MouseDoubleClick( this, null );
  843. }
  844. }
  845. /// <summary>
  846. /// 输入值变化
  847. /// </summary>
  848. /// <param name="sender"></param>
  849. /// <param name="e"></param>
  850. void txtTextQuery_EventTextBoxEx_TextChanged( object sender, EventArgs e )
  851. {
  852. if ( !this.IsFirstRun )
  853. {
  854. if ( this.txtTextQuery.Text.Trim() == "" )
  855. {
  856. this.lstTextQuery.Visible = true;
  857. }
  858. }
  859. }
  860. /// <summary>
  861. /// 点击输入框
  862. /// </summary>
  863. /// <param name="sender"></param>
  864. /// <param name="e"></param>
  865. void txtTextQuery_Enter( object sender, EventArgs e )
  866. {
  867. this.txtTextQuery_EventTextBoxEx_TextChanged( null, null );
  868. }
  869. /// <summary>
  870. /// 查询
  871. /// </summary>
  872. /// <param name="sender"></param>
  873. /// <param name="e"></param>
  874. void btnQuery_Click( object sender, EventArgs e )
  875. {
  876. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.服务客人);
  877. }
  878. /// <summary>
  879. /// 按键盘上的下健时
  880. /// </summary>
  881. /// <param name="sender"></param>
  882. /// <param name="e"></param>
  883. void txtTextQuery_KeyDown( object sender, KeyEventArgs e )
  884. {
  885. if ( e.KeyCode == Keys.Down || e.KeyCode == Keys.Up )
  886. {
  887. if (this.lstTextQuery.Items.Count > 0)
  888. {
  889. if (this.lstTextQuery.SelectedItem != null)
  890. {
  891. this.lstTextQuery.SelectedIndex = 0; this.lstTextQuery.Focus();
  892. }
  893. }
  894. }
  895. else if ( e.KeyCode == Keys.Enter )
  896. {
  897. LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.服务客人);
  898. }
  899. }
  900. /// <summary>
  901. /// 文本框失去焦点事件
  902. /// </summary>
  903. /// <param name="sender"></param>
  904. /// <param name="e"></param>
  905. void txtTextQuery_Leave( object sender, EventArgs e )
  906. {
  907. if ( !this.lstTextQuery.Focused )
  908. {
  909. this.lstTextQuery.Visible = false;
  910. }
  911. }
  912. /// <summary>
  913. /// 列表列双击事件
  914. /// </summary>
  915. /// <param name="sender"></param>
  916. /// <param name="e"></param>
  917. void dgvData_CellDoubleClick( object sender, DataGridViewCellEventArgs e )
  918. {
  919. if ( e.ColumnIndex >= 0 && e.RowIndex >= 0 )
  920. {
  921. this.cmbdgv.Visible = false;
  922. this.mskdgv.Visible = false;
  923. this.dtpcdgv.Visible = false;
  924. this.cmbtreevdgv.Visible = false;
  925. this.txtdgv.Visible = false;
  926. this.lstTextQuery.Visible = false;
  927. this.txtIntCount.Visible = false;
  928. if ( this.dgvData.CurrentRow.Cells["服务状态"].Value.ToString().Trim() != "OK" )
  929. {
  930. if ( String.IsNullOrEmpty( this.dgvData.Rows[e.RowIndex].Cells["ID"].Value.ToString() ) )
  931. {
  932. if ( this.dgvData.Columns[e.ColumnIndex].Name == "数量" )
  933. {
  934. DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
  935. Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
  936. this.txtIntCount.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y - 1 );
  937. this.txtIntCount.Size = rect.Size;
  938. this.txtIntCount.Visible = true;
  939. this.txtIntCount.Text = (String)cell.Value;
  940. this.txtIntCount.Focus();
  941. }
  942. else
  943. {
  944. return;
  945. }
  946. }
  947. DataTable dt = orbll.GetView_Custom( "tb_ErpWeddingService", StrWhere: "ID = '" + this.dgvData.Rows[e.RowIndex].Cells["ID"].Value + "'", ShowColumnName: "Ws_ReservationServiceDividedShop,Ws_WeddingDate,Ws_Serviceman1,Ws_Serviceman2,Ws_Remark" ).Tables[0];
  948. if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务门店" )
  949. {
  950. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_ReservationServiceDividedShop"].ToString() ) ) && !IsUpdateAnPai )
  951. {
  952. return;
  953. }
  954. DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
  955. Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
  956. this.cmbtreevStoreName.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
  957. this.cmbtreevStoreName.Size = rect.Size;
  958. this.cmbtreevStoreName.Visible = true;
  959. this.mskdgv.Visible = false;
  960. this.cmbtreevdgv.Visible = false;
  961. this.txtdgv.Visible = false;
  962. this.dtpcdgv.Visible = false;
  963. this.cmbtreevStoreName.TextFindTag( cell.Value.ToString().Trim() );
  964. this.cmbtreevStoreName.StrKey = "F";
  965. this.cmbtreevStoreName.Focus();
  966. }
  967. else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务日期" )//选择日期
  968. {
  969. if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
  970. {
  971. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString() ) ) )
  972. {
  973. return;
  974. }
  975. }
  976. DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
  977. Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
  978. this.dtpcdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
  979. this.dtpcdgv.Size = rect.Size;
  980. this.dtpcdgv.Visible = true;
  981. this.dtpcdgv.DateValue = cell.Value.ToString().Trim();
  982. this.dtpcdgv.Focus();
  983. }
  984. else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务时间" )//选择时间
  985. {
  986. if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != "" )
  987. {
  988. if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
  989. {
  990. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" )
  991. {
  992. return;
  993. }
  994. }
  995. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule|| !LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
  996. {
  997. DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
  998. Rectangle rect = this.dgvData.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, true);
  999. this.mskdgv.Location = new Point(rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y);
  1000. this.mskdgv.Size = rect.Size;
  1001. this.mskdgv.Visible = true;
  1002. this.mskdgv.Text = cell.Value.ToString().Trim();
  1003. this.mskdgv.Tag = "S";
  1004. this.mskdgv.Focus();
  1005. }
  1006. else {
  1007. //选择时间
  1008. DateTime dayDate = SDateTime.Now;
  1009. string shopID = "";
  1010. List<DateTime> dateTimes = GetDateTime();
  1011. List<string> selectShopIDs = GetSelectShopID();
  1012. if (dateTimes.Count > 0)
  1013. {
  1014. dayDate = dateTimes[0];
  1015. }
  1016. if (selectShopIDs.Count > 0)
  1017. {
  1018. shopID = selectShopIDs[0];
  1019. }
  1020. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
  1021. {
  1022. if (selectShopIDs.Count <= 0)
  1023. {
  1024. MessageBoxCustom.Show("需要先选择要预约的门店");
  1025. return;
  1026. }
  1027. }
  1028. if (dateTimes.Count <= 0)
  1029. {
  1030. MessageBoxCustom.Show("需要先选择服务日期");
  1031. return;
  1032. }
  1033. Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.服务客人, this.GetCameraOrderType());
  1034. if (cameraTime != null)
  1035. {
  1036. DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
  1037. cell.Value = cameraTime.CameraTime;
  1038. if (TimeTemplateKeyValues.ContainsKey(e.RowIndex))
  1039. {
  1040. this.TimeTemplateKeyValues.Remove(e.RowIndex);
  1041. }
  1042. this.TimeTemplateKeyValues.Add(e.RowIndex, cameraTime);
  1043. this.dgvData.Rows[e.RowIndex].Tag = "1";
  1044. }
  1045. }
  1046. }
  1047. else
  1048. {
  1049. MessageBoxCustom.Show( "请先填服务日期" ); return;
  1050. }
  1051. }
  1052. else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务状态" )//选择状态
  1053. {
  1054. if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != "" )
  1055. {
  1056. if ( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.CurrentRow.Cells["服务人员2"].Value.ToString().Trim() != "" )
  1057. {
  1058. DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
  1059. Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
  1060. this.cmbdgv.Items.Clear();
  1061. for ( int i = 0; i < StrStatus.Length; i++ )
  1062. {
  1063. this.cmbdgv.Items.Add( StrStatus[i].Trim() );
  1064. }
  1065. this.cmbdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
  1066. this.cmbdgv.Size = rect.Size;
  1067. this.cmbdgv.Visible = true;
  1068. this.cmbdgv.Text = cell.Value.ToString().Trim();
  1069. this.cmbdgv.Tag = "Z";
  1070. this.cmbdgv.Focus();
  1071. }
  1072. else
  1073. {
  1074. MessageBoxCustom.Show( "服务人员必填一位" ); return;
  1075. }
  1076. }
  1077. else
  1078. {
  1079. MessageBoxCustom.Show( "请先填服务日期" ); return;
  1080. }
  1081. }
  1082. else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务备注" )//选择状态
  1083. {
  1084. if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
  1085. {
  1086. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Remark"].ToString() ) ) )
  1087. {
  1088. return;
  1089. }
  1090. }
  1091. DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
  1092. Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
  1093. this.txtdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y - 1 );
  1094. this.txtdgv.Size = rect.Size;
  1095. this.txtdgv.Visible = true;
  1096. this.txtdgv.Text = (String)cell.Value;
  1097. this.txtdgv.Focus();
  1098. this.txtdgv.Focus();
  1099. }
  1100. else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员1" || this.dgvData.Columns[e.ColumnIndex].Name == "服务人员2" )
  1101. {
  1102. LYFZ.EnumPublic.EnumWorkPersonType WorkPersonType = EnumPublic.EnumWorkPersonType.服务师1;
  1103. if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员1" )
  1104. {
  1105. if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
  1106. {
  1107. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Serviceman1"].ToString() ) ) )
  1108. {
  1109. return;
  1110. }
  1111. }
  1112. WorkPersonType = EnumPublic.EnumWorkPersonType.服务师1;
  1113. }
  1114. if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员2" )
  1115. {
  1116. if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
  1117. {
  1118. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Serviceman2"].ToString() ) ) )
  1119. {
  1120. return;
  1121. }
  1122. }
  1123. WorkPersonType = EnumPublic.EnumWorkPersonType.服务师2;
  1124. }
  1125. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
  1126. frm.StrTime = this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim();
  1127. frm.WorkPersonType = WorkPersonType;
  1128. frm.ShowDialog();
  1129. if ( frm.IsSaveed )
  1130. {
  1131. this.dgvData.CurrentRow.Cells[e.ColumnIndex].Value = frm.StrPersonName;
  1132. this.dgvData.CurrentRow.Cells[e.ColumnIndex].Tag = frm.StrPersonNumber;
  1133. this.dgvData.CurrentRow.Tag = "1";
  1134. }
  1135. }
  1136. }
  1137. else { MessageBoxCustom.Show( "此服务已结束不能再修改!" ); return; }
  1138. }
  1139. }
  1140. /// <summary>
  1141. /// 服务人员失去焦点
  1142. /// </summary>
  1143. /// <param name="sender"></param>
  1144. /// <param name="e"></param>
  1145. void cmbtreevdgv_Leave( object sender, EventArgs e )
  1146. {
  1147. if ( this.cmbtreevdgv.StrKey != null )
  1148. {
  1149. if ( this.cmbtreevdgv.StrKey.ToString().Trim() == "R1" )
  1150. {
  1151. this.dgvData.CurrentRow.Cells["服务人员1"].Value = this.cmbtreevdgv.Text.Trim();
  1152. if ( this.cmbtreevdgv.Text != "" )
  1153. {
  1154. this.dgvData.CurrentRow.Cells["服务人员1"].Tag = this.cmbtreevdgv.Tag.ToString().Trim();
  1155. }
  1156. else { this.dgvData.CurrentRow.Cells["服务人员1"].Tag = null; }
  1157. }
  1158. if ( this.cmbtreevdgv.StrKey.ToString().Trim() == "R2" )
  1159. {
  1160. this.dgvData.CurrentRow.Cells["服务人员2"].Value = this.cmbtreevdgv.Text.Trim(); if ( this.cmbtreevdgv.Text != "" )
  1161. {
  1162. this.dgvData.CurrentRow.Cells["服务人员2"].Tag = this.cmbtreevdgv.Tag.ToString().Trim();
  1163. }
  1164. else { this.dgvData.CurrentRow.Cells["服务人员2"].Tag = null; }
  1165. }
  1166. this.dgvData.CurrentRow.Tag = "1";
  1167. this.cmbtreevdgv.Visible = false;
  1168. }
  1169. }
  1170. /// <summary>
  1171. /// 选择门店
  1172. /// </summary>
  1173. /// <param name="sender"></param>
  1174. /// <param name="e"></param>
  1175. void cmbtreevStoreName_Leave( object sender, EventArgs e )
  1176. {
  1177. if ( this.cmbtreevStoreName.StrKey != null )
  1178. {
  1179. if ( this.cmbtreevStoreName.StrKey.ToString().Trim() == "F" )
  1180. {
  1181. if ( this.cmbtreevStoreName.Text.Trim() != "" )
  1182. {
  1183. this.dgvData.CurrentRow.Cells["服务门店"].Value = this.cmbtreevStoreName.Text.Trim();
  1184. this.dgvData.CurrentRow.Cells["服务门店"].Tag = this.cmbtreevStoreName.Tag;
  1185. }
  1186. else
  1187. {
  1188. this.dgvData.CurrentRow.Cells["服务门店"].Value = "";
  1189. this.dgvData.CurrentRow.Cells["服务门店"].Tag = null;
  1190. }
  1191. this.dgvData.CurrentRow.Tag = "1";
  1192. }
  1193. this.cmbtreevStoreName.Visible = false;
  1194. }
  1195. }
  1196. /// <summary>
  1197. /// 下拉选择失去焦点
  1198. /// </summary>
  1199. /// <param name="sender"></param>
  1200. /// <param name="e"></param>
  1201. void cmbdgv_Leave( object sender, EventArgs e )
  1202. {
  1203. if ( this.cmbdgv.Tag != null )
  1204. {
  1205. if ( this.cmbdgv.Tag.ToString().Trim() == "Z" )
  1206. {
  1207. this.dgvData.CurrentRow.Cells["服务状态"].Value = this.cmbdgv.Text.Trim();
  1208. }
  1209. this.dgvData.CurrentRow.Cells["服务状态"].Tag = "1";
  1210. this.dgvData.CurrentRow.Tag = "1";
  1211. this.cmbdgv.Visible = false;
  1212. }
  1213. }
  1214. /// <summary>
  1215. /// 下拉选择失去焦点
  1216. /// </summary>
  1217. /// <param name="sender"></param>
  1218. /// <param name="e"></param>
  1219. void mskdgv_Leave( object sender, EventArgs e )
  1220. {
  1221. if ( this.mskdgv.Tag != null )
  1222. {
  1223. if ( this.mskdgv.Tag.ToString().Trim() == "S" )
  1224. {
  1225. if ( this.mskdgv.Text.Trim() != ":" )
  1226. {
  1227. try
  1228. {
  1229. DateTime strts = Convert.ToDateTime( SDateTime.Now.ToString( "yyyy-MM-dd" ) + " " + this.mskdgv.Text.Trim() );
  1230. this.dgvData.CurrentRow.Cells["服务时间"].Value = this.mskdgv.Text.Trim();
  1231. }
  1232. catch { MessageBoxCustom.Show( "不是有效的时间格式" ); this.mskdgv.Text = ""; this.mskdgv.Focus(); return; }
  1233. }
  1234. else
  1235. {
  1236. this.dgvData.CurrentRow.Cells["服务时间"].Value = "";
  1237. }
  1238. this.dgvData.CurrentRow.Cells["服务时间"].Tag = "1";
  1239. this.dgvData.CurrentRow.Tag = "1";
  1240. }
  1241. this.mskdgv.Visible = false;
  1242. }
  1243. }
  1244. /// <summary>
  1245. /// 备注离开事件
  1246. /// </summary>
  1247. /// <param name="sender"></param>
  1248. /// <param name="e"></param>
  1249. void txtdgv_Leave( object sender, EventArgs e )
  1250. {
  1251. this.dgvData.CurrentRow.Cells["服务备注"].Value = this.txtdgv.Text.Trim();
  1252. this.dgvData.CurrentRow.Tag = "1";
  1253. this.txtdgv.Visible = false;
  1254. }
  1255. /// <summary>
  1256. /// 数量离开事件
  1257. /// </summary>
  1258. /// <param name="sender"></param>
  1259. /// <param name="e"></param>
  1260. void txtIntCount_Leave( object sender, EventArgs e )
  1261. {
  1262. this.dgvData.CurrentRow.Cells["数量"].Value = this.txtIntCount.Text.Trim();
  1263. this.dgvData.CurrentRow.Tag = "1";
  1264. this.txtIntCount.Visible = false;
  1265. }
  1266. /// <summary>
  1267. /// 日期控件失去焦点
  1268. /// </summary>
  1269. /// <param name="sender"></param>
  1270. /// <param name="e"></param>
  1271. void dtpcdgv_Leave( object sender, EventArgs e )
  1272. {
  1273. if ( this.dgvData.CurrentCell.ColumnIndex == this.dgvData.Columns["服务日期"].Index )
  1274. {
  1275. if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != this.dtpcdgv.DateValue.Trim() && !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) )
  1276. {
  1277. this.dgvData.CurrentRow.Cells["服务日期"].Tag = "1";
  1278. }
  1279. if ( !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) )
  1280. {
  1281. if ( !string.IsNullOrEmpty( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() ) )
  1282. {
  1283. if ( this.dgvData.CurrentRow.Cells["服务人员1"].Tag != null )
  1284. {
  1285. if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.dgvData.CurrentRow.Cells["服务人员1"].Tag.ToString().Trim() ) )
  1286. {
  1287. MessageBoxCustom.Show( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
  1288. this.dtpcdgv.DateValue = "";
  1289. this.dtpcdgv.Focus();
  1290. return;
  1291. }
  1292. }
  1293. }
  1294. if ( !string.IsNullOrEmpty( this.dgvData.CurrentRow.Cells["服务人员2"].Value.ToString().Trim() ) )
  1295. {
  1296. if ( this.dgvData.CurrentRow.Cells["服务人员2"].Tag != null )
  1297. {
  1298. if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.dgvData.CurrentRow.Cells["服务人员2"].Tag.ToString().Trim() ) )
  1299. {
  1300. MessageBoxCustom.Show( this.dgvData.CurrentRow.Cells["服务人员2"].Value.ToString().Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
  1301. this.dtpcdgv.DateValue = "";
  1302. this.dtpcdgv.Focus();
  1303. return;
  1304. }
  1305. }
  1306. }
  1307. this.dgvData.CurrentRow.Cells["服务日期"].Value = this.dtpcdgv.DateValue.Trim();
  1308. }
  1309. else
  1310. {
  1311. this.dgvData.CurrentRow.Cells["服务日期"].Value = "";
  1312. this.dgvData.CurrentRow.Cells["服务时间"].Value = "";
  1313. }
  1314. this.dgvData.CurrentRow.Tag = "1";
  1315. }
  1316. this.dtpcdgv.Text = "";
  1317. this.dtpcdgv.Visible = false;
  1318. }
  1319. /// <summary>
  1320. /// 绑定
  1321. /// </summary>
  1322. /// <param name="WsNumber"></param>
  1323. void GetOrdNumberGetData()
  1324. {
  1325. string strWhere = "";
  1326. string strWhere2 = "";
  1327. if ( !string.IsNullOrEmpty( this.OrdNumber ) )
  1328. {
  1329. strWhere = " Ord_Number = '" + this.OrdNumber + "'";
  1330. strWhere2 = " and Ws_Number = '" + this.OrdNumber + "'";
  1331. }
  1332. else
  1333. {
  1334. strWhere = " tb_ErpOrder.ID = '0' ";
  1335. strWhere2 = " and tb_ErpWeddingService.ID = '0'";
  1336. }
  1337. string strViewName = "tb_ErpOrder Left Join dbo.tb_ErpOrderDigital ON Ord_Number = Ordv_Number " +
  1338. "left join dbo.tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber";
  1339. string strColumnName = "Ord_DividedShop," +
  1340. "M_Cus_CustomerNumber," +
  1341. "Cus_Name," +
  1342. "Cus_Sex_cs," +
  1343. "Ord_SeriesPrice," +
  1344. "Ordv_IntoRegisterQuantity," +
  1345. "Ordv_IntoBottomQuantity," +
  1346. "CASE [Ord_SinceOrderNumber] WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS ShowOrdNumber," +
  1347. "Ord_SeriesName,Ord_Type," +
  1348. "(select stuff((select ',' + dbo.fn_CheckUserIDGetUserName( OrdPe_OrdersPerson) from tb_ErpOrdersPerson where OrdPe_OrderNumber=Ord_Number for xml path('')),1,1,'')) as OrdPe_OrdersPerson," +
  1349. "Ordv_ViceNumber," +
  1350. "Case when Ord_Type = '1' then (select top 1 Ordpg_Sights from dbo.tb_ErpOrdersPhotography where Ordpg_Number = Ordv_Number and Ordpg_ViceNumber = Ordv_ViceNumber) else '' end AS Ordpg_Sights";
  1351. string strColumnName2 = "tb_ErpWeddingService.ID," +
  1352. "Ws_ProdNumber," +
  1353. "Ws_Type," +
  1354. "Ws_ProdCostPrice," +
  1355. "Ws_ProdSoldPrice," +
  1356. "Ws_ProdName AS 服务内容," +
  1357. "Ws_ProdQuantity AS 数量," +
  1358. "Company_Name AS 服务门店," +
  1359. "Company_DividedShop AS 门店编号," +
  1360. "dbo.fn_CheckWeddingServiceStatus(Ws_Status) AS 服务状态," +
  1361. "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ws_WeddingDate)) AS 服务日期," +
  1362. "dbo.fn_CheckDateTimeReturn_Time(dbo.fn_CheckDateTime(Ws_WeddingDate)) AS 服务时间," +
  1363. "Ws_Serviceman1 AS 服务人员1," +
  1364. "Ws_Serviceman2 AS 服务人员2," +
  1365. "Ws_Remark AS 服务备注";
  1366. string ExecuteSql = orbll.GetView_CustomReturnExecuteSql( strViewName, StrWhere: strWhere, ShowColumnName: strColumnName );
  1367. ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql( "tb_ErpWeddingService Left Join tb_ErpCompanyInfo on Company_DividedShop = Ws_ReservationServiceDividedShop", StrWhere: " (Ws_Type = '1' or Ws_Type = '2') " + strWhere2, ShowColumnName: strColumnName2 );
  1368. DataSet dtSet = orbll.GetView_Custom( ExecuteSql );
  1369. DataTable tblOrder = dtSet.Tables["ds"];
  1370. DataTable tblWedding = dtSet.Tables["ds1"];
  1371. if ( this.dgvData.Columns.Count <= 0 )
  1372. {
  1373. for ( int i = 0; i < tblWedding.Columns.Count; i++ )
  1374. {
  1375. if ( tblWedding.Columns[i].ColumnName.Trim() != "门店编号" )
  1376. {
  1377. DataGridViewColumn dc = new DataGridViewColumn();
  1378. dc.HeaderText = tblWedding.Columns[i].ColumnName.Trim();
  1379. dc.Name = tblWedding.Columns[i].ColumnName.Trim();
  1380. switch ( dc.Name.Trim() )
  1381. {
  1382. case "ID":
  1383. case "Ws_ProdNumber":
  1384. case "Ws_Type":
  1385. case "Ws_ProdCostPrice":
  1386. case "Ws_ProdSoldPrice":
  1387. dc.Visible = false; break;
  1388. case "服务备注": dc.Width = 240; break;
  1389. case "数量": dc.Width = 80; break;
  1390. default: break;
  1391. }
  1392. dc.ReadOnly = true;
  1393. this.dgvData.Columns.Add( dc );
  1394. }
  1395. }
  1396. }
  1397. this.dgvData.Rows.Clear();
  1398. if ( tblOrder.Rows.Count > 0 )
  1399. {
  1400. if ( tblOrder.Rows[0]["Ord_DividedShop"].ToString().Trim() != LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() )
  1401. {
  1402. if ( MessageBoxCustom.Show( "'" + tblOrder.Rows[0]["ShowOrdNumber"].ToString().Trim() + "'订单不属于本店所开,是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.No )
  1403. {
  1404. return;
  1405. }
  1406. }
  1407. if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
  1408. {
  1409. if (this.currentSelectCameraTime != null)
  1410. {
  1411. if (tblOrder.Rows[0]["Ord_Type"].ToString().Trim() != this.currentSelectCameraTime.DayTemplate.OrderType.ToString())
  1412. {
  1413. MessageBoxCustom.Show(this.currentSelectCameraTime.GetPromptInfo());
  1414. return;
  1415. }
  1416. }
  1417. }
  1418. this.tx_serial_price.Text = tblOrder.Rows[0]["Ord_SeriesPrice"].ToString().Trim();
  1419. this.tx_rdrc.Text = string.Format( "{0}\\{1}", tblOrder.Rows[0]["Ordv_IntoBottomQuantity"].ToString().Trim(), tblOrder.Rows[0]["Ordv_IntoRegisterQuantity"].ToString().Trim() );
  1420. this.txtOrderNumber.Text = tblOrder.Rows[0]["ShowOrdNumber"].ToString().Trim();
  1421. this.txtSeriesName.Text = tblOrder.Rows[0]["Ord_SeriesName"].ToString().Trim();
  1422. this.txtOrdersPerson.Text = tblOrder.Rows[0]["OrdPe_OrdersPerson"].ToString().Trim();
  1423. DataTable tblClientWedding = orbll.GetView_Custom( "tb_ErpCustomer", StrWhere: "Cus_CustomerNumber = '" + tblOrder.Rows[0]["M_Cus_CustomerNumber"].ToString().Trim() + "'", ShowColumnName: "Cus_DayForMarriage,Cus_DayForMarriageLunar" ).Tables[0];
  1424. if ( tblClientWedding.Rows.Count > 0 )
  1425. {
  1426. this.txtWedding.Text = LYFZ.Command.Command_Validate.DateTimeToString( tblClientWedding.Rows[0]["Cus_DayForMarriage"] );
  1427. this.chkWedding.Checked = false;
  1428. if ( LYFZ.Command.Command_Validate.DateTimeToString( tblClientWedding.Rows[0]["Cus_DayForMarriage"] ) != "" )
  1429. {
  1430. if ( tblClientWedding.Rows[0]["Cus_DayForMarriageLunar"].ToString().Trim() == "1" )
  1431. {
  1432. this.chkWedding.Checked = true;
  1433. }
  1434. }
  1435. }
  1436. this.StrOrdType = tblOrder.Rows[0]["Ord_Type"].ToString().Trim();
  1437. this.SetClientData( tblOrder.Rows[0]["Cus_Name"].ToString().Trim(), tblOrder.Rows[0]["Cus_Sex_cs"].ToString().Trim(), tblOrder.Rows[0]["Ord_Type"].ToString().Trim() );
  1438. //DataGridViewCell cellShopID = null;
  1439. // DataGridViewCell cellDate = null;
  1440. // DataGridViewCell cellTime = null;
  1441. for ( int i = 0; i < tblWedding.Rows.Count; i++ )
  1442. {
  1443. DataGridViewRow dgvl = new DataGridViewRow();
  1444. DataGridViewCell cell = null;
  1445. for ( int j = 0; j < tblWedding.Columns.Count; j++ )
  1446. {
  1447. if ( tblWedding.Columns[j].ColumnName.Trim() != "门店编号" )
  1448. {
  1449. cell = new DataGridViewTextBoxCell();
  1450. switch ( tblWedding.Columns[j].ColumnName.Trim() )
  1451. {
  1452. case "服务门店":
  1453. // cellShopID = cell;
  1454. cell.Value = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim();
  1455. cell.Tag = tblWedding.Rows[i]["门店编号"].ToString().Trim();
  1456. break;
  1457. case "服务人员1":
  1458. case "服务人员2":
  1459. cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName( tblWedding.Rows[i][tblWedding.Columns[j].ColumnName] );
  1460. cell.Tag = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim();
  1461. break;
  1462. default: cell.Value = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim(); break;
  1463. }
  1464. dgvl.Cells.Add( cell );
  1465. }
  1466. }
  1467. this.dgvData.Rows.Add( dgvl );
  1468. }
  1469. }
  1470. }
  1471. /// <summary>
  1472. /// 设计加载的项
  1473. /// </summary>
  1474. /// <param name="StrName"></param>
  1475. /// <param name="StrSex"></param>
  1476. /// <param name="StrOrderType"></param>
  1477. void SetClientData( string StrName, string StrSex, string StrOrderType )
  1478. {
  1479. string[] StrNameArray = StrName.Trim().Split( '/' );
  1480. string[] StrSexArray = StrSex.Trim().Split( '/' );
  1481. this.btnUpdate.Visible = false;
  1482. this.panelWedding.Visible = false;
  1483. if ( StrOrderType.Trim() == "0" || StrOrderType.Trim() == "4" )
  1484. {
  1485. if ( StrNameArray.Length > 1 )
  1486. {
  1487. if ( StrSexArray[0].Trim() == "男" )
  1488. {
  1489. lblName1.Text = "男宾姓名:";
  1490. }
  1491. else if ( StrSexArray[0].Trim() == "女" )
  1492. {
  1493. lblName1.Text = "女宾姓名:";
  1494. }
  1495. txtName1.Text = StrNameArray[0].Trim();
  1496. if ( StrSexArray[1].Trim() == "男" )
  1497. {
  1498. lblName2.Text = "男宾姓名:";
  1499. }
  1500. else if ( StrSexArray[1].Trim() == "女" )
  1501. {
  1502. lblName2.Text = "女宾姓名:";
  1503. }
  1504. txtName2.Text = StrNameArray[1].Trim();
  1505. }
  1506. else
  1507. {
  1508. lblName1.Text = "男宾姓名:";
  1509. lblName2.Text = "女宾姓名:";
  1510. if ( StrSexArray[0].Trim() == "男" )
  1511. {
  1512. txtName1.Text = StrNameArray[0].Trim();
  1513. }
  1514. else if ( StrSexArray[0].Trim() == "女" )
  1515. {
  1516. txtName2.Text = StrNameArray[0].Trim();
  1517. }
  1518. }
  1519. this.panelWedding.Visible = true;
  1520. }
  1521. else if ( StrOrderType.Trim() == "1" )
  1522. {
  1523. lblName1.Text = "宝贝姓名:";
  1524. lblName2.Text = "家长姓名:";
  1525. txtName1.Text = StrNameArray[0].Trim();
  1526. if (StrNameArray.Length > 1)
  1527. {
  1528. txtName2.Text = StrNameArray[1].Trim();
  1529. }
  1530. else
  1531. {
  1532. txtName2.Text = StrNameArray[0].Trim();
  1533. }
  1534. }
  1535. else if ( StrOrderType.Trim() == "2" )
  1536. {
  1537. lblName1.Text = "客户姓名:";
  1538. lblName2.Text = "客户性别:";
  1539. txtName1.Text = StrNameArray[0].Trim();
  1540. txtName2.Text = StrSexArray[0].Trim();
  1541. }
  1542. else if ( StrOrderType.Trim() == "3" )
  1543. {
  1544. lblName1.Text = "客户姓名:";
  1545. lblName2.Text = "客户性别:";
  1546. txtName1.Text = StrNameArray[0].Trim();
  1547. txtName2.Text = StrSexArray[0].Trim();
  1548. this.btnUpdate.Visible = true;
  1549. this.panelWedding.Visible = true;
  1550. }
  1551. //lblName1.Location = new Point(15, lblName1.Location.Y);
  1552. //lblName2.Location = new Point(311, lblName1.Location.Y);
  1553. }
  1554. /// <summary>
  1555. /// 设计加载的项
  1556. /// </summary>
  1557. void SetClientData()
  1558. {
  1559. string StrOrderType = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetVersion();
  1560. this.panelWedding.Visible = false;
  1561. if ( StrOrderType.Trim() == "-1" )
  1562. {
  1563. lblName1.Text = "男/家姓名:";
  1564. lblName2.Text = "女/宝姓名:";
  1565. //lblName1.Location = new Point(10, lblName1.Location.Y);
  1566. //lblName2.Location = new Point(lblName1.Location.X, lblName2.Location.Y);
  1567. }
  1568. else if ( StrOrderType.Trim() == "2" )
  1569. {
  1570. lblName1.Text = "客户姓名:";
  1571. lblName2.Text = "客户性别:";
  1572. }
  1573. else if ( StrOrderType.Trim() == "0" )
  1574. {
  1575. lblName1.Text = "男宾姓名:";
  1576. lblName2.Text = "女宾姓名:";
  1577. this.panelWedding.Visible = true;
  1578. }
  1579. else if ( StrOrderType.Trim() == "1" )
  1580. {
  1581. lblName1.Text = "家长姓名:";
  1582. lblName2.Text = "宝贝姓名:";
  1583. }
  1584. //lblName1.Location = new Point(15, lblName1.Location.Y);
  1585. //lblName2.Location = new Point(lblName1.Location.X, lblName2.Location.Y);
  1586. }
  1587. /// <summary>
  1588. /// 列表列点击事件(右键)
  1589. /// </summary>
  1590. /// <param name="sender"></param>
  1591. /// <param name="e"></param>
  1592. void dgvData_CellMouseDown( object sender, DataGridViewCellMouseEventArgs e )
  1593. {
  1594. if ( e.Button == MouseButtons.Right )
  1595. {
  1596. if ( e.ColumnIndex != -1 && e.RowIndex != -1 )
  1597. {
  1598. ToolStripMenuItem item = null;
  1599. #region 日期
  1600. if ( e.ColumnIndex == this.dgvData.Columns["服务日期"].Index )
  1601. {
  1602. //弹出操作菜单
  1603. item = new ToolStripMenuItem();
  1604. item.Text = "清空值";
  1605. item.Tag = "StrDate";
  1606. this.dgvData.conMenu.Items.Add( item );
  1607. item = new ToolStripMenuItem();
  1608. item.Text = "日期";
  1609. item.Tag = "StrDate";
  1610. this.dgvData.conMenu.Items.Add( item );
  1611. }
  1612. if ( e.ColumnIndex == this.dgvData.Columns["服务时间"].Index )
  1613. {
  1614. //弹出操作菜单
  1615. item = new ToolStripMenuItem();
  1616. item.Text = "清空值";
  1617. item.Tag = "StrTime";
  1618. this.dgvData.conMenu.Items.Add( item );
  1619. item = new ToolStripMenuItem();
  1620. item.Text = "时间";
  1621. item.Tag = "StrTime";
  1622. this.dgvData.conMenu.Items.Add( item );
  1623. }
  1624. if ( e.ColumnIndex == this.dgvData.Columns["服务状态"].Index )
  1625. {
  1626. //弹出操作菜单
  1627. item = new ToolStripMenuItem();
  1628. item.Text = "清空值";
  1629. item.Tag = "StrStatus";
  1630. this.dgvData.conMenu.Items.Add( item );
  1631. item = new ToolStripMenuItem();
  1632. item.Text = "未开始";
  1633. item.Tag = "StrStatus";
  1634. this.dgvData.conMenu.Items.Add( item );
  1635. item = new ToolStripMenuItem();
  1636. item.Text = "OK";
  1637. item.Tag = "StrStatus";
  1638. this.dgvData.conMenu.Items.Add( item );
  1639. }
  1640. if ( e.ColumnIndex == this.dgvData.Columns["服务人员1"].Index )
  1641. {
  1642. //弹出操作菜单
  1643. item = new ToolStripMenuItem();
  1644. item.Text = "清空值";
  1645. item.Tag = "STrCmbTreeV1";
  1646. this.dgvData.conMenu.Items.Add( item );
  1647. item = new ToolStripMenuItem();
  1648. item.Text = "选择人员";
  1649. item.Tag = "STrCmbTreeV1";
  1650. this.dgvData.conMenu.Items.Add( item );
  1651. }
  1652. if ( e.ColumnIndex == this.dgvData.Columns["服务人员2"].Index )
  1653. {
  1654. //弹出操作菜单
  1655. item = new ToolStripMenuItem();
  1656. item.Text = "清空值";
  1657. item.Tag = "STrCmbTreeV2";
  1658. this.dgvData.conMenu.Items.Add( item );
  1659. item = new ToolStripMenuItem();
  1660. item.Text = "选择人员";
  1661. item.Tag = "STrCmbTreeV2";
  1662. this.dgvData.conMenu.Items.Add( item );
  1663. }
  1664. if ( e.ColumnIndex == this.dgvData.Columns["服务备注"].Index )
  1665. {
  1666. //弹出操作菜单
  1667. item = new ToolStripMenuItem();
  1668. item.Text = "清空值";
  1669. item.Tag = "StrText";
  1670. this.dgvData.conMenu.Items.Add( item );
  1671. item = new ToolStripMenuItem();
  1672. item.Text = "填写备注";
  1673. item.Tag = "StrText";
  1674. this.dgvData.conMenu.Items.Add( item );
  1675. }
  1676. #endregion
  1677. }
  1678. }
  1679. }
  1680. /// <summary>
  1681. /// 获取预约门店ID
  1682. /// </summary>
  1683. /// <returns></returns>
  1684. List<string> GetSelectShopID()
  1685. {
  1686. List<string> shopIDlist = new List<string>();
  1687. foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
  1688. {
  1689. if (dataGridView.Cells["服务门店"].Tag != null)
  1690. {
  1691. string shopID = dataGridView.Cells["服务门店"].Tag.ToString();
  1692. if (!shopIDlist.Any(s => s.ToLower() == shopID.ToLower()))
  1693. {
  1694. shopIDlist.Add(shopID);
  1695. }
  1696. }
  1697. }
  1698. if (shopIDlist.Count > 1)
  1699. {
  1700. MessageBoxCustom.Show("不能同时预约不同门店的摄控时间");
  1701. }
  1702. return shopIDlist;
  1703. }
  1704. /// <summary>
  1705. /// 获取预约日期
  1706. /// </summary>
  1707. /// <returns></returns>
  1708. List<DateTime> GetDateTime()
  1709. {
  1710. List<DateTime> dateTimelist = new List<DateTime>();
  1711. foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
  1712. {
  1713. if (dataGridView.Cells["服务日期"].Value != null)
  1714. {
  1715. string dateTimeString = dataGridView.Cells["服务日期"].Value.ToString();
  1716. if (!String.IsNullOrWhiteSpace(dateTimeString))
  1717. {
  1718. if (!dateTimelist.Any(d => d.ToYYYY_MM_dd().ToLower() == dateTimeString.ToLower()))
  1719. {
  1720. dateTimelist.Add(Convert.ToDateTime(dateTimeString));
  1721. }
  1722. }
  1723. }
  1724. }
  1725. if (dateTimelist.Count > 1)
  1726. {
  1727. MessageBoxCustom.Show("不能同时预约不同日期的摄控时间");
  1728. }
  1729. return dateTimelist;
  1730. }
  1731. /// <summary>
  1732. /// 右键菜单选择项事件
  1733. /// </summary>
  1734. /// <param name="sender"></param>
  1735. /// <param name="e"></param>
  1736. void dgvData_DataGridViewConMenu_ItemClicked( object sender, ToolStripItemClickedEventArgs e )
  1737. {
  1738. ToolStripItem item = e.ClickedItem;
  1739. #region
  1740. string strID = "";
  1741. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1742. {
  1743. strID += "'" + this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() + "',";
  1744. }
  1745. DataTable dt = orbll.GetView_Custom( "tb_ErpWeddingService", StrWhere: "ID in (" + strID.TrimEnd( ',' ) + ")", ShowColumnName: "ID,Ws_WeddingDate,Ws_Serviceman1,Ws_Serviceman2,Ws_Remark" ).Tables[0];
  1746. dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
  1747. if ( item.Tag.ToString().Trim() == "StrDate" )
  1748. {
  1749. if ( item.Text.Trim() == "日期" )
  1750. {
  1751. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetDateSuperSmallForm frm = new SuperSmallForm.GetDateSuperSmallForm();
  1752. frm.ShowDialog();
  1753. if ( frm.IsOK )
  1754. {
  1755. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1756. {
  1757. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
  1758. {
  1759. if ( dt.Rows.Count > 0 )
  1760. {
  1761. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1762. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && !IsUpdateAnPai )
  1763. {
  1764. return;
  1765. }
  1766. if ( this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != frm.StrValue.Trim() && !string.IsNullOrEmpty( frm.StrValue.Trim() ) )
  1767. {
  1768. this.dgvData.SelectedRows[i].Cells["服务日期"].Tag = "1";
  1769. }
  1770. this.dgvData.SelectedRows[i].Cells["服务日期"].Value = frm.StrValue;
  1771. this.dgvData.SelectedRows[i].Tag = "1";
  1772. }
  1773. else
  1774. {
  1775. if ( this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != frm.StrValue.Trim() && !string.IsNullOrEmpty( frm.StrValue.Trim() ) )
  1776. {
  1777. this.dgvData.SelectedRows[i].Cells["服务日期"].Tag = "1";
  1778. }
  1779. this.dgvData.SelectedRows[i].Cells["服务日期"].Value = frm.StrValue;
  1780. this.dgvData.SelectedRows[i].Tag = "1";
  1781. }
  1782. }
  1783. }
  1784. }
  1785. }
  1786. else
  1787. {
  1788. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1789. {
  1790. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
  1791. {
  1792. if ( dt.Rows.Count > 0 )
  1793. {
  1794. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1795. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && !IsUpdateAnPai )
  1796. {
  1797. return;
  1798. }
  1799. this.dgvData.SelectedRows[i].Cells["服务日期"].Value = "";
  1800. this.dgvData.SelectedRows[i].Tag = "1";
  1801. }
  1802. else
  1803. {
  1804. this.dgvData.SelectedRows[i].Cells["服务日期"].Value = "";
  1805. this.dgvData.SelectedRows[i].Tag = "1";
  1806. }
  1807. }
  1808. }
  1809. }
  1810. }
  1811. else if ( item.Tag.ToString().Trim() == "StrTime" )
  1812. {
  1813. if ( item.Text.Trim() == "时间" )
  1814. {
  1815. /* LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetTimeSuperSmallForm frm = new SuperSmallForm.GetTimeSuperSmallForm();
  1816. frm.ShowDialog();
  1817. if ( frm.IsOK )
  1818. {
  1819. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1820. {
  1821. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  1822. {
  1823. if ( dt.Rows.Count > 0 )
  1824. {
  1825. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1826. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
  1827. {
  1828. return;
  1829. }
  1830. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = frm.StrValue;
  1831. this.dgvData.SelectedRows[i].Tag = "1";
  1832. }
  1833. else
  1834. {
  1835. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = frm.StrValue;
  1836. this.dgvData.SelectedRows[i].Tag = "1";
  1837. }
  1838. }
  1839. }
  1840. }*/
  1841. DateTime dayDate = SDateTime.Now;
  1842. string shopID = "";
  1843. List<DateTime> dateTimes = GetDateTime();
  1844. List<string> selectShopIDs = GetSelectShopID();
  1845. if (dateTimes.Count > 0)
  1846. {
  1847. dayDate = dateTimes[0];
  1848. }
  1849. if (selectShopIDs.Count > 0)
  1850. {
  1851. shopID = selectShopIDs[0];
  1852. }
  1853. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
  1854. {
  1855. if (selectShopIDs.Count <= 0)
  1856. {
  1857. MessageBoxCustom.Show("需要先选择要预约的门店");
  1858. return;
  1859. }
  1860. }
  1861. if (dateTimes.Count <= 0)
  1862. {
  1863. MessageBoxCustom.Show("需要先选择服务日期");
  1864. return;
  1865. }
  1866. Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.服务客人, this.GetCameraOrderType());
  1867. if (cameraTime != null)
  1868. {
  1869. for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
  1870. {
  1871. if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
  1872. {
  1873. if (dt.Rows.Count > 0)
  1874. {
  1875. DataRow dtRow = dt.Rows.Find(dt.Rows[0]["ID"]);
  1876. if (!string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dtRow["Ws_WeddingDate"].ToString())) && LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm") != "00:00" && !IsUpdateAnPai)
  1877. {
  1878. return;
  1879. }
  1880. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = cameraTime.CameraTime;
  1881. this.dgvData.SelectedRows[i].Tag = "1";
  1882. }
  1883. else
  1884. {
  1885. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = cameraTime.CameraTime;
  1886. this.dgvData.SelectedRows[i].Tag = "1";
  1887. }
  1888. if (TimeTemplateKeyValues.ContainsKey(this.dgvData.SelectedRows[i].Index))
  1889. {
  1890. this.TimeTemplateKeyValues.Remove(this.dgvData.SelectedRows[i].Index);
  1891. }
  1892. this.TimeTemplateKeyValues.Add(this.dgvData.SelectedRows[i].Index, cameraTime);
  1893. }
  1894. }
  1895. }
  1896. }
  1897. else
  1898. {
  1899. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1900. {
  1901. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  1902. {
  1903. if ( dt.Rows.Count > 0 )
  1904. {
  1905. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1906. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
  1907. {
  1908. return;
  1909. }
  1910. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
  1911. }
  1912. else
  1913. {
  1914. this.dgvData.SelectedRows[i].Cells["服务时间"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
  1915. }
  1916. }
  1917. }
  1918. }
  1919. }
  1920. else if ( item.Tag.ToString().Trim() == "StrStatus" )
  1921. {
  1922. if ( item.Text.Trim() != "清空值" )
  1923. {
  1924. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1925. {
  1926. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" && (this.dgvData.SelectedRows[i].Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.SelectedRows[i].Cells["服务人员2"].Value.ToString().Trim() != "") )
  1927. {
  1928. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != item.Text.Trim() && !string.IsNullOrEmpty( item.Text.Trim() ) )
  1929. {
  1930. this.dgvData.SelectedRows[i].Cells["服务状态"].Tag = "1";
  1931. }
  1932. this.dgvData.SelectedRows[i].Cells["服务状态"].Value = item.Text.Trim();
  1933. this.dgvData.SelectedRows[i].Tag = "1";
  1934. }
  1935. }
  1936. }
  1937. else
  1938. {
  1939. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1940. {
  1941. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
  1942. {
  1943. this.dgvData.SelectedRows[i].Cells["服务状态"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
  1944. }
  1945. }
  1946. }
  1947. }
  1948. else if ( item.Tag.ToString().Trim() == "StrText" )
  1949. {
  1950. if ( item.Text.Trim() == "填写备注" )
  1951. {
  1952. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetTextRemarkSuperSmallForm frm = new SuperSmallForm.GetTextRemarkSuperSmallForm();
  1953. frm.ShowDialog();
  1954. if ( frm.IsSaveed )
  1955. {
  1956. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1957. {
  1958. if ( dt.Rows.Count > 0 )
  1959. {
  1960. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1961. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Remark"].ToString() ) ) && !IsUpdateAnPai )
  1962. {
  1963. return;
  1964. }
  1965. this.dgvData.SelectedRows[i].Cells["服务备注"].Value = frm.StrValue; this.dgvData.SelectedRows[i].Tag = "1";
  1966. }
  1967. else
  1968. {
  1969. this.dgvData.SelectedRows[i].Cells["服务备注"].Value = frm.StrValue; this.dgvData.SelectedRows[i].Tag = "1";
  1970. }
  1971. }
  1972. }
  1973. }
  1974. else
  1975. {
  1976. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  1977. {
  1978. if ( dt.Rows.Count > 0 )
  1979. {
  1980. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  1981. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Remark"].ToString() ) ) && !IsUpdateAnPai )
  1982. {
  1983. return;
  1984. }
  1985. this.dgvData.SelectedRows[i].Cells["服务备注"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
  1986. }
  1987. else
  1988. {
  1989. this.dgvData.SelectedRows[i].Cells["服务备注"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
  1990. }
  1991. }
  1992. }
  1993. }
  1994. else if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" || item.Tag.ToString().Trim() == "STrCmbTreeV2" )
  1995. {
  1996. if ( item.Text.Trim() == "选择人员" )
  1997. {
  1998. LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
  1999. frm.StrTime = this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim();
  2000. if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
  2001. {
  2002. frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.服务师1;
  2003. }
  2004. else
  2005. {
  2006. frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.服务师2;
  2007. }
  2008. frm.ShowDialog();
  2009. if ( frm.IsSaveed )
  2010. {
  2011. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  2012. {
  2013. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  2014. {
  2015. if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
  2016. {
  2017. if ( dt.Rows.Count > 0 )
  2018. {
  2019. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  2020. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman1"].ToString() ) ) && !IsUpdateAnPai )
  2021. {
  2022. return;
  2023. }
  2024. this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = frm.StrPersonName;
  2025. this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = frm.StrPersonNumber;
  2026. }
  2027. else
  2028. {
  2029. this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = frm.StrPersonName;
  2030. this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = frm.StrPersonNumber;
  2031. }
  2032. }
  2033. else if ( item.Tag.ToString().Trim() == "STrCmbTreeV2" )
  2034. {
  2035. if ( dt.Rows.Count > 0 )
  2036. {
  2037. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  2038. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman2"].ToString() ) ) && !IsUpdateAnPai )
  2039. {
  2040. return;
  2041. }
  2042. this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = frm.StrPersonName;
  2043. this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = frm.StrPersonNumber;
  2044. }
  2045. else
  2046. {
  2047. this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = frm.StrPersonName;
  2048. this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = frm.StrPersonNumber;
  2049. }
  2050. }
  2051. this.dgvData.SelectedRows[i].Tag = "1";
  2052. }
  2053. }
  2054. this.dgvData.CurrentRow.Tag = "1";
  2055. }
  2056. }
  2057. else
  2058. {
  2059. for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
  2060. {
  2061. if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
  2062. {
  2063. if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
  2064. {
  2065. if ( dt.Rows.Count > 0 )
  2066. {
  2067. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  2068. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman1"].ToString() ) ) && !IsUpdateAnPai )
  2069. {
  2070. return;
  2071. }
  2072. this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
  2073. this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
  2074. this.dgvData.SelectedRows[i].Tag = "1";
  2075. }
  2076. else
  2077. {
  2078. this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
  2079. this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
  2080. this.dgvData.SelectedRows[i].Tag = "1";
  2081. }
  2082. }
  2083. else if ( item.Tag.ToString().Trim() == "STrCmbTreeV2" )
  2084. {
  2085. if ( dt.Rows.Count > 0 )
  2086. {
  2087. DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
  2088. if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman2"].ToString() ) ) && !IsUpdateAnPai )
  2089. {
  2090. return;
  2091. }
  2092. this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
  2093. this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
  2094. }
  2095. else
  2096. {
  2097. this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
  2098. this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
  2099. }
  2100. }
  2101. this.dgvData.CurrentRow.Tag = "1";
  2102. }
  2103. }
  2104. }
  2105. }
  2106. //else if (item.Tag.ToString().Trim() == "STrCmbTreeV1")
  2107. //{
  2108. // if (item.Text.Trim() == "选择人员")
  2109. // {
  2110. // LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetPeopleSuperSmallForm frm = new SuperSmallForm.GetPeopleSuperSmallForm();
  2111. // frm.ShowDialog();
  2112. // if (frm.IsOK)
  2113. // {
  2114. // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
  2115. // {
  2116. // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
  2117. // {
  2118. // string[] strValues = frm.StrValue.Split(',');
  2119. // this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = strValues[0];
  2120. // this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = strValues[1];
  2121. // this.dgvData.SelectedRows[i].Tag = "1";
  2122. // }
  2123. // }
  2124. // }
  2125. // }
  2126. // else
  2127. // {
  2128. // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
  2129. // {
  2130. // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
  2131. // {
  2132. // this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
  2133. // this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
  2134. // this.dgvData.SelectedRows[i].Tag = "1";
  2135. // }
  2136. // }
  2137. // }
  2138. //}
  2139. //else if (item.Tag.ToString().Trim() == "STrCmbTreeV2")
  2140. //{
  2141. // if (item.Text.Trim() == "选择人员")
  2142. // {
  2143. // LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetPeopleSuperSmallForm frm = new SuperSmallForm.GetPeopleSuperSmallForm();
  2144. // frm.ShowDialog();
  2145. // if (frm.IsOK)
  2146. // {
  2147. // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
  2148. // {
  2149. // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
  2150. // {
  2151. // string[] strValues = frm.StrValue.Split(',');
  2152. // this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = strValues[0];
  2153. // this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = strValues[1];
  2154. // this.dgvData.SelectedRows[i].Tag = "1";
  2155. // }
  2156. // }
  2157. // }
  2158. // }
  2159. // else
  2160. // {
  2161. // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
  2162. // {
  2163. // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
  2164. // {
  2165. // this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
  2166. // this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
  2167. // this.dgvData.SelectedRows[i].Tag = "1";
  2168. // }
  2169. // }
  2170. // }
  2171. //}
  2172. #endregion
  2173. }
  2174. /// <summary>
  2175. /// 限制数量输入规则
  2176. /// </summary>
  2177. /// <param name="sender"></param>
  2178. /// <param name="e"></param>
  2179. void txtIntCount_KeyPress( object sender, KeyPressEventArgs e )
  2180. {
  2181. if ( !Char.IsNumber( e.KeyChar ) && !Char.IsControl( e.KeyChar ) )
  2182. {
  2183. e.Handled = true;
  2184. }
  2185. }
  2186. }
  2187. }