2024-09-18 10:48:34 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using FineUIPro.Web.HSSE.EduTrain;
|
2024-09-27 18:17:21 +08:00
|
|
|
|
using Model;
|
2024-09-18 10:48:34 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-09-27 18:17:21 +08:00
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.IO;
|
2024-09-18 10:48:34 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CLGL
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class InPlanMaster : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
|
InitDrpList();
|
|
|
|
|
|
// 绑定表格
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 绑定数据
|
|
|
|
|
|
private void InitDrpList()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
|
|
|
|
|
drpWarehouse.DataTextField = "Text";
|
|
|
|
|
|
drpWarehouse.DataValueField = "Value";
|
|
|
|
|
|
drpWarehouse.DataSource = BLL.DropListService .HJGL_WarehouseCode();
|
|
|
|
|
|
drpWarehouse.DataBind();
|
|
|
|
|
|
Funs.FineUIPleaseSelect(this.drpWarehouse);
|
|
|
|
|
|
drpTypeInt.DataTextField = "Key";
|
|
|
|
|
|
drpTypeInt.DataValueField = "Value";
|
|
|
|
|
|
drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x=>x.Key.Contains("入库"));
|
|
|
|
|
|
drpTypeInt.DataBind();
|
|
|
|
|
|
Funs.FineUIPleaseSelect(this.drpTypeInt);
|
|
|
|
|
|
drpStates.DataTextField = "Key";
|
|
|
|
|
|
drpStates.DataValueField = "Value";
|
|
|
|
|
|
drpStates.DataSource = BLL.TwConst.StateMap;
|
|
|
|
|
|
drpStates.DataBind();
|
|
|
|
|
|
Funs.FineUIPleaseSelect(this.drpStates);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.Tw_InOutMasterOutput table = new Model.Tw_InOutMasterOutput();
|
|
|
|
|
|
table.ProjectId=this.CurrUser.LoginProjectId;
|
|
|
|
|
|
table.InOutType = (int?)TwConst.InOutType.入库;
|
|
|
|
|
|
if (drpTypeInt.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
table.TypeInt = Convert.ToInt32(drpTypeInt.SelectedValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (drpStates.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
table.State = Convert.ToInt32(drpStates.SelectedValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (drpWarehouse.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
table.WarehouseCode = drpWarehouse.SelectedValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
var tb = BLL.TwInOutplanmasterService.GetListData(table, Grid1);
|
|
|
|
|
|
Grid1.RecordCount = TwInOutplanmasterService.Count;
|
|
|
|
|
|
Grid1.DataSource = tb;
|
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
|
|
|
|
|
|
Grid2.DataSource=null;
|
|
|
|
|
|
Grid2.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void BindDetailGrid(string inOutPlanMasterId)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.Tw_InOutDetailOutput table = new Model.Tw_InOutDetailOutput();
|
|
|
|
|
|
table.InOutPlanMasterId = inOutPlanMasterId;
|
2024-11-12 17:56:01 +08:00
|
|
|
|
table.MaterialCode = txtMaterialCode.Text;
|
2024-09-18 10:48:34 +08:00
|
|
|
|
var tb = BLL.TwInOutplandetailService.GetListData(table, Grid2);
|
|
|
|
|
|
Grid2.DataSource = tb;
|
|
|
|
|
|
Grid2.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region GV 数据操作
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 过滤表头
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
//protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// this.BindGrid();
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
|
this.Grid1.SortField = e.SortField;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.RowIndex >= 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
string ID = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|
|
|
|
|
BindDetailGrid(ID);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 分页显示条数下拉框
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 数据编辑事件
|
|
|
|
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 新增
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnImport_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterDataIn.aspx?", "导入 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 编辑按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string ID = Grid1.SelectedRowID;
|
|
|
|
|
|
var model = BLL.TwInOutplanmasterService.GetById(ID);
|
|
|
|
|
|
if (model != null) ///已上报时不能删除
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterEdit.aspx?Id={0}", ID, "编辑 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnEdit_Click(null, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 批量删除
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
|
|
|
|
{
|
|
|
|
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
|
|
|
|
var model = BLL.TwInOutplanmasterService.GetById(rowID);
|
|
|
|
|
|
if (model.State == (int)TwConst.State.已审核|| model.State == (int)TwConst.State.已完成)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
BLL.TwInOutplanmasterService.DeleteById(rowID);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnPassMaster_OnClick(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string planId = Grid1.SelectedRowID;
|
|
|
|
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
|
|
|
|
if (planMaster.State != (int)TwConst.State.待审核)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
planMaster.State = (int)TwConst.State.已审核;
|
2024-09-24 20:38:50 +08:00
|
|
|
|
planMaster.AuditMan=this.CurrUser.PersonId;
|
|
|
|
|
|
planMaster.AuditDate = DateTime.Now;
|
2024-09-18 10:48:34 +08:00
|
|
|
|
TwInOutplanmasterService.Update(planMaster);
|
|
|
|
|
|
ShowNotify("审核通过!", MessageBoxIcon.Success);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnGenInMaster_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string planId = Grid1.SelectedRowID;
|
|
|
|
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
2024-09-24 20:38:50 +08:00
|
|
|
|
if (planMaster.State != (int)TwConst.State.已审核)
|
2024-09-18 10:48:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-09-24 20:38:50 +08:00
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterEdit.aspx?Id={0}", Grid1.SelectedRowID, "编辑 - ")));
|
|
|
|
|
|
|
2024-09-18 10:48:34 +08:00
|
|
|
|
}
|
2024-09-24 20:38:50 +08:00
|
|
|
|
//if ( planMaster.State != (int)TwConst.State.已审核)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// TwInputmasterService.GenInMasterByPlanId(planId);
|
|
|
|
|
|
// BindGrid();
|
|
|
|
|
|
// ShowNotify("生成入库单成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
//}
|
2024-09-18 10:48:34 +08:00
|
|
|
|
|
2024-09-24 20:38:50 +08:00
|
|
|
|
}
|
2024-09-18 10:48:34 +08:00
|
|
|
|
|
2024-09-24 20:38:50 +08:00
|
|
|
|
protected void btnRevokeGenInMaster_Click(object sender, EventArgs e)
|
2024-09-18 10:48:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string planId = Grid1.SelectedRowID;
|
|
|
|
|
|
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
|
|
|
|
|
if (planMaster.State != (int)TwConst.State.已完成)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
TwInputmasterService.RevokeGenInMasterByPlanId(planId);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
ShowNotify("撤销入库单成功!",MessageBoxIcon.Success);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 关闭弹出窗
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关闭弹出窗
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 获取权限按钮
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
|
{
|
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.Tw_InPlanMasterMenuId);
|
|
|
|
|
|
if (buttonList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnImport.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
|
this.btnGenInMaster.Hidden = false;
|
|
|
|
|
|
this.btnRevokeGenInMaster.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAuditing))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnPassMaster.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 导出按钮
|
|
|
|
|
|
/// 导出按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Response.ClearContent();
|
|
|
|
|
|
string filename = Funs.GetNewFileName();
|
|
|
|
|
|
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("出入库计划主表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
|
|
|
|
|
Response.ContentType = "application/excel";
|
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
|
|
|
|
|
this.Grid1.PageSize = 500;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
Response.Write(GetGridTableHtml(Grid1));
|
|
|
|
|
|
Response.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导出方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string GetGridTableHtml(Grid grid)
|
|
|
|
|
|
{
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
|
|
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
foreach (GridRow row in grid.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
|
|
|
|
if (column.ColumnID == "tfNumber")
|
|
|
|
|
|
{
|
|
|
|
|
|
html = (row.FindControl("lblNumber") as System.Web.UI.WebControls.Label).Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</table>");
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
2024-09-27 18:17:21 +08:00
|
|
|
|
|
2024-09-18 10:48:34 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-09-27 18:17:21 +08:00
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "btnInPlanMasterPrint")
|
|
|
|
|
|
{
|
|
|
|
|
|
Print(e.RowID);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Print(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
BLL.FastReportService.ResetData();
|
|
|
|
|
|
if (string.IsNullOrEmpty(Id))
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Tw_InOutMasterOutput queryModel = new Tw_InOutMasterOutput()
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = Id
|
|
|
|
|
|
};
|
|
|
|
|
|
var result =TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault();
|
|
|
|
|
|
List<Model.Tw_PrintMaster> tw_PrintMasters = new List<Model.Tw_PrintMaster>();
|
|
|
|
|
|
List<Model.Tw_PrintDetail> tw_PrintDetails = new List<Model.Tw_PrintDetail>();
|
|
|
|
|
|
Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ReqUnitName = result.ReqUnitName,
|
|
|
|
|
|
CusBillCode = result.CusBillCode,
|
|
|
|
|
|
CreateDate = result.CreateDate.Value.ToString("yyyy-MM-dd"),
|
|
|
|
|
|
ProjectName = ProjectService.GetProjectNameByProjectId(result.ProjectId),
|
|
|
|
|
|
CategoryString = result.CategoryString,
|
|
|
|
|
|
BillName = TwConst.PlanPrintMap.Where(x => x.Value == result.TypeInt).Select(x => x.Key).FirstOrDefault(),
|
2024-11-07 16:22:03 +08:00
|
|
|
|
AuditManName = !string.IsNullOrEmpty(result.AuditMan) ? BLL.Person_PersonsService.getSignatureUrl(result.AuditMan) : "",
|
|
|
|
|
|
AuditDate = string.Format("{0:yyyy-MM-dd}", result.AuditDate),
|
|
|
|
|
|
AuditManName2 = !string.IsNullOrEmpty(result.AuditMan2) ? BLL.Person_PersonsService.getSignatureUrl(result.AuditMan2) : "",
|
|
|
|
|
|
AuditDate2 = string.Format("{0:yyyy-MM-dd}", result.AuditDate2),
|
2024-11-12 17:56:01 +08:00
|
|
|
|
WarehouseManName = !string.IsNullOrEmpty(result.CreateManName) ? BLL.Person_PersonsService.getSignatureUrl(result.CreateManName) : "",
|
|
|
|
|
|
WarehouseManAuditDate = string.Format("{0:yyyy-MM-dd}", result.CreateDate),
|
2024-09-27 18:17:21 +08:00
|
|
|
|
};
|
|
|
|
|
|
tw_PrintMasters.Add(printMaster);
|
2024-11-07 16:22:03 +08:00
|
|
|
|
// orderApproveIn.ProjectManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ProjectManager) : "";
|
2024-09-27 18:17:21 +08:00
|
|
|
|
DataTable Table1 = LINQToDataTable(tw_PrintMasters);
|
|
|
|
|
|
if (Table1 != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Table1.TableName = "Table1";
|
|
|
|
|
|
}
|
|
|
|
|
|
Tw_InOutPlanDetail_Relation queryModel2 = new Tw_InOutPlanDetail_Relation()
|
|
|
|
|
|
{
|
|
|
|
|
|
InOutPlanMasterId = Id
|
|
|
|
|
|
};
|
|
|
|
|
|
var ListDetailRelation =TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList();
|
|
|
|
|
|
int SortIndex = 1;
|
|
|
|
|
|
int SortIndex2 = 1;
|
|
|
|
|
|
var tw_PrintDetailRelation=(from x in ListDetailRelation
|
|
|
|
|
|
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
|
|
|
|
|
join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
|
|
|
|
|
join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId
|
|
|
|
|
|
select new Model.Tw_PrintDetail
|
|
|
|
|
|
{
|
|
|
|
|
|
SortIndex=SortIndex++,
|
|
|
|
|
|
PipelineCode=z.PipelineCode,
|
|
|
|
|
|
PipelineComponentCode=x.PrefabricatedComponents,
|
|
|
|
|
|
MaterialCode=y.MaterialCode,
|
|
|
|
|
|
MaterialDef=y.MaterialDef,
|
|
|
|
|
|
MaterialSpec=y.MaterialSpec,
|
|
|
|
|
|
MaterialUnit=y.MaterialUnit,
|
|
|
|
|
|
PlanNum = (x.Number ?? 0).ToString(),
|
|
|
|
|
|
UnitWorkName = m.UnitWorkName,
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
var UnitWorkName= tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName;
|
|
|
|
|
|
Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail
|
|
|
|
|
|
{
|
|
|
|
|
|
MaterialDef = "材料编码合计"
|
|
|
|
|
|
};
|
|
|
|
|
|
var tw_PrintDetail = ( from x in Funs.DB.Tw_InOutPlanDetail
|
|
|
|
|
|
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
|
|
|
|
|
where x.InOutPlanMasterId==Id
|
2024-11-12 17:56:01 +08:00
|
|
|
|
orderby x.SortIndex
|
2024-09-27 18:17:21 +08:00
|
|
|
|
select new Model.Tw_PrintDetail
|
|
|
|
|
|
{
|
|
|
|
|
|
SortIndex =0,
|
|
|
|
|
|
PipelineCode = "-",
|
|
|
|
|
|
PipelineComponentCode = "-",
|
|
|
|
|
|
MaterialCode = y.MaterialCode,
|
|
|
|
|
|
MaterialDef = y.MaterialDef,
|
|
|
|
|
|
MaterialSpec = y.MaterialSpec,
|
|
|
|
|
|
MaterialUnit = y.MaterialUnit,
|
|
|
|
|
|
PlanNum = (x.PlanNum ?? 0).ToString(),
|
|
|
|
|
|
ActNum = (x.ActNum ?? 0).ToString(),
|
|
|
|
|
|
UnitWorkName = UnitWorkName,
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
foreach (var item in tw_PrintDetail)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.SortIndex = SortIndex2++;
|
|
|
|
|
|
}
|
|
|
|
|
|
tw_PrintDetails.AddRange(tw_PrintDetailRelation);
|
|
|
|
|
|
tw_PrintDetails.Add(tw_PrintDetailRelation2);
|
|
|
|
|
|
tw_PrintDetails.AddRange(tw_PrintDetail);
|
|
|
|
|
|
DataTable Data = LINQToDataTable(tw_PrintDetails);
|
|
|
|
|
|
if (Data != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Data.TableName = "Data";
|
|
|
|
|
|
}
|
|
|
|
|
|
BLL.FastReportService.ResetData();
|
|
|
|
|
|
BLL.FastReportService.AddFastreportTable(Table1);
|
|
|
|
|
|
BLL.FastReportService.AddFastreportTable(Data);
|
|
|
|
|
|
string initTemplatePath = "";
|
|
|
|
|
|
string rootPath = Server.MapPath("~/");
|
|
|
|
|
|
initTemplatePath = "File\\Fastreport\\材料入库计划单.frx";
|
|
|
|
|
|
|
|
|
|
|
|
if (File.Exists(rootPath + initTemplatePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-09-18 10:48:34 +08:00
|
|
|
|
|
2024-11-12 17:56:01 +08:00
|
|
|
|
protected void txtMaterialCode_OnTextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindDetailGrid(Grid1.SelectedRowID);
|
|
|
|
|
|
}
|
2024-09-18 10:48:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|