using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using CoreFS.CA06;
using Infragistics.Win.UltraWinGrid;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Core.StlMes.Client.PlnSaleOrd
{
public partial class FrmApplyRoval : FrmBase
{
public FrmApplyRoval()
{
InitializeComponent();
}
private void FrmApplyRoval_Load(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
DateTime d1 = new DateTime(now.Year, now.Month, 1);
DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
txtStratTime.Value = d1;
txtEndTime.Value = d2;
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
base.ToolBar_Click(sender, ToolbarKey);
switch (ToolbarKey)
{
case "Query"://查询
Query();
break;
case "AppThrough"://审批通过
AppThrough();
break;
case "AppNotThrough"://审批不通过
AppNotThrough();
break;
case "CancelThrough"://取消审批
CancelThrough();
break;
case"Export":
exportData();
break;
case "Close": //关闭
this.Close();
break;
default:
break;
}
}
///
/// 导出
///
private void exportData()
{
GridHelper.ulGridToExcel(ultraGrid1, "合同推荐长度审批汇总");
}
///
/// 查询
///
private void Query()
{
string orderNo = "";
string strat = "";
string startTime = "";
string endTime = "";
if (chcOrderNo.Checked)
{
if (txtOrderNo.Text.Equals(""))
{
MessageUtil.ShowTips("请输入合同号!");
return;
}
else
{
orderNo = txtOrderNo.Text.ToString().Trim();
}
}
if (chcStrat.Checked)
{
strat = comStrat.Value.ToString();
}
if (chcTime.Checked)
{
startTime = txtStratTime.Value.ToString();
endTime = txtEndTime.Value.ToString();
}
string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order.FrmApplyRoval.queryApplyNo", new object[] { orderNo, strat, startTime, endTime, this.ValidDataPurviewIds, this.UserInfo.GetUserName(), supp }, this.ob);
GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
}
///
/// 审批通过
///
private void AppThrough()
{
ultraGrid1.UpdateData();
IQueryable chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
if (chcRows == null || chcRows.Count() == 0)
{
MessageUtil.ShowTips("请选择申请单!");
return;
}
ArrayList List = new ArrayList();
foreach (UltraGridRow urow in chcRows)
{
ArrayList jsonList = new ArrayList();
jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
List.Add(jsonList);
}
if (MessageUtil.ShowYesNoAndQuestion("是否审批通过?") == DialogResult.No)
{
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
ccp.MethodName = "appThrough";
ccp.ServerParams = new object[] { List,this.UserInfo.GetUserName() };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("审批通过成功!"))
{
Query();
}
}
///
/// 审批不通过
///
private void AppNotThrough()
{
ultraGrid1.UpdateData();
IQueryable chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
if (chcRows == null || chcRows.Count() == 0)
{
MessageUtil.ShowTips("请选择申请单!");
return;
}
ArrayList List = new ArrayList();
foreach (UltraGridRow urow in chcRows)
{
ArrayList jsonList = new ArrayList();
jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
List.Add(jsonList);
}
if (MessageUtil.ShowYesNoAndQuestion("是否审批不通过?") == DialogResult.No)
{
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
ccp.MethodName = "appNotThrough";
ccp.ServerParams = new object[] { List,this.UserInfo.GetUserName() };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("审批不通过成功!"))
{
Query();
}
}
///
/// 撤销审批
///
private void CancelThrough()
{
ultraGrid1.UpdateData();
IQueryable chcRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
if (chcRows == null || chcRows.Count() == 0)
{
MessageUtil.ShowTips("请选择申请单!");
return;
}
ArrayList List = new ArrayList();
foreach (UltraGridRow urow in chcRows)
{
ArrayList jsonList = new ArrayList();
jsonList.Add(urow.Cells["APPLY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_PK"].Value.ToString());
jsonList.Add(urow.Cells["ORD_LN_DLY_PK"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MIN_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTH_MAX_N"].Value.ToString());
jsonList.Add(urow.Cells["LENGTHDISC_N"].Text.ToString());
jsonList.Add(urow.Cells["SHRT_STOVE_N"].Text.ToString());
jsonList.Add(urow.Cells["ORDER_NO"].Value.ToString());
jsonList.Add(urow.Cells["ORDER_SEQ"].Value.ToString());
jsonList.Add(urow.Cells["DELIVERY_NO"].Value.ToString());
jsonList.Add(urow.Cells["ISSUED_MEMO"].Text.ToString().Trim());
jsonList.Add(urow.Cells["LEN_NO_N"].Text.ToString());
List.Add(jsonList);
}
if (MessageUtil.ShowYesNoAndQuestion("是否撤销审批?") == DialogResult.No)
{
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.order.FrmApplyRoval";
ccp.MethodName = "cancelThrough";
ccp.ServerParams = new object[] { List, this.UserInfo.GetUserName() };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("撤销审批成功!"))
{
Query();
}
}
private void chcOrderNo_CheckedChanged(object sender, EventArgs e)
{
if (chcOrderNo.Checked) { txtOrderNo.Enabled = true; } else { txtOrderNo.Enabled = false; }
if (chcStrat.Checked) { comStrat.Enabled = true; } else { comStrat.Enabled = false; }
if (chcTime.Checked) { txtStratTime.Enabled = true; txtEndTime.Enabled = true; } else { txtStratTime.Enabled = false; txtEndTime.Enabled = false; }
}
}
}