FrmPurchase.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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 FrmPurchase : LYFZ.Software.UI.InventoryManagement.PurchasingManagement.FrmPurchase
  14. {
  15. private delegate void UpdateControl();
  16. bool bl = false;
  17. public string Pord_PurchaseNumber;
  18. public FrmPurchase()
  19. {
  20. this.FormClosed += FrmPurchase_FormClosed;
  21. this.dgv1.CellMouseDown += dgv1_CellMouseDown;
  22. this.dgv1.DataGridViewConMenu_ItemClicked += dgv1_DataGridViewConMenu_ItemClicked;
  23. }
  24. void FrmPurchase_FormClosed(object sender, FormClosedEventArgs e)
  25. {
  26. if (bl)
  27. { this.DialogResult = DialogResult.OK; }
  28. }
  29. /// <summary>
  30. /// 窗体加载事件
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="e"></param>
  34. protected override void FrmPurchase_Shown(object sender, EventArgs e)
  35. {
  36. //绑定数据表
  37. GetPurchaseProduct(Pord_PurchaseNumber);
  38. BindVendor();
  39. }
  40. /// <summary>
  41. /// 获取采购商品表
  42. /// </summary>
  43. public void GetPurchaseProduct(string Ppt_PurchaseNumber)
  44. {
  45. dgv1.Rows.Clear();
  46. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductbll = new BLL.BLL_ErpPurchaseProduct();
  47. DataTable dt = PurchaseProductbll.View_tb_PurchaseProduct(" and Ppt_PurchaseNumber='" + Ppt_PurchaseNumber + "'").Tables[0];
  48. if (dt.Rows.Count > 0)
  49. {
  50. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  51. {
  52. this.Invoke(new UpdateControl(delegate()
  53. {
  54. for (int t = 0; t < dt.Rows.Count; t++)
  55. {
  56. DataGridViewRow dgvr = new DataGridViewRow();
  57. DataGridViewCell cell = null;
  58. cell = new DataGridViewTextBoxCell();
  59. cell.Value = dt.Rows[t]["ID"].ToString().Trim();
  60. dgvr.Cells.Add(cell);
  61. cell = new DataGridViewTextBoxCell();
  62. cell.Value = dt.Rows[t]["Ppt_PurchaseNumber"].ToString().Trim();
  63. dgvr.Cells.Add(cell);
  64. cell = new DataGridViewTextBoxCell();
  65. cell.Value = dt.Rows[t]["Ppt_ProductNumberName"].ToString().Trim();
  66. dgvr.Cells.Add(cell);
  67. cell = new DataGridViewTextBoxCell();
  68. cell.Value = dt.Rows[t]["Ppt_PurchaseQuantity"].ToString().Trim();
  69. dgvr.Cells.Add(cell);
  70. cell = new DataGridViewTextBoxCell();
  71. cell.Value = dt.Rows[t]["Ppt_ProductCategoryName"].ToString().Trim();
  72. dgvr.Cells.Add(cell);
  73. cell = new DataGridViewTextBoxCell();
  74. cell.Value = "";
  75. dgvr.Cells.Add(cell);
  76. cell = new DataGridViewTextBoxCell();
  77. cell.Value = "";
  78. dgvr.Cells.Add(cell);
  79. cell = new DataGridViewTextBoxCell();
  80. cell.Value = dt.Rows[t]["Ppt_ProductCategory"].ToString().Trim();
  81. dgvr.Cells.Add(cell);
  82. cell = new DataGridViewTextBoxCell();
  83. cell.Value = dt.Rows[t]["Ppt_ProductNumber"].ToString().Trim();
  84. dgvr.Cells.Add(cell);
  85. cell = new DataGridViewTextBoxCell();
  86. if (dt.Rows[t]["Ppt_PurchasePrice"].ToString().Trim() == "0.00")
  87. { cell.Value = dt.Rows[t]["Prod_CostPrice"].ToString().Trim(); }
  88. else
  89. { cell.Value = dt.Rows[t]["Ppt_PurchasePrice"].ToString().Trim(); }
  90. dgvr.Cells.Add(cell);
  91. cell = new DataGridViewTextBoxCell();
  92. cell.Value = dt.Rows[t]["Ppt_PurchaseVendor"].ToString().Trim();
  93. dgvr.Cells.Add(cell);
  94. cell = new DataGridViewTextBoxCell();
  95. if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "0")
  96. {
  97. cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购中.ToString();
  98. dgvr.DefaultCellStyle.ForeColor = Color.Orange;
  99. }
  100. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "1")
  101. { cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购完成.ToString(); }
  102. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "2")
  103. { cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.采购取消.ToString(); }
  104. else if (dt.Rows[t]["Ppt_PurchaseStatus"].ToString().Trim() == "3")
  105. {
  106. cell.Value = LYFZ.EnumPublic.Ppt_PurchaseStatus.申请中.ToString();
  107. dgvr.DefaultCellStyle.ForeColor = Color.Orange;
  108. }
  109. dgvr.Cells.Add(cell);
  110. cell = new DataGridViewTextBoxCell();
  111. cell.Value = dt.Rows[t]["Ppt_PurchasePerson"].ToString().Trim();
  112. dgvr.Cells.Add(cell);
  113. cell = new DataGridViewTextBoxCell();
  114. cell.Value = Convert.ToDateTime(dt.Rows[t]["Ppt_PurchaseTime"]).ToString("yyyy-MM-dd").Trim();
  115. dgvr.Cells.Add(cell);
  116. this.dgv1.Rows.Add(dgvr);
  117. }
  118. dgv1.ClearSelection();
  119. }));
  120. });
  121. }
  122. }
  123. /// <summary>
  124. /// 采购
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. protected override void btnPurchase_Click(object sender, EventArgs e)
  129. {
  130. try
  131. {
  132. if (dgv1.SelectedRows.Count == 0)
  133. {
  134. MessageBoxCustom.Show("请选择采购的商品!可多选!");
  135. return;
  136. }
  137. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  138. if (dgv1.SelectedRows.Count > 0)
  139. {
  140. #region 判断商品厂商不能为空
  141. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  142. {
  143. string Ppt_PurchaseVendor = dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  144. if (string.IsNullOrEmpty(Ppt_PurchaseVendor))
  145. {
  146. MessageBoxCustom.Show("商品厂商不能为空!");
  147. return;
  148. }
  149. }
  150. #endregion
  151. #region 判断采购完成不能修改
  152. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  153. {
  154. string Status = dgv1.SelectedRows[i].Cells["Status"].Value.ToString();
  155. string Ir_ProductName = dgv1.SelectedRows[i].Cells["Ir_ProductName"].Value.ToString();
  156. if (Status.ToString() == "采购完成")
  157. {
  158. MessageBoxCustom.Show(Ir_ProductName + " 已经" + Status + "不能修改!");
  159. return;
  160. }
  161. }
  162. #endregion
  163. #region 修改采购商品表
  164. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  165. {
  166. int id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  167. LYFZ.Model.Model_ErpPurchaseProduct PurchaseProductModel = PurchaseProductBll.GetModel(id);
  168. PurchaseProductModel.Ppt_PurchaseQuantity = Convert.ToInt32(dgv1.SelectedRows[i].Cells["Prod_Quantity"].Value);
  169. PurchaseProductModel.Ppt_PurchasePrice = Convert.ToDecimal(dgv1.SelectedRows[i].Cells["Ppt_PurchasePrice"].Value);
  170. PurchaseProductModel.Ppt_PurchaseVendor = dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  171. PurchaseProductModel.Ppt_PurchaseStatus = "0";
  172. PurchaseProductModel.Ppt_PurchasePerson = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  173. PurchaseProductModel.Ppt_PurchaseTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
  174. PurchaseProductBll.Update(PurchaseProductModel);
  175. }
  176. #endregion
  177. #region 修改采购订单表状态
  178. PurchaseProductBll.UpdateCgDd("0", Pord_PurchaseNumber);
  179. #endregion
  180. }
  181. GetPurchaseProduct(Pord_PurchaseNumber);
  182. bl = true;
  183. MessageBoxCustom.Show("保存成功!");
  184. }
  185. catch (Exception ex)
  186. { MessageBoxCustom.Show(ex.Message); }
  187. }
  188. /// <summary>
  189. /// 不采购
  190. /// </summary>
  191. /// <param name="sender"></param>
  192. /// <param name="e"></param>
  193. protected override void btnNotPurchase_Click(object sender, EventArgs e)
  194. {
  195. try
  196. {
  197. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  198. if (dgv1.SelectedRows.Count == 0)
  199. {
  200. MessageBoxCustom.Show("请选择不采购的商品!可多选!");
  201. return;
  202. }
  203. #region 判断采购完成不能修改
  204. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  205. {
  206. string Status = dgv1.SelectedRows[i].Cells["Status"].Value.ToString();
  207. string Ir_ProductName = dgv1.SelectedRows[i].Cells["Ir_ProductName"].Value.ToString();
  208. if (Status.ToString() == "采购完成")
  209. {
  210. MessageBoxCustom.Show(Ir_ProductName + " 已经" + Status + "不能修改!");
  211. return;
  212. }
  213. }
  214. #endregion
  215. #region 更新采购商品表状态
  216. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  217. {
  218. int Id = Convert.ToInt32(dgv1.SelectedRows[i].Cells["ID"].Value);
  219. PurchaseProductBll.UpdatePpt_PurchaseStatus("Ppt_PurchaseStatus='2',Ppt_PurchasePerson='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name + "',Ppt_PurchaseTime='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyy-MM-dd") + "' ", Id);
  220. }
  221. #endregion
  222. #region 更新采购订单表状态
  223. int sum = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "'");
  224. int Qx = PurchaseProductBll.GetCount("Ppt_PurchaseNumber='" + Pord_PurchaseNumber + "' and Ppt_PurchaseStatus='2'");
  225. if (sum == Qx)
  226. {
  227. PurchaseProductBll.UpdateCgDd("2", Pord_PurchaseNumber);
  228. }
  229. #endregion
  230. GetPurchaseProduct(Pord_PurchaseNumber);
  231. bl = true;
  232. MessageBoxCustom.Show("保存成功!");
  233. }
  234. catch (Exception ex)
  235. { MessageBoxCustom.Show(ex.Message); }
  236. }
  237. /// <summary>
  238. /// 保存更改数量
  239. /// </summary>
  240. /// <param name="sender"></param>
  241. /// <param name="e"></param>
  242. protected override void btnSave_Click(object sender, EventArgs e)
  243. {
  244. try
  245. {
  246. if (dgv1.Rows.Count > 0)
  247. {
  248. if (MessageBoxCustom.Show("你确定修改采购列表中的商品吗?", "增加提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  249. {
  250. #region 修改采购商品表
  251. for (int i = 0; i < dgv1.Rows.Count; i++)
  252. {
  253. string Status = dgv1.Rows[i].Cells["Status"].Value.ToString();
  254. string Ir_ProductName = dgv1.Rows[i].Cells["Ir_ProductName"].Value.ToString();
  255. if (Status.ToString() == "采购完成")
  256. {
  257. MessageBoxCustom.Show(Ir_ProductName + " 已经" + Status + "不能修改!");
  258. return;
  259. }
  260. int id = Convert.ToInt32(dgv1.Rows[i].Cells["ID"].Value);
  261. LYFZ.BLL.BLL_ErpPurchaseProduct PurchaseProductBll = new BLL.BLL_ErpPurchaseProduct();
  262. LYFZ.Model.Model_ErpPurchaseProduct PurchaseProductModel = PurchaseProductBll.GetModel(id);
  263. PurchaseProductModel.Ppt_PurchaseQuantity = Convert.ToInt32(dgv1.Rows[i].Cells["Prod_Quantity"].Value);
  264. PurchaseProductModel.Ppt_PurchasePrice = Convert.ToDecimal(dgv1.Rows[i].Cells["Ppt_PurchasePrice"].Value);
  265. PurchaseProductModel.Ppt_PurchaseVendor = dgv1.Rows[i].Cells["Ppt_PurchaseVendor"].Value.ToString();
  266. PurchaseProductBll.Update(PurchaseProductModel);
  267. }
  268. GetPurchaseProduct(Pord_PurchaseNumber);
  269. MessageBoxCustom.Show("保存成功!");
  270. #endregion
  271. }
  272. }
  273. }
  274. catch (Exception ex)
  275. { MessageBoxCustom.Show(ex.Message); }
  276. }
  277. /// <summary>
  278. /// 关闭
  279. /// </summary>
  280. /// <param name="sender"></param>
  281. /// <param name="e"></param>
  282. protected override void btnClose_Click(object sender, EventArgs e)
  283. {
  284. this.Close();
  285. }
  286. /// <summary>
  287. /// 只能输入数字
  288. /// </summary>
  289. /// <param name="sender"></param>
  290. /// <param name="e"></param>
  291. protected override void dgv1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  292. {
  293. try
  294. {
  295. if (dgv1.Rows.Count > 0)
  296. {
  297. if (dgv1.CurrentRow.Cells["Prod_Quantity"].Value == null)
  298. {
  299. MessageBoxCustom.Show("采购数量不能为空!");
  300. int id = Convert.ToInt32(dgv1.CurrentRow.Cells["ID"].Value);
  301. LYFZ.BLL.BLL_ErpPurchaseProduct bll = new BLL.BLL_ErpPurchaseProduct();
  302. dgv1.CurrentRow.Cells["Prod_Quantity"].Value = bll.GetList("ID=" + id + "").Tables[0].Rows[0]["Ppt_PurchaseQuantity"].ToString();
  303. return;
  304. }
  305. if (dgv1.CurrentRow.Cells["Ppt_PurchasePrice"].Value == null)
  306. {
  307. MessageBoxCustom.Show("商品单价不能为空!");
  308. string Prod_Number = dgv1.CurrentRow.Cells["Prod_Number"].Value.ToString();
  309. LYFZ.BLL.BLL_ErpProduct Productbll = new BLL.BLL_ErpProduct();
  310. dgv1.CurrentRow.Cells["Ppt_PurchasePrice"].Value = Productbll.GetList("Prod_Number='" + Prod_Number + "'").Tables[0].Rows[0]["Prod_CostPrice"].ToString();
  311. return;
  312. }
  313. if (Command.Command_Validate.IsNumber(dgv1.CurrentRow.Cells["Prod_Quantity"].Value.ToString()) == false)
  314. {
  315. MessageBoxCustom.Show("只能输入纯数字!");
  316. int id = Convert.ToInt32(dgv1.CurrentRow.Cells["ID"].Value);
  317. LYFZ.BLL.BLL_ErpPurchaseProduct bll = new BLL.BLL_ErpPurchaseProduct();
  318. dgv1.CurrentRow.Cells["Prod_Quantity"].Value = bll.GetList("ID=" + id + "").Tables[0].Rows[0]["Ppt_PurchaseQuantity"].ToString();
  319. return;
  320. }
  321. if (Command.Command_Validate.IsNumeric(dgv1.CurrentRow.Cells["Ppt_PurchasePrice"].Value.ToString()) == false)
  322. {
  323. MessageBoxCustom.Show("只能输入数字或者小数!");
  324. string Prod_Number = dgv1.CurrentRow.Cells["Prod_Number"].Value.ToString();
  325. LYFZ.BLL.BLL_ErpProduct Productbll = new BLL.BLL_ErpProduct();
  326. dgv1.CurrentRow.Cells["Ppt_PurchasePrice"].Value = Productbll.GetList("Prod_Number='" + Prod_Number + "'").Tables[0].Rows[0]["Prod_CostPrice"].ToString();
  327. return;
  328. }
  329. }
  330. }
  331. catch (Exception ex)
  332. {
  333. MessageBoxCustom.Show(ex.Message);
  334. }
  335. }
  336. //<summary>
  337. //绑定商品厂商
  338. //</summary>
  339. public void BindVendor()
  340. {
  341. LYFZ.BLL.BLL_ErpOrder Orderbll = new BLL.BLL_ErpOrder();
  342. DataTable dt = Orderbll.GetView_Custom("tb_ErpVendor", StrWhere: "", ShowColumnName: "distinct Vd_Name").Tables[0];
  343. if (dt.Rows.Count > 0)
  344. {
  345. this.cmbFactory.DataSource = dt;
  346. this.cmbFactory.ValueMember = "Vd_Name";
  347. this.cmbFactory.DisplayMember = "Vd_Name";
  348. cmbFactory.SelectedIndex = -1;
  349. }
  350. }
  351. /// <summary>
  352. /// 选择商品厂商
  353. /// </summary>
  354. /// <param name="sender"></param>
  355. /// <param name="e"></param>
  356. protected override void cmbFactory_SelectedIndexChanged(object sender, EventArgs e)
  357. {
  358. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  359. {
  360. dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value = cmbFactory.Text;
  361. }
  362. }
  363. /// <summary>
  364. /// 导出
  365. /// </summary>
  366. /// <param name="sender"></param>
  367. /// <param name="e"></param>
  368. protected override void btnExport_Click(object sender, EventArgs e)
  369. {
  370. if (dgv1.Rows.Count > 0)
  371. {
  372. dgv1.ExportDataTable();
  373. }
  374. }
  375. /// <summary>
  376. /// 打印
  377. /// </summary>
  378. /// <param name="sender"></param>
  379. /// <param name="e"></param>
  380. protected override void btnPrint_Click(object sender, EventArgs e)
  381. {
  382. if (dgv1.Rows.Count == 0)
  383. {
  384. MessageBoxCustom.Show("无打印数据!");
  385. return;
  386. }
  387. Hashtable htData = new Hashtable();
  388. htData["dgvData"] = this.dgv1;
  389. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.库存采购单, htData);
  390. }
  391. /// <summary
  392. /// dgv控件里面塞下拉框
  393. /// </summary>
  394. /// <param name="sender"></param>
  395. /// <param name="e"></param>
  396. protected override void dgv1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  397. {
  398. if (this.dgv1.Rows.Count > 0)
  399. {
  400. if (this.dgv1.CurrentCell.ColumnIndex == this.dgv1.Columns["Ppt_PurchaseVendor"].Index)
  401. {
  402. DataGridViewCell cell = this.dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex];
  403. Rectangle rect = this.dgv1.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, true);
  404. this.cmbFactory.Location = new Point(rect.Location.X + this.dgv1.Location.X, rect.Location.Y + this.dgv1.Location.Y);
  405. this.cmbFactory.Size = rect.Size;
  406. if (cell.Value != null)
  407. { this.cmbFactory.Text = (string)cell.Value; }
  408. this.cmbFactory.Visible = true;
  409. this.cmbFactory.Focus();
  410. }
  411. }
  412. }
  413. /// <summary>
  414. ///
  415. /// </summary>
  416. /// <param name="sender"></param>
  417. /// <param name="e"></param>
  418. protected override void cmbFactory_Leave(object sender, EventArgs e)
  419. {
  420. this.dgv1.CurrentRow.Cells["Ppt_PurchaseVendor"].Value = this.cmbFactory.Text.Trim();
  421. this.cmbFactory.Visible = false;
  422. }
  423. /// <summary>
  424. /// 右键菜单
  425. /// </summary>
  426. /// <param name="sender"></param>
  427. /// <param name="e"></param>
  428. void dgv1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
  429. {
  430. if (e.Button == MouseButtons.Right)
  431. {
  432. ToolStripMenuItem item = null;
  433. item = new ToolStripMenuItem();
  434. item.Text = "查看商品图片";
  435. item.Tag = "View";
  436. this.dgv1.conMenu.Items.Add(item);
  437. item = new ToolStripMenuItem();
  438. item.Text = "取消厂商";
  439. item.Tag = "Cancel";
  440. this.dgv1.conMenu.Items.Add(item);
  441. item = new ToolStripMenuItem();
  442. item.Text = "选择厂商";
  443. item.Tag = "Select";
  444. this.dgv1.conMenu.Items.Add(item);
  445. }
  446. }
  447. void dgv1_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  448. {
  449. ToolStripItem item = e.ClickedItem;
  450. if (item.Tag.ToString().Trim() == "View")
  451. {
  452. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ProductViewPhoto(this.dgv1.CurrentRow.Cells["Prod_Number"].Value.ToString().Trim());
  453. }
  454. else if (item.Tag.ToString().Trim() == "Select")
  455. {
  456. LYFZ.Software.MainBusiness.InventoryManagement.PurchasingManagement.FrmSelectManufacturer set = new FrmSelectManufacturer();
  457. set.ShowDialog();
  458. if (!string.IsNullOrEmpty(set.NumberSjName))
  459. {
  460. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  461. { dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value = set.NumberSjName; }
  462. }
  463. }
  464. else if (item.Tag.ToString().Trim() == "Cancel")
  465. {
  466. if (MessageBoxCustom.Show("您确定要取消厂商吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  467. { return; }
  468. for (int i = 0; i < dgv1.SelectedRows.Count; i++)
  469. { dgv1.SelectedRows[i].Cells["Ppt_PurchaseVendor"].Value = ""; }
  470. }
  471. }
  472. }
  473. }