You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

170 lines
5.9 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
using CK.SCP.Models.ScpEntity;
using CK.SCP.Controller;
using FineUI;
using CK.SCP.Models.Enums;
namespace SCP.Views.SupplierData
{
public partial class SCP_MPO_DETAIL : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request["PurdocNO"]))
{
BindDetail();
}
else
{
Alert.Show("请选择数据后再查看明细!");
return;
}
}
}
public void SearchV_TB_PO_DETAIL(Action<IQueryable<V_TB_MPO_DETAIL>> p_action)
{
V_TB_MPO_DETAIL _entity = new V_TB_MPO_DETAIL();
string purdocnolist =Request["PurdocNO"];
_entity.purdocnolist = purdocnolist.Split(',').ToList();
_entity.Ctype = "N";
SCP_MPO_CONTROLLER.Get_V_TB_MPO_DETAIL_List(_entity,(_ret)=> {
if (_ret.State == ReturnStatus.Succeed)
{
p_action(_ret.Result);
}
});
}
public void BindDetail()
{
SearchV_TB_PO_DETAIL((ret)=>{
this.Grid_V_TB_MPO_DETAIL.RecordCount = ret.Count();
var list = SortAndPage<V_TB_MPO_DETAIL>(ret, Grid_V_TB_MPO_DETAIL);
Grid_V_TB_MPO_DETAIL.DataSource = list.ToList();
Grid_V_TB_MPO_DETAIL.DataBind();
});
}
protected void Grid_V_TB_PO_DETAIL_PageIndexChange(object sender, GridPageEventArgs e)
{
BindDetail();
}
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid_V_TB_MPO_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
BindDetail();
}
/// <summary>
/// 审批通过
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAccept_Click(object sender, EventArgs e)
{
int[] selections = Grid_V_TB_MPO_DETAIL.SelectedRowIndexArray;
List<string> NOList = new List<string>();
//List<string> ctylist = new List<string>();
List<int> AcceptStatusList = new List<int>();
if (selections.Count() ==0 )
{
Alert.Show("您未选择数据进行审批");
return;
}
else
{
foreach (int rowIndex in selections)
{
NOList.Add(Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][1] as string);
//ctylist.Add(Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][4] as string);
var app = Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][3].ToString();
AcceptStatusList.Add(int.Parse(app));
}
NOList = NOList.Distinct().ToList();
//if (ctylist.Contains("D"))
//{
// Alert.Show("选择的数据包含已经作废的数据");
// return;
//}
if (AcceptStatusList.Contains((int)GeneralMaterialOrderState.Finish))
{
Alert.Show("选择的数据包含已确认的数据");
return;
}
var ret = SCP_MPO_CONTROLLER.Save_MPO_STATE(NOList, GeneralMaterialOrderState.Finish);
if (ret.State == ReturnStatus.Succeed)
{
Alert.Show("确认成功");
BindDetail();
}
else
{
Alert.Show(string.Join("<br>", ret.MessageList));
return;
}
}
}
/// <summary>
/// 取消审批
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCancel_Click(object sender, EventArgs e)
{
int[] selections = Grid_V_TB_MPO_DETAIL.SelectedRowIndexArray;
List<string> NOList = new List<string>();
List<string> ctylist = new List<string>();
List<int> AcceptStatusList = new List<int>();
if (selections.Count() == 0)
{
Alert.Show("您未选择数据进行取消审批");
return;
}
else
{
foreach (int rowIndex in selections)
{
NOList.Add(Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][1] as string);
ctylist.Add(Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][4] as string);
AcceptStatusList.Add(int.Parse(Grid_V_TB_MPO_DETAIL.DataKeys[rowIndex][3].ToString()));
}
NOList = NOList.Distinct().ToList();
//if (ctylist.Contains("D"))
//{
// Alert.Show("选择的数据包含已经作废的数据");
// return;
//}
if (AcceptStatusList.Contains((int)GeneralMaterialOrderState.New))
{
Alert.Show("选择的数据包含新建的数据");
return;
}
var ret = SCP_MPO_CONTROLLER.Save_MPO_STATE(NOList, GeneralMaterialOrderState.New);
if (ret.State == ReturnStatus.Succeed)
{
Alert.Show("取消成功");
BindDetail();
}
else
{
Alert.Show(string.Join("<br>", ret.MessageList));
return;
}
}
}
}
}