| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- /*******************************************************************************
- * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_1302.cs
- * 2.功能描述:新增/编辑装具管理
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 冯林勇 2022/07/25 1.00 新建
- *******************************************************************************/
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using System;
- using System.Data;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- /// <summary>
- /// 新增/编辑装具管理
- /// </summary>
- public partial class F_MST_1302 : DKFormBase
- {
- #region 成员变量
- /// <summary>
- /// 页面状态
- /// </summary>
- public string FromStatus
- {
- get;
- set;
- }
- #endregion
- #region 构造函数
- public F_MST_1302(string entruckingCode)
- {
- InitializeComponent();
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- //装具条码
- this.txtEntruckingCode.Text = string.Empty;
- //容量
- this.txtTruckSize.Text = string.Empty;
- //停用标识
- this.cmbValueFlag.Text = string.Empty;
- //备注
- this.txtRemarks.Text = string.Empty;
- DataTable dtValueFlag = new DataTable();
- DataRow drValueFlag = dtValueFlag.NewRow();
- dtValueFlag.Columns.Add("ValueFlagID");
- dtValueFlag.Columns.Add("ValueFlagName");
- drValueFlag[0] = "1";
- drValueFlag[1] = "正常";
- dtValueFlag.Rows.Add(drValueFlag);
- drValueFlag = dtValueFlag.NewRow();
- drValueFlag[0] = "2";
- drValueFlag[1] = "停用";
- dtValueFlag.Rows.Add(drValueFlag);
- cmbValueFlag.DisplayMember = "ValueFlagName";
- cmbValueFlag.ValueMember = "ValueFlagID";
- cmbValueFlag.DataSource = dtValueFlag;
- if (!string.IsNullOrEmpty(entruckingCode))
- {
- FromStatus = "Edit";
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "GetEntruckingInfo";
- cre.Properties["EntruckingCode"] = entruckingCode;
- ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
- if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
- {
- //装具条码
- this.txtEntruckingCode.Text = entruckingCode;
- //容量
- this.txtTruckSize.Text = sre.Data.Tables[0].Rows[0]["TRUCKSIZE"].ToString();
- //停用标识
- this.cmbValueFlag.SelectedValue = sre.Data.Tables[0].Rows[0]["VALUEFLAG"].ToString();
- //备注
- this.txtRemarks.Text = sre.Data.Tables[0].Rows[0]["REMARKS"].ToString();
- }
- }
- else
- {
- FromStatus = "Add";
- //装具条码
- this.txtEntruckingCode.Text = string.Empty;
- //容量
- this.txtTruckSize.Text = string.Empty;
- //停用标识
- this.cmbValueFlag.SelectedValue = 1;
- //备注
- this.txtRemarks.Text = string.Empty;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_1302_Load(object sender, EventArgs e)
- {
- try
- {
-
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- #region 数据啊校验
- //装具条码
- if (string.IsNullOrEmpty(this.txtEntruckingCode.Text.ToString()))
- {
- //必须输入
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "装具条码"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.txtEntruckingCode.Focus();
- return;
- }
- //容量
- if (string.IsNullOrEmpty(this.txtTruckSize.Text.ToString()))
- {
- //必须输入
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "容量"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- this.txtTruckSize.Focus();
- return;
- }
- #endregion
- #region 保存方法
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "InsertEntruckingInfo";
- //装具条码
- cre.Properties["txtEntruckingCode"] = this.txtEntruckingCode.Text.ToString();
- //容量
- cre.Properties["txtTruckSize"] = this.txtTruckSize.Text.ToString();
- //备注
- cre.Properties["txtRemarks"] = this.txtRemarks.Text.ToString();
- //停用标识
- cre.Properties["cmbValueFlag"] = this.cmbValueFlag.SelectedValue.ToString() == "" ? null : this.cmbValueFlag.SelectedValue.ToString();
- //页面状态
- cre.Properties["FromStatus"] = FromStatus.ToString();
- ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre);
- if (sre.OtherStatus > 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- Close();
- return;
- }
- else if (Convert.ToInt32(sre.OtherStatus) == -1001)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
- "存在相同装具条码"),
- "",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- return;
- }
- else if (Convert.ToInt32(sre.OtherStatus) == -1002)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
- "装具条码使用状态下装具条码"),
- "",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- return;
- }
- else if (Convert.ToInt32(sre.OtherStatus) == -1003)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W007,
- "未更新任何数据"),
- "",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- return;
- }
- #endregion
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 取消按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
- #region 私有方法
- #endregion
- }
- }
|