FrmPackagesGoodsSet.cs 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176
  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 LYFZ.Command;
  10. using LYFZ.ComponentLibrary;
  11. using System.Collections;
  12. using LYFZ.Software.MainBusiness.DoorCityProcess;
  13. namespace LYFZ.Software.MainBusiness.InitialSet
  14. {
  15. public partial class FrmPackagesGoodsSet : LYFZ.Software.UI.InitialSet.FrmPackagesGoodsSet
  16. {
  17. public FrmPackagesGoodsSet()
  18. {
  19. this.btnDown.Click += btnDown_Click;
  20. this.btnUp.Click += btnUp_Click;
  21. this.FormClosing += FrmPackagesGoodsSet_FormClosing;
  22. }
  23. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  24. LYFZ.BLL.BLL_ErpProduct ptbll = new BLL.BLL_ErpProduct();
  25. LYFZ.BLL.BLL_ErpPackages packages = new BLL.BLL_ErpPackages();
  26. LYFZ.BLL.BLL_ErpTheScenery tsbll = new BLL.BLL_ErpTheScenery();
  27. LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
  28. LYFZ.BLL.BLL_ErpPackagesGiftMerchandise pkgmbll = new BLL.BLL_ErpPackagesGiftMerchandise();
  29. #region 属性
  30. /// <summary>
  31. /// 是否保存
  32. /// </summary>
  33. public bool IsSaveed = false;
  34. /// <summary>
  35. /// 套系编号
  36. /// </summary>
  37. string StrPakPackagesID = "";
  38. private string _strPakUnitPrice;
  39. /// <summary>
  40. /// 套系价格
  41. /// </summary>
  42. public string StrPakUnitPrice
  43. {
  44. get
  45. {
  46. //string[] strValue = _strPakUnitPrice.Split(':');
  47. if (string.IsNullOrEmpty(_strPakUnitPrice))
  48. { return "0"; }
  49. else
  50. { return _strPakUnitPrice; }
  51. }
  52. set
  53. {
  54. _strPakUnitPrice = value;
  55. if (_strPakUnitPrice == "")
  56. { _strPakUnitPrice = "0"; }
  57. this.lblPakUnitPrice.Text = "套系价格:" + _strPakUnitPrice;
  58. }
  59. }
  60. private string _strPakIntoTheArchive;
  61. /// <summary>
  62. /// 赠送张数
  63. /// </summary>
  64. public string StrPakIntoTheArchive
  65. {
  66. get { return _strPakIntoTheArchive; }
  67. set
  68. {
  69. _strPakIntoTheArchive = value;
  70. this.lblPakIntoTheArchive.Text = "赠送张数:" + _strPakIntoTheArchive;
  71. }
  72. }
  73. /// <summary>
  74. /// true为首次运行
  75. /// </summary>
  76. private bool IsFirstLoad = true;
  77. /// <summary>
  78. /// 套系设置是否有修改
  79. /// </summary>
  80. private bool IsPackagesSet = false;
  81. #endregion
  82. /// <summary>
  83. /// 窗体加载
  84. /// </summary>
  85. /// <param name="sender"></param>
  86. /// <param name="e"></param>
  87. protected override void FrmPackagesGoodsSet_Shown(object sender, EventArgs e)
  88. {
  89. WaitForm wf = new WaitForm();
  90. wf.ShowForm(this);
  91. try
  92. {
  93. //获取绑定拍摄次数 获取绑定套系名称
  94. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_PackagesCategoryAndName(this.CtvPak_Name, StrParentCode: "AAAAAAB");
  95. this.tabPage1.Parent = null;
  96. this.tabPage2.Parent = null;
  97. switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
  98. {
  99. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  100. if (!LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition)
  101. {
  102. this.tabPage2.Parent = this.tab;
  103. this.btnUp.Visible = true;
  104. this.btnDown.Visible = true;
  105. }
  106. else
  107. {
  108. this.tabPage1.Parent = this.tab;
  109. this.tabPage2.Parent = this.tab;
  110. }
  111. break;
  112. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  113. this.tabPage1.Parent = this.tab;
  114. break;
  115. default:
  116. this.tabPage1.Parent = this.tab;
  117. this.tabPage2.Parent = this.tab;
  118. break;
  119. }
  120. //清空
  121. this.StrPakPackagesID = "";
  122. this.StrPakUnitPrice = "0";
  123. this.StrPakIntoTheArchive = "0/0";
  124. this.dgv1.Rows.Clear();
  125. this.dgv2.Rows.Clear();
  126. this.dgv3.Rows.Clear();
  127. this.dgv4.Rows.Clear();
  128. #region 权限设置
  129. this.btnSave1.Enabled = false;
  130. this.btnProductSet.Enabled = false;
  131. this.btnDelete1.Enabled = false;
  132. this.btnDelete2.Enabled = false;
  133. this.btnDelete3.Enabled = false;
  134. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Add) || LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Update))
  135. { this.btnSave1.Enabled = true; this.btnProductSet.Enabled = true; }
  136. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.PackagesGoodsCompetence, CustomAttributes.OperatingAuthority.Delete))
  137. {
  138. this.btnDelete1.Enabled = true;
  139. this.btnDelete2.Enabled = true;
  140. this.btnDelete3.Enabled = true;
  141. }
  142. #endregion
  143. wf.CloseForm();
  144. wf = null;
  145. }
  146. catch
  147. { wf.CloseForm(); wf = null; }
  148. this.IsFirstLoad = false;
  149. }
  150. /// <summary>
  151. /// 选择套系名称获取商品详细信息
  152. /// </summary>
  153. /// <param name="sender"></param>
  154. /// <param name="e"></param>
  155. protected override void CtvPak_Name_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  156. {
  157. WaitForm wf = new WaitForm();
  158. wf.ShowForm(this);
  159. try
  160. {
  161. if (CtvPak_Name.Tag != null)
  162. {
  163. this.Bind();
  164. this.GetCostSellingPrice();
  165. }
  166. wf.CloseForm();
  167. wf = null;
  168. }
  169. catch
  170. {
  171. wf.CloseForm();
  172. wf = null;
  173. }
  174. }
  175. /// <summary>
  176. /// 获取初始数据
  177. /// </summary>
  178. public void Bind()
  179. {
  180. this.dgv1.Rows.Clear();
  181. this.dgv2.Rows.Clear();
  182. this.dgv3.Rows.Clear();
  183. this.dgv4.Rows.Clear();
  184. //获取套系名称资料
  185. DataTable dt = packages.GetList("Pak_Name='" + this.CtvPak_Name.Text.ToString() + "'").Tables[0];
  186. if (dt.Rows.Count > 0)
  187. {
  188. this.StrPakPackagesID = dt.Rows[0]["Pak_PackagesID"].ToString();
  189. this.StrPakUnitPrice = dt.Rows[0]["Pak_UnitPrice"].ToString();
  190. this.StrPakIntoTheArchive = dt.Rows[0]["Pak_IntoTheArchive"].ToString() + "/" + dt.Rows[0]["Pak_IntoTheBook"].ToString();
  191. #region 获取套系赠送商品
  192. dt = pkgmbll.View_tb_ErpPackagesGiftMerchandise("Pgm_PackagesCode='" + this.StrPakPackagesID + "' and tb_ErpPackagesGiftMerchandise.Pgm_GiveType='0'").Tables[0];
  193. if (dt.Rows.Count > 0)
  194. {
  195. for (int t = 0; t < dt.Rows.Count; t++)
  196. {
  197. DataGridViewRow dgvr = new DataGridViewRow();
  198. DataGridViewCell cell = null;
  199. cell = new DataGridViewTextBoxCell();
  200. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  201. dgvr.Cells.Add(cell);
  202. cell = new DataGridViewTextBoxCell();
  203. cell.Value = dt.Rows[t]["Pgm_ProductNumber"].ToString().Trim();
  204. dgvr.Cells.Add(cell);
  205. cell = new DataGridViewTextBoxCell();
  206. cell.Value = dt.Rows[t]["Prod_Name"].ToString().Trim();
  207. dgvr.Cells.Add(cell);
  208. cell = new DataGridViewTextBoxCell();
  209. cell.Value = dt.Rows[t]["Pgm_Quantity"].ToString().Trim();
  210. dgvr.Cells.Add(cell);
  211. cell = new DataGridViewTextBoxCell();
  212. cell.Value = dt.Rows[t]["Prod_CostPrice"].ToString().Trim();
  213. dgvr.Cells.Add(cell);
  214. cell = new DataGridViewTextBoxCell();
  215. cell.Value = dt.Rows[t]["Prod_SalesPrice"].ToString().Trim();
  216. dgvr.Cells.Add(cell);
  217. this.dgv1.Rows.Add(dgvr);
  218. }
  219. }
  220. #endregion
  221. #region 获取服务内容
  222. dt = pkgmbll.View_tb_ErpPackagesGiftMerchandise("Pgm_PackagesCode='" + this.StrPakPackagesID + "' and tb_ErpPackagesGiftMerchandise.Pgm_GiveType='1'").Tables[0];
  223. if (dt.Rows.Count > 0)
  224. {
  225. for (int t = 0; t < dt.Rows.Count; t++)
  226. {
  227. DataGridViewRow dgvr = new DataGridViewRow();
  228. DataGridViewCell cell = null;
  229. cell = new DataGridViewTextBoxCell();
  230. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  231. dgvr.Cells.Add(cell);
  232. cell = new DataGridViewTextBoxCell();
  233. cell.Value = dt.Rows[t]["Pgm_ProductNumber"].ToString().Trim();
  234. dgvr.Cells.Add(cell);
  235. cell = new DataGridViewTextBoxCell();
  236. cell.Value = dt.Rows[t]["Prod_Name"].ToString().Trim();
  237. dgvr.Cells.Add(cell);
  238. cell = new DataGridViewTextBoxCell();
  239. cell.Value = dt.Rows[t]["Pgm_Quantity"].ToString().Trim();
  240. dgvr.Cells.Add(cell);
  241. cell = new DataGridViewTextBoxCell();
  242. cell.Value = dt.Rows[t]["Prod_CostPrice"].ToString().Trim();
  243. dgvr.Cells.Add(cell);
  244. cell = new DataGridViewTextBoxCell();
  245. cell.Value = dt.Rows[t]["Prod_SalesPrice"].ToString().Trim();
  246. dgvr.Cells.Add(cell);
  247. this.dgv2.Rows.Add(dgvr);
  248. }
  249. }
  250. #endregion
  251. #region 获取婚纱景点设置
  252. dt = pkgmbll.View_tb_ErpPackagesGiftMerchandise_tb_ErpTheScenery("Pgm_PackagesCode='" + this.StrPakPackagesID + "' and tb_ErpPackagesGiftMerchandise.Pgm_GiveType='2' and (tb_ErpPackagesGiftMerchandise.Pgm_GiveType!='1' or tb_ErpPackagesGiftMerchandise.Pgm_GiveType!='2' )").Tables[0];
  253. if (dt.Rows.Count > 0)
  254. {
  255. for (int t = 0; t < dt.Rows.Count; t++)
  256. {
  257. DataGridViewRow dgvr = new DataGridViewRow();
  258. DataGridViewCell cell = null;
  259. cell = new DataGridViewTextBoxCell();
  260. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  261. dgvr.Cells.Add(cell);
  262. cell = new DataGridViewTextBoxCell();
  263. cell.Value = dt.Rows[t]["Pgm_ProductNumber"].ToString().Trim();
  264. dgvr.Cells.Add(cell);
  265. cell = new DataGridViewTextBoxCell();
  266. cell.Value = dt.Rows[t]["Tsc_Name"].ToString().Trim();
  267. dgvr.Cells.Add(cell);
  268. cell = new DataGridViewTextBoxCell();
  269. cell.Value = dt.Rows[t]["Pgm_Quantity"].ToString().Trim();
  270. dgvr.Cells.Add(cell);
  271. cell = new DataGridViewTextBoxCell();
  272. cell.Value = dt.Rows[t]["Tsc_CostPrice"].ToString().Trim();
  273. dgvr.Cells.Add(cell);
  274. cell = new DataGridViewTextBoxCell();
  275. cell.Value = dt.Rows[t]["Tsc_SalesPrice"].ToString().Trim();
  276. dgvr.Cells.Add(cell);
  277. this.dgv3.Rows.Add(dgvr);
  278. }
  279. }
  280. #endregion
  281. #region 获取儿童景点设置
  282. dt = pkgmbll.GetList(" Pgm_PackagesCode='" + this.StrPakPackagesID + "' and Pgm_GiveType='3' and (Pgm_GiveType!='1' or Pgm_GiveType!='2' )", " id asc").Tables[0];
  283. if (dt.Rows.Count > 0)
  284. {
  285. for (int t = 0; t < dt.Rows.Count; t++)
  286. {
  287. DataGridViewRow dgvr = new DataGridViewRow();
  288. DataGridViewCell cell = null;
  289. cell = new DataGridViewTextBoxCell();
  290. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  291. dgvr.Cells.Add(cell);
  292. cell = new DataGridViewTextBoxCell();
  293. cell.Value = dt.Rows[t]["Pgm_ProductNumber"].ToString().Trim();
  294. dgvr.Cells.Add(cell);
  295. cell = new DataGridViewTextBoxCell();
  296. cell.Value = dt.Rows[t]["Pgm_ProductName"].ToString().Trim();
  297. dgvr.Cells.Add(cell);
  298. cell = new DataGridViewTextBoxCell();
  299. cell.Value = dt.Rows[t]["Pgm_Quantity"].ToString().Trim();
  300. dgvr.Cells.Add(cell);
  301. this.dgv4.Rows.Add(dgvr);
  302. }
  303. }
  304. #endregion
  305. }
  306. else
  307. {
  308. this.StrPakPackagesID = "";
  309. this.StrPakUnitPrice = "0";
  310. this.StrPakIntoTheArchive = "0/0";
  311. if (string.IsNullOrEmpty(this.StrPakPackagesID))
  312. {
  313. MessageBoxCustom.Show(this.CtvPak_Name.Text.ToString() + " 此类型无套系名称!请添加套系名称");
  314. this.CtvPak_Name.Text = "";
  315. }
  316. }
  317. }
  318. /// <summary>
  319. /// 套系赠送商品==删除
  320. /// </summary>
  321. /// <param name="sender"></param>
  322. /// <param name="e"></param>
  323. protected override void btnDelete1_Click(object sender, EventArgs e)
  324. {
  325. try
  326. {
  327. if (this.dgv1.Rows.Count > 0 && this.dgv1.SelectedRows.Count > 0)
  328. {
  329. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  330. {
  331. //删除
  332. int Id = Convert.ToInt32(this.dgv1.CurrentRow.Cells["ID"].Value.ToString());
  333. if (Id == 0)
  334. { this.dgv1.Rows.RemoveAt(this.dgv1.CurrentRow.Index); }
  335. if (Id > 0)
  336. {
  337. if (pkgmbll.Delete(Id) == true) { }
  338. this.dgv1.Rows.RemoveAt(this.dgv1.CurrentRow.Index);
  339. }
  340. this.GetCostSellingPrice();
  341. }
  342. }
  343. }
  344. catch (Exception ex)
  345. { MessageBoxCustom.Show(ex.Message); }
  346. }
  347. /// <summary>
  348. /// 套系赠送商品==商品工具箱
  349. /// </summary>
  350. /// <param name="sender"></param>
  351. /// <param name="e"></param>
  352. protected override void btnToolbox1_Click(object sender, EventArgs e)
  353. {
  354. if (string.IsNullOrEmpty(this.CtvPak_Name.Text))
  355. { MessageBoxCustom.Show("请选择套系名称!"); return; }
  356. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm frm = new DoorCityProcess.SetSmallForm.ToolboxSamllForm();
  357. frm.LoadType = "套系包含商品";
  358. frm.ShowDialog();
  359. if (frm.IsSaveed)
  360. {
  361. for (int i = 0; i < frm.mlist.Count; i++)
  362. {
  363. bool IsFind = false;
  364. for (int t = 0; t < this.dgv1.Rows.Count; t++)
  365. {
  366. if (this.dgv1.Rows[t].Cells["Pgm_ProductNumber"].Value.Equals(frm.mlist[i].Prod_Number))
  367. {
  368. this.dgv1.Rows[t].Cells["Pgm_Quantity"].Value = (Convert.ToInt32(this.dgv1.Rows[t].Cells["Pgm_Quantity"].Value) + 1).ToString();
  369. IsFind = true; break;
  370. }
  371. }
  372. if (!IsFind)
  373. {
  374. DataGridViewRow dgvr = new DataGridViewRow();
  375. DataGridViewCell cell = null;
  376. cell = new DataGridViewTextBoxCell();
  377. cell.Value = 0;
  378. dgvr.Cells.Add(cell);
  379. cell = new DataGridViewTextBoxCell();
  380. cell.Value = frm.mlist[i].Prod_Number;
  381. dgvr.Cells.Add(cell);
  382. cell = new DataGridViewTextBoxCell();
  383. cell.Value = frm.mlist[i].Prod_Name;
  384. dgvr.Cells.Add(cell);
  385. cell = new DataGridViewTextBoxCell();
  386. cell.Value = "1";
  387. dgvr.Cells.Add(cell);
  388. cell = new DataGridViewTextBoxCell();
  389. cell.Value = frm.mlist[i].Prod_CostPrice;
  390. dgvr.Cells.Add(cell);
  391. cell = new DataGridViewTextBoxCell();
  392. cell.Value = frm.mlist[i].Prod_SalesPrice;
  393. dgvr.Cells.Add(cell);
  394. this.dgv1.Rows.Add(dgvr);
  395. }
  396. }
  397. }
  398. this.GetCostSellingPrice();
  399. }
  400. /// <summary>
  401. /// 更改数量事件
  402. /// </summary>
  403. /// <param name="sender"></param>
  404. /// <param name="e"></param>
  405. protected override void dgv1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  406. {
  407. if (this.dgv1.Rows.Count > 0)
  408. {
  409. if (!Command.Command_Validate.IsNumber(this.dgv1.CurrentRow.Cells["Pgm_Quantity"].Value.ToString()))
  410. {
  411. MessageBoxCustom.Show("只能输入纯数字!");
  412. this.dgv1.CurrentRow.Cells["Pgm_Quantity"].Value = "1";
  413. return;
  414. }
  415. this.GetCostSellingPrice();
  416. }
  417. }
  418. /// <summary>
  419. /// 婚庆服务==删除
  420. /// </summary>
  421. /// <param name="sender"></param>
  422. /// <param name="e"></param>
  423. protected override void btnDelete2_Click(object sender, EventArgs e)
  424. {
  425. try
  426. {
  427. if (this.dgv2.Rows.Count > 0 && this.dgv2.SelectedRows.Count > 0)
  428. {
  429. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  430. {
  431. //删除
  432. int Id = Convert.ToInt32(this.dgv2.CurrentRow.Cells["ID2"].Value.ToString());
  433. if (Id == 0)
  434. { this.dgv2.Rows.RemoveAt(this.dgv2.CurrentRow.Index); }
  435. else if (Id > 0)
  436. {
  437. if (pkgmbll.Delete(Id) == true)
  438. { this.dgv2.Rows.RemoveAt(this.dgv2.CurrentRow.Index); }
  439. }
  440. this.GetCostSellingPrice();
  441. }
  442. }
  443. }
  444. catch (Exception ex)
  445. { MessageBoxCustom.Show(ex.Message); }
  446. }
  447. /// <summary>
  448. /// 婚庆服务==商品工具箱
  449. /// </summary>
  450. /// <param name="sender"></param>
  451. /// <param name="e"></param>
  452. protected override void btnToolbox2_Click(object sender, EventArgs e)
  453. {
  454. if (string.IsNullOrEmpty(this.CtvPak_Name.Text))
  455. { MessageBoxCustom.Show("请选择套系名称!"); return; }
  456. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm frm = new DoorCityProcess.SetSmallForm.ToolboxSamllForm();
  457. frm.LoadType = "婚庆报务";
  458. frm.ShowDialog();
  459. if (frm.IsSaveed)
  460. {
  461. for (int i = 0; i < frm.mlist.Count; i++)
  462. {
  463. bool IsFind = false;
  464. for (int t = 0; t < this.dgv2.Rows.Count; t++)
  465. {
  466. if (this.dgv2.Rows[t].Cells["Pgm_ProductNumber2"].Value.ToString().Trim() == frm.mlist[i].Prod_Number.Trim())
  467. {
  468. this.dgv2.Rows[t].Cells["Pgm_Quantity2"].Value = (Convert.ToInt32(this.dgv2.Rows[t].Cells["Pgm_Quantity2"].Value) + 1);
  469. IsFind = true;
  470. }
  471. }
  472. if (!IsFind)
  473. {
  474. DataGridViewRow dgvr = new DataGridViewRow();
  475. DataGridViewCell cell = null;
  476. cell = new DataGridViewTextBoxCell();
  477. cell.Value = 0;
  478. dgvr.Cells.Add(cell);
  479. cell = new DataGridViewTextBoxCell();
  480. cell.Value = frm.mlist[i].Prod_Number;
  481. dgvr.Cells.Add(cell);
  482. cell = new DataGridViewTextBoxCell();
  483. cell.Value = frm.mlist[i].Prod_Name;
  484. dgvr.Cells.Add(cell);
  485. cell = new DataGridViewTextBoxCell();
  486. cell.Value = "1";
  487. dgvr.Cells.Add(cell);
  488. cell = new DataGridViewTextBoxCell();
  489. cell.Value = frm.mlist[i].Prod_CostPrice;
  490. dgvr.Cells.Add(cell);
  491. cell = new DataGridViewTextBoxCell();
  492. cell.Value = frm.mlist[i].Prod_SalesPrice;
  493. dgvr.Cells.Add(cell);
  494. this.dgv2.Rows.Add(dgvr);
  495. }
  496. }
  497. }
  498. this.GetCostSellingPrice();
  499. }
  500. /// <summary>
  501. /// 更改数量事件
  502. /// </summary>
  503. /// <param name="sender"></param>
  504. /// <param name="e"></param>
  505. protected override void dgv2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  506. {
  507. if (this.dgv2.Rows.Count > 0)
  508. {
  509. if (!Command.Command_Validate.IsNumber(this.dgv2.CurrentRow.Cells["Pgm_Quantity2"].Value.ToString()))
  510. {
  511. MessageBoxCustom.Show("只能输入纯数字!");
  512. this.dgv2.CurrentRow.Cells["Pgm_Quantity2"].Value = "1";
  513. return;
  514. }
  515. this.GetCostSellingPrice();
  516. }
  517. }
  518. /// <summary>
  519. /// 婚纱景点==删除
  520. /// </summary>
  521. /// <param name="sender"></param>
  522. /// <param name="e"></param>
  523. protected override void btnDelete3_Click(object sender, EventArgs e)
  524. {
  525. try
  526. {
  527. if (this.tab.SelectedTab.Name.Equals(this.tab.TabPages[0].Name))
  528. {
  529. if (this.dgv3.Rows.Count > 0)
  530. {
  531. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  532. {
  533. //删除
  534. if (this.dgv3.SelectedRows.Count > 0)
  535. {
  536. int Id = Convert.ToInt32(this.dgv3.CurrentRow.Cells["ID3"].Value.ToString());
  537. if (Id == 0)
  538. { this.dgv3.Rows.RemoveAt(this.dgv3.CurrentRow.Index); }
  539. if (Id > 0)
  540. {
  541. if (pkgmbll.Delete(Id) == true)
  542. { this.dgv3.Rows.RemoveAt(this.dgv3.CurrentRow.Index); }
  543. }
  544. this.GetCostSellingPrice();
  545. }
  546. }
  547. }
  548. }
  549. else if (this.tab.SelectedTab.Name.Equals(this.tab.TabPages[1].Name))
  550. {
  551. if (this.dgv4.Rows.Count > 0)
  552. {
  553. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  554. {
  555. //删除
  556. if (this.dgv4.SelectedRows.Count > 0)
  557. {
  558. int Id = Convert.ToInt32(this.dgv4.CurrentRow.Cells["ID4"].Value.ToString());
  559. if (Id == 0)
  560. { this.dgv4.Rows.RemoveAt(this.dgv4.CurrentRow.Index); }
  561. if (Id > 0)
  562. {
  563. if (pkgmbll.Delete(Id) == true)
  564. { this.dgv4.Rows.RemoveAt(this.dgv4.CurrentRow.Index); }
  565. }
  566. this.GetCostSellingPrice();
  567. }
  568. }
  569. }
  570. }
  571. }
  572. catch (Exception ex)
  573. { MessageBoxCustom.Show(ex.Message); }
  574. }
  575. /// <summary>
  576. /// 婚纱景点==景点工具箱
  577. /// </summary>
  578. /// <param name="sender"></param>
  579. /// <param name="e"></param>
  580. protected override void btnToolbox3_Click(object sender, EventArgs e)
  581. {
  582. try
  583. {
  584. if (string.IsNullOrEmpty(this.CtvPak_Name.Text))
  585. { MessageBoxCustom.Show("请选择套系名称!"); return; }
  586. LYFZ.Software.MainBusiness.InitialSet.PackagesGoods.FrmTheScenery set = new PackagesGoods.FrmTheScenery();
  587. if (this.tab.SelectedTab.Name.Equals(this.tab.TabPages[0].Name))
  588. {
  589. #region
  590. set.StrSightsType = "0";
  591. set.ShowDialog();
  592. ArrayList ListArray = set.ListArray;
  593. if (ListArray.Count > 0)
  594. {
  595. for (int i = 0; i < ListArray.Count; i++)
  596. {
  597. bool IsFind = false;
  598. for (int t = 0; t < this.dgv3.Rows.Count; t++)
  599. {
  600. if (this.dgv3.Rows[t].Cells["Pgm_ProductNumber3"].Value.ToString().Trim() == ListArray[i].ToString().Trim())
  601. { IsFind = true; break; }
  602. }
  603. if (!IsFind)
  604. {
  605. ListItem listitem = (ListItem)ListArray[i];
  606. DataTable dt = tsbll.GetList("ID='" + listitem.StrValue + "'").Tables[0];
  607. DataGridViewRow dgvr = new DataGridViewRow();
  608. DataGridViewCell cell = null;
  609. cell = new DataGridViewTextBoxCell();
  610. cell.Value = 0;
  611. dgvr.Cells.Add(cell);
  612. cell = new DataGridViewTextBoxCell();
  613. cell.Value = dt.Rows[0]["ID"].ToString().Trim();
  614. dgvr.Cells.Add(cell);
  615. cell = new DataGridViewTextBoxCell();
  616. cell.Value = dt.Rows[0]["Tsc_Name"].ToString().Trim();
  617. dgvr.Cells.Add(cell);
  618. cell = new DataGridViewTextBoxCell();
  619. cell.Value = "1";
  620. dgvr.Cells.Add(cell);
  621. cell = new DataGridViewTextBoxCell();
  622. cell.Value = dt.Rows[0]["Tsc_CostPrice"].ToString().Trim();
  623. dgvr.Cells.Add(cell);
  624. cell = new DataGridViewTextBoxCell();
  625. cell.Value = dt.Rows[0]["Tsc_SalesPrice"].ToString().Trim();
  626. dgvr.Cells.Add(cell);
  627. this.dgv3.Rows.Add(dgvr);
  628. }
  629. }
  630. }
  631. #endregion
  632. }
  633. else if (this.tab.SelectedTab.Name.Equals(this.tab.TabPages[1].Name))
  634. {
  635. #region
  636. set.StrSightsType = "1";
  637. set.ShowDialog();
  638. ArrayList ListArray = set.ListArray;
  639. if (ListArray.Count > 0)
  640. {
  641. for (int i = 0; i < ListArray.Count; i++)
  642. {
  643. bool IsFind = false;
  644. for (int t = 0; t < this.dgv4.Rows.Count; t++)
  645. {
  646. if (this.dgv4.Rows[t].Cells["Pgm_ProductNumber4"].Value.ToString().Trim() == ListArray[i].ToString().Trim())
  647. { IsFind = true; break; }
  648. }
  649. if (!IsFind)
  650. {
  651. ListItem listitem = (ListItem)ListArray[i];
  652. DataTable dt = tsbll.GetList("ID='" + listitem.StrValue + "'").Tables[0];
  653. DataGridViewRow dgvr = new DataGridViewRow();
  654. DataGridViewCell cell = null;
  655. cell = new DataGridViewTextBoxCell();
  656. cell.Value = 0;
  657. dgvr.Cells.Add(cell);
  658. cell = new DataGridViewTextBoxCell();
  659. cell.Value = dt.Rows[0]["ID"].ToString().Trim();
  660. dgvr.Cells.Add(cell);
  661. cell = new DataGridViewTextBoxCell();
  662. cell.Value = dt.Rows[0]["Tsc_Name"].ToString().Trim();
  663. dgvr.Cells.Add(cell);
  664. cell = new DataGridViewTextBoxCell();
  665. cell.Value = "1";
  666. dgvr.Cells.Add(cell);
  667. this.dgv4.Rows.Add(dgvr);
  668. }
  669. }
  670. }
  671. #endregion
  672. }
  673. this.GetCostSellingPrice();
  674. }
  675. catch (Exception ex)
  676. { MessageBoxCustom.Show(ex.Message); }
  677. }
  678. /// <summary>
  679. /// 更改数量事件
  680. /// </summary>
  681. /// <param name="sender"></param>
  682. /// <param name="e"></param>
  683. protected override void dgv3_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  684. {
  685. if (this.dgv3.Rows.Count > 0)
  686. {
  687. if (!Command.Command_Validate.IsNumber(this.dgv3.CurrentRow.Cells["Pgm_Quantity3"].Value.ToString()))
  688. {
  689. MessageBoxCustom.Show("只能输入纯数字!");
  690. this.dgv3.CurrentRow.Cells["Pgm_Quantity3"].Value = "1";
  691. return;
  692. }
  693. this.GetCostSellingPrice();
  694. }
  695. }
  696. /// <summary>
  697. /// 更改数量事件
  698. /// </summary>
  699. /// <param name="sender"></param>
  700. /// <param name="e"></param>
  701. protected override void dgv4_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  702. {
  703. if (this.dgv4.Rows.Count > 0)
  704. {
  705. if (!Command.Command_Validate.IsNumber(this.dgv4.CurrentRow.Cells["Pgm_Quantity4"].Value.ToString()))
  706. {
  707. MessageBoxCustom.Show("只能输入纯数字!");
  708. this.dgv4.CurrentRow.Cells["Pgm_Quantity4"].Value = "1";
  709. return;
  710. }
  711. }
  712. }
  713. /// <summary>
  714. /// 选择版本获取商品成本价,卖价
  715. /// </summary>
  716. /// <param name="sender"></param>
  717. /// <param name="e"></param>
  718. protected override void tab_SelectedIndexChanged(object sender, EventArgs e)
  719. {
  720. if (!this.IsFirstLoad)
  721. {
  722. if (this.tab.SelectedTab != null)
  723. {
  724. if (this.tab.SelectedTab.Name.Trim() == "tabPage2")
  725. {
  726. this.btnDown.Visible = true;
  727. this.btnUp.Visible = true;
  728. }
  729. else
  730. {
  731. this.btnDown.Visible = false;
  732. this.btnUp.Visible = false;
  733. }
  734. this.GetCostSellingPrice();
  735. }
  736. }
  737. }
  738. /// <summary>
  739. /// 获取商品成本价,卖价
  740. /// </summary>
  741. public void GetCostSellingPrice()
  742. {
  743. decimal Prod_CostPrice = 0;
  744. decimal Prod_SalesPrice = 0;
  745. decimal Prod_CostPrice2 = 0;
  746. decimal Prod_SalesPrice2 = 0;
  747. decimal Prod_CostPrice3 = 0;
  748. decimal Prod_SalesPrice3 = 0;
  749. decimal Prod_CostPrice4 = 0;
  750. decimal Prod_SalesPrice4 = 0;
  751. //decimal Prod_CostPrice5 = 0;
  752. //decimal Prod_SalesPrice5 = 0;
  753. //套系赠送商品
  754. for (int i = 0; i < this.dgv1.Rows.Count; i++)
  755. {
  756. //成本价
  757. Prod_CostPrice += Convert.ToDecimal(Convert.ToDecimal(this.dgv1.Rows[i].Cells["Prod_CostPrice"].Value) * Convert.ToDecimal(this.dgv1.Rows[i].Cells["Pgm_Quantity"].Value));
  758. //卖价
  759. Prod_SalesPrice += Convert.ToDecimal(Convert.ToDecimal(this.dgv1.Rows[i].Cells["Prod_SalesPrice"].Value) * Convert.ToDecimal(this.dgv1.Rows[i].Cells["Pgm_Quantity"].Value));
  760. }
  761. //服务
  762. for (int i = 0; i < this.dgv2.Rows.Count; i++)
  763. {
  764. //成本价
  765. Prod_CostPrice2 += Convert.ToDecimal(Convert.ToDecimal(this.dgv2.Rows[i].Cells["Prod_CostPrice2"].Value) * Convert.ToDecimal(this.dgv2.Rows[i].Cells["Pgm_Quantity2"].Value));
  766. //卖价
  767. Prod_SalesPrice2 += Convert.ToDecimal(Convert.ToDecimal(this.dgv2.Rows[i].Cells["Prod_SalesPrice2"].Value) * Convert.ToDecimal(this.dgv2.Rows[i].Cells["Pgm_Quantity2"].Value));
  768. }
  769. //婚纱景点设置
  770. for (int i = 0; i < this.dgv3.Rows.Count; i++)
  771. {
  772. //成本价
  773. Prod_CostPrice3 += Convert.ToDecimal(Convert.ToDecimal(this.dgv3.Rows[i].Cells["Prod_CostPrice3"].Value) * Convert.ToDecimal(this.dgv3.Rows[i].Cells["Pgm_Quantity3"].Value));
  774. //卖价
  775. Prod_SalesPrice3 += Convert.ToDecimal(Convert.ToDecimal(this.dgv3.Rows[i].Cells["Prod_SalesPrice3"].Value) * Convert.ToDecimal(this.dgv3.Rows[i].Cells["Pgm_Quantity3"].Value));
  776. }
  777. //儿童与婚纱区分版本
  778. //版本判断
  779. switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
  780. {
  781. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  782. this.lblCBJ.Text = Convert.ToDecimal(Prod_CostPrice + Prod_CostPrice2).ToString("N2");
  783. this.lblMJ.Text = Convert.ToDecimal(Prod_SalesPrice + Prod_SalesPrice2).ToString("N2");
  784. break;
  785. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  786. this.lblCBJ.Text = Convert.ToDecimal(Prod_CostPrice + Prod_CostPrice2 + Prod_CostPrice3).ToString("N2");
  787. this.lblMJ.Text = Convert.ToDecimal(Prod_SalesPrice + Prod_SalesPrice2 + Prod_SalesPrice3).ToString("N2");
  788. break;
  789. default:
  790. this.lblCBJ.Text = Convert.ToDecimal(Prod_CostPrice + Prod_CostPrice2 + Prod_CostPrice3 + Prod_CostPrice4).ToString("N2");
  791. this.lblMJ.Text = Convert.ToDecimal(Prod_SalesPrice + Prod_SalesPrice2 + Prod_SalesPrice3 + Prod_SalesPrice4).ToString("N2");
  792. break;
  793. }
  794. }
  795. /// <summary>
  796. /// 保存
  797. /// </summary>
  798. /// <param name="sender"></param>
  799. /// <param name="e"></param>
  800. protected override void btnSave1_Click(object sender, EventArgs e)
  801. {
  802. try
  803. {
  804. #region 判断值是否为空
  805. if (string.IsNullOrEmpty(this.CtvPak_Name.Text))
  806. {
  807. MessageBoxCustom.Show("请选择套系名称!");
  808. return;
  809. }
  810. if (string.IsNullOrEmpty(this.StrPakPackagesID))
  811. {
  812. MessageBoxCustom.Show(this.CtvPak_Name.Text.ToString() + " 此类型无套系名称!请添加套系名称");
  813. this.CtvPak_Name.Text = "";
  814. return;
  815. }
  816. decimal CBJ = Convert.ToDecimal(this.lblCBJ.Text);
  817. decimal UnitPrice = Convert.ToDecimal(this.StrPakUnitPrice);
  818. if (UnitPrice <= CBJ)
  819. {
  820. if (MessageBoxCustom.Show("套系价格必须大于商品成本价!是否继续保存?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  821. { return; }
  822. }
  823. #endregion
  824. #region 获取类别名称和类别编号
  825. DataTable dtpackages = packages.GetList("Pak_PackagesID='" + this.StrPakPackagesID + "'").Tables[0];
  826. string Pak_PackagesClass = "";
  827. string Pak_Name = "";
  828. if (dtpackages.Rows.Count > 0)
  829. {
  830. Pak_PackagesClass = dtpackages.Rows[0]["Pak_PackagesClass"].ToString();
  831. Pak_Name = dtpackages.Rows[0]["Pak_Name"].ToString();
  832. }
  833. #endregion
  834. LYFZ.Model.Model_ErpPackagesGiftMerchandise model = null;
  835. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  836. #region 增加,修改赠送商品
  837. if (this.dgv1.Rows.Count > 0)
  838. {
  839. for (int i = 0; i < this.dgv1.Rows.Count; i++)
  840. {
  841. //增加
  842. int Id = Convert.ToInt32(this.dgv1.Rows[i].Cells["ID"].Value.ToString());
  843. string Pgm_ProductNumber = this.dgv1.Rows[i].Cells["Pgm_ProductNumber"].Value.ToString();
  844. string Pgm_ProductName = this.dgv1.Rows[i].Cells["Pgm_ProductName"].Value.ToString();
  845. int Pgm_Quantity = Convert.ToInt32(this.dgv1.Rows[i].Cells["Pgm_Quantity"].Value.ToString());
  846. if (Id == 0)
  847. {
  848. model = new Model.Model_ErpPackagesGiftMerchandise();
  849. model.Pgm_GiveType = 0;
  850. model.Pgm_ProductNumber = Pgm_ProductNumber;
  851. model.Pgm_Quantity = Pgm_Quantity;
  852. model.Pgm_StageNumber = "";
  853. model.Pgm_ProductName = Pgm_ProductName;
  854. model.Pgm_StageName = "";
  855. model.Pgm_PackagesNumber = Pak_PackagesClass;
  856. model.Pgm_PackagesName = Pak_Name;
  857. model.Pgm_PackagesCode = this.StrPakPackagesID;
  858. clist.Add(pkgmbll.GetAddCommandInfo(model));
  859. }
  860. //修改
  861. if (Id > 0)
  862. {
  863. model = new Model.Model_ErpPackagesGiftMerchandise();
  864. model = pkgmbll.GetModel(Id);
  865. model.Pgm_Quantity = Pgm_Quantity;
  866. model.Pgm_PackagesName = Pak_Name;
  867. clist.Add(pkgmbll.GetUpdateCommandInfo(model));
  868. }
  869. }
  870. }
  871. #endregion
  872. #region 增加,修改服务内容
  873. if (this.dgv2.Rows.Count > 0)
  874. {
  875. for (int i = 0; i < this.dgv2.Rows.Count; i++)
  876. {
  877. //增加
  878. int Id = Convert.ToInt32(this.dgv2.Rows[i].Cells["ID2"].Value.ToString());
  879. string Pgm_ProductNumber = this.dgv2.Rows[i].Cells["Pgm_ProductNumber2"].Value.ToString();
  880. string Pgm_ProductName = this.dgv2.Rows[i].Cells["Pgm_ProductName2"].Value.ToString();
  881. int Pgm_Quantity = Convert.ToInt32(this.dgv2.Rows[i].Cells["Pgm_Quantity2"].Value.ToString());
  882. if (Id == 0)
  883. {
  884. model = new Model.Model_ErpPackagesGiftMerchandise();
  885. model.Pgm_GiveType = 1;
  886. model.Pgm_ProductNumber = Pgm_ProductNumber;
  887. model.Pgm_Quantity = Pgm_Quantity;
  888. model.Pgm_PackagesNumber = Pak_PackagesClass;
  889. model.Pgm_StageNumber = "";
  890. model.Pgm_ProductName = Pgm_ProductName;
  891. model.Pgm_PackagesName = Pak_Name;
  892. model.Pgm_StageName = "";
  893. model.Pgm_PackagesCode = this.StrPakPackagesID;
  894. clist.Add(pkgmbll.GetAddCommandInfo(model));
  895. }
  896. //修改
  897. else if (Id > 0)
  898. {
  899. model = pkgmbll.GetModel(Id);
  900. model.Pgm_Quantity = Pgm_Quantity;
  901. model.Pgm_PackagesName = Pak_Name;
  902. clist.Add(pkgmbll.GetUpdateCommandInfo(model));
  903. }
  904. }
  905. }
  906. #endregion
  907. #region 增加婚纱景点
  908. if (this.dgv3.Rows.Count > 0)
  909. {
  910. for (int i = 0; i < this.dgv3.Rows.Count; i++)
  911. {
  912. //增加
  913. int Id = Convert.ToInt32(this.dgv3.Rows[i].Cells["ID3"].Value.ToString());
  914. string Pgm_ProductNumber = this.dgv3.Rows[i].Cells["Pgm_ProductNumber3"].Value.ToString();
  915. string Pgm_ProductName = this.dgv3.Rows[i].Cells["Pgm_ProductName3"].Value.ToString();
  916. int Pgm_Quantity = Convert.ToInt32(this.dgv3.Rows[i].Cells["Pgm_Quantity3"].Value.ToString());
  917. if (Id == 0)
  918. {
  919. model = new Model.Model_ErpPackagesGiftMerchandise();
  920. model.Pgm_GiveType = 2;
  921. model.Pgm_ProductNumber = Pgm_ProductNumber;
  922. model.Pgm_Quantity = Pgm_Quantity;
  923. model.Pgm_PackagesNumber = Pak_PackagesClass;
  924. model.Pgm_StageNumber = "";
  925. model.Pgm_ProductName = Pgm_ProductName;
  926. model.Pgm_PackagesName = Pak_Name;
  927. model.Pgm_StageName = "";
  928. model.Pgm_PackagesCode = this.StrPakPackagesID;
  929. clist.Add(pkgmbll.GetAddCommandInfo(model));
  930. }
  931. //修改
  932. else if (Id > 0)
  933. {
  934. model = pkgmbll.GetModel(Id);
  935. model.Pgm_Quantity = Pgm_Quantity;
  936. model.Pgm_PackagesName = Pak_Name;
  937. clist.Add(pkgmbll.GetUpdateCommandInfo(model));
  938. }
  939. }
  940. }
  941. #endregion
  942. #region 增加儿童景点
  943. if (this.dgv4.Rows.Count > 0)
  944. {
  945. for (int i = 0; i < this.dgv4.Rows.Count; i++)
  946. {
  947. //增加
  948. int Id = Convert.ToInt32(this.dgv4.Rows[i].Cells["ID4"].Value.ToString());
  949. string Pgm_ProductNumber = this.dgv4.Rows[i].Cells["Pgm_ProductNumber4"].Value.ToString();
  950. string Pgm_ProductName = this.dgv4.Rows[i].Cells["Pgm_ProductName4"].Value.ToString();
  951. int Pgm_Quantity = Convert.ToInt32(this.dgv4.Rows[i].Cells["Pgm_Quantity4"].Value.ToString());
  952. if (Id == 0)
  953. {
  954. model = new Model.Model_ErpPackagesGiftMerchandise();
  955. model.Pgm_GiveType = 3;
  956. model.Pgm_ProductNumber = Pgm_ProductNumber;
  957. model.Pgm_Quantity = Pgm_Quantity;
  958. model.Pgm_PackagesNumber = Pak_PackagesClass;
  959. model.Pgm_StageNumber = "";
  960. model.Pgm_ProductName = Pgm_ProductName;
  961. model.Pgm_PackagesName = Pak_Name;
  962. model.Pgm_StageName = "";
  963. model.Pgm_PackagesCode = this.StrPakPackagesID;
  964. clist.Add(pkgmbll.GetAddCommandInfo(model));
  965. }
  966. //修改
  967. else if (Id > 0)
  968. {
  969. model = pkgmbll.GetModel(Id);
  970. model.Pgm_Quantity = Pgm_Quantity;
  971. model.Pgm_PackagesName = Pak_Name;
  972. clist.Add(pkgmbll.GetUpdateCommandInfo(model));
  973. }
  974. }
  975. }
  976. #endregion
  977. if (clist.Count > 0)
  978. {
  979. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  980. {
  981. this.IsSaveed = true;
  982. this.Bind();
  983. this.GetCostSellingPrice();
  984. MessageBoxCustom.Show("保存成功!");
  985. }
  986. else
  987. { MessageBoxCustom.Show("保存失败!"); }
  988. }
  989. }
  990. catch (Exception ex)
  991. { MessageBoxCustom.Show(ex.Message); }
  992. }
  993. /// <summary>
  994. /// 设置套系
  995. /// </summary>
  996. /// <param name="sender"></param>
  997. /// <param name="e"></param>
  998. protected override void btnProductSet_Click(object sender, EventArgs e)
  999. {
  1000. LYFZ.Software.MainBusiness.InitialSet.FrmPackagesSet set = new FrmPackagesSet();
  1001. set.ShowDialog();
  1002. if (set.IsSaveed)
  1003. {
  1004. this.CtvPak_Name.Text = "";
  1005. this.lblCBJ.Text = "0.00";
  1006. this.lblMJ.Text = "0.00";
  1007. this.IsPackagesSet = true;
  1008. this.FrmPackagesGoodsSet_Shown(sender, e);
  1009. }
  1010. }
  1011. /// <summary>
  1012. /// 窗体大小发生变化
  1013. /// </summary>
  1014. /// <param name="sender"></param>
  1015. /// <param name="e"></param>
  1016. protected override void FrmPackagesGoodsSet_Resize(object sender, EventArgs e)
  1017. {
  1018. if (this.WindowState == FormWindowState.Maximized)
  1019. { this.panelEx2.Size = new Size(950, this.Height - 85); }
  1020. else
  1021. { this.panelEx2.Size = new Size(950, 525); }
  1022. }
  1023. /// <summary>
  1024. /// 拍摄次数下移
  1025. /// </summary>
  1026. /// <param name="sender"></param>
  1027. /// <param name="e"></param>
  1028. void btnDown_Click(object sender, EventArgs e)
  1029. {
  1030. if (this.dgv4.Rows.Count > 0)
  1031. {
  1032. //得到当前选中行的索引
  1033. int rowIndex = this.dgv4.SelectedRows[0].Index;
  1034. if (rowIndex == this.dgv4.Rows.Count - 1)
  1035. { return; }
  1036. List<string> list = new List<string>();
  1037. //把当前选中行的数据存入list数组中
  1038. for (int i = 0; i < this.dgv4.Columns.Count; i++)
  1039. { list.Add(this.dgv4.SelectedRows[0].Cells[i].Value.ToString()); }
  1040. for (int j = 0; j < this.dgv4.Columns.Count; j++)
  1041. {
  1042. if (j > 0)
  1043. {
  1044. this.dgv4.Rows[rowIndex].Cells[j].Value = this.dgv4.Rows[rowIndex + 1].Cells[j].Value;
  1045. this.dgv4.Rows[rowIndex + 1].Cells[j].Value = list[j].ToString();
  1046. }
  1047. }
  1048. int dk = this.dgv4.CurrentRow.Index;
  1049. this.dgv4.Rows[rowIndex].Selected = false;
  1050. this.dgv4.Rows[rowIndex + 1].Selected = true;
  1051. }
  1052. }
  1053. /// <summary>
  1054. /// 拍摄次数上移
  1055. /// </summary>
  1056. /// <param name="sender"></param>
  1057. /// <param name="e"></param>
  1058. void btnUp_Click(object sender, EventArgs e)
  1059. {
  1060. if (this.dgv4.Rows.Count > 0)
  1061. {
  1062. //得到当前选中行的索引
  1063. int rowIndex = this.dgv4.SelectedRows[0].Index;
  1064. if (rowIndex == 0)
  1065. { return; }
  1066. List<string> list = new List<string>();
  1067. //把当前选中行的数据存入list数组中
  1068. for (int i = 0; i < this.dgv4.Columns.Count; i++)
  1069. { list.Add(this.dgv4.SelectedRows[0].Cells[i].Value.ToString()); }
  1070. for (int j = 0; j < this.dgv4.Columns.Count; j++)
  1071. {
  1072. if (j > 0)
  1073. {
  1074. this.dgv4.Rows[rowIndex].Cells[j].Value = this.dgv4.Rows[rowIndex - 1].Cells[j].Value;
  1075. this.dgv4.Rows[rowIndex - 1].Cells[j].Value = list[j].ToString();
  1076. }
  1077. }
  1078. this.dgv4.Rows[rowIndex].Selected = false;
  1079. this.dgv4.Rows[rowIndex - 1].Selected = true;
  1080. }
  1081. }
  1082. /// <summary>
  1083. /// 窗体关闭前
  1084. /// </summary>
  1085. /// <param name="sender"></param>
  1086. /// <param name="e"></param>
  1087. void FrmPackagesGoodsSet_FormClosing(object sender, FormClosingEventArgs e)
  1088. {
  1089. if (!this.IsSaveed)
  1090. {
  1091. if (this.IsPackagesSet)
  1092. { this.IsSaveed = this.IsPackagesSet; }
  1093. }
  1094. }
  1095. }
  1096. }