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.ck;
using Infragistics.Win.UltraWinGrid;
using System.Collections;
using Core.Mes.Client.Comm.Tool;
using com.hnshituo.pur.vo;
namespace Pur.ck
{
public partial class PurExcDeliveryManag : FrmPmsBase
{
public PurExcDeliveryManag()
{
InitializeComponent();
}
///
/// 菜单栏
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
Get_ExcDeliveryNoticeM();
break;
case "Update":
Upd_ExcDeliveryNoticeM();
break;
case "Delete":
Del_ExcDeliveryNoticeM();
break;
case "Add":
Add_ExcDeliveryNoticeM();
break;
case "Return":
Ret_ExcDeliveryNoticeM();
break;
case "Confirm":
Con_ExcDeliveryNoticeM();
break;
case "Receiving":
Rec_ExcDeliveryNoticeM();
break;
}
}
///
/// 生成收货单
///
private void Rec_ExcDeliveryNoticeM()
{
throw new NotImplementedException();
}
///
/// 到货确认
///
private void Con_ExcDeliveryNoticeM()
{
throw new NotImplementedException();
}
///
/// 退货
///
private void Ret_ExcDeliveryNoticeM()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
PurExcDe_Return Ret = new PurExcDe_Return(this.ob,uge);
Ret.ShowDialog();
}
///
/// 生成送货子单
///
private void Add_ExcDeliveryNoticeM()
{
UltraGridRow uge = ultraGrid1.ActiveRow;
string str = uge.Cells["DeliveryId"].Value.ToString();
string str2 = uge.Cells["orderId"].Value.ToString();
PurExcDeliveryOk PwdOK = new PurExcDeliveryOk(this.ob, uge);
PwdOK.ShowDialog();
Get_ExcDeliveryNoticeM();
}
///
/// 删除
///
private void Del_ExcDeliveryNoticeM()
{
try
{
if (SQ == "0")
{
UltraGridRow uge = ultraGrid1.ActiveRow;
ExcDeliveryM EdnM = new ExcDeliveryM();
EdnM.DeliveryId = uge.Cells["DeliveryId"].Value.ToString();
EdnM.Validflag = "0";
CoreResult crt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryMService", "doUpdate", new object[] { EdnM });
if (crt.Resultcode != 0)
{
MessageUtil.ShowTips("送货单 " + EdnM.DeliveryId + " 删除失败");
return;
}
MessageUtil.ShowTips("送货单 " + EdnM.DeliveryId + " 删除成功!");
Get_ExcDeliveryNoticeM();
}
if (SQ == "1")
{
UltraGridRow uge = ultraGrid2.ActiveRow;
ExcDeliveryC EdnC = new ExcDeliveryC();
EdnC.DeliveryLineSqe = uge.Cells["DeliveryLineSqe"].Value.ToString();
EdnC.Validflag = "0";
EdnC.Qty = 0;
CoreResult crt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryCService", "doUpdate", new object[] { EdnC });
if (crt.Resultcode != 0)
{
MessageUtil.ShowTips("送货单行 " + EdnC.DeliveryLineSqe + " 删除失败");
return;
}
MessageUtil.ShowTips("送货单行 " + EdnC.DeliveryLineSqe + " 删除成功!");
ExcDeliveryC EdnCC = new ExcDeliveryC();
EdnCC.DeliveryId = uge.Cells["DeliveryId"].Value.ToString();
EdnCC.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryCService", "find_ExcDC", new object[] { EdnCC, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
}
}
catch (Exception e)
{
MessageUtil.ShowTips("送货单行 删除失败" + e);
return;
}
}
///
/// 修改
///
private void Upd_ExcDeliveryNoticeM()
{
UltraGridRow uge = ultraGrid2.ActiveRow;
ExcDeliveryC EdnC = new ExcDeliveryC();
if (uge == null)
{
MessageUtil.ShowTips("请选择送货单行!");
return;
}
try
{
if (string.IsNullOrEmpty(ultraTextEditor6.Text))
{
MessageUtil.ShowTips("已发货数量不能为空!");
return;
}
EdnC.DeliveryLineSqe = uge.Cells["DeliveryLineSqe"].Value.ToString();
EdnC.CreatedQty = Convert.ToDouble(ultraTextEditor6.Value);
CoreResult crt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryCService", "doUpdate", new object[] { EdnC });
if (crt.Resultcode != 0)
{
MessageUtil.ShowTips("送货单行 " + EdnC.DeliveryLineSqe + " 修改失败");
return;
}
MessageUtil.ShowTips("送货单行 " + EdnC.DeliveryLineSqe + " 修改成功!");
}
catch (Exception e)
{
MessageUtil.ShowTips("送货单行 " + EdnC.DeliveryLineSqe + " 修改失败"+e);
return;
}
ExcDeliveryC EdnCC = new ExcDeliveryC();
EdnCC.DeliveryId = uge.Cells["DeliveryId"].Value.ToString();
EdnCC.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryCService", "find_ExcDC", new object[] { EdnCC, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
}
///
/// 查询
///
private void Get_ExcDeliveryNoticeM()
{
dataTable2.Clear();
ExcDeliveryM EdnM = new ExcDeliveryM();
EdnM.OrderId = txt_OrderId.Text;
EdnM.NoticeId = txt_NoticeId.Text;
EdnM.CreateTime = Convert.ToDateTime(txt_CreateTimeS.Text);
EdnM.DeleteTime = Convert.ToDateTime(txt_CreateTimeE.Value);
DataTable dt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryMService", "find_ExcDM ", new object[] { EdnM });
GridHelper.CopyDataToDatatable(dt,dataTable1,true);
}
string SQ = "";
private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
{
SQ = "0";
UltraGridRow uge = ultraGrid1.ActiveRow;
ExcDeliveryC EdnC = new ExcDeliveryC();
EdnC.DeliveryId = uge.Cells["DeliveryId"].Value.ToString();
EdnC.Validflag = "1";
DataTable dt = this.execute("com.hnshituo.pur.ck.service.ExcDeliveryCService", "find_ExcDC", new object[] { EdnC, 0, 0 });
GridHelper.CopyDataToDatatable(dt, dataTable2, true);
}
private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
{
SQ = "1";
UltraGridRow uge = ultraGrid2.ActiveRow;
ultraTextEditor4.Text = uge.Cells["ITEMNAME"].Value.ToString();
ultraTextEditor5.Text = uge.Cells["QTY"].Value.ToString();
ultraTextEditor6.Text = uge.Cells["CREATEDQTY"].Value.ToString();
}
private void PurExcDeliveryManag_Load(object sender, EventArgs e)
{
txt_CreateTimeS.Value = DateTime.Now.AddMonths(-1);
txt_CreateTimeE.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString()).AddHours(23).AddMinutes(59);
Get_ExcDeliveryNoticeM();
}
}
}