c1
zl!XF@JkYiDw3bRx)x;@y^gysV8Wp^n}5_z2IfX
ze&9B&KLjYb0b6wd?C}@?vkcs!zm+@e3iJS@cAh}jrpx@31t{eG6w3;9M>FW>2
zTLnPNu>tU|bs&_t3k1Gu2)xIqWl(4|EOn0o_c1YWv)gEJ2uC|MP6U_1NwBcXc(~-7
z4BF!+fbHms@U%q=^ax3XOus4MVK)^v2xh=Tt(h=dX*Qg8nG4Sn=0PWi`LNu30nFeo
z1lO2FuvLCB?DSj=w>6f6yWvu(l3M}v)yY|lmC)936|fSrpdw%m=!{znZXc5FL#5);k407N=pG<5{?=UIY`pied5K%TS|M0-Jv>fh3EoK;N(Q>VF$f
zMwG!Y-aSY%y$4U+@57Pc`*3~SeXvq~2wn9bqu!pu`6181U#9{}y1ampj#WS(FuYZK
z3A$=8;Wzg;kmg(s0il1vAi-a-e^?E;$G(HB?Dz08_5+!qXz(VhCC5MryDO(MKH9aI
zD-M&NY`sE#3y&!oPSJXyKy1}G=#c>Y(hMKtC`1fC!U7SOj9%izsc49#p@x1x_0yx;
zr&R`uVlp`_yi&0EsL5>Dcfca)xB1)>IhaX_J=xo+YRBsyMX~65&DDPn=WWSwIY%j@+(~>A}-{iwM
zO7+Bc3h*leA5qzqzmtkNV>;BA{iXao9F`+7cLYud08U~(8Hiv~RsApc6yuue;Z
zQ3&xgiNhl)ShQfM=Zdl-cQVZ<=vX-P=;3*um?^u
zPct=nT09+|0q-XspVyw(f!CSGGO{&h@R@uTU!JeXSLUnoTktjcE%~kZwzZvWyViEE
z?O8jl)~|MWEkno@$_QnJ@NWiebK4r3Cj
z`!CQyEk2D3q8|OUvSd+Z(^gm2xJPg|FOY+FZFXGeBQF6XS|FwP3Mq7r&B#aWJZ7#pH
zjjbpiCkk+j433M5j|ofQxrc>C28Z&7#KeUlzdHhYWK~f+MEPQI`Uw2vCZc!dhDdn`BZM)6WSAf|
zMf`+lgD^w1Mf{AQcypu{2up+&g3cqX5p=VL;y)m4>iiTYNZpq;KsO6x@Wh4(z3_HW
z0^WujhZ_8Lrv)+$NeN^_9C@-PfI`vlr+=V>dqVt|QS2}-RUD5u|LE3TU|s0%6TG|f
zv3#n>w@9G#E0OUcvBvwBbcs9~Zy)8B0(CnLI)KMKpGYxd(r*X+YYbs|mz-m9d`_RTx9
z@6dm15=VmvI+@Q}PB%!uy*~C>K8;({c5))2U-@ZA@pa`h@E$1Lt&IhDw1Sae$@zJ-
z8lGH=OBVlro}y{amvq{6j^?@FQ@%tR*{*b)Y^cHiEk6T$pM?V=wYu@xP4jjAy*9eg
z#_MEff!}v^;QfAl*Dld}05>n<_lyY^Jy7Jg#6aRG{GQ9w9$t0YK3ZaFQu?2$f&T-3
C5Il$g
diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs
index 29002a1c..c178df09 100644
--- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs
@@ -1,4 +1,5 @@
using Aspose.Words;
+using Aspose.Words.Tables;
using BLL;
using System;
using System.Collections.Generic;
@@ -45,7 +46,7 @@ namespace FineUIPro.Web.HSSE.Check
Technique_CheckItemSetService.InitCheckItemSetDropDownList(this.drpSupCheckItemSet, "2", "0", true);
////权限按钮方法
this.GetButtonPower();
- btnNew.OnClientClick = Window1.GetShowReference("CheckSpecialEdit.aspx") + "return false;";
+ //btnNew.OnClientClick = Window1.GetShowReference("CheckSpecialEdit.aspx") + "return false;";
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
@@ -203,7 +204,9 @@ namespace FineUIPro.Web.HSSE.Check
}
else
{
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckSpecialEdit.aspx?CheckSpecialId={0}", CheckSpecialId, "编辑 - ")));
+ //PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckSpecialEdit.aspx?CheckSpecialId={0}", CheckSpecialId, "编辑 - ")));
+ //pc端只有台账
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckSpecialView.aspx?CheckSpecialId={0}", CheckSpecialId, "查看 - ")));
}
}
}
@@ -254,7 +257,7 @@ namespace FineUIPro.Web.HSSE.Check
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
- this.btnNew.Hidden = false;
+ //this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
@@ -357,7 +360,7 @@ namespace FineUIPro.Web.HSSE.Check
initTemplatePath = "File\\Word\\HSSE\\专项检查.doc";
uploadfilepath = rootPath + initTemplatePath;
newUrl = uploadfilepath.Replace(".doc", string.Format("{0:yyyy-MM}", DateTime.Now) + ".doc");
- filePath = initTemplatePath.Replace(".doc", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
+ //filePath = initTemplatePath.Replace(".doc", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf");
if (File.Exists(newUrl)) {
File.Delete(newUrl);
}
@@ -427,6 +430,65 @@ namespace FineUIPro.Web.HSSE.Check
}
}
+ Bookmark bookmarkWorkAreaName = doc.Range.Bookmarks["WorkAreaName"];
+ if (bookmarkWorkAreaName != null)
+ {
+ if (checkSpecial != null)
+ {
+ if (!string.IsNullOrEmpty(checkSpecial.WorkAreaId))
+ {
+ bookmarkWorkAreaName.Text = UnitWorkService.GetUnitWorkName(checkSpecial.WorkAreaId);
+ }
+
+ }
+
+ }
+
+ Bookmark bookmarkResponsibleName = doc.Range.Bookmarks["ResponsibleName"];
+ if (bookmarkResponsibleName != null)
+ {
+ if (checkSpecial != null)
+ {
+ if (!string.IsNullOrEmpty(checkSpecial.ResponsibleUnit))
+ {
+ bookmarkResponsibleName.Text = UnitService.GetUnitNameByUnitId(checkSpecial.ResponsibleUnit);
+ }
+
+ }
+
+ }
+
+ Bookmark bookmarkQuestionName = doc.Range.Bookmarks["QuestionName"];
+ if (bookmarkQuestionName != null)
+ {
+ if (checkSpecial != null)
+ {
+ if (!string.IsNullOrEmpty(checkSpecial.QuestionType))
+ {
+ bookmarkQuestionName.Text = UnitService.GetQuestionTypeId(checkSpecial.QuestionType);
+ }
+
+ }
+
+ }
+
+ Bookmark bookmarkPartInPersonNames = doc.Range.Bookmarks["PartInPersonNames"];
+ if (bookmarkPartInPersonNames != null)
+ {
+ if (checkSpecial != null)
+ {
+ if (!string.IsNullOrEmpty(checkSpecial.PartInPersonNames))
+ {
+ bookmarkPartInPersonNames.Text = checkSpecial.PartInPersonNames;
+ }
+
+ }
+
+ }
+ //WorkAreaName
+ // ResponsibleName
+ // QuestionName
+ // PartInPersonNames
//专项检查列表
Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc);
builder.MoveToBookmark("tab");
@@ -443,6 +505,57 @@ namespace FineUIPro.Web.HSSE.Check
orderby x.SortIndex
select x).ToList();
int num = 1;
+ #region 插入表头
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ builder.CellFormat.Width = 40;
+ builder.Write("序号");
+
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ builder.CellFormat.Width = 100;
+ builder.Write("问题描述");
+
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ builder.CellFormat.Width = 250;
+ builder.CellFormat.WrapText = true;
+ builder.Write("检查内容");
+
+ //builder.InsertCell();
+ //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ //builder.CellFormat.Width = 60;
+ //builder.Write("处理结果");
+
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ builder.CellFormat.Width = 60;
+ builder.Write("整改期限");
+
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ builder.CellFormat.Width = 60;
+ builder.Write("处理措施");
+ builder.EndRow();
+ #endregion
foreach (Model.View_CheckSpecialDetail detail in checkSpecialDetails)
{
//序号
@@ -451,80 +564,89 @@ namespace FineUIPro.Web.HSSE.Check
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 20;
+ builder.CellFormat.Width = 40;
builder.Write(num.ToString());
- //单位工程
- builder.InsertCell();
- builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
- builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
- builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
- builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 55;
- builder.Write(string.IsNullOrEmpty(detail.CheckAreaName) ? "" : detail.CheckAreaName);
- //单位
- builder.InsertCell();
- builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
- builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
- builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
- builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 120;
- builder.Write(string.IsNullOrEmpty(detail.UnitName) ? "" : detail.UnitName);
+ ////单位工程
+ //builder.InsertCell();
+ //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ //builder.CellFormat.Width = 60;
+ //builder.Write(string.IsNullOrEmpty(detail.CheckAreaName) ? "" : detail.CheckAreaName);
+ ////单位
+ //builder.InsertCell();
+ //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ //builder.CellFormat.Width = 120;
+ //builder.Write(string.IsNullOrEmpty(detail.UnitName) ? "" : detail.UnitName);
//问题描述
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 40;
- builder.Write(string.IsNullOrEmpty(detail.Unqualified) ? "" : detail.Unqualified);
- //问题类型
- builder.InsertCell();
- builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
- builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
- builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
- builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
builder.CellFormat.Width = 100;
- builder.Write(string.IsNullOrEmpty(detail.CheckItemName)?"": detail.CheckItemName);
+ builder.Write(string.IsNullOrEmpty(detail.Unqualified) ? "" : detail.Unqualified);
+ //问题内容
+ builder.InsertCell();
+ builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;//水平居中对齐
+ builder.CellFormat.Width = 250;
+ builder.CellFormat.WrapText = true;
+ builder.Write(string.IsNullOrEmpty(detail.CheckItemSetContent)?"": detail.CheckItemSetContent);
- //处理结果
+ ////处理结果
+ //builder.InsertCell();
+ //builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
+ //builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
+ //builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
+ //builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
+ //builder.CellFormat.Width = 60;
+ //builder.Write(string.IsNullOrEmpty(detail.CompleteStatusName) ? "" : detail.CompleteStatusName);
+ //整改期限
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 50;
- builder.Write(string.IsNullOrEmpty(detail.CompleteStatusName) ? "" : detail.CompleteStatusName);
+ builder.CellFormat.Width = 60;
+ builder.Write(string.Format("{0:yyyy-MM-dd}", detail.Rectification_Date));
//隐患类别
builder.InsertCell();
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
- builder.CellFormat.Width = 50;
- builder.Write(string.IsNullOrEmpty(detail.HiddenHazardTypeName) ? "" : detail.HiddenHazardTypeName);
+ builder.CellFormat.Width = 60;
+ builder.Write(string.IsNullOrEmpty(detail.HandleStepLink) ? "" : detail.HandleStepLink);
builder.EndRow();
num++;
}
builder.EndTable();
doc.Save(newUrl);
//生成PDF文件
- string pdfUrl = newUrl.Replace(".doc", ".pdf");
+ //string pdfUrl = newUrl.Replace(".doc", ".pdf");
Document doc1 = new Aspose.Words.Document(newUrl);
//验证参数
- if (doc1 == null) { throw new Exception("Word文件无效"); }
- doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
- string fileName = Path.GetFileName(filePath);
- FileInfo info = new FileInfo(pdfUrl);
+ //if (doc1 == null) { throw new Exception("Word文件无效"); }
+ //doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
+ string fileName = Path.GetFileName(newUrl);
+ FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
- Response.TransmitFile(pdfUrl, 0, fileSize);
+ Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
- File.Delete(pdfUrl);
+ //File.Delete(pdfUrl);
}
#endregion
}
diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
index 3e87226e..4eb70936 100644
--- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
@@ -33,6 +33,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -50,28 +62,28 @@
-
-
- --%>
+ <%--
-
- --%>
+
-
-
- --%>
+
-
-
+ --%>
//------------------------------------------------------------------------------
-namespace FineUIPro.Web.HSSE.Check {
-
-
- public partial class CheckSpecialView {
-
+namespace FineUIPro.Web.HSSE.Check
+{
+
+
+ public partial class CheckSpecialView
+ {
+
///
/// form1 控件。
///
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
-
+
///
/// PageManager1 控件。
///
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.PageManager PageManager1;
-
+
///
/// SimpleForm1 控件。
///
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Form SimpleForm1;
-
+
///
/// txtCheckSpecialCode 控件。
///
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtCheckSpecialCode;
-
+
///
/// rbType 控件。
///
@@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.RadioButtonList rbType;
-
+
///
/// txtSupCheckItemSet 控件。
///
@@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtSupCheckItemSet;
-
+
///
/// txtCheckDate 控件。
///
@@ -74,7 +76,34 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtCheckDate;
-
+
+ ///
+ /// txtResponsibleUnit 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtResponsibleUnit;
+
+ ///
+ /// txtWorkAreaId 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtWorkAreaId;
+
+ ///
+ /// txtQuestionType 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtQuestionType;
+
///
/// txtPartInPersons 控件。
///
@@ -83,7 +112,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtPartInPersons;
-
+
///
/// txtPartInPersonNames 控件。
///
@@ -92,7 +121,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtPartInPersonNames;
-
+
///
/// Grid1 控件。
///
@@ -101,7 +130,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Grid Grid1;
-
+
///
/// Toolbar1 控件。
///
@@ -110,7 +139,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Toolbar Toolbar1;
-
+
///
/// lbTemp 控件。
///
@@ -119,7 +148,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Label lbTemp;
-
+
///
/// btnAttachUrl 控件。
///
@@ -128,7 +157,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnAttachUrl;
-
+
///
/// ToolbarFill1 控件。
///
@@ -137,7 +166,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarFill ToolbarFill1;
-
+
///
/// btnClose 控件。
///
@@ -146,7 +175,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnClose;
-
+
///
/// hdId 控件。
///
@@ -155,7 +184,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.HiddenField hdId;
-
+
///
/// hdAttachUrl 控件。
///
@@ -164,7 +193,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.HiddenField hdAttachUrl;
-
+
///
/// WindowAtt 控件。
///
@@ -173,7 +202,7 @@ namespace FineUIPro.Web.HSSE.Check {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Window WindowAtt;
-
+
///
/// Window1 控件。
///
diff --git a/SGGL/FineUIPro.Web/HSSE/InformationAnalysis/CheckAnalysis.aspx.cs b/SGGL/FineUIPro.Web/HSSE/InformationAnalysis/CheckAnalysis.aspx.cs
index 7ca15220..e1888b58 100644
--- a/SGGL/FineUIPro.Web/HSSE/InformationAnalysis/CheckAnalysis.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/InformationAnalysis/CheckAnalysis.aspx.cs
@@ -59,37 +59,66 @@ namespace FineUIPro.Web.HSSE.InformationAnalysis
dtCheck.Columns.Add("检查类型", typeof(string));
dtCheck.Columns.Add("数量", typeof(string));
- List newCheckAnalyseView = new List();
- var checkAnalyseView = from x in Funs.DB.View_CheckAnalysis
- where x.ProjectId == this.ProjectId
- select x;
- if (!string.IsNullOrEmpty(this.txtStarTime.Text))
- {
- checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStarTime.Text));
- }
- if (!string.IsNullOrEmpty(this.txtEndTime.Text))
- {
- checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndTime.Text));
- }
- if (checkAnalyseView.Count() > 0)
- {
- foreach (var item in checkAnalyseView)
- {
- Model.SpResourceCollection view = new Model.SpResourceCollection
- {
- UnitName = BLL.Check_ProjectCheckItemSetService.ConvertCheckItemType(item.CheckItem),
- TotalCount = 1
- };
- newCheckAnalyseView.Add(view);
- }
- }
+ //List newCheckAnalyseView = new List();
+ //var checkAnalyseView = from x in Funs.DB.View_CheckAnalysis
+ // where x.ProjectId == this.ProjectId
+ // select x;
+ //if (!string.IsNullOrEmpty(this.txtStarTime.Text))
+ //{
+ // checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStarTime.Text));
+ //}
+ //if (!string.IsNullOrEmpty(this.txtEndTime.Text))
+ //{
+ // checkAnalyseView = checkAnalyseView.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndTime.Text));
+ //}
+ //if (checkAnalyseView.Count() > 0)
+ //{
+ // foreach (var item in checkAnalyseView)
+ // {
+ // Model.SpResourceCollection view = new Model.SpResourceCollection
+ // {
+ // UnitName = BLL.Check_ProjectCheckItemSetService.ConvertCheckItemType(item.CheckItem),
+ // TotalCount = 1
+ // };
+ // newCheckAnalyseView.Add(view);
+ // }
+ //}
- var checkType = newCheckAnalyseView.Select(x => x.UnitName).Distinct();
- foreach (var itemType in checkType)
+ //var checkType = newCheckAnalyseView.Select(x => x.UnitName).Distinct();
+ string[] TypeArray = { "HSE巡检", "专项检查", "综合检查", "开工前检查", "季节性/节假日前检查" };
+ #region 加载各项数据的子数据
+ var count1 = Funs.DB.View_Hazard_HazardRegister.Where(x => x.ProjectId == this.ProjectId).ToList().Count();
+
+ var count2 = (from x in Funs.DB.Check_CheckSpecialDetail
+ join y in Funs.DB.Check_CheckSpecial on x.CheckSpecialId equals y.CheckSpecialId
+ select x).ToList().Count();
+
+ var count3 = (from x in Funs.DB.Check_CheckColligationDetail
+ join y in Funs.DB.Check_CheckColligation on x.CheckColligationId equals y.CheckColligationId
+ where y.ProjectId == this.ProjectId
+ select x).ToList().Count();
+
+ var count4 = (from x in Funs.DB.Check_CheckWorkDetail
+ join y in Funs.DB.Check_CheckWork on x.CheckWorkId equals y.CheckWorkId
+ where y.ProjectId == this.ProjectId
+ select x).ToList().Count;
+
+ var count5 = (from x in Funs.DB.Check_CheckHolidayDetail
+ join y in Funs.DB.Check_CheckHoliday on x.CheckHolidayId equals y.CheckHolidayId
+ select x).ToList().Count();
+
+ List list = new List();
+ list.Add(new CheckAnalysisModel() { itemType = TypeArray[0], count = count1 });
+ list.Add(new CheckAnalysisModel() { itemType = TypeArray[1], count = count2 });
+ list.Add(new CheckAnalysisModel() { itemType = TypeArray[2], count = count3 });
+ list.Add(new CheckAnalysisModel() { itemType = TypeArray[3], count = count4 });
+ list.Add(new CheckAnalysisModel() { itemType = TypeArray[4], count = count5 });
+ #endregion
+ foreach (var itemType in list)
{
DataRow rowUnit = dtCheck.NewRow();
- rowUnit["检查类型"] = itemType;
- rowUnit["数量"] = newCheckAnalyseView.Where(x => x.UnitName == itemType).Count();
+ rowUnit["检查类型"] = itemType.itemType;
+ rowUnit["数量"] = itemType.count;
dtCheck.Rows.Add(rowUnit);
}
@@ -97,6 +126,11 @@ namespace FineUIPro.Web.HSSE.InformationAnalysis
this.gvCheck.DataBind();
this.ChartCostTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtCheck, "危险因素分析", this.drpChartType.SelectedValue, 1150, 450, this.ckbShow.Checked));
}
+
+ public class CheckAnalysisModel {
+ public string itemType { get; set; }
+ public int count { get; set; }
+ }
#endregion
#region 统计查询
diff --git a/SGGL/Model/APIItem/HSSE/CheckSpecialDetailItem.cs b/SGGL/Model/APIItem/HSSE/CheckSpecialDetailItem.cs
index b5539e84..8d6f8c13 100644
--- a/SGGL/Model/APIItem/HSSE/CheckSpecialDetailItem.cs
+++ b/SGGL/Model/APIItem/HSSE/CheckSpecialDetailItem.cs
@@ -203,5 +203,9 @@ namespace Model
///
public string Rectification_Date { get; set; }
+ ///
+ /// 处理意见
+ ///
+ public string CheckOpinions { get; set; }
}
}
diff --git a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
index 91f4f824..bda13b16 100644
--- a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
+++ b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
@@ -180,5 +180,65 @@ namespace Model
get;
set;
}
+
+ ///
+ /// 受检单位
+ ///
+ public string ResponsibleUnit
+ {
+ get;
+ set;
+ }
+ ///
+ /// 受检单位
+ ///
+ public string ResponsibleUnitName
+ {
+ get;
+ set;
+ }
+ ///
+ /// 单位工程ID
+ ///
+ public string WorkAreaId
+ {
+ get;
+ set;
+ }
+ ///
+ /// 单位工程ID
+ ///
+ public string WorkAreaName
+ {
+ get;
+ set;
+ }
+ ///
+ /// 问题类型
+ ///
+ public string QuestionType
+ {
+ get;
+ set;
+ }
+ ///
+ /// 问题类型
+ ///
+ public string QuestionTypeName
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// 审核人
+ ///
+ public string ResponsibleMan { get; set; }
+
+ ///
+ /// 审核状态
+ ///
+ public string AuditState { get; set; }
+
}
}
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index f3139172..339bc509 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -59583,6 +59583,14 @@ namespace Model
private string _CheckItemSetId;
+ private string _ResponsibleUnit;
+
+ private string _WorkAreaId;
+
+ private string _QuestionType;
+
+ private string _ResponsibleMan;
+
private EntityRef _Base_Project;
private EntityRef _Technique_CheckItemSet;
@@ -59623,6 +59631,14 @@ namespace Model
partial void OnPartInPersonNamesChanged();
partial void OnCheckItemSetIdChanging(string value);
partial void OnCheckItemSetIdChanged();
+ partial void OnResponsibleUnitChanging(string value);
+ partial void OnResponsibleUnitChanged();
+ partial void OnWorkAreaIdChanging(string value);
+ partial void OnWorkAreaIdChanged();
+ partial void OnQuestionTypeChanging(string value);
+ partial void OnQuestionTypeChanged();
+ partial void OnResponsibleManChanging(string value);
+ partial void OnResponsibleManChanged();
#endregion
public Check_CheckSpecial()
@@ -59960,6 +59976,86 @@ namespace Model
}
}
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResponsibleUnit", DbType="NVarChar(50)")]
+ public string ResponsibleUnit
+ {
+ get
+ {
+ return this._ResponsibleUnit;
+ }
+ set
+ {
+ if ((this._ResponsibleUnit != value))
+ {
+ this.OnResponsibleUnitChanging(value);
+ this.SendPropertyChanging();
+ this._ResponsibleUnit = value;
+ this.SendPropertyChanged("ResponsibleUnit");
+ this.OnResponsibleUnitChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkAreaId", DbType="NVarChar(50)")]
+ public string WorkAreaId
+ {
+ get
+ {
+ return this._WorkAreaId;
+ }
+ set
+ {
+ if ((this._WorkAreaId != value))
+ {
+ this.OnWorkAreaIdChanging(value);
+ this.SendPropertyChanging();
+ this._WorkAreaId = value;
+ this.SendPropertyChanged("WorkAreaId");
+ this.OnWorkAreaIdChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_QuestionType", DbType="NVarChar(50)")]
+ public string QuestionType
+ {
+ get
+ {
+ return this._QuestionType;
+ }
+ set
+ {
+ if ((this._QuestionType != value))
+ {
+ this.OnQuestionTypeChanging(value);
+ this.SendPropertyChanging();
+ this._QuestionType = value;
+ this.SendPropertyChanged("QuestionType");
+ this.OnQuestionTypeChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResponsibleMan", DbType="NVarChar(50)")]
+ public string ResponsibleMan
+ {
+ get
+ {
+ return this._ResponsibleMan;
+ }
+ set
+ {
+ if ((this._ResponsibleMan != value))
+ {
+ this.OnResponsibleManChanging(value);
+ this.SendPropertyChanging();
+ this._ResponsibleMan = value;
+ this.SendPropertyChanged("ResponsibleMan");
+ this.OnResponsibleManChanged();
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckSpecial_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
public Base_Project Base_Project
{
@@ -60099,6 +60195,8 @@ namespace Model
private System.Nullable _Rectification_Date;
+ private string _CheckOpinions;
+
private EntityRef _Base_Unit;
private EntityRef _WBS_UnitWork;
@@ -60151,6 +60249,8 @@ namespace Model
partial void OnCheckItemSetContentChanged();
partial void OnRectification_DateChanging(System.Nullable value);
partial void OnRectification_DateChanged();
+ partial void OnCheckOpinionsChanging(string value);
+ partial void OnCheckOpinionsChanged();
#endregion
public Check_CheckSpecialDetail()
@@ -60608,6 +60708,26 @@ namespace Model
}
}
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CheckOpinions", DbType="NVarChar(2000)")]
+ public string CheckOpinions
+ {
+ get
+ {
+ return this._CheckOpinions;
+ }
+ set
+ {
+ if ((this._CheckOpinions != value))
+ {
+ this.OnCheckOpinionsChanging(value);
+ this.SendPropertyChanging();
+ this._CheckOpinions = value;
+ this.SendPropertyChanged("CheckOpinions");
+ this.OnCheckOpinionsChanged();
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckSpecialDetail_Base_Unit", Storage="_Base_Unit", ThisKey="UnitId", OtherKey="UnitId", IsForeignKey=true)]
public Base_Unit Base_Unit
{
diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs
index 71118084..a146cd00 100644
--- a/SGGL/WebAPI/Controllers/PersonController.cs
+++ b/SGGL/WebAPI/Controllers/PersonController.cs
@@ -1083,5 +1083,28 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
+
+ #region 二维码扫码获取人员
+ ///
+ /// 二维码扫码获取人员
+ ///
+ ///
+ ///
+ public Model.ResponeData getPersonByPersonIdQrcode(string personId)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = APIPersonService.getPersonByPersonIdQrcode(personId);
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+ #endregion
}
}
\ No newline at end of file
From 7108e961521ec33f90b2ecb42309d3c51a790131 Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Wed, 27 Sep 2023 15:58:06 +0800
Subject: [PATCH 2/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=84=9A=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../版本日志/SGGLDB_WH_2023-09-27.sql | 372 ++++++++++++++++++
1 file changed, 372 insertions(+)
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql b/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql
index e3bfcf70..81a2ba2f 100644
--- a/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql
+++ b/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql
@@ -36,4 +36,376 @@ GO
--ô
alter table SitePerson_Person enable trigger SitePerson_Person_Bak_TRIGGER;
+GO
+
+
+--ȡǰ˴
+ALTER PROCEDURE [dbo].[Sp_APP_GetToDoItems]
+ @projectId NVARCHAR(50)=NULL,
+ @userId NVARCHAR(200)=NULL
+AS
+/*ȡǰ˴*/
+BEGIN
+SELECT HazardRegisterId AS DataId
+ ,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId
+ ,'ȫѲ' AS MenuName
+ ,register.RegisterDef AS Content
+ ,UserId
+ ,users.UserName
+ ,register.RegisterDate AS DataTime
+ ,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr
+ ,'/pagesHSSE/safe/inspecitonconfirm' AS UrlStr
+FROM HSSE_Hazard_HazardRegister AS register
+LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE register.ProjectId=@projectId AND
+((register.states = '1' AND (register.ResponsibleMan =@userId OR register.CCManIds LIKE ('%'+@userId+'%') ))
+OR (register.states = '2' AND register.CheckManId =@userId))
+
+UNION ALL
+SELECT PlanId AS DataId
+ ,'B782A26B-D85C-4F84-8B45-F7AA47B3159E' AS MenuId
+ ,'ѵƻ' AS MenuName
+ ,PlanName AS Content
+ ,UserId
+ ,users.UserName
+ ,DesignerDate AS DataTime
+ ,CONVERT(varchar(100),DesignerDate, 23) AS DataTimeStr
+ ,'/pagesTest/test/trainindex' AS UrlStr
+FROM Training_Plan AS ePlan
+LEFT JOIN Sys_User AS users ON ePlan.DesignerId= users.UserId
+WHERE (ePlan.ProjectId=@projectId or (@projectId is null and ePlan.ProjectId is null))
+ AND (States = '0' OR States = '1' ) AND ePlan.DesignerId =@userId
+
+UNION ALL
+SELECT TestPlanId AS DataId
+ ,'FAF7F4A4-A4BC-4D94-9E88-0CF5A380DB34' AS MenuId
+ ,'Լƻ' AS MenuName
+ ,PlanName AS Content
+ ,UserId
+ ,users.UserName
+ ,PlanDate AS DataTime
+ ,CONVERT(varchar(100),PlanDate, 23) AS DataTimeStr
+ ,'/pagesTest/test/testplan' AS UrlStr
+FROM Training_TestPlan AS TPlan
+LEFT JOIN Sys_User AS users ON users.UserId =TPlan.PlanManId
+WHERE (TPlan.ProjectId=@projectId or (@projectId is null and TPlan.ProjectId is null))
+ AND (States = '0' OR States = '1' ) AND PlanManId =@userId
+
+UNION ALL
+SELECT TaskId AS DataId
+ ,'E108F75D-89D0-4DCA-8356-A156C328805C' AS MenuId
+ ,'ѵ' AS MenuName
+ ,Plans.PlanName AS Content
+ ,users.UserId
+ ,users.UserName
+ ,TaskDate AS DataTime
+ ,CONVERT(varchar(100),TaskDate, 23) AS DataTimeStr
+ ,('/pagesTest/test/taskindex') AS UrlStr
+FROM Training_Task AS Task
+ LEFT JOIN Sys_User AS users ON users.UserId =@userId
+ LEFT JOIN Training_Plan AS Plans ON Plans.PlanId =Task.PlanId
+WHERE (Task.ProjectId=@projectId or (@projectId is null and Task.ProjectId is null))
+ AND (Task.States IS NULL OR Task.States != 2)
+ AND Task.UserId = @userId
+
+UNION ALL
+SELECT TestRecordId AS DataId
+ ,'0EEB138D-84F9-4686-8CBB-CAEAA6CF1B2A' AS MenuId
+ ,'ɨ뿼' AS MenuName
+ ,TestPlan.PlanName AS Content
+ ,TestRecord.TestManId
+ ,Person.PersonName
+ ,TestPlan.TestStartTime AS DataTime
+ ,CONVERT(varchar(100),TestPlan.TestStartTime, 23) AS DataTimeStr
+ ,('/pages/temp_index/index') AS UrlStr
+FROM Training_TestRecord AS TestRecord
+left join Training_TestPlan as TestPlan on TestRecord.TestPlanId = TestPlan.TestPlanId
+left join SitePerson_Person as Person on Person.PersonId = TestRecord.TestManId
+left join Sys_User as uses on Person.IdentityCard = uses.IdentityCard
+WHERE (TestRecord.ProjectId=@projectId or (@projectId is null and TestRecord.ProjectId is null))
+AND TestPlan.States ='1'
+AND TestRecord.TestEndTime IS NULL
+AND (TestRecord.TestManId = @userId or uses.UserId = @userId)
+
+UNION ALL
+SELECT FireWorkId AS DataId
+ ,'2E58D4F1-2FF1-450E-8A00-1CE3BBCF8D4B' AS MenuId
+ ,'ҵ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/dhuo/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_FireWork AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT HeightWorkId AS DataId
+ ,'DA1CAE8E-B5BF-4AC0-9996-AF6CAA412CA9' AS MenuId
+ ,'ߴҵ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/gchu/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_HeightWork AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT LimitedSpaceId AS DataId
+ ,'AEC9166D-1C91-45F0-8BFE-D3D0479A28C7' AS MenuId
+ ,'ռ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/sxkj/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_LimitedSpace AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT RadialWorkId AS DataId
+ ,'F72FF20B-D3EB-46A5-97F7-C99B2473A140' AS MenuId
+ ,'ҵ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/sx/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_RadialWork AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT OpenCircuitId AS DataId
+ ,'4E607E83-41FC-4F49-B26F-A21CFE38328F' AS MenuId
+ ,'·(ռ)' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/dlu/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_OpenCircuit AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT BreakGroundId AS DataId
+ ,'755C6AC9-2E38-4D4F-AF33-33CB1744A907' AS MenuId
+ ,'ҵ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/dtu/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_BreakGround AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT NightWorkId AS DataId
+ ,'7BBAE649-7B00-4475-A911-BFE3A37AC55B' AS MenuId
+ ,'ҹʩ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/yjsg/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_NightWork AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT LiftingWorkId AS DataId
+ ,'A1BE3AB6-9D4A-41E7-8870-E73423165451' AS MenuId
+ ,'װҵ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/dzhuang/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_LiftingWork AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT ElectricityId AS DataId
+ ,'48F64E0F-38B2-4BDC-9B61-6200BD02CBF5' AS MenuId
+ ,'ʱõ' AS MenuName
+ ,LicenseCode AS Content
+ ,UserId
+ ,users.UserName
+ ,ApplyDate AS DataTime
+ ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr
+ ,(CASE WHEN States = '0' THEN '/pagesWork/ldian/add'
+ ELSE '/pagesWork/dhuo/approval' END) AS UrlStr
+FROM License_Electricity AS License
+ LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId
+WHERE License.ProjectId=@projectId
+ AND (States = '0' OR States = '1' OR States= '6')
+ AND License.NextManId LIKE '%'+ @userId+'%'
+
+UNION ALL
+SELECT RectifyNoticesId AS DataId
+ ,'0038D764-D628-46F0-94FF-D0A22C3C45A3' AS MenuId
+ ,'' AS MenuName
+ ,(CASE WHEN Rectify.States =1 THEN 'ǩ'
+ WHEN Rectify.States =2 THEN 'ģ'
+ WHEN Rectify.States =3 THEN 'ˣ'
+ WHEN Rectify.States =4 THEN '飺'
+ WHEN Rectify.States =5 THEN 'ɣ'
+ ELSE 'ύ' END + RectifyNoticesCode) AS Content
+ ,users.UserId
+ ,users.UserName
+ ,CheckedDate AS DataTime
+ ,CONVERT(varchar(100),CheckedDate, 23) AS DataTimeStr
+ ,(CASE WHEN ISNULL(Rectify.States,0) =0 THEN '/pagesHSSE/rn/rn_add' --ύ
+ WHEN Rectify.States =1 THEN '/pagesHSSE/rn/rn_approval' --ǩ
+ WHEN Rectify.States =2 THEN '/pagesHSSE/rn/rn_rectify' --
+ WHEN Rectify.States =3 THEN '/pagesHSSE/rn/rn_rectifycf' --
+ WHEN Rectify.States =4 THEN '/pagesHSSE/rn/rn_confirm' --
+ ELSE '/pagesHSSE/rn/rn_add' END) AS UrlStr
+FROM Check_RectifyNotices AS Rectify
+ LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE Rectify.Projectid=@projectId AND Rectify.States <> 5
+ AND ((ISNULL(Rectify.States,0) =0 AND Rectify.CompleteManId LIKE '%'+ @userId+'%')
+ OR (Rectify.States =1 AND Rectify.SignPerson LIKE '%'+ @userId+'%')
+ OR (Rectify.States =2 AND Rectify.DutyPersonId LIKE '%'+ @userId+'%')
+ OR (Rectify.States =3 AND Rectify.UnitHeadManId LIKE '%'+ @userId+'%')
+ OR (Rectify.States =4 AND Rectify.CheckPerson LIKE '%'+ @userId+'%')
+ OR (Rectify.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND (ProfessionalEngineerTime1 IS NULL OR ProfessionalEngineerTime2 IS NULL))
+ OR (Rectify.ConstructionManagerId LIKE '%'+ @userId+'%' AND (ConstructionManagerTime1 IS NULL OR ConstructionManagerTime2 IS NULL))
+ OR (Rectify.ProjectManagerId LIKE '%'+ @userId+'%' AND (ProjectManagerTime1 IS NULL OR ProjectManagerTime2 IS NULL)))
+
+UNION ALL
+SELECT PersonId AS DataId
+ ,'EE260447-028F-46AF-8864-9A5DC9DAA5BD' AS MenuId
+ ,'ֳԱ' AS MenuName
+ ,Person.PersonName AS Content
+ ,users.UserId
+ ,users.UserName
+ ,Person.InTime AS DataTime
+ ,CONVERT(varchar(100),Person.InTime, 23) AS DataTimeStr
+ ,('/pagesHSSE/info/peopledetail') AS UrlStr
+FROM SitePerson_Person AS Person
+ LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE Person.ProjectId=@projectId AND (Person.IsUsed IS NULL OR Person.IsUsed= 0)
+ AND Person.AuditorId = @userId AND Person.AuditorDate IS NULL
+
+
+UNION ALL
+SELECT PauseNoticeId AS DataId
+ ,'C81DB7ED-165E-4C69-86B0-A3AAE37059FE' AS MenuId
+ ,'ͣ' AS MenuName
+ ,(CASE WHEN PauseNotice.PauseStates =1 THEN 'ǩ'
+ WHEN PauseNotice.PauseStates =2 THEN ''
+ WHEN PauseNotice.PauseStates =3 THEN 'գ'
+ ELSE 'ύ' END + PauseNoticeCode) AS Content
+ ,users.UserId
+ ,users.UserName
+ ,PauseTime AS DataTime
+ ,CONVERT(varchar(100),PauseTime, 23) AS DataTimeStr
+ ,(CASE WHEN ISNULL(PauseNotice.PauseStates,0) =0 THEN '/pagesHSSE/info/stop_add' --ύ
+ WHEN PauseNotice.PauseStates =1 AND PauseNotice.SignManId=@userId THEN '/pagesHSSE/info/stop_approval' --ǩ
+ WHEN PauseNotice.PauseStates =2 AND PauseNotice.ApproveManId=@userId THEN '/pagesHSSE/info/stop_confirm' --
+ WHEN PauseNotice.PauseStates =3 AND PauseNotice.DutyPersonId=@userId THEN '/pagesHSSE/info/stop_feedback' --
+ ELSE '/pagesHSSE/info/stop_add' END) AS UrlStr
+FROM Check_PauseNotice AS PauseNotice
+ LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE PauseNotice.ProjectId=@projectId AND PauseNotice.PauseStates <> 4
+ AND ((ISNULL(PauseNotice.PauseStates,0) =0 AND PauseNotice.CompileManId LIKE '%'+ @userId+'%')
+ OR (PauseNotice.PauseStates =1 AND PauseNotice.SignManId LIKE '%'+ @userId+'%')
+ OR (PauseNotice.PauseStates =2 AND PauseNotice.ApproveManId LIKE '%'+ @userId+'%')
+ OR (PauseNotice.PauseStates =3 AND PauseNotice.DutyPersonId LIKE '%'+ @userId+'%')
+ OR (PauseNotice.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND ProfessionalEngineerTime IS NULL)
+ OR (PauseNotice.ConstructionManagerId LIKE '%'+ @userId+'%' AND ConstructionManagerTime IS NULL)
+ OR (PauseNotice.UnitHeadManId LIKE '%'+ @userId+'%' AND UnitHeadManTime IS NULL)
+ OR (PauseNotice.SupervisorManId LIKE '%'+ @userId+'%' AND SupervisorManTime IS NULL)
+ OR (PauseNotice.OwnerId LIKE '%'+ @userId+'%' AND OwnerTime IS NULL))
+UNION ALL
+SELECT PunishNoticeId AS DataId
+ ,'755F1C1D-2178-47D8-9F82-A501B53A2436' AS MenuId
+ ,'' AS MenuName
+ ,(CASE WHEN PunishNotice.PunishStates =1 THEN 'ǩ'
+ WHEN PunishNotice.PunishStates =2 THEN ''
+ WHEN PunishNotice.PunishStates =3 THEN 'ִ'
+ ELSE 'ύ' END + PunishNoticeCode) AS Content
+ ,users.UserId
+ ,users.UserName
+ ,PunishNoticeDate AS DataTime
+ ,CONVERT(varchar(100),PunishNoticeDate, 23) AS DataTimeStr
+ ,(CASE WHEN ISNULL(PunishNotice.PunishStates,0) =0 THEN '/pagesTest/punish/add' --ύ
+ WHEN PunishNotice.PunishStates =1 AND PunishNotice.SignMan=@userId THEN '/pagesTest/punish/approval' --ǩ
+ WHEN PunishNotice.PunishStates =2 AND PunishNotice.ApproveMan=@userId THEN '/pagesTest/punish/rectify' --
+ WHEN PunishNotice.PunishStates =3 AND PunishNotice.DutyPersonId=@userId THEN '/pagesTest/punish/rectifycf' --ִ
+ ELSE '/pagesTest/punish/detail' END) AS UrlStr
+FROM Check_PunishNotice AS PunishNotice
+ LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE PunishNotice.ProjectId=@projectId AND PunishNotice.PunishStates <> 4
+ AND ((ISNULL(PunishNotice.PunishStates,0) =0 AND PunishNotice.CompileMan LIKE '%'+ @userId+'%')
+ OR (PunishNotice.PunishStates =1 AND PunishNotice.SignMan LIKE '%'+ @userId+'%')
+ OR (PunishNotice.PunishStates =2 AND PunishNotice.ApproveMan LIKE '%'+ @userId+'%')
+ OR (PunishNotice.PunishStates =3 AND PunishNotice.DutyPersonId LIKE '%'+ @userId+'%')
+ OR (PunishNotice.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND ProfessionalEngineerTime IS NULL)
+ OR (PunishNotice.ConstructionManagerId LIKE '%'+ @userId+'%' AND ConstructionManagerTime IS NULL)
+ OR (PunishNotice.UnitHeadManId LIKE '%'+ @userId+'%' AND UnitHeadManTime IS NULL))
+UNION ALL
+
+SELECT CheckSpecialId AS DataId
+ ,'1B08048F-93ED-4E84-AE65-DB7917EA2DFB' AS MenuId
+ ,'ר' AS MenuName
+ ,checkspecial.CheckSpecialCode+'ר' AS Content
+ ,UserId
+ ,users.UserName
+ ,checkspecial.CheckTime AS DataTime
+ ,CONVERT(varchar(100),checkspecial.CheckTime, 23) AS DataTimeStr
+ ,'/pagesHSSE/grow/special_detail' AS UrlStr
+FROM Check_CheckSpecial AS checkspecial
+LEFT JOIN Sys_User AS users ON users.UserId =@userId
+WHERE checkspecial.ProjectId=@projectId AND
+checkspecial.States='1' and checkspecial.ResponsibleMan=@userId
+
+
+ORDER BY DataTime DESC
+END
+
+
+
+
+
From 2e1c911889f8ff78f641f81db6a653d3c3f26afa Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Wed, 27 Sep 2023 17:33:57 +0800
Subject: [PATCH 3/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SGGL/BLL/API/HSSE/APIResourcesService.cs | 46 +++++++++++++++++-------
1 file changed, 33 insertions(+), 13 deletions(-)
diff --git a/SGGL/BLL/API/HSSE/APIResourcesService.cs b/SGGL/BLL/API/HSSE/APIResourcesService.cs
index 1aab6df0..21ccacce 100644
--- a/SGGL/BLL/API/HSSE/APIResourcesService.cs
+++ b/SGGL/BLL/API/HSSE/APIResourcesService.cs
@@ -357,22 +357,42 @@ namespace BLL
///
/// 1-checkType;2-专项检查;3-综合检查
///
- public static List getCheckItemSetListBySupCheckItemId(string supTypeId, string checkType)
+ public static List getCheckItemSetListBySupCheckItemId(string supTypeId, string checkType,string supName="")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getDataLists = from x in db.Technique_CheckItemSet
- where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
- orderby x.SortIndex
- select new Model.ResourcesItem
- {
- ResourcesId = x.CheckItemSetId,
- ResourcesCode = x.MapCode,
- ResourcesName = x.CheckItemName,
- SupResourcesId = x.SupCheckItem,
- IsEndLever = x.IsEndLever,
- };
- return getDataLists.ToList();
+ if (!string.IsNullOrEmpty(supName))
+ {
+ var getDataLists = from x in db.Technique_CheckItemSet
+ where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
+ && x.CheckItemName.Contains(supName)
+ orderby x.SortIndex
+ select new Model.ResourcesItem
+ {
+ ResourcesId = x.CheckItemSetId,
+ ResourcesCode = x.MapCode,
+ ResourcesName = x.CheckItemName,
+ SupResourcesId = x.SupCheckItem,
+ IsEndLever = x.IsEndLever,
+ };
+ return getDataLists.ToList();
+ }
+ else {
+ var getDataLists = from x in db.Technique_CheckItemSet
+ where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
+ orderby x.SortIndex
+ select new Model.ResourcesItem
+ {
+ ResourcesId = x.CheckItemSetId,
+ ResourcesCode = x.MapCode,
+ ResourcesName = x.CheckItemName,
+ SupResourcesId = x.SupCheckItem,
+ IsEndLever = x.IsEndLever,
+ };
+ return getDataLists.ToList();
+ }
+
+
}
}
From 98345cb94f57318d088d1a536de67a90d317754e Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Sat, 7 Oct 2023 16:58:43 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../版本日志/SGGLDB_WH_2023-09-30.sql | 47 ++
.../版本日志/SGGLDB_WH_2023-10-07.sql | 4 +
SGGL/BLL/API/HSSE/APICheckSpecialService.cs | 228 ++++--
SGGL/BLL/ProjectData/ProjectService.cs | 4 +
SGGL/FineUIPro.Web/ErrLog.txt | 22 +
.../HSSE/Check/CheckSpecialView.aspx | 4 +-
.../ProjectData/Installation.aspx.cs | 763 +++++++++---------
.../ProjectData/ProjectSetSave.aspx | 6 +
.../ProjectData/ProjectSetSave.aspx.cs | 4 +
.../ProjectSetSave.aspx.designer.cs | 114 +--
.../ProjectData/ProjectSetView.aspx | 6 +
.../ProjectData/ProjectSetView.aspx.cs | 2 +
.../ProjectSetView.aspx.designer.cs | 18 +
SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs | 5 +
SGGL/Model/Model.cs | 72 ++
.../HSSE/CheckSpecialController.cs | 27 +-
16 files changed, 829 insertions(+), 497 deletions(-)
create mode 100644 DataBase/版本日志/SGGLDB_WH_2023-09-30.sql
create mode 100644 DataBase/版本日志/SGGLDB_WH_2023-10-07.sql
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql b/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql
new file mode 100644
index 00000000..8c9b1c05
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql
@@ -0,0 +1,47 @@
+--ר¼
+alter table Check_CheckSpecial add ReceiveMan nvarchar(2000) null;
+
+--States0- 1-ύ 2-ͨ 3-ȷ
+
+
+--רϸͼ
+/****** Object: View [dbo].[View_CheckSpecialDetail] Script Date: 2023/9/30 11:19:54 ******/
+SET ANSI_NULLS ON
+GO
+
+SET QUOTED_IDENTIFIER ON
+GO
+/*LEFT JOIN Sys_Const AS const ON const.ConstValue = detail.HandleStep and const.GroupId='HandleStep'*/
+ALTER VIEW [dbo].[View_CheckSpecialDetail]
+AS
+SELECT detail.CheckSpecialDetailId, detail.CheckSpecialId, detail.CheckItem, checkItemSet.CheckItemName, detail.Unqualified,
+ detail.SortIndex, detail.UnitId, detail.HandleStep, detail.CompleteStatus,
+ (CASE WHEN detail.CompleteStatus = 1 THEN 'ϸ' ELSE 'ϸ' END) AS CompleteStatusName, detail.LimitedDate,
+ detail.CompletedDate, detail.CheckContent, detail.CheckArea,
+ workArea.UnitWorkName + (CASE WHEN workArea.ProjectType = '1' THEN '()' WHEN workArea.ProjectType = '2' THEN '(װ)'
+ ELSE '' END) AS CheckAreaName, detail.DataId, detail.DataType, unit.UnitName,
+ dbo.GetConstTextByIds(detail.HandleStep) AS HandleStepStr,
+ (CASE WHEN detail.DataType LIKE '%1%' THEN '·ĵ:' +
+ (SELECT RectifyNoticesCode
+ FROM Check_RectifyNotices
+ WHERE detail.DataId LIKE '%' + RectifyNoticesId + '%') ELSE '' END)
+ + (CASE WHEN detail.DataType LIKE '%2%' THEN '·:' +
+ (SELECT PunishNoticeCode
+ FROM Check_PunishNotice
+ WHERE detail.DataId LIKE '%' + PunishNoticeId + '%') ELSE '' END)
+ + (CASE WHEN detail.DataType = '3' THEN '·ͣ:' +
+ (SELECT PauseNoticeCode
+ FROM Check_PauseNotice
+ WHERE detail.DataId LIKE '%' + PauseNoticeId + '%') ELSE '' END) AS HandleStepLink, detail.HiddenHazardType,
+ (CASE WHEN detail.HiddenHazardType = '3' THEN 'ش' WHEN detail.HiddenHazardType = '2' THEN 'ϴ' WHEN detail.HiddenHazardType
+ = '1' THEN 'һ' ELSE '' END) AS HiddenHazardTypeName, detail.CheckItemSetId, detail.CheckItemSetContent,
+ detail.Rectification_Date
+FROM dbo.Check_CheckSpecialDetail AS detail LEFT OUTER JOIN
+ dbo.Technique_CheckItemSet AS checkItemSet ON checkItemSet.CheckItemSetId = detail.CheckItem LEFT OUTER JOIN
+ dbo.Base_Unit AS unit ON unit.UnitId = detail.UnitId LEFT OUTER JOIN
+ dbo.WBS_UnitWork AS workArea ON detail.CheckArea = workArea.UnitWorkId
+
+
+GO
+
+
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql
new file mode 100644
index 00000000..990bad7f
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql
@@ -0,0 +1,4 @@
+alter table Base_Project add ProjType nvarchar(50) null
+GO
+alter table Base_Project add ProjPhase nvarchar(50) null
+GO
\ No newline at end of file
diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
index 09c6c784..de0945c2 100644
--- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
+++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
@@ -14,49 +14,96 @@ namespace BLL
///
///
///
- public static Model.CheckSpecialItem getCheckSpecialById(string CheckSpecialId)
+ public static Model.CheckSpecialItem getCheckSpecialById(string CheckSpecialId,string state="0")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getInfo = from x in db.Check_CheckSpecial
- where x.CheckSpecialId == CheckSpecialId
- select new Model.CheckSpecialItem
- {
- CheckSpecialId = x.CheckSpecialId,
- ProjectId = x.ProjectId,
- CheckSpecialCode = x.CheckSpecialCode,
- CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
- CheckType = x.CheckType,
- CheckItemSetId = x.CheckItemSetId,
- CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
- CheckPersonId = x.CheckPerson,
- CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
- CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
- DaySummary = x.DaySummary,
- PartInUnitIds = x.PartInUnits,
- PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
- PartInPersonIds = x.PartInPersonIds,
- PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
- PartInPersonNames2 = x.PartInPersonNames,
- CompileManId = x.CompileMan,
- CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
- States = x.States,
- AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
- CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId),
+ if (state == "0")
+ {
+ //状态是0的时候查看所有
+ var getInfo = from x in db.Check_CheckSpecial
+ where x.CheckSpecialId == CheckSpecialId
+ select new Model.CheckSpecialItem
+ {
+ CheckSpecialId = x.CheckSpecialId,
+ ProjectId = x.ProjectId,
+ CheckSpecialCode = x.CheckSpecialCode,
+ CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
+ CheckType = x.CheckType,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
+ CheckPersonId = x.CheckPerson,
+ CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
+ CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
+ DaySummary = x.DaySummary,
+ PartInUnitIds = x.PartInUnits,
+ PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
+ PartInPersonIds = x.PartInPersonIds,
+ PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
+ PartInPersonNames2 = x.PartInPersonNames,
+ CompileManId = x.CompileMan,
+ CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
+ States = x.States,
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId,"0"),
- ResponsibleUnit=x.ResponsibleUnit,
- ResponsibleUnitName=UnitService.GetUnitNameByUnitId(x.ResponsibleUnit),
- WorkAreaId=x.WorkAreaId,
- WorkAreaName= UnitWorkService.GetUnitWorkName(x.WorkAreaId),
- QuestionType=x.QuestionType,
- QuestionTypeName=UnitService.GetQuestionTypeId(x.QuestionType),
+ ResponsibleUnit = x.ResponsibleUnit,
+ ResponsibleUnitName = UnitService.GetUnitNameByUnitId(x.ResponsibleUnit),
+ WorkAreaId = x.WorkAreaId,
+ WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
+ QuestionType = x.QuestionType,
+ QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
- ResponsibleMan=x.ResponsibleMan,
+ ResponsibleMan = x.ResponsibleMan,
+ ReceiveMan = x.ReceiveMan
+ };
+ return getInfo.FirstOrDefault();
+ }
+ else {
+ //状态是1的时候查看不合格的子项
+ var getInfo = from x in db.Check_CheckSpecial
+ where x.CheckSpecialId == CheckSpecialId
+ select new Model.CheckSpecialItem
+ {
+ CheckSpecialId = x.CheckSpecialId,
+ ProjectId = x.ProjectId,
+ CheckSpecialCode = x.CheckSpecialCode,
+ CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
+ CheckType = x.CheckType,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
+ CheckPersonId = x.CheckPerson,
+ CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
+ CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
+ DaySummary = x.DaySummary,
+ PartInUnitIds = x.PartInUnits,
+ PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
+ PartInPersonIds = x.PartInPersonIds,
+ PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
+ PartInPersonNames2 = x.PartInPersonNames,
+ CompileManId = x.CompileMan,
+ CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
+ States = x.States,
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId,"1"),
- };
- return getInfo.FirstOrDefault();
+ ResponsibleUnit = x.ResponsibleUnit,
+ ResponsibleUnitName = UnitService.GetUnitNameByUnitId(x.ResponsibleUnit),
+ WorkAreaId = x.WorkAreaId,
+ WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
+ QuestionType = x.QuestionType,
+ QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
+
+ ResponsibleMan = x.ResponsibleMan,
+ ReceiveMan = x.ReceiveMan
+
+
+ };
+ return getInfo.FirstOrDefault();
+ }
+
}
}
#endregion
@@ -68,12 +115,14 @@ namespace BLL
///
///
///
- public static List getCheckSpecialList(string projectId, string states)
+ public static List getCheckSpecialList(string projectId, string states,string userid)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getCheckSpecial = from x in db.Check_CheckSpecial
where x.ProjectId == projectId && x.States ==states
+ //当前保存人、审核人、确认人能看到
+ &&(x.CompileMan==userid || x.ResponsibleMan==userid || userid.Contains(x.ReceiveMan))
orderby x.CheckSpecialCode descending
select new Model.CheckSpecialItem
{
@@ -97,6 +146,7 @@ namespace BLL
CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
States = x.States,
AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ ReceiveMan=x.ResponsibleMan
};
return getCheckSpecial.ToList();
}
@@ -237,43 +287,83 @@ namespace BLL
///
///
///
- public static List getCheckSpecialDetailList(string checkSpecialId)
+ public static List getCheckSpecialDetailList(string checkSpecialId,string CompleteStatus="0")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getInfo = from x in db.Check_CheckSpecialDetail
- where x.CheckSpecialId == checkSpecialId
- orderby x.SortIndex
- select new Model.CheckSpecialDetailItem
- {
- CheckSpecialDetailId = x.CheckSpecialDetailId,
- CheckSpecialId = x.CheckSpecialId,
- CheckItemSetId = x.CheckItem,
- CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
- CheckContent = x.CheckContent,
- SortIndex = x.SortIndex,
- Unqualified = x.Unqualified,
- Suggestions = x.Suggestions,
- WorkArea = db.WBS_UnitWork.First(y=>y.UnitWorkId ==x.CheckArea).UnitWorkName,
- WorkAreaId=x.CheckArea,
- UnitId = x.UnitId,
- UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
- HandleStep = x.HandleStep,
- HandleStepName = getNames(x.HandleStep),
- HiddenHazardType = x.HiddenHazardType,
- HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
- LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
- CompleteStatus = x.CompleteStatus,
- CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
- CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
- AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
+ if (CompleteStatus == "0")
+ {
+ var getInfo = from x in db.Check_CheckSpecialDetail
+ where x.CheckSpecialId == checkSpecialId
+ orderby x.SortIndex
+ select new Model.CheckSpecialDetailItem
+ {
+ CheckSpecialDetailId = x.CheckSpecialDetailId,
+ CheckSpecialId = x.CheckSpecialId,
+ CheckItemSetId = x.CheckItem,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
+ CheckContent = x.CheckContent,
+ SortIndex = x.SortIndex,
+ Unqualified = x.Unqualified,
+ Suggestions = x.Suggestions,
+ WorkArea = db.WBS_UnitWork.First(y => y.UnitWorkId == x.CheckArea).UnitWorkName,
+ WorkAreaId = x.CheckArea,
+ UnitId = x.UnitId,
+ UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
+ HandleStep = x.HandleStep,
+ HandleStepName = getNames(x.HandleStep),
+ HiddenHazardType = x.HiddenHazardType,
+ HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
+ LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
+ CompleteStatus = x.CompleteStatus,
+ CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
+ CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
- CheckItemDetailSetId = x.CheckItemSetId,
- CheckItemDetailContent = x.CheckItemSetContent,
- Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
- CheckOpinions=x.CheckOpinions,
- };
- return getInfo.ToList();
+ CheckItemDetailSetId = x.CheckItemSetId,
+ CheckItemDetailContent = x.CheckItemSetContent,
+ Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
+ CheckOpinions = x.CheckOpinions,
+ };
+ return getInfo.ToList();
+ }
+ else {
+ //查询不合格子项
+ var getInfo = from x in db.Check_CheckSpecialDetail
+ where x.CheckSpecialId == checkSpecialId && x.CompleteStatus==false
+ orderby x.SortIndex
+ select new Model.CheckSpecialDetailItem
+ {
+ CheckSpecialDetailId = x.CheckSpecialDetailId,
+ CheckSpecialId = x.CheckSpecialId,
+ CheckItemSetId = x.CheckItem,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
+ CheckContent = x.CheckContent,
+ SortIndex = x.SortIndex,
+ Unqualified = x.Unqualified,
+ Suggestions = x.Suggestions,
+ WorkArea = db.WBS_UnitWork.First(y => y.UnitWorkId == x.CheckArea).UnitWorkName,
+ WorkAreaId = x.CheckArea,
+ UnitId = x.UnitId,
+ UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
+ HandleStep = x.HandleStep,
+ HandleStepName = getNames(x.HandleStep),
+ HiddenHazardType = x.HiddenHazardType,
+ HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
+ LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
+ CompleteStatus = x.CompleteStatus,
+ CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
+ CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
+
+ CheckItemDetailSetId = x.CheckItemSetId,
+ CheckItemDetailContent = x.CheckItemSetContent,
+ Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
+ CheckOpinions = x.CheckOpinions,
+ };
+ return getInfo.ToList();
+ }
+
}
}
///
diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs
index a7b50ff4..2db27732 100644
--- a/SGGL/BLL/ProjectData/ProjectService.cs
+++ b/SGGL/BLL/ProjectData/ProjectService.cs
@@ -138,6 +138,8 @@
HJProjectCode = project.HJProjectCode,
KZProjectCode = project.KZProjectCode,
Progress = project.Progress,
+ ProjType = project.ProjType,
+ ProjPhase = project.ProjPhase,
};
db.Base_Project.InsertOnSubmit(newProject);
db.SubmitChanges();
@@ -186,6 +188,8 @@
newProject.HJProjectCode = project.HJProjectCode;
newProject.KZProjectCode = project.KZProjectCode;
newProject.Progress = project.Progress;
+ newProject.ProjType = project.ProjType;
+ newProject.ProjPhase = project.ProjPhase;
db.SubmitChanges();
HSEDataCollectService.ProjectHSEDataCollectSubmission(newProject);
}
diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt
index 76e939ac..b012a6c2 100644
--- a/SGGL/FineUIPro.Web/ErrLog.txt
+++ b/SGGL/FineUIPro.Web/ErrLog.txt
@@ -3193,3 +3193,25 @@ IP地址:::1
出错时间:09/26/2023 18:55:14
+
+错误信息开始=====>
+错误类型:JsonReaderException
+错误信息:Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path '', line 1, position 1.
+错误堆栈:
+ 在 Newtonsoft.Json.Linq.JArray.Load(JsonReader reader, JsonLoadSettings settings)
+ 在 Newtonsoft.Json.Linq.JArray.Parse(String json, JsonLoadSettings settings)
+ 在 Newtonsoft.Json.Linq.JArray.Parse(String json)
+ 在 FineUIPro.Web.ProjectData.Installation.btnMenuDown_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\ProjectData\Installation.aspx.cs:行号 257
+ 在 FineUIPro.MenuButton.OnClick(EventArgs e)
+ 在 (MenuButton , EventArgs )
+ 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
+ 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+ 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+出错时间:10/07/2023 16:42:46
+出错文件:http://localhost:8579/ProjectData/Installation.aspx
+IP地址:::1
+操作人员:JT
+
+出错时间:10/07/2023 16:42:46
+
diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
index 4eb70936..08a475e7 100644
--- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecialView.aspx
@@ -81,9 +81,9 @@
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" HeaderText="整改期限">
- <%--
- --%>
+
x.CnProfessionName.Contains(name.Substring(0, 2)));
- //拷贝专业
- if (cn != null)
- {
- if (cn.CnProfessionName != "防腐绝热" && cn.CnProfessionName != "地勘" && cn.CnProfessionName != "全厂地下主管网" && cn.CnProfessionName != "临时设施" && cn.CnProfessionName != "总图")
- {
- Model.WBS_CnProfession cnProfession = new Model.WBS_CnProfession();
- cnProfession.CnProfessionId = id;
- cnProfession.CnProfessionName = cn.CnProfessionName;
- cnProfession.CnProfessionCode = cn.CnProfessionCode;
- cnProfession.InstallationId = parentId;
- cnProfession.ProjectId = this.CurrUser.LoginProjectId;
- cnProfession.StartDate = Funs.GetNewDateTime(planStart);
- cnProfession.EndDate = Funs.GetNewDateTime(planFinish);
- cnProfession.OldId = cn.CnProfessionId;
- db.WBS_CnProfession.InsertOnSubmit(cnProfession);
- db.SubmitChanges();
- //单位工程
- var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var unitProjectInit in unitProjects)
- {
- Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
- unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
- unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
- unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
- unitProject.InstallationId = parentId;
- unitProject.SortIndex = unitProjectInit.SortIndex;
- unitProject.SuperUnitProjectId = null;
- unitProject.ProjectId = this.CurrUser.LoginProjectId;
- unitProject.CnProfessionId = id;
- unitProject.StartDate = Funs.GetNewDateTime(planStart);
- unitProject.EndDate = Funs.GetNewDateTime(planFinish);
- unitProject.Remark = unitProjectInit.Remark;
- unitProject.IsIn = true;
- db.Wbs_UnitProject.InsertOnSubmit(unitProject);
- db.SubmitChanges();
- }
- //分部分项
- var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var wbsSetInit in wbsSets)
- {
- Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
- wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
- wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
- wbsSet.WbsSetName = wbsSetInit.WbsSetName;
- wbsSet.InstallationId = parentId;
- wbsSet.CnProfessionId = id;
- wbsSet.UnitProjectId = (from x in db.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.CnProfessionId == id select x.UnitProjectId).FirstOrDefault();
- if (wbsSetInit.SuperWbsSetCode == null)
- {
- wbsSet.SuperWbsSetId = null;
- }
- else
- {
- wbsSet.SuperWbsSetId = (from x in db.Wbs_WbsSet
- where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == parentId && x.CnProfessionId == id
- select x.WbsSetId).FirstOrDefault();
- }
- wbsSet.ProjectId = this.CurrUser.LoginProjectId;
- wbsSet.StartDate = Funs.GetNewDateTime(planStart);
- wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
- wbsSet.Flag = wbsSetInit.Flag;
- wbsSet.Way = wbsSetInit.Way;
- wbsSet.Weights = wbsSetInit.Weights;
- wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
- wbsSet.ControlPoint = wbsSetInit.ControlPoint;
- wbsSet.Remark = wbsSetInit.Remark;
- wbsSet.IsIn = true;
- db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
- db.SubmitChanges();
- var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
- foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
- {
- Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
- wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
- wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
- wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
- if (wbsSetMatchCostControl.WbsSetId != null)
- {
- db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
- db.SubmitChanges();
- //拷贝费用清单项
- var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
- foreach (var costControlInit in costControlInits)
- {
- Model.WBS_CostControl costControl = new Model.WBS_CostControl();
- costControl.CostControlId = SQLHelper.GetNewID();
- costControl.ProjectId = this.CurrUser.LoginProjectId;
- costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
- costControl.CostControlCode = costControlInit.CostControlInitCode;
- costControl.CostControlName = costControlInit.CostControlInitName;
- costControl.Unit = costControlInit.Unit;
- db.WBS_CostControl.InsertOnSubmit(costControl);
- db.SubmitChanges();
- }
- }
- }
- }
- }
- else
- {
- var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
- if (oldInstallation == null)
- {
- Model.Project_Installation installation = new Model.Project_Installation();
- installation.InstallationId = id;
- installation.ProjectId = this.CurrUser.LoginProjectId;
- installation.InstallationCode = code;
- installation.InstallationName = name;
- installation.SuperInstallationId = sgId;
- installation.StartDate = Funs.GetNewDateTime(planStart);
- installation.EndDate = Funs.GetNewDateTime(planFinish);
- installation.IsEnd = true;
- installation.Def = remark;
- db.Project_Installation.InsertOnSubmit(installation);
- db.SubmitChanges();
- // 拷贝总图等专业下WBS内容
- //拷贝单位工程及子单位工程
- var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var unitProjectInit in unitProjects)
- {
- Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
- unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
- unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
- unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
- if (unitProjectInit.SuperUnitProject == null)
- {
- unitProject.SuperUnitProjectId = null;
- }
- else
- {
- unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
- where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
- select x.UnitProjectId).FirstOrDefault();
- }
- unitProject.InstallationId = id;
- unitProject.SortIndex = unitProjectInit.SortIndex;
- unitProject.ProjectId = this.CurrUser.LoginProjectId;
- unitProject.StartDate = Funs.GetNewDateTime(planStart);
- unitProject.EndDate = Funs.GetNewDateTime(planFinish);
- unitProject.Remark = unitProjectInit.Remark;
- unitProject.IsIn = true;
- db.Wbs_UnitProject.InsertOnSubmit(unitProject);
- db.SubmitChanges();
- }
- //拷贝分部/子分部/分项/子分项
- var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var wbsSetInit in wbsSets)
- {
- Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
- wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
- wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
- wbsSet.WbsSetName = wbsSetInit.WbsSetName;
- wbsSet.InstallationId = id;
- wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
- if (wbsSetInit.SuperWbsSetCode == null)
- {
- wbsSet.SuperWbsSetId = null;
- }
- else
- {
- wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
- where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
- select x.WbsSetId).FirstOrDefault();
- }
- wbsSet.ProjectId = this.CurrUser.LoginProjectId;
- wbsSet.StartDate = Funs.GetNewDateTime(planStart);
- wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
- wbsSet.Flag = wbsSetInit.Flag;
- wbsSet.Way = wbsSetInit.Way;
- wbsSet.Weights = wbsSetInit.Weights;
- wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
- wbsSet.ControlPoint = wbsSetInit.ControlPoint;
- wbsSet.Remark = wbsSetInit.Remark;
- wbsSet.IsIn = true;
- db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
- db.SubmitChanges();
- var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
- foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
- {
- Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
- wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
- wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
- wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
- if (wbsSetMatchCostControl.WbsSetId != null)
- {
- db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
- db.SubmitChanges();
- //拷贝费用清单项
- var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
- foreach (var costControlInit in costControlInits)
- {
- Model.WBS_CostControl costControl = new Model.WBS_CostControl();
- costControl.CostControlId = SQLHelper.GetNewID();
- costControl.ProjectId = this.CurrUser.LoginProjectId;
- costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
- costControl.CostControlCode = costControlInit.CostControlInitCode;
- costControl.CostControlName = costControlInit.CostControlInitName;
- costControl.Unit = costControlInit.Unit;
- db.WBS_CostControl.InsertOnSubmit(costControl);
- db.SubmitChanges();
- }
- }
- }
- }
- }
- }
- }
- }
- else if (level == "6" || level == "7")
- {
- if (name.Contains("防腐绝热") || name.Contains("地勘") || name.Contains("全厂地下主管网") || name.Contains("临时设施") || name.Contains("总图"))
- {
- var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
- if (cn != null)
- {
- var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
- if (oldInstallation == null)
- {
- Model.Project_Installation installation = new Model.Project_Installation();
- installation.InstallationId = id;
- installation.ProjectId = this.CurrUser.LoginProjectId;
- installation.InstallationCode = code;
- installation.InstallationName = name;
- installation.SuperInstallationId = sgId;
- installation.StartDate = Funs.GetNewDateTime(planStart);
- installation.EndDate = Funs.GetNewDateTime(planFinish);
- installation.IsEnd = true;
- installation.Def = remark;
- db.Project_Installation.InsertOnSubmit(installation);
- db.SubmitChanges();
- // 拷贝总图等专业下WBS内容
- //拷贝单位工程及子单位工程
- var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var unitProjectInit in unitProjects)
- {
- Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
- unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
- unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
- unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
- if (unitProjectInit.SuperUnitProject == null)
- {
- unitProject.SuperUnitProjectId = null;
- }
- else
- {
- unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
- where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
- select x.UnitProjectId).FirstOrDefault();
- }
- unitProject.InstallationId = id;
- unitProject.SortIndex = unitProjectInit.SortIndex;
- unitProject.ProjectId = this.CurrUser.LoginProjectId;
- unitProject.StartDate = Funs.GetNewDateTime(planStart);
- unitProject.EndDate = Funs.GetNewDateTime(planFinish);
- unitProject.Remark = unitProjectInit.Remark;
- unitProject.IsIn = true;
- db.Wbs_UnitProject.InsertOnSubmit(unitProject);
- db.SubmitChanges();
- }
- //拷贝分部/子分部/分项/子分项
- var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
- foreach (var wbsSetInit in wbsSets)
- {
- Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
- wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
- wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
- wbsSet.WbsSetName = wbsSetInit.WbsSetName;
- wbsSet.InstallationId = id;
- wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
- if (wbsSetInit.SuperWbsSetCode == null)
- {
- wbsSet.SuperWbsSetId = null;
- }
- else
- {
- wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
- where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
- select x.WbsSetId).FirstOrDefault();
- }
- wbsSet.ProjectId = this.CurrUser.LoginProjectId;
- wbsSet.StartDate = Funs.GetNewDateTime(planStart);
- wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
- wbsSet.Flag = wbsSetInit.Flag;
- wbsSet.Way = wbsSetInit.Way;
- wbsSet.Weights = wbsSetInit.Weights;
- wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
- wbsSet.ControlPoint = wbsSetInit.ControlPoint;
- wbsSet.Remark = wbsSetInit.Remark;
- wbsSet.IsIn = true;
- db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
- db.SubmitChanges();
- var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
- foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
- {
- Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
- wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
- wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
- wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
- if (wbsSetMatchCostControl.WbsSetId != null)
- {
- db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
- db.SubmitChanges();
- //拷贝费用清单项
- var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
- foreach (var costControlInit in costControlInits)
- {
- Model.WBS_CostControl costControl = new Model.WBS_CostControl();
- costControl.CostControlId = SQLHelper.GetNewID();
- costControl.ProjectId = this.CurrUser.LoginProjectId;
- costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
- costControl.CostControlCode = costControlInit.CostControlInitCode;
- costControl.CostControlName = costControlInit.CostControlInitName;
- costControl.Unit = costControlInit.Unit;
- db.WBS_CostControl.InsertOnSubmit(costControl);
- db.SubmitChanges();
- }
- }
- }
- }
- }
- }
- }
+ proId= item["id"].ToString();
}
}
- ShowNotify("抽取成功!", MessageBoxIcon.Success);
- InitTreeMenu();
+ var returndata = BLL.APIGetHttpService.ControlHttp(Funs.ControlApiUrl + "/Projects/GetConstructionWbsList?ProjId=" + proId, "GET", contenttype, null, null);
+ if (!string.IsNullOrEmpty(returndata))
+ {
+ JObject obj = JObject.Parse(returndata);
+ JArray arr = JArray.Parse(obj["result"].ToString());
+ Model.SGGLDB db = Funs.DB;
+ //专业
+ var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
+ //单位工程及子单位工程
+ var unitProjectInits = from x in db.Wbs_UnitProjectInit orderby x.SuperUnitProject select x;
+ //分部/子分部/分项/子分项
+ var wbsSetInits = (from x in db.WBS_WbsSetInit orderby x.SuperWbsSetCode select x).ToList();
+ //费用清单对应关系
+ var wbsSetMatchCostControlInits = from x in db.WBS_WbsSetMatchCostControlInit orderby x.WbsSetCode select x;
+ //费用清单项
+ var totalCostControlInits = from x in db.WBS_CostControlInit orderby x.CostControlInitCode select x;
+ string sgId = string.Empty;
+ foreach (var item in arr)
+ {
+ string id = item["id"].ToString(); //记录Id,主键
+ string parentId = item["parentId"].ToString(); //上一级记录Id
+ string code = item["code"].ToString(); //WBS编码
+ string name = item["name"].ToString(); //WBS名称
+ string level = item["level"].ToString(); //级别,0-7依次表示:项目、阶段(施工)、装置、工序、主项、专业、分部工程、分项工程
+ string isLeaf = item["isLeaf"].ToString(); //是否末级
+ string ppsId = item["ppsId"].ToString(); //阶段ID,3代表施工
+ string projId = item["projId"].ToString(); //项目ID
+ string planStart = item["planStart"].ToString(); //计划开始日期
+ string planFinish = item["planFinish"].ToString(); //计划完成日期
+ string remark = item["remark"].ToString(); //备注
+ if (level == "0" || level == "1" || level == "2" || level == "3" || level == "4")
+ {
+ Model.Project_Installation installation = new Model.Project_Installation();
+ installation.InstallationId = id;
+ installation.ProjectId = this.CurrUser.LoginProjectId;
+ installation.InstallationCode = code;
+ installation.InstallationName = name;
+ installation.SuperInstallationId = parentId == "-1" ? "0" : parentId;
+ installation.StartDate = Funs.GetNewDateTime(planStart);
+ installation.EndDate = Funs.GetNewDateTime(planFinish);
+ installation.IsEnd = Convert.ToBoolean(isLeaf);
+ installation.Def = remark;
+ db.Project_Installation.InsertOnSubmit(installation);
+ db.SubmitChanges();
+ if (name == "施工")
+ {
+ sgId = id;
+ }
+ }
+ else if (level == "5")
+ {
+ var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
+ //拷贝专业
+ if (cn != null)
+ {
+ if (cn.CnProfessionName != "防腐绝热" && cn.CnProfessionName != "地勘" && cn.CnProfessionName != "全厂地下主管网" && cn.CnProfessionName != "临时设施" && cn.CnProfessionName != "总图")
+ {
+ Model.WBS_CnProfession cnProfession = new Model.WBS_CnProfession();
+ cnProfession.CnProfessionId = id;
+ cnProfession.CnProfessionName = cn.CnProfessionName;
+ cnProfession.CnProfessionCode = cn.CnProfessionCode;
+ cnProfession.InstallationId = parentId;
+ cnProfession.ProjectId = this.CurrUser.LoginProjectId;
+ cnProfession.StartDate = Funs.GetNewDateTime(planStart);
+ cnProfession.EndDate = Funs.GetNewDateTime(planFinish);
+ cnProfession.OldId = cn.CnProfessionId;
+ db.WBS_CnProfession.InsertOnSubmit(cnProfession);
+ db.SubmitChanges();
+ //单位工程
+ var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var unitProjectInit in unitProjects)
+ {
+ Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
+ unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
+ unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
+ unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
+ unitProject.InstallationId = parentId;
+ unitProject.SortIndex = unitProjectInit.SortIndex;
+ unitProject.SuperUnitProjectId = null;
+ unitProject.ProjectId = this.CurrUser.LoginProjectId;
+ unitProject.CnProfessionId = id;
+ unitProject.StartDate = Funs.GetNewDateTime(planStart);
+ unitProject.EndDate = Funs.GetNewDateTime(planFinish);
+ unitProject.Remark = unitProjectInit.Remark;
+ unitProject.IsIn = true;
+ db.Wbs_UnitProject.InsertOnSubmit(unitProject);
+ db.SubmitChanges();
+ }
+ //分部分项
+ var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var wbsSetInit in wbsSets)
+ {
+ Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
+ wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
+ wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
+ wbsSet.WbsSetName = wbsSetInit.WbsSetName;
+ wbsSet.InstallationId = parentId;
+ wbsSet.CnProfessionId = id;
+ wbsSet.UnitProjectId = (from x in db.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.CnProfessionId == id select x.UnitProjectId).FirstOrDefault();
+ if (wbsSetInit.SuperWbsSetCode == null)
+ {
+ wbsSet.SuperWbsSetId = null;
+ }
+ else
+ {
+ wbsSet.SuperWbsSetId = (from x in db.Wbs_WbsSet
+ where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == parentId && x.CnProfessionId == id
+ select x.WbsSetId).FirstOrDefault();
+ }
+ wbsSet.ProjectId = this.CurrUser.LoginProjectId;
+ wbsSet.StartDate = Funs.GetNewDateTime(planStart);
+ wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
+ wbsSet.Flag = wbsSetInit.Flag;
+ wbsSet.Way = wbsSetInit.Way;
+ wbsSet.Weights = wbsSetInit.Weights;
+ wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
+ wbsSet.ControlPoint = wbsSetInit.ControlPoint;
+ wbsSet.Remark = wbsSetInit.Remark;
+ wbsSet.IsIn = true;
+ db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
+ db.SubmitChanges();
+ var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
+ foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
+ {
+ Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
+ wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
+ wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
+ wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
+ if (wbsSetMatchCostControl.WbsSetId != null)
+ {
+ db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
+ db.SubmitChanges();
+ //拷贝费用清单项
+ var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
+ foreach (var costControlInit in costControlInits)
+ {
+ Model.WBS_CostControl costControl = new Model.WBS_CostControl();
+ costControl.CostControlId = SQLHelper.GetNewID();
+ costControl.ProjectId = this.CurrUser.LoginProjectId;
+ costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
+ costControl.CostControlCode = costControlInit.CostControlInitCode;
+ costControl.CostControlName = costControlInit.CostControlInitName;
+ costControl.Unit = costControlInit.Unit;
+ db.WBS_CostControl.InsertOnSubmit(costControl);
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
+ if (oldInstallation == null)
+ {
+ Model.Project_Installation installation = new Model.Project_Installation();
+ installation.InstallationId = id;
+ installation.ProjectId = this.CurrUser.LoginProjectId;
+ installation.InstallationCode = code;
+ installation.InstallationName = name;
+ installation.SuperInstallationId = sgId;
+ installation.StartDate = Funs.GetNewDateTime(planStart);
+ installation.EndDate = Funs.GetNewDateTime(planFinish);
+ installation.IsEnd = true;
+ installation.Def = remark;
+ db.Project_Installation.InsertOnSubmit(installation);
+ db.SubmitChanges();
+ // 拷贝总图等专业下WBS内容
+ //拷贝单位工程及子单位工程
+ var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var unitProjectInit in unitProjects)
+ {
+ Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
+ unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
+ unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
+ unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
+ if (unitProjectInit.SuperUnitProject == null)
+ {
+ unitProject.SuperUnitProjectId = null;
+ }
+ else
+ {
+ unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
+ where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
+ select x.UnitProjectId).FirstOrDefault();
+ }
+ unitProject.InstallationId = id;
+ unitProject.SortIndex = unitProjectInit.SortIndex;
+ unitProject.ProjectId = this.CurrUser.LoginProjectId;
+ unitProject.StartDate = Funs.GetNewDateTime(planStart);
+ unitProject.EndDate = Funs.GetNewDateTime(planFinish);
+ unitProject.Remark = unitProjectInit.Remark;
+ unitProject.IsIn = true;
+ db.Wbs_UnitProject.InsertOnSubmit(unitProject);
+ db.SubmitChanges();
+ }
+ //拷贝分部/子分部/分项/子分项
+ var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var wbsSetInit in wbsSets)
+ {
+ Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
+ wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
+ wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
+ wbsSet.WbsSetName = wbsSetInit.WbsSetName;
+ wbsSet.InstallationId = id;
+ wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
+ if (wbsSetInit.SuperWbsSetCode == null)
+ {
+ wbsSet.SuperWbsSetId = null;
+ }
+ else
+ {
+ wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
+ where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
+ select x.WbsSetId).FirstOrDefault();
+ }
+ wbsSet.ProjectId = this.CurrUser.LoginProjectId;
+ wbsSet.StartDate = Funs.GetNewDateTime(planStart);
+ wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
+ wbsSet.Flag = wbsSetInit.Flag;
+ wbsSet.Way = wbsSetInit.Way;
+ wbsSet.Weights = wbsSetInit.Weights;
+ wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
+ wbsSet.ControlPoint = wbsSetInit.ControlPoint;
+ wbsSet.Remark = wbsSetInit.Remark;
+ wbsSet.IsIn = true;
+ db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
+ db.SubmitChanges();
+ var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
+ foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
+ {
+ Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
+ wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
+ wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
+ wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
+ if (wbsSetMatchCostControl.WbsSetId != null)
+ {
+ db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
+ db.SubmitChanges();
+ //拷贝费用清单项
+ var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
+ foreach (var costControlInit in costControlInits)
+ {
+ Model.WBS_CostControl costControl = new Model.WBS_CostControl();
+ costControl.CostControlId = SQLHelper.GetNewID();
+ costControl.ProjectId = this.CurrUser.LoginProjectId;
+ costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
+ costControl.CostControlCode = costControlInit.CostControlInitCode;
+ costControl.CostControlName = costControlInit.CostControlInitName;
+ costControl.Unit = costControlInit.Unit;
+ db.WBS_CostControl.InsertOnSubmit(costControl);
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (level == "6" || level == "7")
+ {
+ if (name.Contains("防腐绝热") || name.Contains("地勘") || name.Contains("全厂地下主管网") || name.Contains("临时设施") || name.Contains("总图"))
+ {
+ var cn = cnProfessionInits.FirstOrDefault(x => x.CnProfessionName.Contains(name.Substring(0, 2)));
+ if (cn != null)
+ {
+ var oldInstallation = Funs.DB.Project_Installation.FirstOrDefault(x => x.InstallationName == name);
+ if (oldInstallation == null)
+ {
+ Model.Project_Installation installation = new Model.Project_Installation();
+ installation.InstallationId = id;
+ installation.ProjectId = this.CurrUser.LoginProjectId;
+ installation.InstallationCode = code;
+ installation.InstallationName = name;
+ installation.SuperInstallationId = sgId;
+ installation.StartDate = Funs.GetNewDateTime(planStart);
+ installation.EndDate = Funs.GetNewDateTime(planFinish);
+ installation.IsEnd = true;
+ installation.Def = remark;
+ db.Project_Installation.InsertOnSubmit(installation);
+ db.SubmitChanges();
+ // 拷贝总图等专业下WBS内容
+ //拷贝单位工程及子单位工程
+ var unitProjects = unitProjectInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var unitProjectInit in unitProjects)
+ {
+ Model.Wbs_UnitProject unitProject = new Model.Wbs_UnitProject();
+ unitProject.UnitProjectId = SQLHelper.GetNewID(typeof(Model.Wbs_UnitProject));
+ unitProject.UnitProjectCode = unitProjectInit.UnitProjectCode;
+ unitProject.UnitProjectName = unitProjectInit.UnitProjectName;
+ if (unitProjectInit.SuperUnitProject == null)
+ {
+ unitProject.SuperUnitProjectId = null;
+ }
+ else
+ {
+ unitProject.SuperUnitProjectId = (from x in Funs.DB.Wbs_UnitProject
+ where x.UnitProjectCode == unitProjectInit.SuperUnitProject && x.InstallationId == id
+ select x.UnitProjectId).FirstOrDefault();
+ }
+ unitProject.InstallationId = id;
+ unitProject.SortIndex = unitProjectInit.SortIndex;
+ unitProject.ProjectId = this.CurrUser.LoginProjectId;
+ unitProject.StartDate = Funs.GetNewDateTime(planStart);
+ unitProject.EndDate = Funs.GetNewDateTime(planFinish);
+ unitProject.Remark = unitProjectInit.Remark;
+ unitProject.IsIn = true;
+ db.Wbs_UnitProject.InsertOnSubmit(unitProject);
+ db.SubmitChanges();
+ }
+ //拷贝分部/子分部/分项/子分项
+ var wbsSets = wbsSetInits.Where(x => x.CnProfessionId == cn.CnProfessionId);
+ foreach (var wbsSetInit in wbsSets)
+ {
+ Model.Wbs_WbsSet wbsSet = new Model.Wbs_WbsSet();
+ wbsSet.WbsSetId = SQLHelper.GetNewID(typeof(Model.Wbs_WbsSet));
+ wbsSet.WbsSetCode = wbsSetInit.WbsSetCode;
+ wbsSet.WbsSetName = wbsSetInit.WbsSetName;
+ wbsSet.InstallationId = id;
+ wbsSet.UnitProjectId = (from x in Funs.DB.Wbs_UnitProject where x.UnitProjectCode == wbsSetInit.UnitProjectCode && x.InstallationId == id select x.UnitProjectId).FirstOrDefault();
+ if (wbsSetInit.SuperWbsSetCode == null)
+ {
+ wbsSet.SuperWbsSetId = null;
+ }
+ else
+ {
+ wbsSet.SuperWbsSetId = (from x in Funs.DB.Wbs_WbsSet
+ where x.WbsSetCode == wbsSetInit.SuperWbsSetCode && x.InstallationId == id
+ select x.WbsSetId).FirstOrDefault();
+ }
+ wbsSet.ProjectId = this.CurrUser.LoginProjectId;
+ wbsSet.StartDate = Funs.GetNewDateTime(planStart);
+ wbsSet.EndDate = Funs.GetNewDateTime(planFinish);
+ wbsSet.Flag = wbsSetInit.Flag;
+ wbsSet.Way = wbsSetInit.Way;
+ wbsSet.Weights = wbsSetInit.Weights;
+ wbsSet.ControlItemDef = wbsSetInit.ControlItemDef;
+ wbsSet.ControlPoint = wbsSetInit.ControlPoint;
+ wbsSet.Remark = wbsSetInit.Remark;
+ wbsSet.IsIn = true;
+ db.Wbs_WbsSet.InsertOnSubmit(wbsSet);
+ db.SubmitChanges();
+ var wbsSetMatchCostControls = wbsSetMatchCostControlInits.Where(x => x.WbsSetCode == wbsSetInit.WbsSetCode);
+ foreach (var wbsSetMatchCostControlInit in wbsSetMatchCostControls)
+ {
+ Model.WBS_WbsSetMatchCostControl wbsSetMatchCostControl = new Model.WBS_WbsSetMatchCostControl();
+ wbsSetMatchCostControl.WbsSetMatchCostControlId = SQLHelper.GetNewID();
+ wbsSetMatchCostControl.WbsSetId = wbsSet.WbsSetId;
+ wbsSetMatchCostControl.CostControlCode = wbsSetMatchCostControlInit.CostControlInitCode;
+ if (wbsSetMatchCostControl.WbsSetId != null)
+ {
+ db.WBS_WbsSetMatchCostControl.InsertOnSubmit(wbsSetMatchCostControl);
+ db.SubmitChanges();
+ //拷贝费用清单项
+ var costControlInits = from x in totalCostControlInits where x.CostControlInitCode == wbsSetMatchCostControlInit.CostControlInitCode orderby x.CostControlInitCode select x;
+ foreach (var costControlInit in costControlInits)
+ {
+ Model.WBS_CostControl costControl = new Model.WBS_CostControl();
+ costControl.CostControlId = SQLHelper.GetNewID();
+ costControl.ProjectId = this.CurrUser.LoginProjectId;
+ costControl.WbsSetId = wbsSetMatchCostControl.WbsSetId;
+ costControl.CostControlCode = costControlInit.CostControlInitCode;
+ costControl.CostControlName = costControlInit.CostControlInitName;
+ costControl.Unit = costControlInit.Unit;
+ db.WBS_CostControl.InsertOnSubmit(costControl);
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ShowNotify("抽取成功!", MessageBoxIcon.Success);
+ InitTreeMenu();
+ }
}
}
else
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx
index 4e4516d0..5c73709e 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx
@@ -147,6 +147,12 @@
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs
index 871a857f..5d257036 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.cs
@@ -168,6 +168,8 @@ namespace FineUIPro.Web.ProjectData
this.txtEnglishRemark.Text = project.EnglishRemark;
this.txtHJProjectCode.Text = project.HJProjectCode;
this.txtKZProjectCode.Text = project.KZProjectCode;
+ this.txtProjType.Text = project.ProjType;
+ this.txtProjPhase.Text = project.ProjPhase;
if (project.Progress != null)
{
this.txtProgress.Text = project.Progress.ToString();
@@ -209,6 +211,8 @@ namespace FineUIPro.Web.ProjectData
City = this.txtCity.Text.Trim(),
EnglishRemark = this.txtEnglishRemark.Text.Trim(),
Progress = Funs.GetNewDecimal(this.txtProgress.Text),
+ ProjType = this.txtProjType.Text.Trim(),
+ ProjPhase = this.txtProjPhase.Text.Trim(),
};
if (string.IsNullOrEmpty(project.JTProjectCode))
{
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs
index 0429f13e..feb4f79d 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetSave.aspx.designer.cs
@@ -7,13 +7,11 @@
// 自动生成>
//------------------------------------------------------------------------------
-namespace FineUIPro.Web.ProjectData
-{
-
-
- public partial class ProjectSetSave
- {
-
+namespace FineUIPro.Web.ProjectData {
+
+
+ public partial class ProjectSetSave {
+
///
/// form1 控件。
///
@@ -22,7 +20,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
-
+
///
/// PageManager1 控件。
///
@@ -31,7 +29,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.PageManager PageManager1;
-
+
///
/// SimpleForm1 控件。
///
@@ -40,7 +38,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Form SimpleForm1;
-
+
///
/// txtProjectName 控件。
///
@@ -49,7 +47,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtProjectName;
-
+
///
/// txtProjectCode 控件。
///
@@ -58,7 +56,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtProjectCode;
-
+
///
/// txtShortName 控件。
///
@@ -67,7 +65,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtShortName;
-
+
///
/// drpProjectType 控件。
///
@@ -76,7 +74,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpProjectType;
-
+
///
/// drpProjectState 控件。
///
@@ -85,7 +83,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpProjectState;
-
+
///
/// drpProjectState2 控件。
///
@@ -94,7 +92,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpProjectState2;
-
+
///
/// txtStartDate 控件。
///
@@ -103,7 +101,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DatePicker txtStartDate;
-
+
///
/// txtEndDate 控件。
///
@@ -112,7 +110,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DatePicker txtEndDate;
-
+
///
/// txtContractNo 控件。
///
@@ -121,7 +119,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtContractNo;
-
+
///
/// txtDuration 控件。
///
@@ -130,7 +128,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.NumberBox txtDuration;
-
+
///
/// drpProjectManager 控件。
///
@@ -139,7 +137,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpProjectManager;
-
+
///
/// drpConstructionManager 控件。
///
@@ -148,7 +146,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpConstructionManager;
-
+
///
/// drpQAManager 控件。
///
@@ -157,7 +155,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpQAManager;
-
+
///
/// drpHSSEManager 控件。
///
@@ -166,7 +164,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpHSSEManager;
-
+
///
/// drpDriveManager 控件。
///
@@ -175,7 +173,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpDriveManager;
-
+
///
/// drpUnit 控件。
///
@@ -184,7 +182,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpUnit;
-
+
///
/// txtProjectAddress 控件。
///
@@ -193,7 +191,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtProjectAddress;
-
+
///
/// txtJTProjectCode 控件。
///
@@ -202,7 +200,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtJTProjectCode;
-
+
///
/// ckbIsForeign 控件。
///
@@ -211,7 +209,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.CheckBox ckbIsForeign;
-
+
///
/// txtWorkRange 控件。
///
@@ -220,7 +218,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextArea txtWorkRange;
-
+
///
/// txtRemark 控件。
///
@@ -229,7 +227,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextArea txtRemark;
-
+
///
/// txtProjectMoney 控件。
///
@@ -238,7 +236,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.NumberBox txtProjectMoney;
-
+
///
/// txtConstructionMoney 控件。
///
@@ -247,7 +245,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.NumberBox txtConstructionMoney;
-
+
///
/// txtTelephone 控件。
///
@@ -256,7 +254,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtTelephone;
-
+
///
/// drpCountry 控件。
///
@@ -265,7 +263,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpCountry;
-
+
///
/// drpProvince 控件。
///
@@ -274,7 +272,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpProvince;
-
+
///
/// txtCity 控件。
///
@@ -283,7 +281,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtCity;
-
+
///
/// txtMapCoordinates 控件。
///
@@ -292,7 +290,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtMapCoordinates;
-
+
///
/// bottomPanel 控件。
///
@@ -301,7 +299,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ContentPanel bottomPanel;
-
+
///
/// txtEnglishRemark 控件。
///
@@ -310,7 +308,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtEnglishRemark;
-
+
///
/// txtHJProjectCode 控件。
///
@@ -319,7 +317,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtHJProjectCode;
-
+
///
/// txtKZProjectCode 控件。
///
@@ -328,7 +326,25 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtKZProjectCode;
-
+
+ ///
+ /// txtProjType 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtProjType;
+
+ ///
+ /// txtProjPhase 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtProjPhase;
+
///
/// txtProgress 控件。
///
@@ -337,7 +353,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.NumberBox txtProgress;
-
+
///
/// Toolbar1 控件。
///
@@ -346,7 +362,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Toolbar Toolbar1;
-
+
///
/// ckIsUpTotalMonth 控件。
///
@@ -355,7 +371,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.CheckBox ckIsUpTotalMonth;
-
+
///
/// btnAttachUrl 控件。
///
@@ -364,7 +380,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnAttachUrl;
-
+
///
/// btnSave 控件。
///
@@ -373,7 +389,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnSave;
-
+
///
/// btnClose 控件。
///
@@ -382,7 +398,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnClose;
-
+
///
/// hdCompileMan 控件。
///
@@ -391,7 +407,7 @@ namespace FineUIPro.Web.ProjectData
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.HiddenField hdCompileMan;
-
+
///
/// WindowAtt 控件。
///
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx
index 91db6d71..686dee6f 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx
@@ -106,6 +106,12 @@
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.cs
index a9b1e359..92b46111 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.cs
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.cs
@@ -102,6 +102,8 @@ namespace FineUIPro.Web.ProjectData
this.txtEnglishRemark.Text = project.EnglishRemark;
this.txtHJProjectCode.Text = project.HJProjectCode;
this.txtKZProjectCode.Text = project.KZProjectCode;
+ this.txtProjType.Text = project.ProjType;
+ this.txtProjPhase.Text = project.ProjPhase;
if (project.Progress != null)
{
this.txtProgress.Text = project.Progress.ToString();
diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.designer.cs
index cbd49494..0dddc5da 100644
--- a/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSetView.aspx.designer.cs
@@ -300,6 +300,24 @@ namespace FineUIPro.Web.ProjectData {
///
protected global::FineUIPro.TextBox txtKZProjectCode;
+ ///
+ /// txtProjType 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtProjType;
+
+ ///
+ /// txtProjPhase 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TextBox txtProjPhase;
+
///
/// txtEnglishRemark 控件。
///
diff --git a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
index bda13b16..69814a79 100644
--- a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
+++ b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
@@ -240,5 +240,10 @@ namespace Model
///
public string AuditState { get; set; }
+ ///
+ /// 接收人
+ ///
+ public string ReceiveMan { get; set; }
+
}
}
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index 339bc509..cf137fd9 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -25021,6 +25021,10 @@ namespace Model
private string _ProjectAttribute;
+ private string _ProjType;
+
+ private string _ProjPhase;
+
private EntitySet _Accident_AccidentHandle;
private EntitySet _Accident_AccidentPersonRecord;
@@ -25675,6 +25679,10 @@ namespace Model
partial void OnCLProjectCodeChanged();
partial void OnProjectAttributeChanging(string value);
partial void OnProjectAttributeChanged();
+ partial void OnProjTypeChanging(string value);
+ partial void OnProjTypeChanged();
+ partial void OnProjPhaseChanging(string value);
+ partial void OnProjPhaseChanged();
#endregion
public Base_Project()
@@ -26699,6 +26707,46 @@ namespace Model
}
}
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjType", DbType="NVarChar(50)")]
+ public string ProjType
+ {
+ get
+ {
+ return this._ProjType;
+ }
+ set
+ {
+ if ((this._ProjType != value))
+ {
+ this.OnProjTypeChanging(value);
+ this.SendPropertyChanging();
+ this._ProjType = value;
+ this.SendPropertyChanged("ProjType");
+ this.OnProjTypeChanged();
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjPhase", DbType="NVarChar(50)")]
+ public string ProjPhase
+ {
+ get
+ {
+ return this._ProjPhase;
+ }
+ set
+ {
+ if ((this._ProjPhase != value))
+ {
+ this.OnProjPhaseChanging(value);
+ this.SendPropertyChanging();
+ this._ProjPhase = value;
+ this.SendPropertyChanged("ProjPhase");
+ this.OnProjPhaseChanged();
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Accident_AccidentHandle_Base_Project", Storage="_Accident_AccidentHandle", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="NO ACTION")]
public EntitySet Accident_AccidentHandle
{
@@ -59591,6 +59639,8 @@ namespace Model
private string _ResponsibleMan;
+ private string _ReceiveMan;
+
private EntityRef _Base_Project;
private EntityRef _Technique_CheckItemSet;
@@ -59639,6 +59689,8 @@ namespace Model
partial void OnQuestionTypeChanged();
partial void OnResponsibleManChanging(string value);
partial void OnResponsibleManChanged();
+ partial void OnReceiveManChanging(string value);
+ partial void OnReceiveManChanged();
#endregion
public Check_CheckSpecial()
@@ -60056,6 +60108,26 @@ namespace Model
}
}
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReceiveMan", DbType="NVarChar(2000)")]
+ public string ReceiveMan
+ {
+ get
+ {
+ return this._ReceiveMan;
+ }
+ set
+ {
+ if ((this._ReceiveMan != value))
+ {
+ this.OnReceiveManChanging(value);
+ this.SendPropertyChanging();
+ this._ReceiveMan = value;
+ this.SendPropertyChanged("ReceiveMan");
+ this.OnReceiveManChanged();
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckSpecial_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
public Base_Project Base_Project
{
diff --git a/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs b/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs
index 98d016f0..66405e52 100644
--- a/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs
+++ b/SGGL/WebAPI/Controllers/HSSE/CheckSpecialController.cs
@@ -16,12 +16,12 @@ namespace WebAPI.Controllers
///
///
///
- public Model.ResponeData getCheckSpecialById(string CheckSpecialId)
+ public Model.ResponeData getCheckSpecialById(string CheckSpecialId,string state="0")
{
var responeData = new Model.ResponeData();
try
{
- responeData.data = APICheckSpecialService.getCheckSpecialById(CheckSpecialId);
+ responeData.data = APICheckSpecialService.getCheckSpecialById(CheckSpecialId, state);
}
catch (Exception ex)
{
@@ -41,12 +41,12 @@ namespace WebAPI.Controllers
///
///
///
- public Model.ResponeData getCheckSpecialList(string projectId, string states, int pageIndex)
+ public Model.ResponeData getCheckSpecialList(string projectId, string states, int pageIndex,string userid)
{
var responeData = new Model.ResponeData();
try
{
- var getDataList = APICheckSpecialService.getCheckSpecialList(projectId, states);
+ var getDataList = APICheckSpecialService.getCheckSpecialList(projectId, states, userid);
int pageCount = getDataList.Count();
if (pageCount > 0 && pageIndex > 0)
{
@@ -133,5 +133,24 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
+
+ ///
+ /// 加载措施
+ ///
+ ///
+ public Model.ResponeData getGroup_HandleStep()
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = ConstValue.drpConstItemList(BLL.ConstValue.Group_HandleStep);
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
}
}
From ac0efd6f370f7683a9c74cb8ae6590aec3e3e088 Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Sat, 7 Oct 2023 17:43:32 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SGGL/BLL/API/HSSE/APICheckSpecialService.cs | 16 +++++++++-------
SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs | 1 +
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
index de0945c2..3c15b020 100644
--- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
+++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
@@ -55,8 +55,8 @@ namespace BLL
QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
ResponsibleMan = x.ResponsibleMan,
- ReceiveMan = x.ReceiveMan
-
+ ReceiveMan = x.ReceiveMan,
+ ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan)
};
return getInfo.FirstOrDefault();
@@ -97,8 +97,8 @@ namespace BLL
QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
ResponsibleMan = x.ResponsibleMan,
- ReceiveMan = x.ReceiveMan
-
+ ReceiveMan = x.ReceiveMan,
+ ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan)
};
return getInfo.FirstOrDefault();
@@ -122,7 +122,7 @@ namespace BLL
var getCheckSpecial = from x in db.Check_CheckSpecial
where x.ProjectId == projectId && x.States ==states
//当前保存人、审核人、确认人能看到
- &&(x.CompileMan==userid || x.ResponsibleMan==userid || userid.Contains(x.ReceiveMan))
+ &&(x.CompileMan==userid || x.ResponsibleMan==userid || userid.Split(',').Contains(x.ReceiveMan))
orderby x.CheckSpecialCode descending
select new Model.CheckSpecialItem
{
@@ -146,7 +146,8 @@ namespace BLL
CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
States = x.States,
AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
- ReceiveMan=x.ResponsibleMan
+ ReceiveMan=x.ReceiveMan,
+ ReceiveManName= UserService.getUserNamesUserIds(x.ReceiveMan)
};
return getCheckSpecial.ToList();
}
@@ -185,7 +186,8 @@ namespace BLL
WorkAreaId=newItem.WorkAreaId,
QuestionType=newItem.QuestionType,
//审核人
- ResponsibleMan=newItem.ResponsibleMan
+ ResponsibleMan=newItem.ResponsibleMan,
+ ReceiveMan=newItem.ReceiveMan
};
//if (newItem.States != Const.State_1)
//{
diff --git a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
index 69814a79..0bcae846 100644
--- a/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
+++ b/SGGL/Model/APIItem/HSSE/CheckSpecialItem.cs
@@ -245,5 +245,6 @@ namespace Model
///
public string ReceiveMan { get; set; }
+ public string ReceiveManName { get; set; }
}
}
From e2b5b2e4b961b4ec926492d37235d2cf817db1cd Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Sun, 8 Oct 2023 10:38:24 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../版本日志/SGGLDB_WH_2023-10-08.sql | 27 +
.../HSSE/APIGeneralEquipmentQualityService.cs | 148 ++
SGGL/BLL/BLL.csproj | 2 +
SGGL/BLL/Common/NPOIExcel.cs | 1559 +++++++++++++++++
.../HSSE/QualityAudit/EquipmentQuality.aspx | 3 +-
.../QualityAudit/EquipmentQuality.aspx.cs | 118 ++
.../EquipmentQuality.aspx.designer.cs | 59 +-
.../QualityAudit/GeneralEquipmentQuality.aspx | 3 +-
.../GeneralEquipmentQuality.aspx.cs | 132 +-
.../GeneralEquipmentQuality.aspx.designer.cs | 59 +-
.../APIItem/HSSE/EquipmentQualityItem.cs | 8 +
SGGL/Model/Model.cs | 305 ++++
.../HSSE/GeneralEquipmentQualityController.cs | 160 ++
SGGL/WebAPI/WebAPI.csproj | 1 +
14 files changed, 2531 insertions(+), 53 deletions(-)
create mode 100644 DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
create mode 100644 SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs
create mode 100644 SGGL/BLL/Common/NPOIExcel.cs
create mode 100644 SGGL/WebAPI/Controllers/HSSE/GeneralEquipmentQualityController.cs
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
new file mode 100644
index 00000000..9ae0578d
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
@@ -0,0 +1,27 @@
+Create VIEW [dbo].[View_QualityAudit_GeneralEquipmentQuality] AS
+/*豸Ϣбͼ*/
+SELECT equ.GeneralEquipmentQualityId
+ ,equ.ProjectId
+ ,equ.GeneralEquipmentQualityCode
+ ,equ.UnitId
+ ,Unit.UnitName
+ ,equ.SpecialEquipmentId
+ ,sp.SpecialEquipmentName
+ ,equ.[IsQualified]
+ ,equ.EquipmentCount
+ ,equ.InDate
+ ,equ.Remark
+ ,equ.CompileMan
+ ,U.UserName AS CompileManName
+ ,equ.CompileDate
+ ,equ.QRCodeAttachUrl
+ ,REPLACE(a.AttachUrl,'\', '/') AS AttachUrl
+FROM QualityAudit_GeneralEquipmentQuality AS equ
+LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=equ.UnitId
+LEFT JOIN Base_SpecialEquipment AS sp ON equ.SpecialEquipmentId = sp.SpecialEquipmentId
+LEFT JOIN Sys_User AS U ON U.UserId = equ.CompileMan
+LEFT JOIN AttachFile AS a ON a.ToKeyId = equ.GeneralEquipmentQualityId
+
+
+
+GO
diff --git a/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs b/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs
new file mode 100644
index 00000000..458e6492
--- /dev/null
+++ b/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs
@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using EmitMapper;
+
+namespace BLL
+{
+ public static class APIGeneralEquipmentQualityService
+ {
+ #region 根据equipmentQualityId获取机具设备信息
+ ///
+ /// 根据equipmentQualityId获取机具设备信息
+ ///
+ ///
+ ///
+ public static Model.EquipmentQualityItem getEquipmentQualityByEquipmentQualityIdFactoryCode(string equipmentQualityId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getEquipmentQuality = (from x in db.View_QualityAudit_GeneralEquipmentQuality
+ where x.GeneralEquipmentQualityId == equipmentQualityId
+ select new Model.EquipmentQualityItem
+ {
+ EquipmentQualityId = x.GeneralEquipmentQualityId,
+ ProjectId = x.ProjectId,
+ EquipmentQualityCode = x.GeneralEquipmentQualityCode,
+ EquipmentCount = x.EquipmentCount.HasValue? x.EquipmentCount.Value.ToString():"",
+ UnitId = x.UnitId,
+ IsQualified =x.IsQualified.HasValue? x.IsQualified.Value?"是":"否":"",
+ UnitName = x.UnitName,
+ SpecialEquipmentName = x.SpecialEquipmentName,
+ InDate = string.Format("{0:yyyy-MM-dd}", x.InDate),
+ Remark = x.Remark,
+ CompileManId = x.CompileMan,
+ CompileManName = x.CompileManName,
+ CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
+ AttachUrl = x.AttachUrl.Replace('\\', '/')
+ }); ;
+ return getEquipmentQuality.FirstOrDefault();
+ }
+ }
+ #endregion
+
+ #region 获取机具设备列表信息
+ ///
+ /// 获取机具设备列表信息
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getEquipmentQualityList(string projectId, string unitId, string strParam)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getEquipmentQuality = from x in db.View_QualityAudit_GeneralEquipmentQuality
+ where x.ProjectId == projectId && (x.UnitId == unitId || unitId == null)
+ && (strParam == null || x.SpecialEquipmentName.Contains(strParam) )
+ orderby x.GeneralEquipmentQualityCode descending
+ select new Model.EquipmentQualityItem
+ {
+ EquipmentQualityId = x.GeneralEquipmentQualityId,
+ ProjectId = x.ProjectId,
+ EquipmentQualityCode = x.GeneralEquipmentQualityCode,
+ EquipmentCount = x.EquipmentCount.HasValue ? x.EquipmentCount.Value.ToString() : "",
+ UnitId = x.UnitId,
+ IsQualified = x.IsQualified.HasValue ? x.IsQualified.Value ? "是" : "否" : "",
+ UnitName = x.UnitName,
+ SpecialEquipmentName = x.SpecialEquipmentName,
+ InDate = string.Format("{0:yyyy-MM-dd}", x.InDate),
+ Remark = x.Remark,
+ CompileManId = x.CompileMan,
+ CompileManName = x.CompileManName,
+ CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
+ AttachUrl = x.AttachUrl.Replace('\\', '/')
+ };
+ return getEquipmentQuality.ToList();
+ }
+ }
+ #endregion
+
+ #region 保存QualityAudit_EquipmentQuality
+ ///
+ /// 保存QualityAudit_EquipmentQuality
+ ///
+ /// 机具设备资质
+ ///
+ public static void SaveEquipmentQuality(Model.EquipmentQualityItem newItem)
+ {
+ Model.SGGLDB db = Funs.DB;
+ Model.QualityAudit_GeneralEquipmentQuality newEquipmentQuality = new Model.QualityAudit_GeneralEquipmentQuality
+ {
+ GeneralEquipmentQualityId = newItem.EquipmentQualityId,
+ ProjectId = newItem.ProjectId,
+ GeneralEquipmentQualityCode = newItem.EquipmentQualityCode,
+ UnitId = newItem.UnitId,
+ SpecialEquipmentId = newItem.SpecialEquipmentId,
+ InDate = Funs.GetNewDateTime(newItem.InDate),
+ Remark = newItem.Remark,
+ CompileMan = newItem.CompileManId,
+ };
+ if (!string.IsNullOrEmpty(newItem.IsQualified))
+ {
+ if ("1".Equals(newItem.IsQualified))
+ {
+ newEquipmentQuality.IsQualified = true;
+ }
+ else
+ {
+ newEquipmentQuality.IsQualified = false;
+
+ }
+ }
+ if (!string.IsNullOrEmpty(newItem.EquipmentCount))
+ {
+ try
+ {
+ newEquipmentQuality.EquipmentCount = int.Parse(newItem.EquipmentCount);
+ }
+ catch (Exception e) { }
+ }
+ var updateEquipmentQuality = db.QualityAudit_GeneralEquipmentQuality.FirstOrDefault(x => x.GeneralEquipmentQualityId == newItem.EquipmentQualityId);
+ if (updateEquipmentQuality == null)
+ {
+ newEquipmentQuality.CompileDate = DateTime.Now;
+ newEquipmentQuality.GeneralEquipmentQualityId = SQLHelper.GetNewID();
+ newEquipmentQuality.GeneralEquipmentQualityCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.GeneralEquipmentQualityMenuId, newItem.ProjectId, newItem.UnitId);
+ GeneralEquipmentQualityService.AddGeneralEquipmentQuality(newEquipmentQuality);
+ }
+ else
+ {
+ GeneralEquipmentQualityService.UpdateGeneralEquipmentQuality(newEquipmentQuality);
+ }
+ if (!string.IsNullOrEmpty(newItem.AttachUrl))
+ {
+ ////保存附件
+ UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.GeneralEquipmentQualityMenuId, newEquipmentQuality.GeneralEquipmentQualityId);
+ }
+ else
+ {
+ CommonService.DeleteAttachFileById(newEquipmentQuality.GeneralEquipmentQualityId);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj
index f8b66252..81372eff 100644
--- a/SGGL/BLL/BLL.csproj
+++ b/SGGL/BLL/BLL.csproj
@@ -103,6 +103,7 @@
+
@@ -174,6 +175,7 @@
+
diff --git a/SGGL/BLL/Common/NPOIExcel.cs b/SGGL/BLL/Common/NPOIExcel.cs
new file mode 100644
index 00000000..62868551
--- /dev/null
+++ b/SGGL/BLL/Common/NPOIExcel.cs
@@ -0,0 +1,1559 @@
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.SS.Util;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.OleDb;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace BLL.Common
+{
+ public class NPOIExcel
+ {
+ internal IWorkbook Book { get; set; }
+
+ private int sheetID = 0;
+ ///
+ /// 当前活动的SheetID,所有的操作将指向这个Sheet
+ ///
+ public int ActiveSheetID
+ {
+ get
+ {
+ return sheetID;
+ }
+ set
+ {
+ sheetID = value;
+ }
+ }
+
+ ///
+ /// 当前活动的SheetName,所有的操作将指向这个Sheet
+ ///
+ public String ActiveSheetName
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).SheetName;
+ }
+ set
+ {
+ sheetID = Book.GetSheetIndex(value);
+ }
+ }
+ ///
+ /// 当前活动的Sheet,所有的操作将指向这个Sheet
+ ///
+ public ISheet ActiveSheet
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID);
+ }
+ }
+
+ ///
+ /// 第一行非空行的行号
+ ///
+ public int FirstRowNum
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).FirstRowNum;
+ }
+ }
+
+ ///
+ /// 最后一行非空行的行号
+ ///
+ public int LastRostNum
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).LastRowNum;
+ }
+ }
+
+ ///
+ /// 无模板的Excel生成或操作
+ ///
+ public NPOIExcel()
+ {
+ Book = new HSSFWorkbook();
+ Book.CreateSheet();
+ }
+
+ public NPOIExcel(Stream fileStream, String fileName)
+ {
+ if (fileName.Substring(fileName.LastIndexOf(".")) == ".xls")
+ {
+ Book = new HSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Book = new XSSFWorkbook(fileStream);
+ }
+ }
+ ///
+ /// 带模板或数据的Excel生成或操作
+ ///
+ ///
+ public NPOIExcel(String fileName)
+ {
+ Book = CreateBook(fileName);
+ }
+
+ ///
+ /// 创建Excel Book
+ ///
+ /// 模板文件名
+ ///
+ private IWorkbook CreateBook(String fileName)
+ {
+ FileInfo file = new FileInfo(fileName);
+ if (!file.Exists)
+ {
+ File.Create(fileName).Close();
+ }
+ FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ IWorkbook book;
+ if (file.Extension == ".xls")
+ {
+ book = new HSSFWorkbook(fs);
+ }
+ else
+ {
+ book = new XSSFWorkbook(fs);
+ }
+ fs.Close();
+ if (book.NumberOfSheets == 0)
+ {
+ book.CreateSheet();
+ }
+ return book;
+ }
+
+ ///
+ /// 新建Sheet
+ ///
+ /// 新建Sheet
+ public ISheet CreateSheet()
+ {
+ return Book.CreateSheet();
+ }
+
+ ///
+ /// 新建Sheet
+ ///
+ /// 新建Sheet的名称
+ /// 新建Sheet
+ public ISheet CreateSheet(String sheetName)
+ {
+ return Book.CreateSheet(sheetName);
+ }
+
+ ///
+ /// 设置行高
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 高度
+ public void SetRowHeight(int rowIndex, float height)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ row.Height = (short)(height * 20);
+ }
+
+ ///
+ /// 设置列宽
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 列号
+ /// 宽度
+ public void SetColumnWidth(int columnIndex, short width)
+ {
+ Book.GetSheetAt(sheetID).SetColumnWidth(columnIndex, width * 256);
+ }
+
+ ///
+ /// 获取或设置默认行高
+ /// 注:只对当前ActiveSheet有效
+ ///
+ public short DefaultRowHeight
+ {
+ get
+ {
+ return (short)(Book.GetSheetAt(sheetID).DefaultRowHeight / 20);
+ }
+ set
+ {
+ Book.GetSheetAt(sheetID).DefaultRowHeight = (short)(value * 20);
+
+ }
+ }
+
+ ///
+ /// 获取或设置默认列宽
+ /// 注:只对当前ActiveSheet有效
+ ///
+ public int DefaultColWidth
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).DefaultColumnWidth;
+ }
+ set
+ {
+ Book.GetSheetAt(sheetID).DefaultColumnWidth = value;
+ }
+ }
+
+ ///
+ /// 某一列的列宽自动调整大小
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 列号
+ public void AutoColWidth(int colIndex)
+ {
+ Book.GetSheetAt(sheetID).AutoSizeColumn(colIndex, true);
+ }
+
+ ///
+ /// 隐藏一行
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ public void HiddenRow(int rowIndex)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ row.ZeroHeight = true;
+ }
+
+ ///
+ /// 删除一行
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ public void RemoveRow(int rowIndex)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row != null)
+ {
+ ActiveSheet.RemoveRow(row);
+ }
+ }
+
+ ///
+ /// 读取单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public object ReadValue(int rowIndex, int columnIndex, bool? isDateTime = null)
+ {
+ try
+ {
+ ICell cell = Book.GetSheetAt(sheetID).GetRow(rowIndex).GetCell(columnIndex);
+ short df = cell.CellStyle.DataFormat;
+
+ //return cell.ToString();
+ switch (cell.CellType)
+ {
+ case CellType.Blank:
+ return null;
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ {
+ switch (cell.CachedFormulaResultType)
+ {
+ case CellType.Blank:
+ return "";
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ throw new Exception("The Formula of this cell is too complex!");
+ case CellType.Numeric:
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ case CellType.Numeric:
+ {
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ catch (System.NullReferenceException)
+ {
+ return null;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ ///
+ /// 设置单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public void SetValue(int rowIndex, int columnIndex, object value)
+ {
+ SetValue(rowIndex, columnIndex, value, false);
+ }
+ public void SetPicValue(int rowIndex, int columnIndex, string value)
+ {
+ byte[] bytes = System.IO.File.ReadAllBytes(value);
+ int pictureIdx = Book.AddPicture(bytes, PictureType.JPEG);
+
+ // 第三步:创建画部
+ IDrawing patriarch = ActiveSheet.CreateDrawingPatriarch();
+ // 第四步:设置锚点
+ int rowline = 1; // y方向
+ // 参数说明:(在起始单元格的X坐标0-1023,Y的坐标0-255,在终止单元格的X坐标0-1023,Y的坐标0-255,起始单元格列数,行数,终止单元格列数,行数)
+ IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, columnIndex, rowIndex, columnIndex+1, rowIndex + 1);
+ // 第五步:把图片插到相应的位置+1
+ IPicture pict = patriarch.CreatePicture(anchor, pictureIdx);
+
+
+ }
+ ///
+ /// 设置单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ /// 是否是公式
+ public void SetValue(int rowIndex, int columnIndex, object value, bool isFormula)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ ICell cell = row.GetCell(columnIndex);
+ if (cell == null)
+ {
+ cell = row.CreateCell(columnIndex);
+ }
+ if (value == null)
+ {
+ cell.SetCellValue("");
+ }
+ if (isFormula)
+ {
+ cell.SetCellFormula(value.ToString());
+ }
+ else
+ {
+ if (value is short)
+ {
+ cell.SetCellValue((short)value);
+ }
+ else if (value is int)
+ {
+ cell.SetCellValue((int)value);
+ }
+ else if (value is long)
+ {
+ cell.SetCellValue((long)value);
+ }
+ else if (value is float)
+ {
+ cell.SetCellValue((float)value);
+ }
+ else if (value is double)
+ {
+ cell.SetCellValue((double)value);
+ }
+ else if (value is bool)
+ {
+ cell.SetCellValue((bool)value);
+ }
+ else if (value is DateTime)
+ {
+ cell.SetCellValue((DateTime)value);
+ }
+ else if (value == null)
+ {
+ }
+ else
+ {
+ cell.SetCellValue(value.ToString());
+ }
+ }
+
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue)
+ {
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, type, operatorType, minValue, maxValue, "", "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ /// 数据格式
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue, String formate)
+ {
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, type, operatorType, minValue, maxValue, formate, "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ /// 数据格式
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue, String formate, String AlertMassage)
+ {
+ CellRangeAddressList regions = new CellRangeAddressList(startRowIndex, EndRowIndex, startColInex, endColIndex);
+ DVConstraint constraint = DVConstraint.CreateNumericConstraint(ValidationType.ANY, 0, null, null);
+ switch (type)
+ {
+ case NPOIDataType.Integer:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.INTEGER, (int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.Float:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.DECIMAL, (int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.Date:
+ if (formate == "")
+ {
+ formate = "yyyy/MM/dd";
+ }
+ constraint = DVConstraint.CreateDateConstraint((int)operatorType, minValue, maxValue, formate);
+ break;
+ case NPOIDataType.Time:
+ constraint = DVConstraint.CreateTimeConstraint((int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.TextLength:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.TEXT_LENGTH, (int)operatorType, minValue, maxValue);
+ break;
+ default:
+ break;
+ }
+
+ HSSFDataValidation dataValidate1 = new HSSFDataValidation(regions, constraint);
+ if (!String.IsNullOrEmpty(AlertMassage))
+ {
+ dataValidate1.CreateErrorBox("Error", AlertMassage);
+ }
+ ActiveSheet.AddValidationData(dataValidate1);
+
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 值系列
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, String[] dataRange)
+ {
+
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, dataRange, "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 值系列
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String[] dataRange, String alertMassage)
+ {
+ ISheetConditionalFormatting hscf = ActiveSheet.SheetConditionalFormatting;
+ CellRangeAddress[] regions = {
+ new CellRangeAddress(startRowIndex, endRowIndex,startColInex,endColIndex)
+ };
+
+ CellRangeAddressList rangeList = new CellRangeAddressList();
+ rangeList.AddCellRangeAddress(new CellRangeAddress(startRowIndex, endRowIndex, startColInex, endColIndex));
+ DVConstraint dvconstraint = DVConstraint.CreateExplicitListConstraint(dataRange);
+ HSSFDataValidation dataValidation = new HSSFDataValidation(rangeList, dvconstraint);
+
+ if (!String.IsNullOrEmpty(alertMassage))
+ {
+ dataValidation.CreateErrorBox("Error", alertMassage);
+ }
+
+ ActiveSheet.AddValidationData(dataValidation);
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 计算公式
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String Formula, String alertMassage)
+ {
+ ISheetConditionalFormatting hscf = ActiveSheet.SheetConditionalFormatting;
+ CellRangeAddress[] regions = {
+ new CellRangeAddress(startRowIndex, endRowIndex,startColInex,endColIndex)
+ };
+
+ CellRangeAddressList rangeList = new CellRangeAddressList();
+ rangeList.AddCellRangeAddress(new CellRangeAddress(startRowIndex, endRowIndex, startColInex, endColIndex));
+ DVConstraint dvconstraint = DVConstraint.CreateFormulaListConstraint(Formula);
+ HSSFDataValidation dataValidation = new HSSFDataValidation(rangeList, dvconstraint);
+
+ if (!String.IsNullOrEmpty(alertMassage))
+ {
+ dataValidation.CreateErrorBox("Error", alertMassage);
+ }
+
+ ActiveSheet.AddValidationData(dataValidation);
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 计算公式
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String Formula)
+ {
+ SetValueRange(startRowIndex, endColIndex, startRowIndex, endColIndex, Formula, "");
+ }
+
+ ///
+ /// 生成单元格样式
+ ///
+ /// 与当前Excel相关的单元格样式
+ public ICellStyle CreateCellStyle()
+ {
+ return Book.CreateCellStyle();
+ }
+
+ ///
+ /// 生成字体
+ ///
+ /// 与当前Excel相关的字体
+ public IFont CreateFont()
+ {
+ return Book.CreateFont();
+ }
+
+ ///
+ /// 设置单元格样式
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 样式
+ public void SetStyle(int rowIndex, int columnIndex, ICellStyle style)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ ICell cell = row.GetCell(columnIndex);
+ if (cell == null)
+ {
+ cell = row.CreateCell(columnIndex);
+ }
+ cell.CellStyle = style;
+ }
+
+ ///
+ /// 合并单元格
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行号
+ /// 开始列号
+ /// 结束行号
+ /// 结束列号
+ public void MergeCells(int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex)
+ {
+ int Index = Book.GetSheetAt(sheetID).AddMergedRegion(new CellRangeAddress(startRowIndex, endRowIndex, startColumnIndex, endColumnIndex));
+ }
+
+ ///
+ /// 拆分单元格
+ /// 注1:只对当前ActiveSheet有效
+ /// 注2:只有合并的单元格才能拆分
+ ///
+ /// 开始行号
+ /// 开始列号
+ public void UnMergeCells(int startRowIndex, int startColumnIndex)
+ {
+ int merges = Book.GetSheetAt(sheetID).NumMergedRegions;
+ CellRangeAddress merge;
+ for (int i = 0; i < merges; i++)
+ {
+ merge = Book.GetSheetAt(sheetID).GetMergedRegion(i);
+ if (merge.FirstRow == startRowIndex && merge.FirstColumn == startColumnIndex)
+ {
+ Book.GetSheetAt(sheetID).RemoveMergedRegion(i);
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 保存到文件
+ /// 注:有模板的,文件扩展名与模板一样;没有模板的,文件扩展名为“.xls”;
+ ///
+ /// 保存文件名
+ public void Save(String fileName)
+ {
+ FileStream file = new FileStream(fileName, FileMode.Create);
+ Book.Write(file);
+ file.Close();
+ }
+
+ ///
+ /// 保存到流
+ /// 注:保存或下载时,有模板的,文件扩展名与模板一样;没有模板的,文件扩展名为“.xls”;
+ ///
+ /// 内存流
+ public MemoryStream Save()
+ {
+ MemoryStream ms = new MemoryStream();
+ Book.Write(ms);
+ return ms;
+ }
+
+ ///
+ /// 把Excel读成DataSet
+ /// 注:必须是正规表格式
+ ///
+ /// 读出的Excel
+ public DataSet ReadAsDataSet()
+ {
+ DataSet rtn = new DataSet();
+ for (int i = 0; i < SheetCount; i++)
+ {
+ ISheet sheet = Book.GetSheetAt(i);
+ rtn.Tables.Add(GetDataTableBySheet(sheet));
+ }
+ return rtn;
+ }
+
+ private DataTable GetDataTableBySheet(ISheet sheet)
+ {
+ DataTable dt = new DataTable(sheet.SheetName);
+ int maxCols = 0;
+ object value;
+ while ((value = ReadValue(sheet, 0, maxCols)) != null)
+ {
+ dt.Columns.Add(value.ToString());
+ maxCols++;
+ }
+
+ int row = 1;
+
+ bool emptyRow = false;
+ int emptyRowCount = 0;
+ while (emptyRowCount < 10)
+ {
+ emptyRow = true;
+ DataRow dr = dt.NewRow();
+ for (int i = 0; i < maxCols; i++)
+ {
+ value = ReadValue(sheet, row, i);
+ if (value != null)
+ {
+ dr[i] = value;
+ emptyRow = false;
+ }
+ }
+ if (!emptyRow)
+ {
+ dt.Rows.Add(dr);
+ emptyRowCount = 0;
+ }
+ else
+ {
+ emptyRowCount++;
+ }
+ row++;
+ }
+
+ return dt;
+ }
+
+ ///
+ /// 根据SheetName导出数据为DataTable
+ ///
+ /// Sheet名称
+ ///
+ public DataTable GetDataTableBySheet(String sheetName)
+ {
+
+ ISheet sheet = Book.GetSheet(sheetName);
+ if (sheet != null)
+ {
+ return GetDataTableBySheet(sheet);
+ }
+ return null;
+
+ }
+
+ ///
+ /// 根据SheetName导出数据为DataTable
+ ///
+ /// Sheet编号
+ ///
+ public DataTable GetDataTableBySheet(int sheetIndex)
+ {
+
+ ISheet sheet = Book.GetSheetAt(sheetIndex);
+ if (sheet != null)
+ {
+ return GetDataTableBySheet(sheet);
+ }
+ return null;
+
+ }
+
+ ///
+ /// 写入表格
+ ///
+ /// 表格数据
+ /// 写入的起始列
+ /// 写入的起始行
+ /// 标题颜色
+ /// 是否需要四周边框
+ public void WriteDataTable(DataTable Data, int col = 1, int row = 1, short? titleColor = null, bool fullBorder = true)
+ {
+ if (Data == null)
+ {
+ return;
+ }
+
+ var titleStyle = CreateCellStyle();
+ var rowStyle = CreateCellStyle();
+ if (titleColor != null)
+ titleStyle.FillForegroundColor = titleColor.Value;
+
+ titleStyle.FillPattern = FillPattern.SolidForeground;
+ if (fullBorder)
+ {
+ titleStyle.BorderBottom = BorderStyle.Thin;
+ titleStyle.BorderLeft = BorderStyle.Thin;
+ titleStyle.BorderRight = BorderStyle.Thin;
+ titleStyle.BorderTop = BorderStyle.Thin;
+ titleStyle.BottomBorderColor = NPOIColor.BLACK;
+ titleStyle.LeftBorderColor = NPOIColor.BLACK;
+ titleStyle.RightBorderColor = NPOIColor.BLACK;
+ titleStyle.TopBorderColor = NPOIColor.BLACK;
+ rowStyle.BorderBottom = BorderStyle.Thin;
+ rowStyle.BorderLeft = BorderStyle.Thin;
+ rowStyle.BorderRight = BorderStyle.Thin;
+ rowStyle.BorderTop = BorderStyle.Thin;
+ rowStyle.BottomBorderColor = NPOIColor.BLACK;
+ rowStyle.LeftBorderColor = NPOIColor.BLACK;
+ rowStyle.RightBorderColor = NPOIColor.BLACK;
+ rowStyle.TopBorderColor = NPOIColor.BLACK;
+ }
+
+ int iCol = 0, iRow = 1;
+
+ foreach (DataColumn dc in Data.Columns)
+ {
+ SetValue(row, col + iCol, dc.ColumnName);
+ SetStyle(row, col + iCol, titleStyle);
+ iCol++;
+ }
+
+ rowStyle.FillForegroundColor = NPOIColor.WHITE;
+
+ foreach (DataRow dr in Data.Rows)
+ {
+ iCol = 0;
+ foreach (DataColumn dc in Data.Columns)
+ {
+ SetValue(row + iRow, col + iCol, dr[dc]);
+ SetStyle(row + iRow, col + iCol, rowStyle);
+ iCol++;
+ }
+ iRow++;
+ }
+
+ for (int i = 0; i < iCol; i++)
+ {
+ this.AutoColWidth(i);
+ }
+ }
+
+ ///
+ /// 读取单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public object ReadValue(ISheet sheet, int rowIndex, int columnIndex, bool? isDateTime = null)
+ {
+ try
+ {
+ ICell cell = sheet.GetRow(rowIndex).GetCell(columnIndex);
+ short df = cell.CellStyle.DataFormat;
+
+ //return cell.ToString();
+ switch (cell.CellType)
+ {
+ case CellType.Blank:
+ return null;
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ {
+ switch (cell.CachedFormulaResultType)
+ {
+ case CellType.Blank:
+ return "";
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ throw new Exception("The Formula of this cell is too complex!");
+ case CellType.Numeric:
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ case CellType.Numeric:
+ {
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ catch (System.NullReferenceException)
+ {
+ return null;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ public int SheetCount
+ {
+ get
+ {
+ return Book.NumberOfSheets;
+ }
+ }
+
+ public String GetSheetName(int Index)
+ {
+ return Book.GetSheetName(Index);
+ }
+
+ public void AddPicture(byte[] data, int row, int col)
+ {
+ int picIndex = Book.AddPicture(data, PictureType.PNG);
+
+ IDrawing draw = ActiveSheet.CreateDrawingPatriarch();
+
+ IClientAnchor anchor = draw.CreateAnchor(0, 0, 255, 255, col, row, col + 5, col + 5);
+ IPicture pic = draw.CreatePicture(anchor, picIndex);
+ pic.Resize();
+ }
+ }
+
+ public enum OperatorTypes
+ {
+ ///
+ /// 介于最大值与小值之间
+ ///
+ BETWEEN = OperatorType.BETWEEN,
+ ///
+ /// 等于最小值
+ ///
+ EQUAL = OperatorType.EQUAL,
+ ///
+ /// 大于或等于最小值
+ ///
+ GREATER_OR_EQUAL = OperatorType.GREATER_OR_EQUAL,
+ ///
+ /// 大于最小值
+ ///
+ GREATER_THAN = OperatorType.GREATER_THAN,
+ ///
+ /// 忽略
+ ///
+ NO_COMPARISON = OperatorType.IGNORED,
+ ///
+ /// 小于或等于最小值
+ ///
+ LESS_OR_EQUAL = OperatorType.LESS_OR_EQUAL,
+ ///
+ /// 小于最小值
+ ///
+ LESS_THAN = OperatorType.LESS_THAN,
+ ///
+ /// 不在最小值与最大值之间
+ ///
+ NOT_BETWEEN = OperatorType.NOT_BETWEEN,
+ ///
+ /// 不等于最小值
+ ///
+ NOT_EQUAL = OperatorType.NOT_EQUAL
+ }
+
+ public enum NPOIDataType
+ {
+ ///
+ /// 验证整数
+ ///
+ Integer,
+ ///
+ /// 验证符点数
+ ///
+ Float,
+ ///
+ /// 验证日期
+ ///
+ Date,
+ ///
+ /// 验证时间
+ ///
+ Time,
+ ///
+ /// 验证字符长度
+ ///
+ TextLength
+ }
+
+ public static class NPOIColor
+ {
+
+ ///
+ /// 红色
+ ///
+ public static short RED { get { return NPOI.HSSF.Util.HSSFColor.Red.Index; } }
+
+ ///
+ /// 蓝色
+ ///
+ public static short BLUE { get { return NPOI.HSSF.Util.HSSFColor.Blue.Index; } }
+
+ ///
+ /// 浅绿色
+ ///
+ public static short AQUA { get { return NPOI.HSSF.Util.HSSFColor.Aqua.Index; } }
+
+ ///
+ /// 自动
+ ///
+ public static short AUTOMATIC { get { return NPOI.HSSF.Util.HSSFColor.Automatic.Index; } }
+
+ ///
+ /// 黑色
+ ///
+ public static short BLACK { get { return NPOI.HSSF.Util.HSSFColor.Black.Index; } }
+
+ ///
+ /// 蓝灰色
+ ///
+ public static short BLUE_GREY { get { return NPOI.HSSF.Util.HSSFColor.BlueGrey.Index; } }
+
+ ///
+ /// 明绿色
+ ///
+ public static short BRIGHT_GREEN { get { return NPOI.HSSF.Util.HSSFColor.BrightGreen.Index; } }
+
+ ///
+ /// 棕色
+ ///
+ public static short BROWN { get { return NPOI.HSSF.Util.HSSFColor.Brown.Index; } }
+
+ ///
+ /// 正常
+ ///
+ public static short COLOR_NORMAL { get { return NPOI.HSSF.Util.HSSFColor.COLOR_NORMAL; } }
+
+ ///
+ /// 珊瑚色
+ ///
+ public static short CORAL { get { return NPOI.HSSF.Util.HSSFColor.Coral.Index; } }
+
+ ///
+ /// 亮蓝色
+ ///
+ public static short CORNFLOWER_BLUE { get { return NPOI.HSSF.Util.HSSFColor.CornflowerBlue.Index; } }
+
+ ///
+ /// 深蓝色
+ ///
+ public static short DARK_BLUE { get { return NPOI.HSSF.Util.HSSFColor.DarkBlue.Index; } }
+
+ ///
+ /// 深绿色
+ ///
+ public static short DARK_GREEN { get { return NPOI.HSSF.Util.HSSFColor.DarkGreen.Index; } }
+
+ ///
+ /// 深红色
+ ///
+ public static short DARK_RED { get { return NPOI.HSSF.Util.HSSFColor.DarkRed.Index; } }
+
+ ///
+ /// 深茶色
+ ///
+ public static short DARK_TEAL { get { return NPOI.HSSF.Util.HSSFColor.DarkTeal.Index; } }
+
+ ///
+ /// 深黄
+ ///
+ public static short DARK_YELLOW { get { return NPOI.HSSF.Util.HSSFColor.DarkYellow.Index; } }
+
+ ///
+ /// 金色
+ ///
+ public static short GOLD { get { return NPOI.HSSF.Util.HSSFColor.Gold.Index; } }
+
+ ///
+ /// 绿色
+ ///
+ public static short GREEN { get { return NPOI.HSSF.Util.HSSFColor.Green.Index; } }
+
+ ///
+ /// 25%灰色
+ ///
+ public static short GREY_25_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey25Percent.Index; } }
+
+ ///
+ /// 40%灰色
+ ///
+ public static short GREY_40_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey40Percent.Index; } }
+
+ ///
+ /// 50%灰色
+ ///
+ public static short GREY_50_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey50Percent.Index; } }
+
+ ///
+ /// 80%灰色
+ ///
+ public static short GREY_80_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey80Percent.Index; } }
+
+ ///
+ /// 靛蓝色
+ ///
+ public static short INDIGO { get { return NPOI.HSSF.Util.HSSFColor.Indigo.Index; } }
+
+ ///
+ /// 淡紫色
+ ///
+ public static short LAVENDER { get { return NPOI.HSSF.Util.HSSFColor.Lavender.Index; } }
+
+ ///
+ /// 粉黄色
+ ///
+ public static short LEMON_CHIFFON { get { return NPOI.HSSF.Util.HSSFColor.LemonChiffon.Index; } }
+
+ ///
+ /// 淡蓝色
+ ///
+ public static short LIGHT_BLUE { get { return NPOI.HSSF.Util.HSSFColor.LightBlue.Index; } }
+
+ ///
+ /// 淡亮蓝色
+ ///
+ public static short LIGHT_CORNFLOWER_BLUE { get { return NPOI.HSSF.Util.HSSFColor.LightCornflowerBlue.Index; } }
+
+ ///
+ /// 淡绿色
+ ///
+ public static short LIGHT_GREEN { get { return NPOI.HSSF.Util.HSSFColor.LightGreen.Index; } }
+
+ ///
+ /// 淡桔黄色
+ ///
+ public static short LIGHT_ORANGE { get { return NPOI.HSSF.Util.HSSFColor.LightOrange.Index; } }
+
+ ///
+ /// 淡蓝绿色
+ ///
+ public static short LIGHT_TURQUOISE { get { return NPOI.HSSF.Util.HSSFColor.LightTurquoise.Index; } }
+
+ ///
+ /// 淡黄色
+ ///
+ public static short LIGHT_YELLOW { get { return NPOI.HSSF.Util.HSSFColor.LightYellow.Index; } }
+
+ ///
+ /// 绿黄色
+ ///
+ public static short LIME { get { return NPOI.HSSF.Util.HSSFColor.Lime.Index; } }
+
+ ///
+ /// 栗色
+ ///
+ public static short MAROON { get { return NPOI.HSSF.Util.HSSFColor.Maroon.Index; } }
+
+ ///
+ /// 橄榄绿色
+ ///
+ public static short OLIVE_GREEN { get { return NPOI.HSSF.Util.HSSFColor.OliveGreen.Index; } }
+
+ ///
+ /// 桔色
+ ///
+ public static short ORANGE { get { return NPOI.HSSF.Util.HSSFColor.Orange.Index; } }
+
+ ///
+ /// 白灰蓝色
+ ///
+ public static short PALE_BLUE { get { return NPOI.HSSF.Util.HSSFColor.PaleBlue.Index; } }
+
+ ///
+ /// 粉红色
+ ///
+ public static short PINK { get { return NPOI.HSSF.Util.HSSFColor.Pink.Index; } }
+
+ ///
+ /// 紫红色
+ ///
+ public static short PLUM { get { return NPOI.HSSF.Util.HSSFColor.Plum.Index; } }
+
+ ///
+ /// 玫瑰红色
+ ///
+ public static short ROSE { get { return NPOI.HSSF.Util.HSSFColor.Rose.Index; } }
+
+ ///
+ /// 高贵蓝
+ ///
+ public static short ROYAL_BLUE { get { return NPOI.HSSF.Util.HSSFColor.RoyalBlue.Index; } }
+
+ ///
+ /// 海绿色
+ ///
+ public static short SEA_GREEN { get { return NPOI.HSSF.Util.HSSFColor.SeaGreen.Index; } }
+
+ ///
+ /// 天空蓝
+ ///
+ public static short SKY_BLUE { get { return NPOI.HSSF.Util.HSSFColor.SkyBlue.Index; } }
+
+ ///
+ /// 棕褐色
+ ///
+ public static short TAN { get { return NPOI.HSSF.Util.HSSFColor.Tan.Index; } }
+
+ ///
+ /// 茶色
+ ///
+ public static short TEAL { get { return NPOI.HSSF.Util.HSSFColor.Teal.Index; } }
+
+ ///
+ /// 蓝绿色
+ ///
+ public static short TURQUOISE { get { return NPOI.HSSF.Util.HSSFColor.Turquoise.Index; } }
+
+ ///
+ /// 紫色
+ ///
+ public static short VIOLET { get { return NPOI.HSSF.Util.HSSFColor.Violet.Index; } }
+
+ ///
+ /// 白色
+ ///
+ public static short WHITE { get { return NPOI.HSSF.Util.HSSFColor.White.Index; } }
+
+ ///
+ /// 黄色
+ ///
+ public static short YELLOW { get { return NPOI.HSSF.Util.HSSFColor.Yellow.Index; } }
+
+ }
+
+ ///
+ /// 针对excel的Oledb
+ ///
+ public class OleDbExcel
+ {
+ ///
+ /// OLEDB连接
+ ///
+ public OleDbConnection Connection
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// 用Oledb对Excel进行操作
+ /// 注:必须是标准表形式Excel内容
+ ///
+ /// Excel文件
+ public OleDbExcel(String excelFile)
+ {
+ String conStr = String.Empty;
+ FileInfo file = new FileInfo(excelFile);
+ if (!file.Exists) { throw new Exception("文件不存在"); }
+ String extension = file.Extension;
+ switch (extension)
+ {
+ case ".xls":
+ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
+ break;
+ case ".xlsx":
+ conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'";
+ break;
+ default:
+ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
+ break;
+ }
+
+ //链接Excel
+ Connection = new OleDbConnection(conStr);
+ }
+
+ private List tableNames;
+
+ ///
+ /// 获取Excel内的Sheet名称
+ ///
+ public List Sheets
+ {
+ get
+ {
+ if (tableNames == null)
+ {
+ try
+ {
+ tableNames = new List();
+ //读取Excel里面的sheet名
+ Connection.Open();
+
+ DataTable schemaTable = Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
+
+ for (int i = 0; i < schemaTable.Rows.Count; i++)
+ {
+ DataRow dr = schemaTable.Rows[i];
+ String tbName = dr["table_name"].ToString();
+ if (tbName[tbName.Length - 1] == '$')
+ {
+ tableNames.Add(tbName);
+ }
+ }
+ Connection.Close();
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+ return tableNames;
+ }
+ }
+
+ ///
+ /// 查询出所有数据
+ ///
+ /// Sheet名称
+ /// sheet内的所有数据
+ public DataSet QueryAll(String tableName)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter();
+ adapter.SelectCommand = new OleDbCommand();
+ adapter.SelectCommand.Connection = Connection;
+ adapter.SelectCommand.CommandText = String.Format("SELECT * FROM {0}", "[" + tableName + "]");
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 查询出所有数据
+ ///
+ /// Sheet序号(从0开始)
+ /// sheet内的所有数据
+ public DataSet QueryAll(int tableIndex)
+ {
+ return QueryAll(Sheets[tableIndex]);
+ }
+
+ ///
+ /// 利用Sql进行查询
+ ///
+ /// Sql语句
+ /// 查询出的数据
+ public DataSet Query(String sql)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection);
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行查询
+ ///
+ /// Sql语句
+ /// 查询参数
+ /// 查询出的数据
+ public DataSet Query(String sql, params OleDbParameter[] param)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection);
+ adapter.SelectCommand.Parameters.AddRange(param);
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行数据操作
+ ///
+ /// sql语句
+ /// 影响的行数
+ public int ExecuteSql(String sql)
+ {
+ try
+ {
+ Connection.Open();
+ OleDbCommand cmd = Connection.CreateCommand();
+ cmd.CommandText = sql;
+ int rtn = cmd.ExecuteNonQuery();
+ Connection.Close();
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行数据操作
+ ///
+ /// sql语句
+ /// 执行参数
+ /// 影响的行数
+ public int ExecuteSql(String sql, params OleDbParameter[] param)
+ {
+ try
+ {
+ Connection.Open();
+ OleDbCommand cmd = Connection.CreateCommand();
+ cmd.CommandText = sql;
+ cmd.Parameters.AddRange(param);
+ int rtn = cmd.ExecuteNonQuery();
+ Connection.Close();
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx
index 9cf6fddb..08f3b06f 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx
@@ -36,7 +36,8 @@
-
+
+
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.cs
index 14616a04..6506bee0 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.cs
@@ -1,10 +1,13 @@
using BLL;
+using BLL.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
+using System.IO;
using System.Linq;
using System.Text;
+using ThoughtWorks.QRCode.Codec;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.QualityAudit
@@ -294,5 +297,120 @@ namespace FineUIPro.Web.HSSE.QualityAudit
}
}
#endregion
+
+ protected void btnQR_Click(object sender, EventArgs e)
+ {
+ string strSql = @"SELECT EquipmentQuality.EquipmentQualityId, CodeRecords.Code AS EquipmentQualityCode,
+ EquipmentQuality.FactoryCode ,EquipmentQuality.QRCodeAttachUrl
+ FROM QualityAudit_EquipmentQuality AS EquipmentQuality
+ LEFT JOIN Sys_CodeRecords AS CodeRecords ON EquipmentQuality.EquipmentQualityId = CodeRecords.DataId
+ LEFT JOIN Base_SpecialEquipment AS SpecialEquipment ON SpecialEquipment.SpecialEquipmentId = EquipmentQuality.SpecialEquipmentId WHERE 1=1 ";
+ List listStr = new List();
+ if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
+ {
+ strSql += " AND EquipmentQuality.ProjectId = @ProjectId";
+ listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
+ }
+ if (!string.IsNullOrEmpty(this.txtEquipmentQualityCode.Text.Trim()))
+ {
+ strSql += " AND EquipmentQualityCode LIKE @EquipmentQualityCode";
+ listStr.Add(new SqlParameter("@EquipmentQualityCode", "%" + this.txtEquipmentQualityCode.Text.Trim() + "%"));
+ }
+ if (this.drpUnitId.SelectedValue != BLL.Const._Null)
+ {
+ strSql += " AND EquipmentQuality.UnitId = @UnitId";
+ listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue.Trim()));
+ }
+ if (!string.IsNullOrEmpty(this.txtSpecialEquipmentName.Text.Trim()))
+ {
+ strSql += " AND SpecialEquipmentName LIKE @SpecialEquipmentName";
+ listStr.Add(new SqlParameter("@SpecialEquipmentName", "%" + this.txtSpecialEquipmentName.Text.Trim() + "%"));
+ }
+ SqlParameter[] parameter = listStr.ToArray();
+ DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
+
+ NPOIExcel excel = new NPOIExcel();
+ excel.SetColumnWidth(0, 50);
+ excel.SetColumnWidth(1, 50);
+ excel.SetColumnWidth(2, 50);
+ for (int i = 0; i < tb.Rows.Count; i++)
+ {
+ if (i % 3 == 0)
+ {
+ excel.SetRowHeight(2 * (int)(i / 3), 200);
+ }
+ string QRCodeAttachUrl = tb.Rows[i]["QRCodeAttachUrl"].ToString();
+ string EquipmentQualityCode = tb.Rows[i]["EquipmentQualityCode"].ToString();
+ if (string.IsNullOrEmpty(QRCodeAttachUrl))
+ {
+ try
+ {
+ var equipmentQuality = Funs.DB.QualityAudit_EquipmentQuality.FirstOrDefault(x => x.EquipmentQualityId == tb.Rows[i]["EquipmentQualityId"].ToString());
+ equipmentQuality.QRCodeAttachUrl = CreateCode_Simple("equipment$" + tb.Rows[i]["FactoryCode"].ToString());
+ QRCodeAttachUrl = equipmentQuality.QRCodeAttachUrl;
+ Funs.DB.SubmitChanges();
+ }
+ catch (Exception e1) { }
+
+ }
+ //add picture data to this workbook.
+ excel.SetPicValue(2 * (int)(i / 3), i % 3, Server.MapPath("~/") + QRCodeAttachUrl);
+ excel.SetValue(2 * (int)(i / 3) + 1, i % 3, EquipmentQualityCode);
+ }
+ string initTemplatePath = Const.ExcelUrl + Funs.GetNewFileName() + ".xls";
+ string uploadfilepath = Server.MapPath("~/") + initTemplatePath;
+ string fileName = Path.GetFileName(initTemplatePath);
+ excel.Save(uploadfilepath);
+ FileInfo info = new FileInfo(uploadfilepath);
+
+ long fileSize = info.Length;
+ Response.ClearContent();
+ Response.ContentType = "application/x-zip-compressed";
+ Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
+ Response.AddHeader("Content-Length", fileSize.ToString());
+ Response.TransmitFile(uploadfilepath, 0, fileSize);
+ Response.Flush();
+ Response.End();
+
+
+
+ }
+
+ private string CreateCode_Simple(string nr)
+ {
+ try
+ {
+ string imageUrl = string.Empty;
+ QRCodeEncoder qrCodeEncoder = new QRCodeEncoder
+ {
+ QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
+ QRCodeScale = nr.Length,
+ QRCodeVersion = 0,
+ QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
+ };
+ System.Drawing.Image image = qrCodeEncoder.Encode(nr, Encoding.UTF8);
+ string filepath = Server.MapPath("~/") + UploadFileService.QRCodeImageFilePath;
+ //如果文件夹不存在,则创建
+ if (!Directory.Exists(filepath))
+ {
+ Directory.CreateDirectory(filepath);
+ }
+ string filename = DateTime.Now.ToString("yyyymmddhhmmssfff").ToString() + ".jpg";
+ imageUrl = filepath + filename;
+ FileStream fs = new FileStream(imageUrl, FileMode.OpenOrCreate, FileAccess.Write);
+ image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
+ fs.Close();
+ image.Dispose();
+ return UploadFileService.QRCodeImageFilePath + filename;
+ }
+
+ catch (Exception ex)
+
+ {
+ }
+ return "";
+ }
+
+
}
}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.designer.cs
index 1b1a9e21..d1027b11 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/EquipmentQuality.aspx.designer.cs
@@ -7,11 +7,13 @@
// 自动生成>
//------------------------------------------------------------------------------
-namespace FineUIPro.Web.HSSE.QualityAudit {
-
-
- public partial class EquipmentQuality {
-
+namespace FineUIPro.Web.HSSE.QualityAudit
+{
+
+
+ public partial class EquipmentQuality
+ {
+
///
/// form1 控件。
///
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
-
+
///
/// PageManager1 控件。
///
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.PageManager PageManager1;
-
+
///
/// Panel1 控件。
///
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Panel Panel1;
-
+
///
/// Grid1 控件。
///
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Grid Grid1;
-
+
///
/// Toolbar2 控件。
///
@@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Toolbar Toolbar2;
-
+
///
/// txtEquipmentQualityCode 控件。
///
@@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtEquipmentQualityCode;
-
+
///
/// drpUnitId 控件。
///
@@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList drpUnitId;
-
+
///
/// txtSpecialEquipmentName 控件。
///
@@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtSpecialEquipmentName;
-
+
///
/// ToolbarFill1 控件。
///
@@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarFill ToolbarFill1;
-
+
///
/// btnNew 控件。
///
@@ -101,7 +103,16 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnNew;
-
+
+ ///
+ /// btnQR 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnQR;
+
///
/// btnOut 控件。
///
@@ -110,7 +121,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnOut;
-
+
///
/// lblNumber 控件。
///
@@ -119,7 +130,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.WebControls.Label lblNumber;
-
+
///
/// ToolbarSeparator1 控件。
///
@@ -128,7 +139,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
-
+
///
/// ToolbarText1 控件。
///
@@ -137,7 +148,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarText ToolbarText1;
-
+
///
/// ddlPageSize 控件。
///
@@ -146,7 +157,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList ddlPageSize;
-
+
///
/// Window1 控件。
///
@@ -155,7 +166,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Window Window1;
-
+
///
/// WindowAtt 控件。
///
@@ -164,7 +175,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Window WindowAtt;
-
+
///
/// Menu1 控件。
///
@@ -173,7 +184,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Menu Menu1;
-
+
///
/// btnMenuEdit 控件。
///
@@ -182,7 +193,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.MenuButton btnMenuEdit;
-
+
///
/// btnMenuDelete 控件。
///
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx
index 79b9f6df..015698e7 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx
@@ -38,7 +38,8 @@
-
+
+
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
index 0532f26f..1fcbfec5 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
@@ -1,10 +1,13 @@
using BLL;
+using BLL.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
+using System.IO;
using System.Linq;
using System.Text;
+using ThoughtWorks.QRCode.Codec;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.QualityAudit
@@ -50,7 +53,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
{
Grid1.PageSize = this.CurrUser.PageSize.Value;
- }
+ }
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
@@ -109,7 +112,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
-
+
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
@@ -265,11 +268,134 @@ namespace FineUIPro.Web.HSSE.QualityAudit
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 = this.Grid1.RecordCount;
+ this.Grid1.PageSize = this.Grid1.RecordCount;
BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
#endregion
+
+
+
+
+
+ protected void btnQR_Click(object sender, EventArgs e)
+ {
+ string strSql = @"SELECT GeneralEquipmentQuality.GeneralEquipmentQualityId,"
+ + @"CodeRecords.Code AS GeneralEquipmentQualityCode,"
+ + @"GeneralEquipmentQuality.GeneralEquipmentQualityCode,"
+ + @"GeneralEquipmentQuality.QRCodeAttachUrl,"
+ + @"SpecialEquipment.SpecialEquipmentName"
+ + @" FROM QualityAudit_GeneralEquipmentQuality AS GeneralEquipmentQuality "
+ + @" LEFT JOIN Base_SpecialEquipment AS SpecialEquipment ON SpecialEquipment.SpecialEquipmentId = GeneralEquipmentQuality.SpecialEquipmentId "
+ + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON GeneralEquipmentQuality.GeneralEquipmentQualityId = CodeRecords.DataId WHERE 1=1 ";
+ List listStr = new List();
+ if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
+ {
+ strSql += " AND GeneralEquipmentQuality.ProjectId = @ProjectId";
+ listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
+ }
+ if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
+ {
+ strSql += " AND GeneralEquipmentQuality.UnitId = @UnitId"; ///状态为已完成
+ listStr.Add(new SqlParameter("@UnitId", this.CurrUser.UnitId));
+ }
+ if (!string.IsNullOrEmpty(this.txtGeneralEquipmentQualityCode.Text.Trim()))
+ {
+ strSql += " AND GeneralEquipmentQualityCode LIKE @GeneralEquipmentQualityCode";
+ listStr.Add(new SqlParameter("@GeneralEquipmentQualityCode", "%" + this.txtGeneralEquipmentQualityCode.Text.Trim() + "%"));
+ }
+ if (!string.IsNullOrEmpty(this.txtUnitName.Text.Trim()))
+ {
+ strSql += " AND UnitName LIKE @UnitName";
+ listStr.Add(new SqlParameter("@UnitName", "%" + this.txtUnitName.Text.Trim() + "%"));
+ }
+ if (!string.IsNullOrEmpty(this.txtSpecialEquipmentName.Text.Trim()))
+ {
+ strSql += " AND SpecialEquipmentName LIKE @SpecialEquipmentName";
+ listStr.Add(new SqlParameter("@SpecialEquipmentName", "%" + this.txtSpecialEquipmentName.Text.Trim() + "%"));
+ }
+ SqlParameter[] parameter = listStr.ToArray();
+ DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
+
+ NPOIExcel excel = new NPOIExcel();
+ excel.SetColumnWidth(0, 50);
+ excel.SetColumnWidth(1, 50);
+ excel.SetColumnWidth(2, 50);
+ for (int i = 0; i < tb.Rows.Count; i++)
+ {
+ if (i % 3 == 0)
+ {
+ excel.SetRowHeight(2 * (int)(i / 3), 200);
+ }
+ string QRCodeAttachUrl = tb.Rows[i]["QRCodeAttachUrl"].ToString();
+ string GeneralEquipmentQualityCode = tb.Rows[i]["GeneralEquipmentQualityCode"].ToString();
+ if (string.IsNullOrEmpty(QRCodeAttachUrl))
+ {
+ try
+ {
+ var equipmentQuality = Funs.DB.QualityAudit_GeneralEquipmentQuality.FirstOrDefault(x => x.GeneralEquipmentQualityId == tb.Rows[i]["GeneralEquipmentQualityId"].ToString());
+ equipmentQuality.QRCodeAttachUrl = CreateCode_Simple("equipment$" + tb.Rows[i]["GeneralEquipmentQualityId"].ToString());
+ QRCodeAttachUrl = equipmentQuality.QRCodeAttachUrl;
+ Funs.DB.SubmitChanges();
+ }
+ catch (Exception e1) { }
+ }
+ //add picture data to this workbook.
+ excel.SetPicValue(2 * (int)(i / 3), i % 3, Server.MapPath("~/") + QRCodeAttachUrl);
+ excel.SetValue(2 * (int)(i / 3) + 1, i % 3, GeneralEquipmentQualityCode);
+ }
+ string initTemplatePath = Const.ExcelUrl + Funs.GetNewFileName() + ".xls";
+ string uploadfilepath = Server.MapPath("~/") + initTemplatePath;
+ string fileName = Path.GetFileName(initTemplatePath);
+ excel.Save(uploadfilepath);
+ FileInfo info = new FileInfo(uploadfilepath);
+
+ long fileSize = info.Length;
+ Response.ClearContent();
+ Response.ContentType = "application/x-zip-compressed";
+ Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
+ Response.AddHeader("Content-Length", fileSize.ToString());
+ Response.TransmitFile(uploadfilepath, 0, fileSize);
+ Response.Flush();
+ Response.End();
+
+
+
+ }
+ private string CreateCode_Simple(string nr)
+ {
+ try
+ {
+ string imageUrl = string.Empty;
+ QRCodeEncoder qrCodeEncoder = new QRCodeEncoder
+ {
+ QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
+ QRCodeScale = nr.Length,
+ QRCodeVersion = 0,
+ QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
+ };
+ System.Drawing.Image image = qrCodeEncoder.Encode(nr, Encoding.UTF8);
+ string filepath = Server.MapPath("~/") + UploadFileService.QRCodeImageFilePath;
+ //如果文件夹不存在,则创建
+ if (!Directory.Exists(filepath))
+ {
+ Directory.CreateDirectory(filepath);
+ }
+ string filename = DateTime.Now.ToString("yyyymmddhhmmssfff").ToString() + ".jpg";
+ imageUrl = filepath + filename;
+ FileStream fs = new FileStream(imageUrl, FileMode.OpenOrCreate, FileAccess.Write);
+ image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
+ fs.Close();
+ image.Dispose();
+ return UploadFileService.QRCodeImageFilePath + filename;
+ }
+
+ catch (Exception ex)
+
+ {
+ }
+ return "";
+ }
}
}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.designer.cs
index ec16217b..fcba2593 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.designer.cs
@@ -7,11 +7,13 @@
// 自动生成>
//------------------------------------------------------------------------------
-namespace FineUIPro.Web.HSSE.QualityAudit {
-
-
- public partial class GeneralEquipmentQuality {
-
+namespace FineUIPro.Web.HSSE.QualityAudit
+{
+
+
+ public partial class GeneralEquipmentQuality
+ {
+
///
/// form1 控件。
///
@@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
-
+
///
/// PageManager1 控件。
///
@@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.PageManager PageManager1;
-
+
///
/// Panel1 控件。
///
@@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Panel Panel1;
-
+
///
/// Grid1 控件。
///
@@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Grid Grid1;
-
+
///
/// Toolbar2 控件。
///
@@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Toolbar Toolbar2;
-
+
///
/// txtGeneralEquipmentQualityCode 控件。
///
@@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtGeneralEquipmentQualityCode;
-
+
///
/// txtUnitName 控件。
///
@@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtUnitName;
-
+
///
/// txtSpecialEquipmentName 控件。
///
@@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.TextBox txtSpecialEquipmentName;
-
+
///
/// ToolbarFill1 控件。
///
@@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarFill ToolbarFill1;
-
+
///
/// btnNew 控件。
///
@@ -101,7 +103,16 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnNew;
-
+
+ ///
+ /// btnQR 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnQR;
+
///
/// btnOut 控件。
///
@@ -110,7 +121,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Button btnOut;
-
+
///
/// lblNumber 控件。
///
@@ -119,7 +130,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::System.Web.UI.WebControls.Label lblNumber;
-
+
///
/// ToolbarSeparator1 控件。
///
@@ -128,7 +139,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
-
+
///
/// ToolbarText1 控件。
///
@@ -137,7 +148,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.ToolbarText ToolbarText1;
-
+
///
/// ddlPageSize 控件。
///
@@ -146,7 +157,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.DropDownList ddlPageSize;
-
+
///
/// Window1 控件。
///
@@ -155,7 +166,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Window Window1;
-
+
///
/// WindowAtt 控件。
///
@@ -164,7 +175,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Window WindowAtt;
-
+
///
/// Menu1 控件。
///
@@ -173,7 +184,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.Menu Menu1;
-
+
///
/// btnMenuEdit 控件。
///
@@ -182,7 +193,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit {
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
protected global::FineUIPro.MenuButton btnMenuEdit;
-
+
///
/// btnMenuDelete 控件。
///
diff --git a/SGGL/Model/APIItem/HSSE/EquipmentQualityItem.cs b/SGGL/Model/APIItem/HSSE/EquipmentQualityItem.cs
index 16689aae..8b1b84da 100644
--- a/SGGL/Model/APIItem/HSSE/EquipmentQualityItem.cs
+++ b/SGGL/Model/APIItem/HSSE/EquipmentQualityItem.cs
@@ -95,5 +95,13 @@ namespace Model
/// 附件
///
public string AttachUrl { get; set; }
+ ///
+ /// 是否合格
+ ///
+ public string IsQualified { get; set; }
+ ///
+ /// 数量
+ ///
+ public string EquipmentCount { get; set; }
}
}
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index cf137fd9..8db11614 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -9179,6 +9179,14 @@ namespace Model
}
}
+ public System.Data.Linq.Table View_QualityAudit_GeneralEquipmentQuality
+ {
+ get
+ {
+ return this.GetTable();
+ }
+ }
+
public System.Data.Linq.Table View_QualityAudit_PersonQuality
{
get
@@ -393032,6 +393040,303 @@ namespace Model
}
}
+ [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_QualityAudit_GeneralEquipmentQuality")]
+ public partial class View_QualityAudit_GeneralEquipmentQuality
+ {
+
+ private string _GeneralEquipmentQualityId;
+
+ private string _ProjectId;
+
+ private string _GeneralEquipmentQualityCode;
+
+ private string _UnitId;
+
+ private string _UnitName;
+
+ private string _SpecialEquipmentId;
+
+ private string _SpecialEquipmentName;
+
+ private System.Nullable _IsQualified;
+
+ private System.Nullable _EquipmentCount;
+
+ private System.Nullable _InDate;
+
+ private string _Remark;
+
+ private string _CompileMan;
+
+ private string _CompileManName;
+
+ private System.Nullable _CompileDate;
+
+ private string _QRCodeAttachUrl;
+
+ private string _AttachUrl;
+
+ public View_QualityAudit_GeneralEquipmentQuality()
+ {
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GeneralEquipmentQualityId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string GeneralEquipmentQualityId
+ {
+ get
+ {
+ return this._GeneralEquipmentQualityId;
+ }
+ set
+ {
+ if ((this._GeneralEquipmentQualityId != value))
+ {
+ this._GeneralEquipmentQualityId = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string ProjectId
+ {
+ get
+ {
+ return this._ProjectId;
+ }
+ set
+ {
+ if ((this._ProjectId != value))
+ {
+ this._ProjectId = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GeneralEquipmentQualityCode", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string GeneralEquipmentQualityCode
+ {
+ get
+ {
+ return this._GeneralEquipmentQualityCode;
+ }
+ set
+ {
+ if ((this._GeneralEquipmentQualityCode != value))
+ {
+ this._GeneralEquipmentQualityCode = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string UnitId
+ {
+ get
+ {
+ return this._UnitId;
+ }
+ set
+ {
+ if ((this._UnitId != value))
+ {
+ this._UnitId = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitName", DbType="NVarChar(200)")]
+ public string UnitName
+ {
+ get
+ {
+ return this._UnitName;
+ }
+ set
+ {
+ if ((this._UnitName != value))
+ {
+ this._UnitName = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SpecialEquipmentId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string SpecialEquipmentId
+ {
+ get
+ {
+ return this._SpecialEquipmentId;
+ }
+ set
+ {
+ if ((this._SpecialEquipmentId != value))
+ {
+ this._SpecialEquipmentId = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SpecialEquipmentName", DbType="NVarChar(50)")]
+ public string SpecialEquipmentName
+ {
+ get
+ {
+ return this._SpecialEquipmentName;
+ }
+ set
+ {
+ if ((this._SpecialEquipmentName != value))
+ {
+ this._SpecialEquipmentName = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsQualified", DbType="Bit")]
+ public System.Nullable IsQualified
+ {
+ get
+ {
+ return this._IsQualified;
+ }
+ set
+ {
+ if ((this._IsQualified != value))
+ {
+ this._IsQualified = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EquipmentCount", DbType="Int")]
+ public System.Nullable EquipmentCount
+ {
+ get
+ {
+ return this._EquipmentCount;
+ }
+ set
+ {
+ if ((this._EquipmentCount != value))
+ {
+ this._EquipmentCount = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InDate", DbType="DateTime")]
+ public System.Nullable InDate
+ {
+ get
+ {
+ return this._InDate;
+ }
+ set
+ {
+ if ((this._InDate != value))
+ {
+ this._InDate = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Remark", DbType="NVarChar(500)")]
+ public string Remark
+ {
+ get
+ {
+ return this._Remark;
+ }
+ set
+ {
+ if ((this._Remark != value))
+ {
+ this._Remark = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")]
+ public string CompileMan
+ {
+ get
+ {
+ return this._CompileMan;
+ }
+ set
+ {
+ if ((this._CompileMan != value))
+ {
+ this._CompileMan = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileManName", DbType="NVarChar(50)")]
+ public string CompileManName
+ {
+ get
+ {
+ return this._CompileManName;
+ }
+ set
+ {
+ if ((this._CompileManName != value))
+ {
+ this._CompileManName = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileDate", DbType="DateTime")]
+ public System.Nullable CompileDate
+ {
+ get
+ {
+ return this._CompileDate;
+ }
+ set
+ {
+ if ((this._CompileDate != value))
+ {
+ this._CompileDate = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_QRCodeAttachUrl", DbType="NVarChar(200)")]
+ public string QRCodeAttachUrl
+ {
+ get
+ {
+ return this._QRCodeAttachUrl;
+ }
+ set
+ {
+ if ((this._QRCodeAttachUrl != value))
+ {
+ this._QRCodeAttachUrl = value;
+ }
+ }
+ }
+
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrl", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
+ public string AttachUrl
+ {
+ get
+ {
+ return this._AttachUrl;
+ }
+ set
+ {
+ if ((this._AttachUrl != value))
+ {
+ this._AttachUrl = value;
+ }
+ }
+ }
+ }
+
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_QualityAudit_PersonQuality")]
public partial class View_QualityAudit_PersonQuality
{
diff --git a/SGGL/WebAPI/Controllers/HSSE/GeneralEquipmentQualityController.cs b/SGGL/WebAPI/Controllers/HSSE/GeneralEquipmentQualityController.cs
new file mode 100644
index 00000000..30335139
--- /dev/null
+++ b/SGGL/WebAPI/Controllers/HSSE/GeneralEquipmentQualityController.cs
@@ -0,0 +1,160 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using BLL;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 一般机具设备资质
+ ///
+ public class GeneralEquipmentQualityController : ApiController
+ {
+ #region 根据equipmentQualityId获取机具设备资质信息
+ ///
+ /// 根据equipmentQualityId获取机具设备资质信息
+ ///
+ ///
+ ///
+ public Model.ResponeData getEquipmentQualityByEquipmentQualityId(string equipmentQualityId)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ responeData.data = APIGeneralEquipmentQualityService.getEquipmentQualityByEquipmentQualityIdFactoryCode(equipmentQualityId);
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+ #endregion
+
+
+
+ #region 根据projectId、unitid获取机具设备资质信息
+ ///
+ /// 根据projectId、unitid获取机具设备资质信息
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Model.ResponeData getEquipmentQualityByProjectIdUnitId(string projectId, string unitId, int pageIndex)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ var getDataList = APIGeneralEquipmentQualityService.getEquipmentQualityList(projectId, unitId, null);
+ int pageCount = getDataList.Count();
+ if (pageCount > 0 && pageIndex > 0)
+ {
+ getDataList = getDataList.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
+ }
+ responeData.data = new { pageCount, getDataList };
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
+ #endregion
+
+ #region 根据projectId、unitid获取机具设备资质信息-查询
+ ///
+ /// 根据projectId、unitid获取机具设备资质信息
+ ///
+ ///
+ ///
+ ///
+ /// 查询条件
+ ///
+ public Model.ResponeData getEquipmentQualityByProjectIdUnitIdQuery(string projectId, string unitId, string strParam, int pageIndex)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ var getDataList = APIGeneralEquipmentQualityService.getEquipmentQualityList(projectId, unitId, strParam);
+ int pageCount = getDataList.Count();
+ if (pageCount > 0 && pageIndex > 0)
+ {
+ getDataList = getDataList.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
+ }
+ responeData.data = new { pageCount, getDataList };
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+ return responeData;
+ }
+ #endregion
+
+ #region 根据projectId、unitid获取特岗机具设备资质资质各状态数
+ ///
+ /// 根据projectId、unitid获取特岗机具设备资质资质各状态数
+ ///
+ ///
+ ///
+ ///
+ public Model.ResponeData getEquipmentQualityCount(string projectId, string unitId)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ var getDataList = new Model.SGGLDB(Funs.ConnString).QualityAudit_GeneralEquipmentQuality.Where(x => x.ProjectId == projectId);
+ if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(projectId, unitId))
+ {
+ getDataList = getDataList.Where(x => x.UnitId == unitId);
+ }
+ ////总数
+ int tatalCount = getDataList.Count();
+
+ responeData.data = new { tatalCount };
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+ #endregion
+
+
+
+ #region 保存QualityAudit_EquipmentQuality
+ ///
+ /// 保存QualityAudit_EquipmentQuality
+ ///
+ /// 机具设备资质
+ ///
+ [HttpPost]
+ public Model.ResponeData SaveEquipmentQuality([FromBody] Model.EquipmentQualityItem newitem)
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ APIGeneralEquipmentQualityService.SaveEquipmentQuality(newitem);
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = ex.Message;
+ }
+
+ return responeData;
+ }
+ #endregion
+ }
+}
diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj
index 43dc784e..47f019c7 100644
--- a/SGGL/WebAPI/WebAPI.csproj
+++ b/SGGL/WebAPI/WebAPI.csproj
@@ -153,6 +153,7 @@
+
From d85160bb0aa241ea81705b87b6a2b3f8c06a7f5c Mon Sep 17 00:00:00 2001
From: gaofei1985 <181547018@qq.com>
Date: Sun, 8 Oct 2023 14:17:29 +0800
Subject: [PATCH 7/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
DataBase/版本日志/SGGLDB_WH_2023-10-08.sql | 4 ++++
.../HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs | 2 +-
.../HSSE/QualityAudit/GeneralEquipmentQualityEdit.aspx.cs | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
index 9ae0578d..3b5aaea3 100644
--- a/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
+++ b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
@@ -25,3 +25,7 @@ LEFT JOIN AttachFile AS a ON a.ToKeyId = equ.GeneralEquipmentQualityId
GO
+
+
+update QualityAudit_GeneralEquipmentQuality set QRCodeAttachUrl =NULL
+GO
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
index 1fcbfec5..999410a1 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQuality.aspx.cs
@@ -335,7 +335,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit
try
{
var equipmentQuality = Funs.DB.QualityAudit_GeneralEquipmentQuality.FirstOrDefault(x => x.GeneralEquipmentQualityId == tb.Rows[i]["GeneralEquipmentQualityId"].ToString());
- equipmentQuality.QRCodeAttachUrl = CreateCode_Simple("equipment$" + tb.Rows[i]["GeneralEquipmentQualityId"].ToString());
+ equipmentQuality.QRCodeAttachUrl = CreateCode_Simple("equipments$" + tb.Rows[i]["GeneralEquipmentQualityId"].ToString());
QRCodeAttachUrl = equipmentQuality.QRCodeAttachUrl;
Funs.DB.SubmitChanges();
}
diff --git a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQualityEdit.aspx.cs b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQualityEdit.aspx.cs
index ffed5d21..ed67f390 100644
--- a/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQualityEdit.aspx.cs
+++ b/SGGL/FineUIPro.Web/HSSE/QualityAudit/GeneralEquipmentQualityEdit.aspx.cs
@@ -215,7 +215,7 @@ namespace FineUIPro.Web.HSSE.QualityAudit
this.SaveData(false);
}
- PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?GeneralEquipmentQualityId={0}&strCode={1}", this.GeneralEquipmentQualityId, "equipment$" + this.GeneralEquipmentQualityId), "二维码查看", 400, 400));
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?GeneralEquipmentQualityId={0}&strCode={1}", this.GeneralEquipmentQualityId, "equipments$" + this.GeneralEquipmentQualityId), "二维码查看", 400, 400));
}
}
}
\ No newline at end of file