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.
 
 
 
 
 

175 lines
6.5 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.ScpEntity;
using CK.SCP.Controller;
using FineUI;
using System.Data;
namespace SCP.SupplierData.SupplierLogistics
{
public partial class SCP_ASN : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadData();
TranslatorAgents(Toolbar2);
TranslatorAgent(Grid_V_TB_ASN);
TranslatorAgents(FormRow_1);
TranslatorAgents(FormRow_2);
TranslatorAgents(FormRow_3);
TranslatorAgents(FormRow_4);
}
}
public void LoadData()
{
//if (!CurrentUser.RoleList.Contains("供应商"))
//{
// Alert.Show("当前用户角色不能操作模块!");
// return;
//}
if (CurrentUser.VenderList.Count == 0 && CurrentUser.Name!="admin")
{
if (CurrentUser.RoleList.Contains("分厂管理员"))
{
BindASN();
}
else
{
Alert.Show("当前用户未分配供应商!");
return;
}
;
}
BindASN();
}
public void BindASN()
{
SearchV_TB_ASN((result) => {
Grid_V_TB_ASN.RecordCount = result.Count();
var list = SortAndPage<V_TB_ASN>(result, Grid_V_TB_ASN);
Grid_V_TB_ASN.DataSource = list;
Grid_V_TB_ASN.DataBind();
});
}
public void SearchV_TB_ASN(Action<IQueryable<V_TB_ASN>> p_action)
{
var ls = SCPDB.TB_FACTORY.Where(p => p.ErpDomain == CurrentUser.UsedDomain).ToList();
DropDownList1.DataSource = ls;
DropDownList1.DataBind();
V_TB_ASN _entity = new V_TB_ASN();
_entity.IsDeleted = false;
_entity.VendId = TXT_VenderName.Text;
_entity.PoBillNum = txtPO.Text;
_entity.AsnBillNum = txtBill.Text;
_entity.AskBillNum = TXT_ASK.Text;
_entity.UserInVendIds = CurrentUser.VenderList;
_entity.UserInAddress = CurrentUser.FactoryList;
_entity.SubSite = DropDownList1.SelectedValue;
_entity.Extend1 = TXT_Extend1.Text;
_entity.Extend2 = TXT_Extend2.Text;
_entity.Extend3 = TXT_Extend3.Text;
SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(_entity, (_ret) => {
if (_ret.State == ReturnStatus.Succeed)
{
p_action(_ret.Result);
}
});
}
protected void Grid_V_TB_ASN_RowDoubleClick(object sender, FineUI.GridRowClickEventArgs e)
{
object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[e.RowIndex];
string AsnBillNum = rowDataKeys[1] as string;
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_DETAIL.aspx?AsnBillNum={0}", AsnBillNum)));
}
protected void BtnOutPut_Click(object sender, EventArgs e)
{
List<string> _ls = new List<string>();
SearchV_TB_ASN(rs => {
_ls=rs.Select(p => p.AsnBillNum).ToList();
DataSet ds = SCP_EXCEL_CONTROLLER.GET_ASN_EXECEL(_ls);
PageBase.DataSetToExcel(ds, "发货单");
});
}
protected void btnDetail_Click(object sender, EventArgs e)
{
if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0)
{
PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!"));
return;
}
object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex];
string AsnBillNum = rowDataKeys[1] as string;
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_DETAIL.aspx?AsnBillNum={0}", AsnBillNum)));
}
protected void btnShow_Click(object sender, EventArgs e)
{
gp1.Hidden = false;
}
protected void btnClose_Click(object sender, EventArgs e)
{
gp1.Hidden = true;
}
protected void BtnSearch_Click(object sender, EventArgs e)
{
BindASN();
}
protected void Grid_V_TB_ASN_PageIndexChange(object sender, GridPageEventArgs e)
{
BindASN();
}
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid_V_TB_ASN.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
BindASN();
}
protected void BtnOutPut_Click1(object sender, EventArgs e)
{
}
protected void btnNew_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference("../SupplierData/SCP_ASK.aspx"));
}
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindASN();
}
protected void btnPallet_Click(object sender, EventArgs e)
{
if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0 )
{
PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!"));
return;
}
object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex];
string AsnBillNum = rowDataKeys[1] as string;
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_PALLET_CREATE.aspx?AsnBillNum={0}", AsnBillNum)));
}
protected void btnPalletDetail_Click(object sender, EventArgs e)
{
if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0)
{
PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!"));
return;
}
object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex];
string AsnBillNum = rowDataKeys[1] as string;
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_PALLET.aspx?AsnBillNum={0}", AsnBillNum)));
}
}
}