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.
174 lines
6.4 KiB
174 lines
6.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.Models.Enums;
|
|
using CK.SCP.Models.ScpEntity;
|
|
using CK.SCP.Utils;
|
|
using CK.SCP.Controller;
|
|
using FineUI;
|
|
|
|
namespace SCP.Views.富维冲压件
|
|
{
|
|
public partial class SCP_PO_QH_DETAIL : PageBase
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
if (CurrentUser.RoleList.Contains("期货合同"))
|
|
{
|
|
btnDelete.Hidden = false;
|
|
}
|
|
if (!string.IsNullOrEmpty(Request["PoBillNum"].Trim()))
|
|
{
|
|
F_PO_DETAIL.Hidden = false;
|
|
GetV_TB_POData();
|
|
BindDetail();
|
|
SetRoleRule();
|
|
}
|
|
else
|
|
{
|
|
F_PO_DETAIL.Hidden = true;
|
|
Search_TB_PO_DETAIL_VIEW((ret) => {
|
|
this.Grid_V_TB_PO_DETAIL.RecordCount = ret.Count();
|
|
var list = SortAndPage<V_TB_PO_DETAIL>(ret, Grid_V_TB_PO_DETAIL);
|
|
Grid_V_TB_PO_DETAIL.DataSource = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(SCP_PO_CONTROLLER.LOAD_PO_DETAIL_SUM(SCP_CONTRACT_CONTROLLER.GET_MAXPO_LIST(list.ToList())));
|
|
|
|
Grid_V_TB_PO_DETAIL.DataBind();
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|
|
private void SetRoleRule()
|
|
{
|
|
IsPriceVisible(Grid_V_TB_PO_DETAIL, "价格", "合同价格", "合同差额");
|
|
}
|
|
|
|
public void SearchV_TB_PO_DETAIL(Action<IQueryable<V_TB_PO_DETAIL>> p_action)
|
|
{
|
|
V_TB_PO_DETAIL _entity = new V_TB_PO_DETAIL();
|
|
_entity.PoBillNum = Request["PoBillNum"];
|
|
SCP_PO_CONTROLLER.Get_V_TB_PO_DETAIL_List(_entity, (_ret) => {
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_action(_ret.Result);
|
|
}
|
|
});
|
|
}
|
|
protected void btnInput_Click1(object sender, EventArgs e)
|
|
{
|
|
if (Grid_V_TB_PO_DETAIL.SelectedRowIndexArray.Count() == 0)
|
|
{
|
|
PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!"));
|
|
return;
|
|
}
|
|
List<string> po = new List<string>();
|
|
List<string> part = new List<string>();
|
|
for (int i = 0, count = Grid_V_TB_PO_DETAIL.Rows.Count; i < count; i++)
|
|
{
|
|
if (Grid_V_TB_PO_DETAIL.SelectedRowIndexArray.Contains(i))
|
|
{
|
|
object[] rowDataKeys = Grid_V_TB_PO_DETAIL.DataKeys[i];
|
|
po.Add(rowDataKeys[1] as string);
|
|
}
|
|
}
|
|
for (int i = 0, count = Grid_V_TB_PO_DETAIL.Rows.Count; i < count; i++)
|
|
{
|
|
if (Grid_V_TB_PO_DETAIL.SelectedRowIndexArray.Contains(i))
|
|
{
|
|
object[] rowDataKeys = Grid_V_TB_PO_DETAIL.DataKeys[i];
|
|
part.Add(rowDataKeys[3] as string);
|
|
}
|
|
}
|
|
|
|
var ret = SCP_PO_CONTROLLER.ToVoid_ts_uni_api(po, part);
|
|
if (ret.State == ReturnStatus.Succeed && ret.Result == true)
|
|
{
|
|
Alert.Show("订单明细作废成功");
|
|
BindDetail();
|
|
}
|
|
else
|
|
{
|
|
Alert.Show(string.Join("<br>", ret.MessageList));
|
|
}
|
|
}
|
|
public void Search_TB_PO_DETAIL_VIEW(Action<IQueryable<V_TB_PO_DETAIL>> p_action)
|
|
{
|
|
V_TB_PO_DETAIL _entity = new V_TB_PO_DETAIL();
|
|
_entity.PoBillNum = Request["PoBillNum"];
|
|
if (string.IsNullOrEmpty(Request["PoBillNum"].Trim()))
|
|
{
|
|
if (!string.IsNullOrEmpty("PartCode"))
|
|
{
|
|
_entity.PartCode = Request["PartCode"];
|
|
}
|
|
if (!string.IsNullOrEmpty(Request["State"]))
|
|
{
|
|
_entity.State = int.Parse(Request["State"]);
|
|
}
|
|
}
|
|
SCP_PO_CONTROLLER.Get_V_TB_PO_DETAIL_List(_entity, (_ret) => {
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_action(_ret.Result);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void GetV_TB_POData()
|
|
{
|
|
V_TB_PO _entity = new V_TB_PO();
|
|
_entity.PoBillNum = Request["PoBillNum"];
|
|
_entity.UserInAddress = CurrentUser.FactoryList;
|
|
|
|
SCP_PO_CONTROLLER.Get_V_TB_PO_List(_entity, (_ret) =>
|
|
{
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
var _result = _ret.Result.FirstOrDefault();
|
|
Session["Order"] = _result;
|
|
this.TXT_PoBillNum.Text = _result.PoBillNum;
|
|
this.DP_BeginTime.SelectedDate = _result.BeginTime;
|
|
this.TXT_Site.Text = _result.Site_Desc;
|
|
this.TXT_State_DESC.Text = _result.State_DESC;
|
|
this.TXT_VendId.Text = _result.VendId;
|
|
this.TXT_VendName.Text = _result.VendName;
|
|
this.txtRemark.Text = _result.Remark;
|
|
}
|
|
});
|
|
}
|
|
|
|
public void BindDetail()
|
|
{
|
|
SearchV_TB_PO_DETAIL((ret) => {
|
|
this.Grid_V_TB_PO_DETAIL.RecordCount = ret.Count();
|
|
var list = SortAndPage<V_TB_PO_DETAIL>(ret, Grid_V_TB_PO_DETAIL);
|
|
Grid_V_TB_PO_DETAIL.DataSource = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(SCP_PO_CONTROLLER.LOAD_PO_DETAIL_SUM(SCP_CONTRACT_CONTROLLER.GET_MAXPO_LIST(list.ToList())));
|
|
Grid_V_TB_PO_DETAIL.DataBind();
|
|
});
|
|
}
|
|
protected void Grid_V_TB_PO_DETAIL_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
Grid_V_TB_PO_DETAIL.SortDirection = e.SortDirection;
|
|
Grid_V_TB_PO_DETAIL.SortField = e.SortField;
|
|
BindDetail();
|
|
}
|
|
protected void Grid_V_TB_PO_DETAIL_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindDetail();
|
|
}
|
|
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid_V_TB_PO_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
|
|
|
|
BindDetail();
|
|
}
|
|
|
|
|
|
}
|
|
}
|