| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- 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 Core.Mes.Client.Comm.Control;
- using Pur.Entity.require_planEntiy;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Pur.Pop_upWindow;
- using com.hnshituo.bpm.req.vo;
- using com.hnshituo.pur.vo;
- using Infragistics.Win;
- using Bpm;
- namespace Pur.require_plan
- {
- public partial class FrmPurRequireApproval : FrmPmsBase
- {
- public FrmPurRequireApproval()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- }
- private void FrmPurRequireApproval_Load(object sender, EventArgs e)
- {
- ck_Mtime.Checked = true;
- cop_planMouthStart.Value = DateTime.Now.AddMonths(-1);
- cop_planMouthEnd.Value = DateTime.Now < DateTime.Parse(DateTime.Now.ToString("yyyy/MM/26")) ? DateTime.Now.AddMonths(1) : DateTime.Now.AddMonths(2);
- txt_Status.SelectedIndex = 1;//审批中
- ultraComboEditor2.SelectedIndex = 0;
- GetPUR_REQUIRE_PLAN();
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0],new string[]{ });
- GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
- }
- //菜单按钮事件
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- GetPUR_REQUIRE_PLAN();
- break;
- case "Approval":
- AppPUR_REQUIRE_PLAN();
- break;
- case "Process":
- ProPUR_REQUIRE_PLAN();
- break;
- }
- }
- private void ProPUR_REQUIRE_PLAN()
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- {
- MessageUtil.ShowWarning("请选择一条需求计划进行查看");
- return;
- }
- string mrId = uge.Cells["mrId"].Value.ToString();
- ProcInstDetail detail = new ProcInstDetail(BpmFlowConstants.PROCDEF_PUR_REQUIREPLAN_AUDIT, mrId);
- detail.ShowDialog();
- }
- /// <summary>
- /// 审批
- /// </summary>
- private void AppPUR_REQUIRE_PLAN()
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- {
- MessageUtil.ShowWarning("请选择待审批的需求计划!");
- return;
- }
- String strMrId = uge.Cells["MrId"].Value.ToString();
- if (String.IsNullOrEmpty(strMrId))
- {
- MessageUtil.ShowWarning("选择的需求计划号为空!");
- return;
- }
- RequirePlanM rpm = this.execute<RequirePlanM>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "findById", new object[] { strMrId });
- if (rpm == null)
- {
- MessageUtil.ShowTips("未发现需求计划:" + strMrId+"信息记录!");
- return;
- }
- if (rpm.Status!="2")
- {
- MessageUtil.ShowWarning("需求计划:" + strMrId + "尚未送审或已审批,请刷新后再操作!");
- return;
- }
- frmExamineShow Fex = new frmExamineShow();
- Fex.ShowDialog();
- if (Fex.Status == null)
- {
- return;
- }
- //if (!Fex.Status.Equals("1"))
- //{
- // MessageUtil.ShowTips("审批失败!");
- // return;
- //}
- //if (!Fex.Status.Equals("2"))
- //{
- // MessageUtil.ShowTips("审批失败!");
- // return;
- //}
- try
- {
- //RequirePlanM RqPM = new RequirePlanM();
- //RqPM.Status = "3";
- //RqPM.MrId = uge.Cells["MrId"].Value.ToString();
- //RqPM.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- //RqPM.UpdateTime = DateTime.Now;
- //RqPM.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- //this.execute("com.hnshituo.pur.requireplan.service.RequirePlanMService", "update", new object[] { RqPM });
- ReqCompleteTask req = new ReqCompleteTask();
- req.OperatorUserId = UserInfo.GetUserID();
- req.TaskId = uge.Cells["BpmTaskId"].Value.ToString();
- if (Fex.Status.Equals("2"))
- {
- req.AuditData = true;
- req.AuditMessage = Fex.ExamineMessage;
- if (rpm.UrgencyType=="2"&&DateTime.Now > DateTime.Parse(DateTime.Now.ToString("yyyy/MM/26")))
- {
- if (MessageUtil.ShowYesNoAndQuestion("已超出审批时限(每月25号截止),若审批通过则将默认归属于为" + DateTime.Now.AddMonths(2).ToString("yyyy/MM") + "的需求! 或请退回走紧急采购。") != DialogResult.Yes)
- {
- return;
- }
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "bpmAudit", new object[] { req });
- if (crt.Resultcode == -1)
- {
- MessageUtil.ShowTips("需求计划:" + strMrId + "审批失败!" + crt.Resultmsg);
- return;
- }
- //更新计划月份
- RequirePlanM ReqM = new RequirePlanM();
- ReqM.MrId = strMrId;
- ReqM.MrPeriodEnd = DateTime.Parse(DateTime.Now.AddMonths(2).ToString("yyyy/MM"));
- ReqM.AuditedTime = DateTime.Now;
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "doUpdate", new object[] { ReqM });
- }
- else
- {
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "bpmAudit", new object[] { req });
- if (crt.Resultcode == -1)
- {
- MessageUtil.ShowTips("需求计划:" + strMrId + "审批失败!" + crt.Resultmsg);
- return;
- }
- }
- MessageUtil.ShowTips("操作成功");
- GetPUR_REQUIRE_PLAN();
- }
- else if (Fex.Status.Equals("1"))
- {
- req.AuditData = false;
- req.AuditMessage = Fex.ExamineMessage;
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "bpmAudit", new object[] { req });
- if (crt.Resultcode == -1)
- {
- MessageUtil.ShowTips("需求计划:" + strMrId + "审批失败!" + crt.Resultmsg);
- return;
- }
- RequirePlanM ReqM = new RequirePlanM();
- ReqM.MrId = strMrId;
- ReqM.Status = "4";
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "doUpdate", new object[] { ReqM });
- if (rt.Resultcode != 0)
- {
- MessageUtil.ShowTips("需求计划:" + strMrId + "审批失败!" + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("操作成功");
- GetPUR_REQUIRE_PLAN();
- }
- }
- catch (Exception e)
- {
- MessageUtil.ShowTips("需求计划:" + strMrId + "审批失败!" + e);
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void GetPUR_REQUIRE_PLAN()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- message.Clear();
- dataSet1.Clear();
- dataSet2.Clear();
- RequirePlanM RqPM = new RequirePlanM();
- RqPM.MrId = ultraTextEditor1.Text.ToString().Trim();
- if (ultraComboEditor2.SelectedIndex != -1)
- {
- RqPM.UrgencyType = ultraComboEditor2.Value.ToString();
- }
- //计划时间
- if (ck_Mtime.Checked == true)
- {
- if (cop_planMouthStart.Text != "")
- {
- DateTime Start1 = DateTime.Parse(Convert.ToDateTime(cop_planMouthStart.Value).ToString("yyyy/MM"));
- RqPM.MrPeriodStart = Start1;
- }
- if (cop_planMouthEnd.Text != "")
- {
- DateTime End1 = DateTime.Parse(Convert.ToDateTime(cop_planMouthEnd.Value).ToString("yyyy/MM"));
- RqPM.MrPeriodEnd = End1;
- }
- }
- RqPM.Validflag = "1";
- RqPM.BpmUserId = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- RqPM.ValidDataPurviewIds = this.ValidDataPurviewIds;
- DataTable dt=new DataTable();
- if (txt_Status.SelectedIndex == -1)
- {
- return;
- }
- if (txt_Status.Value.ToString().Trim() == "wait")
- {
- dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "find_audit_status", new object[] { RqPM });
- }
- else if (txt_Status.Value.ToString().Trim() == "did")
- {
- dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "find_audited_status", new object[] { RqPM });
- }
- else
- {
- dt = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.RequirePlanMService", "find_status", new object[] { RqPM });
- }
- foreach (DataRow row in dt.Rows)
- {
- row["mrPeriodEnd"] = Convert.ToDateTime(row["mrPeriodEnd"]).ToString("yyyy/MM");
- }
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载数据失败:"+ex.Message);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 未审批点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- dataTable2.Clear();
- message.Clear();
- if (ultraGrid1.ActiveRow == null)
- {
- return;
- }
- String strMrId=ultraGrid1.ActiveRow.Cells["mrId"].Value.ToString();
- getdetail(strMrId);
- //加载评审意见
- getOrderReview(strMrId);
- }
- private void getdetail(String strMrId)
- {
- if (String.IsNullOrEmpty(strMrId))
- {
- return;
- }
- RequirePlanM RqPM = new RequirePlanM();
- RqPM.MrId = strMrId;
- RqPM.Validflag = "1";
- DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.requireplan.service.RequirePlanDService", "get_RequirePlanDlike", new object[] { RqPM });
- GridHelper.CopyDataToDatatable(dt1, dataTable2, true);
- GridHelper.RefreshAndAutoSize(ultraGrid2);
- }
- private void txt_Status_ValueChanged(object sender, EventArgs e)
- {
- GetPUR_REQUIRE_PLAN();
- }
- /// <summary>
- /// 获取评审意见
- /// </summary>
- /// <param name="strOrderId"></param>
- private void getOrderReview(string strOrderId)
- {
- DataTable dt11 = this.execute<DataTable>("com.hnshituo.pur.order.service.OrderMService", "getReviewMsg", new object[] { strOrderId });
- GridHelper.CopyDataToDatatable(dt11, dataTable7, true);
- GridHelper.RefreshAndAutoSize(ultraGrid3);
- }
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- }
- }
- }
|