1
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
@@ -69,6 +72,15 @@ namespace FineUIPro.Web.CLGL
|
||||
var tb = BLL.TwInputdetailService.GetListData(table, Grid2);
|
||||
Grid2.DataSource = tb;
|
||||
Grid2.DataBind();
|
||||
for (int i = 0; i < Grid2.Rows.Count; i++)
|
||||
{
|
||||
var model = Grid2.Rows[i].DataItem as Model.Tw_InOutDetailOutput;
|
||||
if (model.ActNum != model.PlanNum)
|
||||
{
|
||||
Grid2.Rows[i].RowCssClass = "red";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -278,8 +290,117 @@ namespace FineUIPro.Web.CLGL
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
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 = TwInputmasterService.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.PrintMap.Where(x => x.Value == result.TypeInt).Select(x => x.Key).FirstOrDefault(),
|
||||
};
|
||||
tw_PrintMasters.Add(printMaster);
|
||||
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_InputDetail
|
||||
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where x.InputMasterId == Id
|
||||
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)));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user