FrmDelivery.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.InventoryManagement
  11. {
  12. public partial class FrmDelivery : LYFZ.Software.UI.InventoryManagement.FrmDelivery
  13. {
  14. private delegate void UpdateControl();
  15. public FrmDelivery()
  16. {
  17. this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
  18. this.dgv1.CellMouseDown += dgv1_CellMouseDown;
  19. this.dgv1.DataGridViewConMenu_ItemClicked += dgv1_DataGridViewConMenu_ItemClicked;
  20. this.dgv2.CellMouseDown += dgv2_CellMouseDown;
  21. this.dgv2.DataGridViewConMenu_ItemClicked += dgv2_DataGridViewConMenu_ItemClicked;
  22. }
  23. #region 加载
  24. protected override void FrmDelivery_Shown(object sender, EventArgs e)
  25. {
  26. this.CtvSelect.TextFindTag("全部");
  27. bind();
  28. SelectGoods();
  29. btnLibrary.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DeliveryCompetence, CustomAttributes.OperatingAuthority.Delivery);
  30. btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DeliveryCompetence, CustomAttributes.OperatingAuthority.Delete);
  31. }
  32. #region 获取所有商品
  33. /// <summary>
  34. /// 获取所有商品
  35. /// </summary>
  36. public void bind()
  37. {
  38. this.ucPagerEx1.PageCurrent = 1;
  39. this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
  40. this.ucPagerEx1.Bind();
  41. }
  42. #endregion
  43. #region 获取出库记录表
  44. /// <summary>
  45. /// 获取出库记录表
  46. /// </summary>
  47. public void GetProductOutStorage()
  48. {
  49. this.ucPagerEx1.PageCurrent = 1;
  50. this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
  51. this.ucPagerEx1.Bind();
  52. }
  53. #endregion
  54. #endregion
  55. #region 新增出库
  56. protected override void btnLibrary_Click(object sender, EventArgs e)
  57. {
  58. try
  59. {
  60. if (dgv1.SelectedRows.Count == 0)
  61. {
  62. MessageBoxCustom.Show("请选择你要出库的商品!");
  63. return;
  64. }
  65. for (int t = 0; t < dgv1.SelectedRows.Count; t++)
  66. {
  67. int Prod_Quantity = Convert.ToInt32(dgv1.SelectedRows[t].Cells["Pos_OutQuantity"].Value);
  68. string Ir_ProductName = dgv1.SelectedRows[t].Cells["Ir_ProductName"].Value.ToString();
  69. if (Prod_Quantity == 0)
  70. {
  71. MessageBoxCustom.Show(Ir_ProductName + " 出库数量不能0,请输入!");
  72. return;
  73. }
  74. }
  75. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  76. {
  77. #region 新增出库记录表
  78. LYFZ.Model.Model_ErpProductOutStorage ProductOutStorageModel = new Model.Model_ErpProductOutStorage();
  79. LYFZ.BLL.BLL_ErpProductOutStorage ProductOutStorageBll = new BLL.BLL_ErpProductOutStorage();
  80. ProductOutStorageModel.Pos_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID();
  81. ProductOutStorageModel.Pos_ProductCategory = dgv1.SelectedRows[i].Cells["Pos_ProductCategory"].Value.ToString();
  82. ProductOutStorageModel.Pos_ProductNumber = dgv1.SelectedRows[i].Cells["Pos_ProductNumber"].Value.ToString();
  83. ProductOutStorageModel.Pos_OutQuantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["Pos_OutQuantity"].Value);
  84. ProductOutStorageModel.Pos_OutTime = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd"));
  85. ProductOutStorageModel.Pos_Remark = dgv1.SelectedRows[i].Cells["Pos_Remark"].Value.ToString();
  86. ProductOutStorageModel.Pos_OutName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  87. ProductOutStorageBll.Add(ProductOutStorageModel);
  88. #endregion
  89. #region 更新商品库存数量
  90. string Prod_Number = dgv1.SelectedRows[i].Cells["Pos_ProductNumber"].Value.ToString();
  91. int Prod_Quantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["Pos_OutQuantity"].Value);
  92. LYFZ.BLL.BLL_ErpProduct ProductBll = new BLL.BLL_ErpProduct();
  93. DataTable dt = ProductBll.GetList("Prod_Number='" + Prod_Number + "'").Tables[0];
  94. int sum = Convert.ToInt32(dt.Rows[0]["Prod_Quantity"]) - Prod_Quantity;
  95. ProductBll.UpdateProduct("Prod_Quantity=" + sum + "", Prod_Number);
  96. #endregion
  97. }
  98. //绑定数据表
  99. bind();
  100. MessageBoxCustom.Show("出库成功!");
  101. }
  102. catch (Exception ex)
  103. {
  104. MessageBoxCustom.Show(ex.Message);
  105. }
  106. }
  107. #endregion
  108. #region 只能输入数字
  109. protected override void dgv1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  110. {
  111. try
  112. {
  113. if (dgv1.Rows.Count > 0)
  114. {
  115. if (dgv1.CurrentRow.Cells["Pos_OutQuantity"].Value == null)
  116. {
  117. MessageBoxCustom.Show("出库数量不能为空!");
  118. dgv1.CurrentRow.Cells["Pos_OutQuantity"].Value = "0";
  119. return;
  120. }
  121. if (Command.Command_Validate.IsNumber(dgv1.CurrentRow.Cells["Pos_OutQuantity"].Value.ToString()) == false)
  122. {
  123. MessageBoxCustom.Show("只能输入纯数字!");
  124. //int id = Convert.ToInt32(dgv1.CurrentRow.Cells["ID"].Value);
  125. //LYFZ.BLL.BLL_ErpProduct bll = new BLL.BLL_ErpProduct();
  126. dgv1.CurrentRow.Cells["Pos_OutQuantity"].Value = "0";//bll.GetList("ID=" + id + "").Tables[0].Rows[0]["Prod_Quantity"].ToString();
  127. return;
  128. }
  129. }
  130. }
  131. catch (Exception ex)
  132. {
  133. MessageBoxCustom.Show(ex.Message);
  134. }
  135. }
  136. #endregion
  137. #region 出库
  138. protected override void radLibrary_Click(object sender, EventArgs e)
  139. {
  140. try
  141. {
  142. dgv2.Visible = false;
  143. dgv1.Visible = true;
  144. btnLibrary.Visible = true;
  145. btnDelete.Visible = false;
  146. //绑定数据表
  147. bind();
  148. }
  149. catch (Exception ex)
  150. {
  151. MessageBoxCustom.Show(ex.Message);
  152. }
  153. }
  154. #endregion
  155. #region 出库记录
  156. protected override void radLibraryRecord_Click(object sender, EventArgs e)
  157. {
  158. try
  159. {
  160. dgv2.Visible = true;
  161. dgv1.Visible = false;
  162. btnLibrary.Visible = false;
  163. btnDelete.Visible = true;
  164. //绑定数据表
  165. GetProductOutStorage();
  166. }
  167. catch (Exception ex)
  168. {
  169. MessageBoxCustom.Show(ex.Message);
  170. }
  171. }
  172. #endregion
  173. #region 绑定查询商品类别
  174. /// <summary>
  175. /// 绑定查询商品类别
  176. /// </summary>
  177. public void SelectGoods()
  178. {
  179. CtvSelect.TreeView.Nodes.Clear();
  180. #region 绑定二级商品类别
  181. LYFZ.BLL.BLL_ErpSystemCategory BLLSystemCategory = new BLL.BLL_ErpSystemCategory();
  182. DataTable tbl = BLLSystemCategory.GetList("Sc_ClassParentID='1'").Tables[0];
  183. if (tbl.Rows.Count > 0)
  184. {
  185. TreeNode root = null;
  186. for (int i = 0; i < tbl.Rows.Count; i++)
  187. {
  188. if (i == 0)
  189. {
  190. root = new TreeNode("全部");
  191. this.CtvSelect.TreeView.Nodes.Add(root);
  192. }
  193. root = new TreeNode();
  194. root.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
  195. root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
  196. this.CreateTreeViewShop(root.Nodes, tbl.Rows[i]["ID"].ToString());
  197. this.CtvSelect.TreeView.Nodes.Add(root);
  198. }
  199. }
  200. #endregion
  201. }
  202. #endregion
  203. #region 绑定三级商品类别
  204. #region 绑定第三级商品类别
  205. /// <summary>
  206. /// 绑定第三级商品类别
  207. /// </summary>
  208. /// <param name="nodes">TreeView的节点集合</param>
  209. /// <param name="dataSource">数据源</param>
  210. /// <param name="parentid"></param>
  211. private void CreateTreeViewShop(TreeNodeCollection nodes, string ClassCode)
  212. {
  213. if (ClassCode != "")
  214. {
  215. LYFZ.BLL.BLL_ErpSystemCategory BLLSystemCategory = new BLL.BLL_ErpSystemCategory();
  216. DataTable tbl = BLLSystemCategory.GetList("Sc_ClassParentID=" + ClassCode + "").Tables[0];
  217. if (tbl.Rows.Count > 0)
  218. {
  219. TreeNode node;
  220. for (int i = 0; i < tbl.Rows.Count; i++)
  221. {
  222. node = new TreeNode();
  223. node.Text = tbl.Rows[i]["Sc_ClassName"].ToString();
  224. node.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString();
  225. nodes.Add(node);
  226. }
  227. }
  228. }
  229. }
  230. #endregion
  231. #endregion
  232. #region 商品查询
  233. protected override void CtvSelect_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
  234. {
  235. try
  236. {
  237. bind();
  238. GetProductOutStorage();
  239. }
  240. catch (Exception ex)
  241. {
  242. MessageBoxCustom.Show(ex.Message);
  243. }
  244. }
  245. #endregion
  246. #region 画分页
  247. /// <summary>
  248. /// 画分页
  249. /// </summary>
  250. /// <param name="e"></param>
  251. /// <returns></returns>
  252. private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
  253. {
  254. #region 出库
  255. if (radLibrary.Checked)
  256. {
  257. dgv1.Rows.Clear();
  258. DataTable dt = new DataTable();
  259. StringBuilder str = new StringBuilder();
  260. if (CtvSelect.Text == "" || CtvSelect.Tag == null || CtvSelect.Text == "全部")
  261. {
  262. str.Append(" 1=1 and Prod_IsEnabled='1' and Prod_Availability=1"); //and Prod_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "'
  263. }
  264. if (CtvSelect.Tag != null)
  265. {
  266. str.Append(" 1=1 and Prod_IsEnabled='1' and Prod_Class='" + CtvSelect.Tag.ToString() + "' and Prod_Availability=1"); //and Prod_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "'
  267. }
  268. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  269. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  270. {
  271. pageData.TableName = "View_tb_ErpProduct";
  272. pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  273. pageData.PageSize = this.ucPagerEx1.PageSize;
  274. pageData.QueryCondition = str.ToString();
  275. pageData.QueryFieldName = "ID,Prod_Number,Prod_DividedShop,Prod_Name,Prod_Class,Prod_Unit,Prod_CostPrice,Prod_SalesPrice,Prod_SpecialPrice,Prod_AlarmQuantity,Prod_IsEnabled,Prod_Quantity,Prod_Expedited,Prod_CreateDatetime,Prod_PreSaleQuantity,Prod_Batch,Prod_ClassName,Sc_ClassCode,Prod_ClassName2,Prod_IsEnabledName,Prod_Availability";
  276. pageData.OrderStr = " ID desc ";
  277. DataSet da = pageData.QueryDataTable();
  278. dt = da.Tables[0];
  279. if (dt.Rows.Count > 0)
  280. {
  281. this.Invoke(new UpdateControl(delegate()
  282. {
  283. #region
  284. for (int t = 0; t < dt.Rows.Count; t++)
  285. {
  286. DataGridViewRow dgvr = new DataGridViewRow();
  287. DataGridViewCell cell = null;
  288. cell = new DataGridViewTextBoxCell();
  289. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  290. dgvr.Cells.Add(cell);
  291. cell = new DataGridViewTextBoxCell();
  292. cell.Value = dt.Rows[t]["Prod_Name"].ToString().Trim();
  293. dgvr.Cells.Add(cell);
  294. cell = new DataGridViewTextBoxCell();
  295. cell.Value = dt.Rows[t]["Prod_Quantity"].ToString().Trim();
  296. dgvr.Cells.Add(cell);
  297. cell = new DataGridViewTextBoxCell();
  298. cell.Value = dt.Rows[t]["Prod_ClassName"].ToString().Trim();
  299. dgvr.Cells.Add(cell);
  300. cell = new DataGridViewTextBoxCell();
  301. cell.Value = dt.Rows[t]["Prod_AlarmQuantity"].ToString().Trim();
  302. dgvr.Cells.Add(cell);
  303. cell = new DataGridViewTextBoxCell();
  304. cell.Value = dt.Rows[t]["Prod_PreSaleQuantity"].ToString().Trim();
  305. dgvr.Cells.Add(cell);
  306. cell = new DataGridViewTextBoxCell();
  307. cell.Value = "0";
  308. dgvr.Cells.Add(cell);
  309. cell = new DataGridViewTextBoxCell();
  310. cell.Value = "";
  311. dgvr.Cells.Add(cell);
  312. cell = new DataGridViewTextBoxCell();
  313. cell.Value = dt.Rows[t]["Prod_Class"].ToString().Trim();
  314. dgvr.Cells.Add(cell);
  315. cell = new DataGridViewTextBoxCell();
  316. cell.Value = dt.Rows[t]["Prod_Number"].ToString().Trim();
  317. dgvr.Cells.Add(cell);
  318. this.dgv1.Rows.Add(dgvr);
  319. dgv1.ClearSelection();
  320. }
  321. #endregion
  322. }));
  323. }
  324. #region 变色
  325. for (int i = 0; i < dgv1.Rows.Count; i++)
  326. {
  327. int Prod_Quantity = Convert.ToInt32(dgv1.Rows[i].Cells["Prod_Quantity"].Value);
  328. int Prod_AlarmQuantity = Convert.ToInt32(dgv1.Rows[i].Cells["Prod_AlarmQuantity"].Value);
  329. if (Prod_Quantity <= Prod_AlarmQuantity)
  330. {
  331. this.dgv1.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
  332. }
  333. }
  334. #endregion
  335. });
  336. try
  337. {
  338. this.ucPagerEx1.TbDataSource = dt;
  339. }
  340. catch { }
  341. return pageData.TotalCount;
  342. }
  343. #endregion
  344. #region 出库记录
  345. if (radLibraryRecord.Checked)
  346. {
  347. dgv2.Rows.Clear();
  348. DataTable dt = new DataTable();
  349. StringBuilder str = new StringBuilder();
  350. if (CtvSelect.Text == "" || CtvSelect.Tag == null || CtvSelect.Text == "全部")
  351. {
  352. str.Append(" 1=1 and Pos_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "' ");
  353. }
  354. if (CtvSelect.Tag != null)
  355. {
  356. str.Append(" 1=1 and Pos_ProductCategory='" + CtvSelect.Tag.ToString() + "' and Pos_DividedShop='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID() + "' ");
  357. }
  358. LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
  359. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  360. {
  361. pageData.TableName = "View_ErpProductOutStorage";
  362. pageData.PageIndex = this.ucPagerEx1.PageCurrent;
  363. pageData.PageSize = this.ucPagerEx1.PageSize;
  364. pageData.QueryCondition = str.ToString();
  365. pageData.QueryFieldName = "ID,Pos_DividedShop,Pos_ProductCategory,Pos_ProductNumber,Pos_OutQuantity,Pos_OutTime,Pos_OutNameID,Pos_OutName,Pos_Remark,Pos_ProductCategoryName,Pos_ProductNumberName";
  366. pageData.OrderStr = " ID desc ";
  367. DataSet da = pageData.QueryDataTable();
  368. dt = da.Tables[0];
  369. if (dt.Rows.Count > 0)
  370. {
  371. this.Invoke(new UpdateControl(delegate()
  372. {
  373. #region
  374. for (int t = 0; t < dt.Rows.Count; t++)
  375. {
  376. DataGridViewRow dgvr = new DataGridViewRow();
  377. DataGridViewCell cell = null;
  378. cell = new DataGridViewTextBoxCell();
  379. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  380. dgvr.Cells.Add(cell);
  381. cell = new DataGridViewTextBoxCell();
  382. cell.Value = dt.Rows[t]["Pos_ProductCategory"].ToString().Trim();
  383. dgvr.Cells.Add(cell);
  384. cell = new DataGridViewTextBoxCell();
  385. cell.Value = dt.Rows[t]["Pos_ProductNumber"].ToString().Trim();
  386. dgvr.Cells.Add(cell);
  387. cell = new DataGridViewTextBoxCell();
  388. cell.Value = dt.Rows[t]["Pos_ProductCategoryName"].ToString().Trim();
  389. dgvr.Cells.Add(cell);
  390. cell = new DataGridViewTextBoxCell();
  391. cell.Value = dt.Rows[t]["Pos_ProductNumberName"].ToString().Trim();
  392. dgvr.Cells.Add(cell);
  393. cell = new DataGridViewTextBoxCell();
  394. cell.Value = dt.Rows[t]["Pos_OutQuantity"].ToString().Trim();
  395. dgvr.Cells.Add(cell);
  396. cell = new DataGridViewTextBoxCell();
  397. cell.Value = dt.Rows[t]["Pos_OutName"].ToString().Trim();
  398. dgvr.Cells.Add(cell);
  399. cell = new DataGridViewTextBoxCell();
  400. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pos_OutTime"]).ToString("yyyy-MM-dd").Trim();
  401. dgvr.Cells.Add(cell);
  402. cell = new DataGridViewTextBoxCell();
  403. cell.Value = dt.Rows[t]["Pos_Remark"].ToString().Trim();
  404. dgvr.Cells.Add(cell);
  405. this.dgv2.Rows.Add(dgvr);
  406. dgv2.ClearSelection();
  407. }
  408. #endregion
  409. }));
  410. }
  411. });
  412. try
  413. {
  414. this.ucPagerEx1.TbDataSource = dt;
  415. }
  416. catch { }
  417. return pageData.TotalCount;
  418. }
  419. #endregion
  420. return 0;
  421. }
  422. #endregion
  423. #region 删除
  424. protected override void btnDelete_Click(object sender, EventArgs e)
  425. {
  426. try
  427. {
  428. if (this.dgv2.SelectedRows.Count == 0)
  429. {
  430. MessageBoxCustom.Show("请选中你要删除的数据!");
  431. return;
  432. }
  433. LYFZ.BLL.BLL_ErpProductOutStorage ProductOutStoragbll = new BLL.BLL_ErpProductOutStorage();
  434. LYFZ.BLL.BLL_ErpProduct Productbll = new BLL.BLL_ErpProduct();
  435. DataTable dt = new DataTable();
  436. if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  437. {
  438. int id = Convert.ToInt32(this.dgv2.CurrentRow.Cells["dataGridViewTextBoxColumn1"].Value);
  439. string Pro_number = dgv2.CurrentRow.Cells["dataGridViewTextBoxColumn9"].Value.ToString();
  440. int Quantity = Convert.ToInt32(this.dgv2.CurrentRow.Cells["dataGridViewTextBoxColumn4"].Value);
  441. //删除出库记录
  442. if (ProductOutStoragbll.Delete(id))
  443. {
  444. #region 更新商品库存数量
  445. //获取商品数量
  446. dt = Productbll.GetList("Prod_Number='" + Pro_number + "'").Tables[0];
  447. if (dt.Rows.Count > 0)
  448. {
  449. int Count = Convert.ToInt32(Convert.ToInt32(dt.Rows[0]["Prod_Quantity"]) + Quantity);
  450. Productbll.UpdateProduct("Prod_Quantity=" + Count + "", Pro_number);
  451. }
  452. #endregion
  453. }
  454. MessageBoxCustom.Show("删除成功!");
  455. GetProductOutStorage();
  456. }
  457. }
  458. catch (Exception ex)
  459. {
  460. MessageBoxCustom.Show(ex.Message);
  461. }
  462. }
  463. #endregion
  464. /// <summary>
  465. /// 右键菜单点击
  466. /// </summary>
  467. /// <param name="sender"></param>
  468. /// <param name="e"></param>
  469. void dgv1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
  470. {
  471. if (e.Button == MouseButtons.Right)
  472. {
  473. ToolStripMenuItem item = null;
  474. item = new ToolStripMenuItem();
  475. item.Text = "查看商品图片";
  476. item.Tag = "View";
  477. this.dgv1.conMenu.Items.Add(item);
  478. }
  479. }
  480. void dgv1_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  481. {
  482. ToolStripItem item = e.ClickedItem;
  483. if (item.Tag.ToString().Trim() == "View")
  484. {
  485. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ProductViewPhoto(this.dgv1.CurrentRow.Cells["Pos_ProductNumber"].Value.ToString().Trim());
  486. }
  487. }
  488. /// <summary>
  489. /// 右键菜单点击
  490. /// </summary>
  491. /// <param name="sender"></param>
  492. /// <param name="e"></param>
  493. void dgv2_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
  494. {
  495. if (e.Button == MouseButtons.Right)
  496. {
  497. ToolStripMenuItem item = null;
  498. item = new ToolStripMenuItem();
  499. item.Text = "查看商品图片";
  500. item.Tag = "View";
  501. this.dgv2.conMenu.Items.Add(item);
  502. }
  503. }
  504. void dgv2_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  505. {
  506. ToolStripItem item = e.ClickedItem;
  507. if (item.Tag.ToString().Trim() == "View")
  508. {
  509. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ProductViewPhoto(this.dgv2.CurrentRow.Cells["dataGridViewTextBoxColumn9"].Value.ToString().Trim());
  510. }
  511. }
  512. }
  513. }