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.
 
 
 
 
 

130 lines
4.4 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.Views..SupplierData
{
public partial class SCP_SHIP_DETAIL_BARCODE : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TranslatorAgents(Toolbar1);
TranslatorAgent(Grid1);
BindData();
string openUrl = string.Format("SCP_SELECT_MAKE.aspx?select=<script>encodeURIComponent({0})</script>", TXT_MarkType.GetValueReference());
btnPrintRe.OnClientClick = WindowUpload.GetSaveStateReference(TXT_MarkType.ClientID) + WindowUpload.GetShowReference(openUrl);
}
}
public void BindData()
{
Search(ret => {
Grid1.RecordCount = ret.Count();
Grid1.DataSource = ret.ToList();
Grid1.DataBind();
});
}
public void Search(Action<IQueryable<TS_BARCODE>> p_action)
{
string billnum = GetQueryValue("BillNo");
TS_BARCODE _code = new TS_BARCODE();
_code.BillNum = billnum;
if (!string.IsNullOrEmpty(txtKeyword.Text))
{
_code.PartCode = txtKeyword.Text;
}
SCP_BARCODE_CONTROLLER.Get_TS_BARCODE_List(_code, ret => {
if (ret.State == ReturnStatus.Succeed)
{
p_action(ret.Result);
}
});
}
//查询
protected void btnSearch_OnClick(object sender, EventArgs e)
{
BindData();
}
//导出
protected void btnOutput_Click(object sender, EventArgs e)
{
string billnum = GetQueryValue("BillNo");
TS_BARCODE _code = new TS_BARCODE();
_code.BillNum = billnum;
SCP_BARCODE_CONTROLLER.Get_TS_BARCODE_List(_code, ret =>
{
if (ret.State == ReturnStatus.Succeed)
{
Dictionary<string, string> cellheader = new Dictionary<string, string>
{
{ "BarCode", "包装箱码" },
{ "Qty", "数量" },
{ "PartCode", "零件编号" },
{ "PartDesc", "零件名称" },
{ "Batch", "批次" },
{ "VendBatch", "供应商批次" },
{ "ProduceDate", "生产日期" },
{ "PoUnit", "单位" }
};
string url = EntityListToExcel2003(cellheader, ret.Result.ToList(), "条码明细");
}
});
}
//补打条码
protected void btnPrintRe_Click(object sender, EventArgs e)
{
string openUrl = string.Format("SCP_SELECT_MAKE.aspx?select={0}", HttpUtility.UrlEncode(TXT_MarkType.Text));
PageContext.RegisterStartupScript(WindowUpload.GetSaveStateReference(TXT_MarkType.ClientID) + WindowUpload.GetShowReference(openUrl));
}
//查询
protected void btnSearch_Click(object sender, EventArgs e)
{
BindData();
}
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindData();
}
protected void WindowUpload1_Close(object sender, WindowCloseEventArgs e)
{
if (string.IsNullOrEmpty(TXT_MarkType.Text))
{
Alert.Show("没有选择标签模板!");
return;
}
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={1}&data=101&type=pdf&filename=标签.pdf&Barcode={0}&open=\")", string.Join("_", _ls.ToArray()), TXT_MarkType.Text);
PageContext.RegisterStartupScript(str);
TXT_MarkType.Text = "";
}
}
}