FrmAcceptanceManagement.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.InventoryManagement.PurchasingManagement
  12. {
  13. public partial class FrmAcceptanceManagement : LYFZ.Software.UI.InventoryManagement.PurchasingManagement.AcceptanceManagement
  14. {
  15. private delegate void UpdateControl();
  16. bool bl = false;
  17. public string Pord_PurchaseNumber;
  18. public FrmAcceptanceManagement()
  19. {
  20. this.FormClosed += FrmAcceptanceManagement_FormClosed;
  21. this.dgv1.CellMouseDown += dgv1_CellMouseDown;
  22. this.dgv1.DataGridViewConMenu_ItemClicked += dgv1_DataGridViewConMenu_ItemClicked;
  23. }
  24. /// <summary>
  25. /// 窗体关闭事件
  26. /// </summary>
  27. /// <param name="sender"></param>
  28. /// <param name="e"></param>
  29. void FrmAcceptanceManagement_FormClosed(object sender, FormClosedEventArgs e)
  30. {
  31. if (bl)
  32. { this.DialogResult = DialogResult.OK; }
  33. }
  34. /// <summary>
  35. /// 窗体加载事件
  36. /// </summary>
  37. /// <param name="sender"></param>
  38. /// <param name="e"></param>
  39. protected override void AcceptanceManagement_Shown(object sender, EventArgs e)
  40. { this.GetPurchaseProduct(Pord_PurchaseNumber); }
  41. /// <summary>
  42. /// 获取采购商品表
  43. /// </summary>
  44. public void GetPurchaseProduct(string Ppt_PurchaseNumber)
  45. {
  46. dgv1.Rows.Clear();
  47. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductbll = new BLL.BLL_ErpPurchaseProduct();
  48. DataTable dt = PurchaseProductbll.View_tb_PurchaseProduct(" and Ppt_PurchaseNumber='" + Ppt_PurchaseNumber + "'").Tables[0];
  49. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  50. {
  51. this.Invoke(new UpdateControl(delegate()
  52. {
  53. for (int t = 0; t < dt.Rows.Count; t++)
  54. {
  55. DataGridViewRow dgvr = new DataGridViewRow();
  56. DataGridViewCell cell = null;
  57. cell = new DataGridViewTextBoxCell();
  58. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  59. dgvr.Cells.Add(cell);
  60. cell = new DataGridViewTextBoxCell();
  61. cell.Value = dt.Rows[t]["Ppt_PurchaseNumber"].ToString().Trim();
  62. dgvr.Cells.Add(cell);
  63. cell = new DataGridViewTextBoxCell();
  64. cell.Value = dt.Rows[t]["Ppt_ProductNumberName"].ToString().Trim();
  65. dgvr.Cells.Add(cell);
  66. cell = new DataGridViewTextBoxCell();
  67. cell.Value = dt.Rows[t]["Ppt_PurchaseQuantity"].ToString().Trim();
  68. dgvr.Cells.Add(cell);
  69. cell = new DataGridViewTextBoxCell();
  70. cell.Value = dt.Rows[t]["Ppt_ProductCategoryName"].ToString().Trim();
  71. dgvr.Cells.Add(cell);
  72. cell = new DataGridViewTextBoxCell();
  73. cell.Value = "";
  74. dgvr.Cells.Add(cell);
  75. cell = new DataGridViewTextBoxCell();
  76. cell.Value = "";
  77. dgvr.Cells.Add(cell);
  78. cell = new DataGridViewTextBoxCell();
  79. cell.Value = dt.Rows[t]["Ppt_ProductCategory"].ToString().Trim();
  80. dgvr.Cells.Add(cell);
  81. cell = new DataGridViewTextBoxCell();
  82. cell.Value = dt.Rows[t]["Ppt_ProductNumber"].ToString().Trim();
  83. dgvr.Cells.Add(cell);
  84. cell = new DataGridViewTextBoxCell();
  85. cell.Value = dt.Rows[t]["Ppt_PurchasePrice"].ToString().Trim();
  86. dgvr.Cells.Add(cell);
  87. cell = new DataGridViewTextBoxCell();
  88. cell.Value = dt.Rows[t]["Ppt_PurchaseVendor"].ToString().Trim();
  89. dgvr.Cells.Add(cell);
  90. cell = new DataGridViewTextBoxCell();
  91. if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "0")
  92. {
  93. cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购中.ToString();
  94. dgvr.DefaultCellStyle.ForeColor = Color.Orange;
  95. }
  96. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "1")
  97. { cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购完成.ToString(); }
  98. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "2")
  99. { cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购取消.ToString(); }
  100. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "3")
  101. {
  102. cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.申请中.ToString();
  103. dgvr.DefaultCellStyle.ForeColor = Color.Orange;
  104. }
  105. dgvr.Cells.Add(cell);
  106. cell = new DataGridViewTextBoxCell();
  107. cell.Value = dt.Rows[t]["Ppt_PurchasePerson"].ToString().Trim();
  108. dgvr.Cells.Add(cell);
  109. cell = new DataGridViewTextBoxCell();
  110. cell.Value = Convert.ToDateTime(dt.Rows[t]["Ppt_PurchaseTime"]).ToString("yyyy-MM-dd").Trim();
  111. dgvr.Cells.Add(cell);
  112. cell = new DataGridViewTextBoxCell();
  113. cell.Value = dt.Rows[t]["Ppt_AcceptanceQuantity"].ToString().Trim();
  114. dgvr.Cells.Add(cell);
  115. cell = new DataGridViewTextBoxCell();
  116. cell.Value = dt.Rows[t]["Ppt_AcceptanceName"].ToString().Trim();
  117. dgvr.Cells.Add(cell);
  118. cell = new DataGridViewTextBoxCell();
  119. cell.Value = Convert.ToDateTime(dt.Rows[t]["Ppt_AcceptanceTime"]).ToString("yyyy-MM-dd").Trim();
  120. dgvr.Cells.Add(cell);
  121. cell = new DataGridViewTextBoxCell();
  122. cell.Value = Convert.ToInt32(dt.Rows[t]["Ppt_PurchaseQuantity"].ToString().Trim()) - Convert.ToInt32(dt.Rows[t]["Ppt_AcceptanceQuantity"].ToString().Trim());
  123. dgvr.Cells.Add(cell);
  124. this.dgv1.Rows.Add(dgvr);
  125. }
  126. this.dgv1.ClearSelection();
  127. }));
  128. });
  129. }
  130. /// <summary>
  131. /// 验收
  132. /// </summary>
  133. /// <param name="sender"></param>
  134. /// <param name="e"></param>
  135. protected override void btnPurchase_Click(object sender, EventArgs e)
  136. {
  137. try
  138. {
  139. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  140. if (dgv1.SelectedRows.Count == 0)
  141. { MessageBoxCustom.Show("请选择验收的商品!可多选!"); return; }
  142. // 商品采购状态判断
  143. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  144. {
  145. string Status = dgv1.SelectedRows[i].Cells["Status"].Value.ToString();
  146. string Ir_ProductName = dgv1.SelectedRows[i].Cells["Ir_ProductName"].Value.ToString();
  147. if (Status.ToString() == "申请中")
  148. { MessageBoxCustom.Show("商品正在申请中,不能验收!"); return; }
  149. if (Status.ToString() == "采购取消")
  150. { MessageBoxCustom.Show(Ir_ProductName + " 商品已经取消采购,不能验收!"); return; }
  151. if (Status.ToString() == "采购完成")
  152. { MessageBoxCustom.Show(Ir_ProductName + " 商品已经采购完成,不能验收!"); return; }
  153. }
  154. if (dgv1.SelectedRows.Count > 0)
  155. {
  156. #region 修改采购商品表
  157. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  158. {
  159. int id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  160. LYFZ.Model.Model_ErpPurchaseProduct PurchaseProductModel = PurchaseProductBll.GetModel(id);
  161. PurchaseProductModel.Ppt_AcceptanceQuantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["BcAcceptance"].Value) + Convert.ToInt32(dgv1.SelectedRows[i].Cells["Ppt_AcceptanceQuantity"].Value);
  162. PurchaseProductBll.Update(PurchaseProductModel);
  163. }
  164. #endregion
  165. #region 更新采购商品表状态
  166. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  167. {
  168. string Prod_Number = dgv1.SelectedRows[i].Cells["Prod_Number"].Value.ToString();
  169. int Id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  170. int Prod_Quantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["Prod_Quantity"].Value);
  171. int Ppt_AcceptanceQuantity = Convert.ToInt32(PurchaseProductBll.GetList("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and Ppt_ProductNumber='" + Prod_Number + "'").Tables[0].Rows[0]["Ppt_AcceptanceQuantity"]); //Convert.ToInt32(dgv1.SelectedRows[i].Cells["Ppt_AcceptanceQuantity"].Value);
  172. if (Prod_Quantity == Ppt_AcceptanceQuantity)
  173. {
  174. PurchaseProductBll.UpdatePpt_PurchaseStatus("Ppt_PurchaseStatus='1',Ppt_AcceptanceName='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name + "',Ppt_AcceptanceTime='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd") + "' ", Id);
  175. }
  176. if (Prod_Quantity < Ppt_AcceptanceQuantity)
  177. {
  178. PurchaseProductBll.UpdatePpt_PurchaseStatus("Ppt_PurchaseStatus='0',Ppt_AcceptanceName='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name + "',Ppt_AcceptanceTime='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd") + "' ", Id);
  179. }
  180. }
  181. #endregion
  182. #region 更新采购订单表状态
  183. int sum = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "'");
  184. int Qx = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and Ppt_PurchaseStatus='1'");
  185. int CgzOrQx = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and (Ppt_PurchaseStatus='0' or Ppt_PurchaseStatus='3')");
  186. if (sum == Qx)
  187. {
  188. PurchaseProductBll.UpdateCgDd("1", Pord_PurchaseNumber);
  189. }
  190. if (CgzOrQx == 0)
  191. {
  192. PurchaseProductBll.UpdateCgDd("1", Pord_PurchaseNumber);
  193. }
  194. #endregion
  195. #region 新增入库
  196. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  197. {
  198. int id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  199. string Prod_Number = dgv1.SelectedRows[i].Cells["Prod_Number"].Value.ToString();
  200. int BcAcceptance = Convert.ToInt32(dgv1.SelectedRows[i].Cells["BcAcceptance"].Value);
  201. if (BcAcceptance != 0)
  202. {
  203. #region 新增入库记录表
  204. LYFZ.Model.Model_ErpProductIntStorage ProductIntStorageModel = new Model.Model_ErpProductIntStorage();
  205. LYFZ.BLL.BLL_ErpProductIntStorage ProductIntStorageBll = new BLL.BLL_ErpProductIntStorage();
  206. ProductIntStorageModel.Pis_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetCompanyInfoID();
  207. ProductIntStorageModel.Pis_ProductCategory = dgv1.SelectedRows[i].Cells["Prod_Class"].Value.ToString();
  208. ProductIntStorageModel.Pis_ProductNumber = dgv1.SelectedRows[i].Cells["Prod_Number"].Value.ToString();
  209. ProductIntStorageModel.Pis_PurchaseQuantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["BcAcceptance"].Value);
  210. ProductIntStorageModel.Pis_PurchaseVendor = dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  211. ProductIntStorageModel.Pis_PurchasePrice = Convert.ToDecimal(dgv1.SelectedRows[i].Cells["Ppt_PurchasePrice"].Value);
  212. ProductIntStorageModel.Pis_Remark = "";
  213. ProductIntStorageModel.Pis_CreateDatetime = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd"));
  214. ProductIntStorageModel.Pis_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  215. ProductIntStorageBll.Add(ProductIntStorageModel);
  216. #endregion
  217. #region 更新采购商品入库状态
  218. LYFZ.Model.Model_ErpPurchaseProduct PurchaseProductModel = PurchaseProductBll.GetModel(id);
  219. PurchaseProductModel.Ppt_StorageStatus = "1";
  220. PurchaseProductBll.Update(PurchaseProductModel);
  221. #endregion
  222. #region 更新商品库存数量
  223. LYFZ.BLL.BLL_ErpProduct ProductBll = new BLL.BLL_ErpProduct();
  224. DataTable dt = ProductBll.GetList("Prod_Number='" + Prod_Number + "'").Tables[0];
  225. int sumQuantity = BcAcceptance + Convert.ToInt32(dt.Rows[0]["Prod_Quantity"]);
  226. ProductBll.UpdateProduct("Prod_Quantity=" + sumQuantity + "", Prod_Number);
  227. #endregion
  228. }
  229. }
  230. #endregion
  231. }
  232. GetPurchaseProduct(Pord_PurchaseNumber);
  233. bl = true;
  234. MessageBoxCustom.Show("保存成功!");
  235. }
  236. catch (Exception ex)
  237. { MessageBoxCustom.Show(ex.Message); }
  238. }
  239. /// <summary>
  240. /// 不验收
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. protected override void btnNotPurchase_Click(object sender, EventArgs e)
  245. {
  246. try
  247. {
  248. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  249. if (dgv1.SelectedRows.Count == 0)
  250. { MessageBoxCustom.Show("请选择不验收的商品!可多选!"); return; }
  251. // 判断商品状态
  252. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  253. {
  254. string Ir_ProductName = dgv1.SelectedRows[i].Cells["Ir_ProductName"].Value.ToString();
  255. string Status = dgv1.SelectedRows[i].Cells["Status"].Value.ToString();
  256. if (Status.ToString() == "申请中")
  257. { MessageBoxCustom.Show("商品正在申请中,不能验收!"); return; }
  258. if (Status.ToString() == "采购取消")
  259. { MessageBoxCustom.Show(Ir_ProductName + " 商品已经取消采购,不能验收!"); return; }
  260. if (Status.ToString() == "采购完成")
  261. { MessageBoxCustom.Show(Ir_ProductName + " 商品已经采购完成,不能验收!"); return; }
  262. }
  263. #region 更新采购商品表状态
  264. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  265. {
  266. int Id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  267. PurchaseProductBll.UpdatePpt_PurchaseStatus("Ppt_PurchaseStatus='2',Ppt_AcceptanceName='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name + "',Ppt_AcceptanceTime='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd") + "' ", Id);
  268. }
  269. #endregion
  270. #region 更新采购订单表状态
  271. int sum = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "'");
  272. int Qx = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and Ppt_PurchaseStatus='2'");
  273. int CgzOrQx = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and (Ppt_PurchaseStatus='0' or Ppt_PurchaseStatus='3')");
  274. if (sum == Qx)
  275. {
  276. PurchaseProductBll.UpdateCgDd("2", Pord_PurchaseNumber);
  277. }
  278. if (CgzOrQx == 0)
  279. {
  280. PurchaseProductBll.UpdateCgDd("1", Pord_PurchaseNumber);
  281. }
  282. #endregion
  283. GetPurchaseProduct(Pord_PurchaseNumber);
  284. bl = true;
  285. MessageBoxCustom.Show("保存成功!");
  286. }
  287. catch (Exception ex)
  288. {
  289. MessageBoxCustom.Show(ex.Message);
  290. }
  291. }
  292. /// <summary>
  293. /// 保存更改数量
  294. /// </summary>
  295. /// <param name="sender"></param>
  296. /// <param name="e"></param>
  297. protected override void btnSave_Click(object sender, EventArgs e)
  298. {
  299. try
  300. {
  301. if (dgv1.Rows.Count > 0)
  302. {
  303. if (MessageBoxCustom.Show("你确定修改采购列表中的商品吗?", "增加提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  304. {
  305. #region 修改采购商品表
  306. for (int i = 0; i < dgv1.Rows.Count; i++)
  307. {
  308. int id = Convert.ToInt32(dgv1.Rows[i].Cells["ID"].Value);
  309. //string Ppt_PurchaseVendor = dgv1.Rows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  310. //LYFZ.BLL.BLL_ErpVendor VendorBll = new BLL.BLL_ErpVendor();
  311. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  312. LYFZ.Model.Model_ErpPurchaseProduct PurchaseProductModel = PurchaseProductBll.GetModel(id);
  313. PurchaseProductModel.Ppt_PurchasePrice = Convert.ToDecimal(dgv1.Rows[i].Cells["Ppt_PurchasePrice"].Value);
  314. PurchaseProductModel.Ppt_PurchaseVendor = dgv1.Rows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  315. PurchaseProductModel.Ppt_AcceptanceQuantity = Convert.ToInt32(dgv1.Rows[i].Cells["Ppt_AcceptanceQuantity"].Value);
  316. PurchaseProductBll.Update(PurchaseProductModel);
  317. }
  318. GetPurchaseProduct(Pord_PurchaseNumber);
  319. MessageBoxCustom.Show("保存成功!");
  320. #endregion
  321. }
  322. }
  323. }
  324. catch (Exception ex)
  325. { MessageBoxCustom.Show(ex.Message); }
  326. }
  327. /// <summary>
  328. /// 关闭
  329. /// </summary>
  330. /// <param name="sender"></param>
  331. /// <param name="e"></param>
  332. protected override void btnClose_Click(object sender, EventArgs e)
  333. {
  334. this.Close();
  335. }
  336. /// <summary>
  337. /// 只能输入数字
  338. /// </summary>
  339. /// <param name="sender"></param>
  340. /// <param name="e"></param>
  341. protected override void dgv1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  342. {
  343. try
  344. {
  345. if (dgv1.Rows.Count > 0)
  346. {
  347. if (dgv1.CurrentRow.Cells["BcAcceptance"].Value == null)
  348. {
  349. MessageBoxCustom.Show("本次验收数量不能为空!");
  350. dgv1.CurrentRow.Cells["BcAcceptance"].Value = Convert.ToInt32(dgv1.CurrentRow.Cells["Prod_Quantity"].Value) - Convert.ToInt32(dgv1.CurrentRow.Cells["Ppt_AcceptanceQuantity"].Value);
  351. return;
  352. }
  353. if (Command.Command_Validate.IsNumber(dgv1.CurrentRow.Cells["BcAcceptance"].Value.ToString()) == false)
  354. {
  355. MessageBoxCustom.Show("只能输入纯数字!");
  356. dgv1.CurrentRow.Cells["BcAcceptance"].Value = Convert.ToInt32(dgv1.CurrentRow.Cells["Prod_Quantity"].Value) - Convert.ToInt32(dgv1.CurrentRow.Cells["Ppt_AcceptanceQuantity"].Value);
  357. return;
  358. }
  359. }
  360. }
  361. catch (Exception ex)
  362. { MessageBoxCustom.Show(ex.Message); }
  363. }
  364. /// <summary>
  365. /// 导出
  366. /// </summary>
  367. /// <param name="sender"></param>
  368. /// <param name="e"></param>
  369. protected override void btnExport_Click(object sender, EventArgs e)
  370. {
  371. if (dgv1.Rows.Count > 0)
  372. { dgv1.ExportDataTable(); }
  373. }
  374. /// <summary>
  375. /// 打印
  376. /// </summary>
  377. /// <param name="sender"></param>
  378. /// <param name="e"></param>
  379. protected override void btnPrint_Click(object sender, EventArgs e)
  380. {
  381. if (dgv1.Rows.Count == 0)
  382. { MessageBoxCustom.Show("无打印数据!"); return; }
  383. Hashtable htData = new Hashtable();
  384. htData["dgvData"] = this.dgv1;
  385. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.库存采购验收单, htData);
  386. }
  387. /// <summary>
  388. /// 左键菜单
  389. /// </summary>
  390. /// <param name="sender"></param>
  391. /// <param name="e"></param>
  392. void dgv1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
  393. {
  394. if (e.Button == MouseButtons.Right)
  395. {
  396. ToolStripMenuItem item = null;
  397. item = new ToolStripMenuItem();
  398. item.Text = "查看商品图片";
  399. item.Tag = "View";
  400. this.dgv1.conMenu.Items.Add(item);
  401. }
  402. }
  403. void dgv1_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  404. {
  405. ToolStripItem item = e.ClickedItem;
  406. if (item.Tag.ToString().Trim() == "View")
  407. {
  408. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ProductViewPhoto(this.dgv1.CurrentRow.Cells["Prod_Number"].Value.ToString().Trim());
  409. }
  410. }
  411. }
  412. }