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.
107 lines
3.6 KiB
107 lines
3.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.Controller;
|
|
using CK.SCP.Models.ScpEntity;
|
|
using CK.SCP.Utils;
|
|
using FineUI;
|
|
|
|
namespace SCP.SupplierData
|
|
{
|
|
public partial class SCP_TS_BARCODE : PageBase
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
LoadData();
|
|
}
|
|
}
|
|
|
|
public void LoadData()
|
|
{
|
|
SearchData((ret) =>
|
|
{
|
|
Grid1.RecordCount = ret.Count();
|
|
var list = SortAndPage<V_TS_BARCODE>(ret, Grid1);
|
|
Grid1.DataSource = list.ToList();
|
|
Grid1.DataBind();
|
|
});
|
|
}
|
|
//查询
|
|
protected void BtnSearch_OnClick(object sender, EventArgs e)
|
|
{
|
|
LoadData();
|
|
}
|
|
|
|
|
|
public void SearchData(Action<IQueryable<V_TS_BARCODE>> p_action)
|
|
{
|
|
var _barCode = new V_TS_BARCODE();
|
|
_barCode.BillNum = txtAsnNumBill.Text;
|
|
_barCode.BarCode = txtBarCode.Text;
|
|
_barCode.PartCode = txtPartCode.Text;
|
|
_barCode.Batch = txtBatch.Text;
|
|
_barCode.IsScanned = false;
|
|
_barCode.UserInAddress = CurrentUser.FactoryList;
|
|
_barCode.UserInVendIds = CurrentUser.VenderList;
|
|
SCP_TS_BARCODE_CONTROLLER.Get_V_TS_BARCODE_List(_barCode, (ret) =>
|
|
{
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_action(ret.Result);
|
|
}
|
|
});
|
|
}
|
|
//导出
|
|
protected void ButtonOut_OnClick(object sender, EventArgs e)
|
|
{
|
|
SearchData((ret) =>
|
|
{
|
|
var list = SortAndPage<V_TS_BARCODE>(ret, Grid1).ToList();
|
|
// 2.设置单元格抬头
|
|
// key:实体对象属性名称,可通过反射获取值
|
|
// value:Excel列的名称
|
|
Dictionary<string, string> cellheader = new Dictionary<string, string> {
|
|
{ "IsScanned_Desc", "是否扫描" },
|
|
{ "BarCode", "条码" },
|
|
{ "PartCode", "零件号" },
|
|
{ "PartName", "零件名称" },
|
|
{ "Batch", "批次" },
|
|
{ "PackQty", "装箱数量" },
|
|
};
|
|
string url = EntityListToExcel2003(cellheader, list, "条码列表");
|
|
});
|
|
|
|
}
|
|
//补打条码
|
|
protected void ButtonPrint_OnClick(object sender, EventArgs e)
|
|
{
|
|
List<string> _ls = new List<string>();
|
|
for(int i = 0, count = Grid1.Rows.Count; i < count; i++)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Contains(i))
|
|
{
|
|
object[] rowDataKeys = Grid1.DataKeys[i];
|
|
int id= ConvertHelper.To<int>(rowDataKeys[0]);
|
|
_ls.Add(id.ToString());
|
|
}
|
|
}
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=Material&data=101&type=pdf&filename=标签.pdf&Barcode={0}&open=\")", string.Join("_", _ls.ToArray()));
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
|
|
LoadData();
|
|
}
|
|
protected void Grid_V_TS_BARCODE_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
LoadData();
|
|
}
|
|
}
|
|
}
|