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 Infragistics.Win.UltraWinGrid;
using System.Collections;
using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Tool;
using Pur.configure;
using Pur.Entity.configureEntity;
using com.hnshituo.pur.vo;
using Pur.Pop_upWindow;
using Pur.Entity.Purplan;
using System;
using Infragistics.Win;
namespace Pur.pur_plan
{
public partial class frmTaskPriceAuditManager : FrmPmsBase
{
public frmTaskPriceAuditManager()
{
InitializeComponent();
ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
}
//菜单按钮事件
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
getTaskPriceAudit();
break;
case "Update":
Upd_TaskRecord();
break;
case "Submittal":
Sub_TaskRecord();
break;
case "Confirm":
Con_TaskRecord();
break;
}
}
///
/// 查询
///
private void getTaskPriceAudit()
{
PurTaskPriceAuditEntity TaskPriceAuditEntity = new PurTaskPriceAuditEntity();
if (txt_id.Text != "")
{
TaskPriceAuditEntity.Id = txt_id.Text;
}
if (Cop_taskId.Text != "")
{
TaskPriceAuditEntity.TaskId = Cop_taskId.Text;
}
if (Cop_taskName.Text != "")
{
TaskPriceAuditEntity.TaskName = Cop_taskName.Text;
}
if (txt_STATUS.Value != null && txt_STATUS.Value.ToString() !="")
{
TaskPriceAuditEntity.Status = txt_STATUS.Value.ToString();
}
DataTable dt = this.execute("com.hnshituo.pur.purplan.service.TaskPriceAuditService", "getTaskPriceAudit", new object[] { TaskPriceAuditEntity });
GridHelper.CopyDataToDatatable(dt, dataTable1, true);
}
///
/// 修改
///
private void Upd_TaskRecord()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择一行数据");
return;
}
if (uge.Cells["STATUS"].Value.ToString().Trim() != "待提报")
{
MessageUtil.ShowTips("不是待提报状态,不能修改");
return;
}
PurTaskPriceAuditEntity TaskPriceAuditEntity = new PurTaskPriceAuditEntity();
TaskPriceAuditEntity.Id = uge.Cells["ID"].Value.ToString();
TaskPriceAuditEntity.ReqOrgName = txt_REQ_ORG_NAME.Text;//填报单位名称
TaskPriceAuditEntity.Remark = txt_REMARK.Text;//备注
TaskPriceAuditEntity.TaskAmt = txt_TASK_AMT.Text.Trim() == "" ? 0 : double.Parse(txt_TASK_AMT.Text);//金额
TaskPriceAuditEntity.TaskQty = txt_TASK_QTY.Text.Trim() == "" ? 0 : double.Parse(txt_TASK_QTY.Text);//数量
TaskPriceAuditEntity.MngOrgName = txt_MNG_ORG_NAME.Text;//定价项目
if (dt_REQ_DATE.Value != null)
{
TaskPriceAuditEntity.ReqDate = (DateTime)dt_REQ_DATE.Value;//申请日期
}
TaskPriceAuditEntity.ProcRecord = txt_procRecord.Text;//定价内容
TaskPriceAuditEntity.TaskName = txt_taskName.Text;//任务名称
TaskPriceAuditEntity.TaskId = txt_taskId.Text;//任务单号
if (mngOrgId != null)
{
TaskPriceAuditEntity.ReqOrgId = mngOrgId;
}
CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.TaskPriceAuditService", "doUpdate", new object[] { TaskPriceAuditEntity });
if (crt.Resultcode != 0)
{
MessageUtil.ShowTips("价格审批修改失败!");
return;
}
else
{
MessageUtil.ShowTips("价格审批修改成功!");
}
getTaskPriceAudit();
}
///
/// 提报
///
private void Sub_TaskRecord()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择一条记录!");
return;
}
PurTaskPriceAuditEntity TaskPriceAuditEntity = new PurTaskPriceAuditEntity();
TaskPriceAuditEntity.Status = "2";
TaskPriceAuditEntity.Id = uge.Cells["id"].Value.ToString();
TaskPriceAuditEntity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
TaskPriceAuditEntity.UpdateTime = DateTime.Now;
TaskPriceAuditEntity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.TaskPriceAuditService", "doUpdate", new object[] { TaskPriceAuditEntity });
if (crt.Resultcode == 0)
{
MessageUtil.ShowTips("提报成功!");
}
else
{
MessageUtil.ShowTips("提报失败!" + crt.Resultmsg);
return;
}
getTaskPriceAudit();
}
///
/// 审批
///
private void Con_TaskRecord()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
if (uge == null)
{
MessageUtil.ShowTips("请选择一条纪要信息!");
return;
}
frmExamineShow Fex = new frmExamineShow();
Fex.ShowDialog();
if (Fex.Status == null)
{
return;
}
if (!Fex.Status.Equals("2"))
{
Fex.Status = "1";//审批不通过
}
else
{
Fex.Status = "3";//审批通过
}
PurTaskPriceAuditEntity TaskPriceAuditEntity = new PurTaskPriceAuditEntity();
TaskPriceAuditEntity.Status = Fex.Status;
TaskPriceAuditEntity.Id = uge.Cells["id"].Value.ToString();
TaskPriceAuditEntity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
TaskPriceAuditEntity.UpdateTime = DateTime.Now;
TaskPriceAuditEntity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
CoreResult crt = this.execute("com.hnshituo.pur.purplan.service.TaskPriceAuditService", "doUpdate", new object[] { TaskPriceAuditEntity });
if (crt.Resultcode == 0)
{
if (Fex.Status == "1")
{
MessageUtil.ShowTips("审批不通过!");
}
else
{
MessageUtil.ShowTips("审批通过!");
}
}
else
{
MessageUtil.ShowTips("审批失败!");
return;
}
getTaskPriceAudit();
}
///
/// 初始化加载界面
///
///
///
private void frmSummaryM_Load(object sender, EventArgs e)
{
Init();
}
///
/// 界面权限分配
///
private void Init()
{
switch (this.CustomInfo.ToString().Trim())
{
case "@Confirming":
#region
ultraPanel2.Visible = false;
#endregion
break;
}
}
///
/// 价格审批激活事件
///
///
///
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
txt_REMARK.Text = ultraGrid1.ActiveRow.Cells["REMARK"].Value.ToString();
txt_TASK_AMT.Text = ultraGrid1.ActiveRow.Cells["TASKAMT"].Value.ToString();
txt_TASK_QTY.Text = ultraGrid1.ActiveRow.Cells["TASKQTY"].Value.ToString();
txt_MNG_ORG_NAME.Text = ultraGrid1.ActiveRow.Cells["MNGORGNAME"].Value.ToString();
txt_REQ_ORG_NAME.Text = ultraGrid1.ActiveRow.Cells["REQORGNAME"].Value.ToString();
dt_REQ_DATE.Text = ultraGrid1.ActiveRow.Cells["REQDATE"].Value.ToString();
txt_procRecord.Text = ultraGrid1.ActiveRow.Cells["procRecord"].Value.ToString();
txt_taskName.Text = ultraGrid1.ActiveRow.Cells["taskName"].Value.ToString();
txt_taskId.Text = ultraGrid1.ActiveRow.Cells["taskId"].Value.ToString();
}
///
/// 科室弹窗
///
///
///
string mngOrgId = null;
private void txt_REQ_ORG_NAME_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
frmdepartment fdt = new frmdepartment(ob);
fdt.ShowDialog();
if (fdt.BuyerUnitDesc == null)
return;
txt_REQ_ORG_NAME.Text = fdt.BuyerUnitDesc;
mngOrgId = fdt.BuyerUnitCode;
}
}
}