/*******************************************************************************
* Copyright(c) 2019 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PP_0103.cs
* 2.功能描述:年计划产品产量新建
* 编辑履历:
* 作者 日期 版本 修改内容
* 徐伟 2019/09/05 1.00 新建
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.Client.Controls;
using Dongke.IBOSS.PRD.Client.DataModels;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.PPModule
{
///
/// 年计划窗体
///
public partial class F_PP_0103 : DKDockPanelBase
{
#region 单例模式 防止窗体被重复创建
private static F_PP_0103 _instance = null;
public static F_PP_0103 Instance
{
get
{
if (_instance == null)
{
_instance = new F_PP_0103();
}
return _instance;
}
}
private void F_PP_0103_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
#endregion
#region 构造函数
///
/// 年计划窗体
///
public F_PP_0103()
{
InitializeComponent();
//this.Text = "年计划";
}
#endregion
//年计划传入的Key和冗余数据
public int planId = 0;
public int planYearNo = DateTime.Now.Year;
public DateTime planStartDate = DateTime.Now;
public DateTime planEndDate = DateTime.Now;
//产品产量id,0:插入操作,>0更新操作
public int planGoodsId = 0;
///
/// 画面加载
///
///
///
private void F_PP_0103_Load(object sender, System.EventArgs e)
{
try
{
// 加载权限
FormPermissionManager.FormPermissionControl(this.Name, this,
LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
private void BtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void BtnSave_Click(object sender, EventArgs e)
{
PlanYearUpdate();
this.Close();
}
//更新操作
private void PlanYearUpdate()
{
//年计划 插入
ClientRequestEntity cre = new ClientRequestEntity();
//用户填写的数据
cre.Properties["GOODSID"] = Convert.ToInt32(goodsCode.SelectedValue);
cre.Properties["PLANQUANTITY"] = Convert.ToInt32(planQuantity.Value);
cre.Properties["REMARKS"] = planRemarks.Text;
//自动填写的数据
cre.Properties["UPDATETIME"] = DateTime.Now;
cre.Properties["UPDATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
ServiceResultEntity result;
if (planGoodsId == 0)
{
//新建专属的列
cre.Properties["PLANID"] = planId;
cre.Properties["YEARNO"] = planYearNo;
cre.Properties["STARTDATE"] = planStartDate;
cre.Properties["ENDDATE"] = planEndDate;
cre.Properties["ACCOUNTID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.AccountID;
cre.Properties["CREATETIME"] = DateTime.Now;
cre.Properties["CREATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
result = PPModuleProxy.Service.PlanYearGoodsInsert(cre);
}
else
{
//更新时主键要指定值
cre.Properties["PLANGOODSID"] = planGoodsId;
result = PPModuleProxy.Service.PlanYearGoodsUpdate(cre);
//更新时生成新版本
}
}
}
}