焊接管理导入修改
This commit is contained in:
@@ -111,7 +111,11 @@
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="80px" ColumnID="Number" DataField="Number"
|
||||
FieldType="String" HeaderText="数量" HeaderTextAlign="Center"
|
||||
FieldType="String" HeaderText="所需数量" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="80px" ColumnID="ActNumber" DataField="ActNumber"
|
||||
FieldType="String" HeaderText="实到数量" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="PackagingCode" DataField="PackagingCode"
|
||||
@@ -153,9 +157,9 @@
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
</script>
|
||||
function reloadGrid() {
|
||||
__doPostBack(null, 'reloadGrid');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -213,8 +213,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
private void BindGrid()
|
||||
{
|
||||
if (tvControlItem.SelectedNode == null) return;
|
||||
var view_HJGL_InstallDatas = BindData(Grid1.PageIndex+1, Grid1.PageSize,out int totalCount, out int componentCount, out int partCount);
|
||||
// 2.获取当前分页数据
|
||||
var view_HJGL_InstallDatas = BindData(Grid1.PageIndex + 1, Grid1.PageSize, out int totalCount, out int componentCount, out int partCount);
|
||||
// 2.获取当前分页数据
|
||||
Grid1.RecordCount = totalCount;
|
||||
var table = view_HJGL_InstallDatas;
|
||||
Grid1.DataSource = table;
|
||||
@@ -247,33 +247,34 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// 查询数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount, out int componentCount, out int partCount)
|
||||
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount, out int componentCount, out int partCount)
|
||||
{
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
|
||||
|
||||
// 一次性统计所有需要的数据(使用 GroupBy 优化)
|
||||
var stats = baseQuery
|
||||
.GroupBy(x => x.TypeStr)
|
||||
.Select(g => new { TypeStr = g.Key, Count = g.Count() })
|
||||
.ToList();
|
||||
|
||||
|
||||
// 从统计结果中提取数据
|
||||
totalCount = stats.Sum(s => s.Count);
|
||||
componentCount = stats.FirstOrDefault(s => s.TypeStr == "预制组件")?.Count ?? 0;
|
||||
partCount = stats.FirstOrDefault(s => s.TypeStr == "预制散件")?.Count ?? 0;
|
||||
|
||||
|
||||
// 分页保护
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
|
||||
|
||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
|
||||
|
||||
// 预制组件数量显示为1,预制散件保持原始数量
|
||||
foreach (var item in query)
|
||||
{
|
||||
if (item.TypeStr == "预制组件")
|
||||
{
|
||||
item.Number = 1;
|
||||
item.ActNumber = 1;
|
||||
}
|
||||
}
|
||||
return query;
|
||||
@@ -281,9 +282,9 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
|
||||
|
||||
private IQueryable<View_HJGL_InstallData> GetIQueryableInstallDatas()
|
||||
{
|
||||
{
|
||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData
|
||||
select x;
|
||||
select x;
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
@@ -315,7 +316,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
|
||||
}
|
||||
}
|
||||
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
|
||||
|
||||
return baseQuery;
|
||||
@@ -410,38 +411,39 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
|
||||
var q = (from x in baseQuery
|
||||
select new
|
||||
{
|
||||
管线号 = x.PipelineCode,
|
||||
类型 = x.TypeStr,
|
||||
编号 = x.Code,
|
||||
预制散件材料描述 = (x.Matdef=="" || x.Matdef==null)?"-":x.Matdef,
|
||||
数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
||||
所在包装编号 = x.PackagingCode,
|
||||
车次 = x.TrainNumber,
|
||||
流水段 = x.FlowingSection
|
||||
});
|
||||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
|
||||
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
||||
var q = (from x in baseQuery
|
||||
select new
|
||||
{
|
||||
管线号 = x.PipelineCode,
|
||||
类型 = x.TypeStr,
|
||||
编号 = x.Code,
|
||||
预制散件材料描述 = (x.Matdef == "" || x.Matdef == null) ? "-" : x.Matdef,
|
||||
所需数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
||||
实到数量 = x.TypeStr == "预制组件" ? 1 : (x.ActNumber ?? 1),
|
||||
所在包装编号 = x.PackagingCode,
|
||||
车次 = x.TrainNumber,
|
||||
流水段 = x.FlowingSection
|
||||
});
|
||||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
||||
|
||||
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
||||
|
||||
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
||||
FileInfo info = new FileInfo(path);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(path);
|
||||
|
||||
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
||||
FileInfo info = new FileInfo(path);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(path);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,93 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.UnitId = unitWork.UnitId;
|
||||
}
|
||||
|
||||
string col0 = pds[i].A;
|
||||
string col0 = Convert.ToString(pds[i].A);
|
||||
string col1 = Convert.ToString(pds[i].B);
|
||||
string col2 = Convert.ToString(pds[i].C);
|
||||
string col3 = Convert.ToString(pds[i].D);
|
||||
string col4 = Convert.ToString(pds[i].E);
|
||||
string col5 = Convert.ToString(pds[i].F);
|
||||
string col6 = Convert.ToString(pds[i].G);
|
||||
string col19 = Convert.ToString(pds[i].U);
|
||||
string col20 = Convert.ToString(pds[i].V);
|
||||
string col21 = Convert.ToString(pds[i].W);
|
||||
string col22 = Convert.ToString(pds[i].X);
|
||||
string col23 = Convert.ToString(pds[i].Y);
|
||||
string col24 = Convert.ToString(pds[i].Z);
|
||||
string col25 = Convert.ToString(pds[i].AA);
|
||||
string col26 = Convert.ToString(pds[i].AB);
|
||||
string col27 = Convert.ToString(pds[i].AC);
|
||||
bool hasRequiredError = false;
|
||||
Action<string> addRequiredError = colName =>
|
||||
{
|
||||
result.Add("第" + (i + 1).ToString() + "行," + colName + "," + "此项为必填项!" + "|");
|
||||
hasRequiredError = true;
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(col0))
|
||||
{
|
||||
addRequiredError("管线号");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col3))
|
||||
{
|
||||
addRequiredError("介质代号");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col4))
|
||||
{
|
||||
addRequiredError("管道等级");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col5))
|
||||
{
|
||||
addRequiredError("探伤比例");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col6))
|
||||
{
|
||||
addRequiredError("探伤类型");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col19))
|
||||
{
|
||||
addRequiredError("焊口号");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col20))
|
||||
{
|
||||
addRequiredError("材质1");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col21))
|
||||
{
|
||||
addRequiredError("材质2");
|
||||
}
|
||||
if (rbDiaType.SelectedValue == "1")
|
||||
{
|
||||
if (string.IsNullOrEmpty(col27))
|
||||
{
|
||||
addRequiredError("外径");
|
||||
}
|
||||
}
|
||||
else if (string.IsNullOrEmpty(col22))
|
||||
{
|
||||
addRequiredError("DN公称直径");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col23))
|
||||
{
|
||||
addRequiredError("达因");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col24))
|
||||
{
|
||||
addRequiredError("壁厚");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col25))
|
||||
{
|
||||
addRequiredError("焊缝类型");
|
||||
}
|
||||
if (string.IsNullOrEmpty(col26))
|
||||
{
|
||||
addRequiredError("焊口属性");
|
||||
}
|
||||
if (hasRequiredError)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string pipeLineId = string.Empty;
|
||||
if (string.IsNullOrEmpty(col0))
|
||||
{
|
||||
@@ -249,10 +335,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.PipelineCode = col0;
|
||||
}
|
||||
|
||||
pipeline.SingleNumber = pds[i].B;
|
||||
pipeline.SingleName = pds[i].C;
|
||||
pipeline.SingleNumber = col1;
|
||||
pipeline.SingleName = col2;
|
||||
|
||||
string col3 = pds[i].D;
|
||||
if (string.IsNullOrEmpty(col3))
|
||||
{
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "介质代号" + "," + "此项为必填项!" + "|");
|
||||
@@ -271,7 +356,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.MediumName = col3;
|
||||
}
|
||||
}
|
||||
string col4 = pds[i].E;
|
||||
if (string.IsNullOrEmpty(col4))
|
||||
{
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "管道等级" + "," + "此项为必填项!" + "|");
|
||||
@@ -290,7 +374,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.PipingClassCode = col4;
|
||||
}
|
||||
}
|
||||
string col5 = pds[i].F;
|
||||
if (!string.IsNullOrEmpty(col5))
|
||||
{
|
||||
var DetectionRate = getDetectionRate.FirstOrDefault(x => x.DetectionRateValue.ToString() == col5.Replace("%", "") || x.DetectionRateCode == col5);
|
||||
@@ -310,7 +393,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "探伤比例" + "," + "此项为必填项!" + "|");
|
||||
}
|
||||
|
||||
string col6 = pds[i].G;
|
||||
if (!string.IsNullOrEmpty(col6))
|
||||
{
|
||||
string typeStr = col6.ToString();
|
||||
@@ -449,7 +531,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.Remark = Convert.ToString(pds[i].T);
|
||||
|
||||
// 以下是焊口信息
|
||||
string col19 = Convert.ToString(pds[i].U);
|
||||
if (string.IsNullOrEmpty(col19))
|
||||
{
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "焊口号" + "," + "此项为必填项!" + "|");
|
||||
@@ -468,12 +549,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
pipeline.WeldJointCode = col19;
|
||||
}
|
||||
|
||||
string col20 = "";
|
||||
if (pds[i].V != null)
|
||||
{
|
||||
col20 = pds[i].V.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(col20))
|
||||
{
|
||||
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col20);
|
||||
@@ -493,12 +568,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "材质1" + "," + "此项为必填项!" + "|");
|
||||
}
|
||||
|
||||
string col21 = "";
|
||||
if (pds[i].W != null)
|
||||
{
|
||||
col21 = pds[i].W.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(col21))
|
||||
{
|
||||
var material = getMaterial.FirstOrDefault(x => x.MaterialCode == col21);
|
||||
@@ -518,12 +587,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "材质2" + "," + "此项为必填项!" + "|");
|
||||
}
|
||||
|
||||
string col22 = Convert.ToString(pds[i].X);
|
||||
string col27 = "";
|
||||
if (pds[i].AC != null)
|
||||
{
|
||||
col27 = pds[i].AC.ToString();
|
||||
}
|
||||
if (rbDiaType.SelectedValue == "1")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(col27))
|
||||
@@ -564,7 +627,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
|
||||
var col23 = Convert.ToString(pds[i].Y);
|
||||
if (col23 != null)
|
||||
{
|
||||
try
|
||||
@@ -582,7 +644,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "达因" + "," + "此项为必填项!" + "|");
|
||||
}
|
||||
|
||||
var col24 = Convert.ToString(pds[i].Z);
|
||||
if (col24 != null)
|
||||
{
|
||||
// var Thickness = Convert.ToDecimal(col24);
|
||||
@@ -641,7 +702,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
}
|
||||
|
||||
string col25 = Convert.ToString(pds[i].AA);
|
||||
if (!string.IsNullOrEmpty(col25))
|
||||
{
|
||||
var weldType = getWeldType.FirstOrDefault(x => x.WeldTypeCode == col25);
|
||||
@@ -699,7 +759,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
{
|
||||
result.Add("第" + (i + 1).ToString() + "行," + "焊缝类型" + "," + "此项为必填项!" + "|");
|
||||
}
|
||||
string col26 = Convert.ToString(pds[i].AB);
|
||||
if (!string.IsNullOrEmpty(col26))
|
||||
{
|
||||
var JointAttribute = BLL.DropListService.HJGL_JointAttribute();
|
||||
@@ -1324,4 +1383,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user