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.
696 lines
28 KiB
696 lines
28 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 System.Data;
|
|
using CK.SCP.Models.Enums;
|
|
using FineUI;
|
|
using CK.SCP.Utils;
|
|
|
|
using System.Text;
|
|
|
|
namespace SCP.SupplierData
|
|
{
|
|
public partial class SCP_ASN_DETAIL : PageBase
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
GetV_TB_ASNData();
|
|
BindDetail();
|
|
SetRoleRule();
|
|
TranslatorAgents(Toolbar2);
|
|
TranslatorAgents(Toolbar1);
|
|
TranslatorAgents(Toolbar3);
|
|
TranslatorAgent(ToolbarText1);
|
|
TranslatorAgent(Grid_V_TB_ASN_DETAIL);
|
|
TranslatorAgents(FormRow_1);
|
|
TranslatorAgents(FormRow_2);
|
|
TranslatorAgents(FormRow_3);
|
|
}
|
|
}
|
|
private void SetRoleRule()
|
|
{
|
|
IsPriceVisible(Grid_V_TB_ASN_DETAIL, "价格");
|
|
}
|
|
|
|
|
|
|
|
public void SearchV_TB_ASN_DETAILData(Action<IQueryable<V_TB_ASN_DETAIL>> p_action)
|
|
{
|
|
V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL();
|
|
_entity.UserInAddress = CurrentUser.FactoryList;
|
|
_entity.AsnBillNum = Request["AsnBillNum"];
|
|
SCP_ASN_CONTROLLER.Get_V_TB_ASN_DETAIL_List(_entity, (_ret) =>
|
|
{
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_action(_ret.Result);
|
|
}
|
|
});
|
|
|
|
}
|
|
public void GetV_TB_ASNData()
|
|
{
|
|
V_TB_ASN _entity = new V_TB_ASN();
|
|
_entity.AsnBillNum = Request["AsnBillNum"];
|
|
_entity.UserInVendIds = CurrentUser.VenderList;
|
|
_entity.UserInAddress = CurrentUser.FactoryList;
|
|
SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(_entity, (_ret) =>
|
|
{
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
var _result = _ret.Result.FirstOrDefault();
|
|
Session["Asn"] = _result;
|
|
TXT_AsnBillNum.Text = _result.AsnBillNum;
|
|
TXT_PlateNumber.Text = _result.PlateNumber;
|
|
TXT_ReceiveUser.Text = _result.ReceiveUser;
|
|
TXT_ShipUser.Text = _result.ShipUser;
|
|
TXT_Site.Text = _result.Site_Desc;
|
|
TXT_Remark.Text = _result.Remark;
|
|
TXT_VendName.Text = _result.VendName;
|
|
DP_ReceiveTime.SelectedDate = _result.ReceiveTime;
|
|
DP_ShipTime.SelectedDate = _result.ShipTime;
|
|
TXT_StateDesc.Text = GetResourceKey(_result.State_DESC);
|
|
if (_result.State == (int)AsnState.Ship)
|
|
{
|
|
string la = GetCurrentLanguage();
|
|
if (la == "CH")
|
|
{
|
|
btnException2.Hidden = true;
|
|
btnException.Hidden = false;
|
|
}
|
|
else
|
|
{
|
|
btnException.Hidden = true;
|
|
btnException2.Hidden = false;
|
|
}
|
|
|
|
//btnException.Hidden = false;
|
|
}
|
|
else
|
|
{
|
|
btnException.Hidden = true;
|
|
btnException2.Hidden = true;
|
|
}
|
|
}
|
|
SCP_BARCODE_CONTROLLER.Get_TS_BARCODE_List(new TS_BARCODE() { BillNum = TXT_AsnBillNum.Text.Trim() }, retobj =>
|
|
{
|
|
if (retobj.State == ReturnStatus.Succeed)
|
|
{
|
|
if (retobj.Result.Count() > 0)
|
|
{
|
|
this.btnCreateBarCode.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
this.btnCreateBarCode.Enabled = true;
|
|
}
|
|
}
|
|
});
|
|
|
|
});
|
|
}
|
|
public void BindDetail()
|
|
{
|
|
string la = GetCurrentLanguage();
|
|
if (la == "CH")
|
|
{
|
|
Button1.Hidden = true;
|
|
btnCance2.Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
btnSend.Hidden = true;
|
|
btnCancel.Hidden = true;
|
|
}
|
|
SearchV_TB_ASN_DETAILData((ret) =>
|
|
{
|
|
Grid_V_TB_ASN_DETAIL.RecordCount = ret.Count();
|
|
var list = SortAndPage<V_TB_ASN_DETAIL>(ret, Grid_V_TB_ASN_DETAIL);
|
|
Grid_V_TB_ASN_DETAIL.DataSource = list;
|
|
Grid_V_TB_ASN_DETAIL.DataBind();
|
|
});
|
|
}
|
|
|
|
protected void btnOutput_Click(object sender, EventArgs e)
|
|
{
|
|
List<V_TB_ASN_DETAIL> _ls = new List<V_TB_ASN_DETAIL>();
|
|
for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++)
|
|
{
|
|
V_TB_ASN_DETAIL inv = new V_TB_ASN_DETAIL();
|
|
object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i];
|
|
|
|
if (rowDataKeys[24] != null)
|
|
{
|
|
inv.AsnBillNum = rowDataKeys[24].ToString();//发货单号
|
|
}
|
|
if (rowDataKeys[8] != null)
|
|
{
|
|
inv.PackQty = decimal.Parse(rowDataKeys[8].ToString());//标包数量
|
|
}
|
|
if (rowDataKeys[25] != null)
|
|
{
|
|
inv.Qty = decimal.Parse(rowDataKeys[25].ToString());//发货数量
|
|
}
|
|
inv.PartCode = rowDataKeys[3].ToString();//零件编号
|
|
if (rowDataKeys[19] != null)
|
|
{
|
|
inv.PartDesc1 = rowDataKeys[19].ToString();//零件名称
|
|
}
|
|
if (rowDataKeys[20] != null)
|
|
{
|
|
inv.CurrencyDesc = rowDataKeys[20].ToString();//货种
|
|
}
|
|
if (rowDataKeys[28] != null)
|
|
{
|
|
inv.Batch = rowDataKeys[28].ToString();//批次
|
|
}
|
|
if (rowDataKeys[26] != null)
|
|
{
|
|
inv.VendBatch = rowDataKeys[26].ToString();//供应商批次
|
|
}
|
|
if (rowDataKeys[27] != null)
|
|
{
|
|
inv.ProduceDate = DateTime.Parse(rowDataKeys[27].ToString());//生产日期
|
|
}
|
|
//if (rowDataKeys[26] != null)
|
|
//{
|
|
// inv.EndTime = DateTime.Parse(rowDataKeys[34].ToString());//到货截至日期
|
|
//}
|
|
inv.PoUnit = rowDataKeys[4].ToString();//采购单位
|
|
// if (rowDataKeys[6] != null)
|
|
// {
|
|
// inv.Price = decimal.Parse(rowDataKeys[6].ToString());//价格
|
|
// }
|
|
// if (rowDataKeys[34] != null)
|
|
//{
|
|
// inv.ReceivedPort_Desc = rowDataKeys[34].ToString();//收货口
|
|
//}
|
|
_ls.Add(inv);
|
|
}
|
|
|
|
|
|
Dictionary<string, string> cellheader = new Dictionary<string, string>
|
|
{
|
|
{ "AsnBillNum", "发货单号" },
|
|
{ "PackQty", "标包数量" },
|
|
{ "Qty", "发货数量" },
|
|
{ "PartCode", "零件编号" },
|
|
{ "PartDesc1", "零件名称" },
|
|
{ "Batch", "批次" },
|
|
{ "VendBatch", "供应商批次" },
|
|
{ "ProduceDate", "生产日期" },
|
|
{ "EndTime", "到货截至日期" },
|
|
{ "PoUnit", "单位" }
|
|
};
|
|
|
|
string url = EntityListToExcel2003(cellheader, _ls, "发货明细");
|
|
}
|
|
|
|
protected void btnCreate_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
BindDetail();
|
|
}
|
|
|
|
protected void btnEdit_Click(object sender, EventArgs e)
|
|
{
|
|
var _asn = Session["Asn"] as V_TB_ASN;
|
|
if (_asn == null)
|
|
{
|
|
Alert.Show(GetResourceKey("发货订单信息不能为空!"));
|
|
}
|
|
List<V_TB_ASN_DETAIL> _list = new List<V_TB_ASN_DETAIL>();
|
|
for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++)
|
|
{
|
|
GridRow row = Grid_V_TB_ASN_DETAIL.Rows[i];
|
|
V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL();
|
|
object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i];
|
|
_entity.UID = ConvertHelper.To<Int32>(rowDataKeys[0]);
|
|
_entity.PoBillNum = rowDataKeys[1] as string;
|
|
_entity.PoLine = ConvertHelper.To<Int32>(rowDataKeys[2]);
|
|
_entity.PartCode = rowDataKeys[3] as string;
|
|
_entity.PoUnit = rowDataKeys[4] as string;
|
|
_entity.LocUnit = rowDataKeys[5] as string;
|
|
_entity.Price = ConvertHelper.To<Decimal>(rowDataKeys[6]);
|
|
_entity.Currency = rowDataKeys[7] as string;
|
|
_entity.PackQty = ConvertHelper.To<Decimal>(rowDataKeys[8]);
|
|
_entity.UnConv = ConvertHelper.To<Decimal>(rowDataKeys[9]);
|
|
_entity.DockCode = rowDataKeys[10] as string;
|
|
_entity.State = ConvertHelper.To<int?>(rowDataKeys[11]);
|
|
_entity.Remark = rowDataKeys[12] as string;
|
|
_entity.CreateTime = ConvertHelper.To<DateTime>(rowDataKeys[13]);
|
|
_entity.CreateUser = rowDataKeys[14] as string;
|
|
_entity.UpdateTime = ConvertHelper.To<DateTime>(rowDataKeys[15]);
|
|
_entity.UpdateUser = rowDataKeys[16] as string;
|
|
_entity.UpdateInfo = rowDataKeys[17] as string;
|
|
_entity.IsDeleted = ConvertHelper.To<Boolean>(rowDataKeys[18]);
|
|
_entity.PartDesc1 = rowDataKeys[19] as string;
|
|
_entity.CurrencyDesc = rowDataKeys[20] as string;
|
|
_entity.Site = rowDataKeys[21] as string;
|
|
_entity.VendName = rowDataKeys[22] as string;
|
|
_entity.PartDesc2 = rowDataKeys[23] as string;
|
|
_entity.AsnBillNum = rowDataKeys[24] as string;
|
|
_entity.Qty = ConvertHelper.To<Decimal>(rowDataKeys[25]);
|
|
_entity.VendBatch = rowDataKeys[26] as string;
|
|
_entity.Batch = rowDataKeys[28] as string;
|
|
_entity.VendId = rowDataKeys[29] as string;
|
|
System.Web.UI.WebControls.TextBox TXT_VenBatch = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_VenBatch");
|
|
System.Web.UI.WebControls.TextBox TXT_PackQty = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_PackQty");
|
|
System.Web.UI.WebControls.TextBox TXT_Qty = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_Qty");
|
|
System.Web.UI.WebControls.TextBox TXT_ProduceDate = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_ProduceDate");
|
|
_entity.VendBatch = TXT_VenBatch.Text;
|
|
|
|
|
|
if (string.IsNullOrEmpty(TXT_ProduceDate.Text))
|
|
{
|
|
Alert.Show(GetResourceKey("包装量填写错误!"));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
_entity.ProduceDate = DateTime.Parse(TXT_ProduceDate.Text);
|
|
}
|
|
_list.Add(_entity);
|
|
}
|
|
if (_list.Count > 0)
|
|
{
|
|
var _first = _list.FirstOrDefault();
|
|
if (_first.State != (int)AsnState.New)
|
|
{
|
|
Alert.Show(GetResourceKey("不是新建状态,不能保存信息!"));
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
private List<V_TB_ASN_DETAIL> GetSelectedList()
|
|
{
|
|
List<V_TB_ASN_DETAIL> _list = new List<V_TB_ASN_DETAIL>();
|
|
int _flag = 0;
|
|
for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++)
|
|
{
|
|
GridRow row = Grid_V_TB_ASN_DETAIL.Rows[i];
|
|
V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL();
|
|
object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i];
|
|
_entity.UID = ConvertHelper.To<Int32>(rowDataKeys[0]);
|
|
_entity.PoBillNum = rowDataKeys[1] as string;
|
|
_entity.PoLine = ConvertHelper.To<Int32>(rowDataKeys[2]);
|
|
_entity.PartCode = rowDataKeys[3] as string;
|
|
_entity.PoUnit = rowDataKeys[4] as string;
|
|
_entity.LocUnit = rowDataKeys[5] as string;
|
|
_entity.Price = ConvertHelper.To<Decimal>(rowDataKeys[6]);
|
|
_entity.Currency = rowDataKeys[7] as string;
|
|
_entity.PackQty = ConvertHelper.To<Decimal>(rowDataKeys[8]);
|
|
_entity.UnConv = ConvertHelper.To<Decimal>(rowDataKeys[9]);
|
|
_entity.DockCode = rowDataKeys[10] as string;
|
|
_entity.State = ConvertHelper.To<int>(rowDataKeys[11]);
|
|
_entity.Remark = rowDataKeys[12] as string;
|
|
_entity.CreateTime = ConvertHelper.To<DateTime>(rowDataKeys[13]);
|
|
_entity.CreateUser = rowDataKeys[14] as string;
|
|
_entity.UpdateTime = ConvertHelper.To<DateTime?>(rowDataKeys[15]);
|
|
_entity.UpdateUser = rowDataKeys[16] as string;
|
|
_entity.UpdateInfo = rowDataKeys[17] as string;
|
|
_entity.IsDeleted = ConvertHelper.To<Boolean>(rowDataKeys[18]);
|
|
_entity.PartDesc1 = rowDataKeys[19] as string;
|
|
_entity.CurrencyDesc = rowDataKeys[20] as string;
|
|
_entity.Site = rowDataKeys[21] as string;
|
|
_entity.VendName = rowDataKeys[22] as string;
|
|
_entity.PartDesc2 = rowDataKeys[23] as string;
|
|
_entity.AsnBillNum = rowDataKeys[24] as string;
|
|
_entity.Qty = ConvertHelper.To<Decimal>(rowDataKeys[25]);
|
|
_entity.VendBatch = rowDataKeys[26] as string;
|
|
_entity.ProduceDate = ConvertHelper.To<DateTime>(rowDataKeys[27]);
|
|
_entity.Batch = rowDataKeys[28] as string;
|
|
_entity.VendId = rowDataKeys[29] as string;
|
|
_entity.Guid = ConvertHelper.To<Guid>(rowDataKeys[29]);
|
|
|
|
_list.Add(_entity);
|
|
}
|
|
if (_flag == 1)
|
|
{ _list = new List<V_TB_ASN_DETAIL>(); }
|
|
return _list;
|
|
}
|
|
protected void btnSend_Click(object sender, EventArgs e)
|
|
{
|
|
var _asn = Session["Asn"] as V_TB_ASN;
|
|
if (_asn == null)
|
|
{
|
|
Alert.Show(GetResourceKey("发货订单信息不能为空!"));
|
|
}
|
|
var _list = GetSelectedList();
|
|
if (_list.Count > 0)
|
|
{
|
|
var _first = _list.FirstOrDefault();
|
|
if (_first.State != (int)AsnState.New)
|
|
{
|
|
Alert.Show(GetResourceKey("不是新建状态,不能保存信息!"));
|
|
}
|
|
else
|
|
{
|
|
var result = SCP_BARCODE_CONTROLLER.Get_TB_PRINT_COUNT_List(new TB_PRINT_COUNT() { BillNo = _asn.AsnBillNum });
|
|
if (result.State == ReturnStatus.Succeed)
|
|
{
|
|
//if (result.Result.Count(p => p.PrintType == (int)PrintType.ASN) == 0)
|
|
//{
|
|
// Alert.Show(_asn.AsnBillNum + "发货单未打印!");
|
|
// return;
|
|
//}
|
|
if (result.Result.Count(p => p.PrintType == (int)PrintType.BAR_CODE) == 0)
|
|
{
|
|
Alert.Show(_asn.AsnBillNum + GetResourceKey("标签未打印!"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
var check = SCP_ASN_CONTROLLER.Get_TS_UNI_API(_asn);
|
|
if (check.State == ReturnStatus.Failed)
|
|
{
|
|
Alert.Show(_asn.AsnBillNum + GetResourceKey("请勿重复提交数据!"));
|
|
return;
|
|
}
|
|
var ret = SCP_ASN_CONTROLLER.Save_TB_ASN_DETAIL(_asn, _list);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
SET_ASN_STATE("发货成功", AsnState.Ship);
|
|
GetV_TB_ASNData();
|
|
BindDetail();
|
|
var SubSite = SCP_BARCODE_CONTROLLER.GetBillNum(_asn.AsnBillNum);
|
|
|
|
if (SubSite.Site == "CQBMPT")
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=SendBill_CQ&data=102&type=pdf&filename=SendBill.pdf&AsnBillNum={0}&open=\")", _asn.AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
else
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=SendBill&data=102&type=pdf&filename=SendBill.pdf&AsnBillNum={0}&open=\")", _asn.AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
|
|
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = _asn.AsnBillNum, PrintType = (int)PrintType.ASN });
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(string.Join("\n\r", ret.MessageList.ToArray()));
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
private void SET_ASN_STATE(string p_msg, AsnState p_state)
|
|
{
|
|
if (Session["Asn"] != null)
|
|
{
|
|
var _ask = Session["Asn"] as V_TB_ASN;
|
|
var ret = SCP_ASN_CONTROLLER.Save_TB_ASN_STATE(new List<string>() { _ask.AsnBillNum }, p_state);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
Alert.Show(GetResourceKey(p_msg));
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey(ret.Message));
|
|
}
|
|
}
|
|
}
|
|
protected void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
SET_ASN_STATE(GetResourceKey("发货单作废成功"), AsnState.Reject);
|
|
|
|
}
|
|
|
|
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid_V_TB_ASN_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
|
|
|
|
BindDetail();
|
|
}
|
|
|
|
protected void Grid_V_TB_ASN_DETAIL_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindDetail();
|
|
}
|
|
|
|
protected void CreateBarCode_Click(object sender, EventArgs e)
|
|
{
|
|
btnCreateBarCode.Enabled = false;
|
|
var _list = GetSelectedList();
|
|
if (_list.Count > 0)
|
|
{
|
|
var ret = SCP_ASN_CONTROLLER.Save_TB_CREATE_BARCODE(_list);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
Alert.Show(GetResourceKey("条码创建成功!"));
|
|
}
|
|
else
|
|
{
|
|
btnCreateBarCode.Enabled = true;
|
|
Alert.Show(string.Join("<BR>", ret.MessageList.ToArray()));
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnBarCodeList_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string AsnBillNum = Request["AsnBillNum"];
|
|
string script = Window1.GetShowReference("SCP_SHIP_DETAIL_BARCODE.aspx?BillNo=" + AsnBillNum, "条码列表");
|
|
PageContext.RegisterStartupScript(script);
|
|
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
Alert.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void SelectedBarCode_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
string AsnBillNum = Request["AsnBillNum"];
|
|
var result = SCP_BARCODE_CONTROLLER.Get_TB_PRINT_COUNT_List(new TB_PRINT_COUNT() { BillNo = AsnBillNum });
|
|
if (result.State == ReturnStatus.Succeed)
|
|
{
|
|
if (result.Result.Count(p => p.PrintType == (int)PrintType.BAR_CODE) == 0)
|
|
{
|
|
Alert.Show(AsnBillNum + GetResourceKey("标签未打印!"));
|
|
return;
|
|
}
|
|
}
|
|
var SubSite = SCP_BARCODE_CONTROLLER.GetBillNum(AsnBillNum);
|
|
if (SubSite.State < 3)
|
|
{
|
|
Alert.Show(AsnBillNum + GetResourceKey("请先点击确认发货再打印发货单!"));
|
|
return;
|
|
}
|
|
if (SubSite.Site == "CQBMPT")
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=SendBill_CQ&data=102&type=pdf&filename=SendBill.pdf&AsnBillNum={0}&open=\")", AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
else
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=SendBill&data=102&type=pdf&filename=SendBill.pdf&AsnBillNum={0}&open=\")", AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
|
|
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.ASN });
|
|
}
|
|
|
|
protected void btnSelectedBarCode_Click(object sender, EventArgs e)
|
|
{
|
|
string AsnBillNum = Request["AsnBillNum"];
|
|
var bacode = SCP_BARCODE_CONTROLLER.GetBacode(AsnBillNum);
|
|
if (bacode.Count() == 0)
|
|
{
|
|
Alert.Show(AsnBillNum + GetResourceKey("标签未创建!"));
|
|
return;
|
|
}
|
|
var SubSite = SCP_BARCODE_CONTROLLER.GetBillNum(AsnBillNum);
|
|
if (!string.IsNullOrEmpty(AsnBillNum) && SubSite.Site == "CQBMPT")
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=Material_CQ&data=101&type=pdf&filename=标签.pdf&AsnBillNum={0}&open=\")", AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
else
|
|
{
|
|
var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=Material&data=101&type=pdf&filename=标签.pdf&AsnBillNum={0}&open=\")", AsnBillNum);
|
|
PageContext.RegisterStartupScript(str);
|
|
}
|
|
SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.BAR_CODE });
|
|
|
|
}
|
|
|
|
protected void btnOutputPallet_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
#region 计算托盘数量和发货数量是否相等
|
|
|
|
SearchV_TB_ASN_DETAILData((ret) =>
|
|
{
|
|
|
|
var _asn = Session["Asn"] as V_TB_ASN;
|
|
if (_asn == null)
|
|
{
|
|
Alert.Show(GetResourceKey("发货单不存在!"));
|
|
return;
|
|
}
|
|
|
|
|
|
var _ls = SCP_ASN_CONTROLLER.Get_CAN_PALLET_QTY(ret.ToList());
|
|
var _errList = new List<string>();
|
|
_ls.ForEach(p =>
|
|
{
|
|
if (p.CanQty > 0)
|
|
{
|
|
_errList.Add(string.Format("编号:{0}名称:{1},托盘数量总和小于发货单数量", p.PartCode, (p.PartDesc1 + p.PartDesc2)));
|
|
}
|
|
});
|
|
if (_errList.Count > 0)
|
|
{
|
|
Alert.Show(string.Join("<BR>", _errList.ToArray()));
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
List<string> _list = new List<string>();
|
|
_list.Add(_asn.AsnBillNum);
|
|
DataSet ds = SCP_EXCEL_CONTROLLER.GET_PALLET_EXECEL(_list);
|
|
PageBase.DataSetToExcel(ds, "打印导出托盘!");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
protected void btnPackage_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected void btnException_Click(object sender, EventArgs e)
|
|
{
|
|
var _asn = Session["Asn"] as V_TB_ASN;
|
|
|
|
SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(new V_TB_ASN() { AsnBillNum = _asn.AsnBillNum }, (rs) =>
|
|
{
|
|
if (rs.State == ReturnStatus.Succeed)
|
|
{
|
|
var _entity = rs.Result.FirstOrDefault();
|
|
if (_entity != null && _entity.State == (int)AsnState.Ship)
|
|
{
|
|
var _list = SCP_DC_UNI_CONTROLLER.GetASN_ASN(_asn.AsnBillNum);
|
|
if (_list != null && _list.Count > 0)
|
|
{
|
|
SET_ASN_STATE(GetResourceKey("设置成异常状态成功"), AsnState.Exception);
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey("发货单不是已发货状态!"));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey("发货单不是【已发货】状态,只能处理【已发货】异常单据!"));
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
protected void btnRepeat_Click(object sender, EventArgs e)
|
|
{
|
|
var _asn = Session["Asn"] as V_TB_ASN;
|
|
if (_asn == null)
|
|
{
|
|
Alert.Show(GetResourceKey("发货订单信息不能为空!"));
|
|
}
|
|
var _list = GetSelectedList();
|
|
if (_list.Count > 0)
|
|
{
|
|
var _first = _list.FirstOrDefault();
|
|
if (_first.State != (int)AsnState.New)
|
|
{
|
|
Alert.Show(GetResourceKey("不是新建状态,不能保存信息!"));
|
|
}
|
|
else
|
|
{
|
|
var result = SCP_BARCODE_CONTROLLER.Get_TB_PRINT_COUNT_List(new TB_PRINT_COUNT() { BillNo = _asn.AsnBillNum });
|
|
if (result.State == ReturnStatus.Succeed)
|
|
{
|
|
if (result.Result.Count(p => p.PrintType == (int)PrintType.ASN) == 0)
|
|
{
|
|
Alert.Show(_asn.AsnBillNum + GetResourceKey("发货单未打印!"));
|
|
return;
|
|
}
|
|
if (result.Result.Count(p => p.PrintType == (int)PrintType.BAR_CODE) == 0)
|
|
{
|
|
Alert.Show(_asn.AsnBillNum + GetResourceKey("标签未打印!"));
|
|
return;
|
|
}
|
|
}
|
|
if (_asn.VendId == "S00770")
|
|
{
|
|
SCPDB.Database.ExecuteSqlCommand("DELETE FROM [TS_UNI_API] where InterfaceType='receive' and BillNum='{0}'", _asn.AsnBillNum);
|
|
SCPDB.SaveChanges();
|
|
}
|
|
var check = SCP_ASN_CONTROLLER.Get_TS_UNI_API(_asn);
|
|
if (check.State == ReturnStatus.Failed)
|
|
{
|
|
Alert.Show(_asn.AsnBillNum + GetResourceKey("请勿重复提交数据!"));
|
|
return;
|
|
}
|
|
var ret = SCP_ASN_CONTROLLER.Save_TB_ASN_DETAIL(_asn, _list);
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
SET_ASN_STATE(GetResourceKey("发货成功"), AsnState.Ship);
|
|
GetV_TB_ASNData();
|
|
BindDetail();
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(GetResourceKey(string.Join("\n\r", ret.MessageList.ToArray())));
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|