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.
 
 
 
 
 

241 lines
8.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CK.SCP.Models.Enums;
using CK.SCP.Models.ScpEntity;
using CK.SCP.Utils;
using CK.SCP.Controller;
using FineUI;
using SCP.Code;
using CK.SCP.Models;
using System.Data;
namespace SCP.PlanData
{
public partial class SCP_INCOMPLETE_ASK : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TranslatorAgents(Toolbar1);
TranslatorAgents(FormRow_1);
TranslatorAgents(FormRow_2);
TranslatorAgents(FormRow_3);
TranslatorAgent(GridINCOM);
LoadData();
}
}
public void LoadData()
{
//if (!CurrentUser.RoleList.Contains("采购人员"))
//{
// Alert.Show("当前用户角色不能操作改模块!");
// return;
//}
//if (CurrentUser.FactoryList == null || CurrentUser.FactoryList.Count == 0)
//{
// Alert.Show("当前用户未选择地点!");
// return;
//}
BindData();
}
public void BindData()
{
SearchV_TB_INCOMPLETE_ASKData((result) => {
GridINCOM.RecordCount = result.Count();
var list = SortAndPage<V_TB_INCOMPLETE_ASK>(result, GridINCOM);
// var list_sum = SCP_ASK_CONTROLLER.RejectQty_SUM(list.ToList());
GridINCOM.DataSource = list;
GridINCOM.DataBind();
});
}
public void SearchV_TB_INCOMPLETE_ASKData(Action<IQueryable<V_TB_INCOMPLETE_ASK>> p_action)
{
V_TB_INCOMPLETE_ASK _entity = new V_TB_INCOMPLETE_ASK();
_entity.PoBillNum = TextBillNo.Text;
if (TextBillTime1.SelectedDate != null)
{
_entity.BeginTimeStart = (DateTime)TextBillTime1.SelectedDate;
}
if (TextBillTime2.SelectedDate != null)
{
_entity.BeginTimeEnd = (DateTime)TextBillTime2.SelectedDate;
}
if (dp_EndTimeStart.SelectedDate != null)
{
_entity.EndTimeStart = (DateTime)dp_EndTimeStart.SelectedDate;
}
if (dp_EndTimeEnd.SelectedDate != null)
{
_entity.EndTimeEnd = (DateTime)dp_EndTimeEnd.SelectedDate;
}
if (TextBoxAskNo.Text != null)
{
_entity.AskBillNum = TextBoxAskNo.Text;
}
if (TextPartCode.Text != null)
{
_entity.PartCode = TextPartCode.Text;
}
if (TextPartName.Text != null)
{
_entity.PartDesc1 = TextPartName.Text;
}
if (TextSubSite.Text != null)
{
_entity.SubSite = TextSubSite.Text;
}
if (TextExtend1.Text != null)
{
_entity.Extend1 = TextExtend1.Text;
}
if (TextExtend2.Text != null)
{
_entity.Extend2 = TextExtend2.Text;
}
if (TextExtend3.Text != null)
{
_entity.Extend3 = TextExtend3.Text;
}
if (!string.IsNullOrEmpty(CurrentUser.Name))
{
if (CurrentUser.Name != "admin")
{
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
{
//if (CurrentUser.FactoryList.FirstOrDefault() == "CNS")
//{
if (!CurrentUser.RoleList.Contains("要货看板所有记录"))
{
if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count == 1)
{
_entity.CreateUser = string.Empty;
}
else
{
_entity.CreateUser = CurrentUser.Name;
}
}
else
{
this.txt_Planner.Hidden = false;
btn_planner.Hidden = false;
if (!string.IsNullOrEmpty(this.txt_Planner.Text))
{
_entity.Buyer = txt_Planner.Text;
}
}
//}
}
}
}
_entity.SendState = int.Parse(rb_SendState.SelectedValue);
//_entity.DayState = int.Parse(ddl_DayState.SelectedValue);
_entity.IsDeleted = false;
_entity.UserInAddress = CurrentUser.FactoryList;
_entity.UserInVendIds = CurrentUser.VenderList;
SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List(_entity, (_ret) =>
{
if (_ret.State == ReturnStatus.Succeed)
{
p_action(_ret.Result);
}
});
}
protected void btnSearch_Click(object sender, EventArgs e)
{
BindData();
}
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
GridINCOM.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
BindData();
}
protected void btnOutput_Click(object sender, EventArgs e)
{
var _ls = new V_TB_INCOMPLETE_ASK();
_ls.PoBillNum = TextBillNo.Text;
if (TextBillTime1.SelectedDate != null)
{
_ls.BeginTimeStart = (DateTime)TextBillTime1.SelectedDate;
}
if (TextBillTime2.SelectedDate != null)
{
_ls.BeginTimeEnd = (DateTime)TextBillTime2.SelectedDate;
}
if (dp_EndTimeStart.SelectedDate != null)
{
_ls.EndTimeStart = (DateTime)dp_EndTimeStart.SelectedDate;
}
if (dp_EndTimeEnd.SelectedDate != null)
{
_ls.EndTimeEnd = (DateTime)dp_EndTimeEnd.SelectedDate;
}
if (TextBoxAskNo.Text != null)
{
_ls.AskBillNum = TextBoxAskNo.Text;
}
if (TextPartCode.Text != null)
{
_ls.PartCode = TextPartCode.Text;
}
if (TextPartName.Text != null)
{
_ls.PartDesc1 = TextPartName.Text;
}
_ls.IsDeleted = false;
_ls.UserInAddress = CurrentUser.FactoryList;
_ls.UserInVendIds = CurrentUser.VenderList;
_ls.SendState = int.Parse(rb_SendState.SelectedValue);
//_ls.DayState = int.Parse(ddl_DayState.SelectedValue);
SCP_ASK_CONTROLLER.Get_V_TB_ASK_ASN_View_List(_ls, (ret) =>
{
if (ret.State == ReturnStatus.Succeed)
{
Dictionary<string, string> cellheader = new Dictionary<string, string>
{
{ "PoBillNum", "订单号" },
{ "AskBillNum", "要货单号" },
{ "PartCode", "零件编号" },
{ "PartDesc1", "零件名称" },
{ "PoLine", "订单行号" },
{ "AskQty", "要货数量" },
{ "Qty", "发货数量" },
{ "ReduceQty", "减产数量" },
{ "Number", "未完成数量" },
{ "BeginTime", "订货日期" },
{ "EndTime", "到货日期" },
{ "Buyer", "计划员" },
{ "ValidityDays", "距到货日期(天)" },
{"SubSite","" },
{"Extend1","" },
{"Extend2","" },
{"Extend3","" },
};
string url = EntityListToExcel2003(cellheader, ret.Result.ToList(), "未完成订单明细");
}
});
}
protected void Grid_V_TB_INCOMPLETE_ASK_PageIndexChange(object sender, GridPageEventArgs e)
{
GridINCOM.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
BindData();
}
protected void btn_planner_Click(object sender, EventArgs e)
{
BindData();
}
}
}