using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Format;
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.SaleOrder
{
public partial class FrmOrderDelverEdate : FrmBase
{
private string SaleOrg = "";//销售组织
private string userName = "";//操作人
public FrmOrderDelverEdate()
{
InitializeComponent();
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
Query();
break;
case "Update":
UpdateDelvryEdate();
break;
case "UpdateLine":
UpdateDelvryEdateLine();
break;
case "Close":
this.Close();
break;
}
}
///
/// 查询库存信息
///
private void Query()
{
string orderNo = txtOrderNo.Text.Trim();
if (orderNo.Equals(""))
{
MessageUtil.ShowTips("请输入合同号!");
return;
}
DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.FrmOrderDelverEdate.doQuery", new Object[] { orderNo, SaleOrg }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
}
///
/// 调整交货期
///
private void UpdateDelvryEdate()
{
this.ultraGrid1.UpdateData();
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要调整的合同信息!");
return;
}
string tian = txtTian.Text.ToString().Trim();
if (!StringUtil.IsInt(tian))
{
MessageUtil.ShowTips("请输入正确的天数!");
return;
}
ArrayList parm = new ArrayList();
foreach (UltraGridRow uRow in checkMagRows)
{
ArrayList parm2 = new ArrayList();
parm2.Add(uRow.Cells["ORD_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORD_LN_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORD_LN_DLY_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORDER_NO"].Value.ToString());
parm2.Add(uRow.Cells["ORDER_SEQ"].Value.ToString());
parm2.Add(uRow.Cells["DELIVERY_NO"].Value.ToString());
parm.Add(parm2);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.sale.order.FrmOrderDelverEdate";
ccp.MethodName = "updateDelvryEdate";
ccp.ServerParams = new object[] { parm, userName, this.UserInfo.GetUserID(), ultraOptionSet1.CheckedIndex.ToString(), tian };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("调整交货期成功!"))
{
Query();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 仅调合同行交货期
///
private void UpdateDelvryEdateLine()
{
this.ultraGrid1.UpdateData();
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要调整的合同信息!");
return;
}
string tian = txtTian.Text.ToString().Trim();
if (!StringUtil.IsInt(tian))
{
MessageUtil.ShowTips("请输入正确的天数!");
return;
}
ArrayList parm = new ArrayList();
foreach (UltraGridRow uRow in checkMagRows)
{
ArrayList parm2 = new ArrayList();
parm2.Add(uRow.Cells["ORD_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORD_LN_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORD_LN_DLY_PK"].Value.ToString());
parm2.Add(uRow.Cells["ORDER_NO"].Value.ToString());
parm2.Add(uRow.Cells["ORDER_SEQ"].Value.ToString());
parm2.Add(uRow.Cells["DELIVERY_NO"].Value.ToString());
parm.Add(parm2);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.sale.order.FrmOrderDelverEdate";
ccp.MethodName = "updateDelvryEdateLine";
ccp.ServerParams = new object[] { parm , userName, this.UserInfo.GetUserID(), ultraOptionSet1.CheckedIndex.ToString(), tian};
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("仅调合同行交货期成功!"))
{
Query();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
private void FrmUpdateFlagJugeStoveNo_Load(object sender, EventArgs e)
{
string deptId = UserInfo.GetDeptid().Trim();
SaleOrg = ClsBaseInfo.GetSaleOrg(deptId);
userName = this.UserInfo.GetUserName();
}
private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e)
{
this.txtOrderNo.Enabled = this.chkJugeHeatNo.Checked;
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
ultraGrid1.UpdateData();
UltraGridRow row = ultraGrid1.ActiveRow;
DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.FrmOrderDelverEdate.doQueryEdateRecord", new Object[] { row.Cells["ORD_PK"].Value.ToString() }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable2, true);
}
}
}