| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;using Pur.Entity;
- using Pur.Entity.configureEntity;
- using Core.Mes.Client.Comm.Control;
- using com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Tool;
- using Pur.Entity;
- namespace Pur.configure
- {
- public partial class FrmStandards : FrmPmsBase
- {
- public FrmStandards()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- try
- {
- this.Cursor = Cursors.WaitCursor;
- get_PurStandards();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- break;
- case "doAdd":
- add_PurStandards();
- break;
- case "doModify":
- upd_PurStandards();
- break;
- case "doDelete":
- del_PurStandards();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询标准编号
- /// </summary>
- /// <param name="configureMEntity"></param>
- public void get_PurStandards()
- {
- PurStandardsEntity StandardsEntity = new PurStandardsEntity();
- StandardsEntity.StandardsId = txt_STANDARDS_ID_QUERY.Text.Trim();
- StandardsEntity.StandardsCode = txt_STANDARDS_CODE_query.Text.Trim();
- StandardsEntity.Validflag = "1";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.StandardsService", "get_PurStandards", new object[] { StandardsEntity });
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);//绑定物料分类表
-
-
-
- }
- /// <summary>
- /// 增加标准编号
- /// </summary>
- /// <param name="configureMEntity"></param>
- public void add_PurStandards()
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No && ValidInput())
- {
- return;
- }
- PurStandardsEntity StandardsEntity = new PurStandardsEntity();
- StandardsEntity.StandardsId = (this.execute<int>("com.hnshituo.pur.configure.service.StandardsService", "get_Id", new object[] { StandardsEntity })+1).ToString();
- StandardsEntity.StandardsCode = txt_STANDARDS_CODE.Text.Trim();
- StandardsEntity.StandardsDesc = txt_STANDARDS_DESC.Text.Trim();
- StandardsEntity.CreateName = UserInfo.GetUserName();
- StandardsEntity.CreateUserid = UserInfo.GetUserID();
- StandardsEntity.Validflag = "1";
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.StandardsService", "doInsert", new object[] { StandardsEntity});
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("添加失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("添加成功!");
- get_PurStandards();//查询标准编号
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "STANDARDSID", StandardsEntity.StandardsId);//激活当前行
- }
- /// <summary>
- /// 修改标准编号
- /// </summary>
- /// <param name="configureMEntity"></param>
- public void upd_PurStandards()
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否确定修改?") == DialogResult.No && ValidInput())
- {
- return;
- }
- if (ultraGrid1.ActiveRow != null)
- {
- PurStandardsEntity StandardsEntity = new PurStandardsEntity();
- StandardsEntity.StandardsId = ultraGrid1.ActiveRow.Cells["STANDARDSID"].Value.ToString();
- StandardsEntity.StandardsCode = txt_STANDARDS_CODE.Text.Trim();
- StandardsEntity.StandardsDesc = txt_STANDARDS_DESC.Text.Trim();
- StandardsEntity.UpdateName = UserInfo.GetUserName();
- StandardsEntity.UpdateUserid = UserInfo.GetUserID();
- StandardsEntity.Validflag = "1";
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.StandardsService", "doUpdate", new object[] { StandardsEntity, 0, 0 });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("修改失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("修改成功!");
- get_PurStandards();//查询标准编号
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "STANDARDSID", StandardsEntity.StandardsId);//激活当前行
- }
- else
- {
- MessageUtil.ShowTips("请选择一条标准编号");
- return;
- }
- }
- /// <summary>
- /// 删除标准编号
- /// </summary>
- /// <param name="configureMEntity"></param>
- public void del_PurStandards()
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否确定删除?") == DialogResult.No)
- {
- return;
- }
- if (ultraGrid1.ActiveRow != null)
- {
- PurStandardsEntity StandardsEntity = new PurStandardsEntity();
- StandardsEntity.StandardsId = ultraGrid1.ActiveRow.Cells["STANDARDSID"].Value.ToString();
- StandardsEntity.StandardsCode = txt_STANDARDS_CODE.Text.Trim();
- StandardsEntity.StandardsDesc = txt_STANDARDS_DESC.Text.Trim();
- StandardsEntity.DeleteTime = System.DateTime.Now;
- StandardsEntity.DeleteName = UserInfo.GetUserName();
- StandardsEntity.DeleteUserid = UserInfo.GetUserID();
- StandardsEntity.Validflag = "0";
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.StandardsService", "doUpdate", new object[] { StandardsEntity, 0, 0 });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("删除失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("删除成功!");
- get_PurStandards();//查询标准编号
- }
- else
- {
- MessageUtil.ShowTips("请选择一条标准编号");
- return;
- }
- }
- /// <summary>
- /// 验证必填项
- /// </summary>
- /// <returns></returns>
- private bool ValidInput()
- {
- if (string.IsNullOrEmpty(txt_STANDARDS_ID.Text.Trim()))
- {
- MessageBox.Show("请输入标准编号ID!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (string.IsNullOrEmpty(txt_STANDARDS_CODE.Text.Trim()))
- {
- MessageBox.Show("请输入标准编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- return true;
- }
- /// <summary>
- /// 激活grid列表
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- txt_STANDARDS_CODE.Text = ultraGrid1.ActiveRow.Cells["STANDARDSCODE"].Value.ToString();
- txt_STANDARDS_DESC.Text = ultraGrid1.ActiveRow.Cells["STANDARDSDESC"].Value.ToString();
- txt_STANDARDS_ID.Text = ultraGrid1.ActiveRow.Cells["STANDARDSID"].Value.ToString();
- }
- }
- }
|