20240508 共检通知单复制功能
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
{
|
||||
@@ -185,7 +186,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
}
|
||||
//合格的情况下不允许修改
|
||||
var model = Funs.DB.ProcessControl_InspectionManagement.FirstOrDefault(x => x.InspectionId == Grid1.SelectedRowID);
|
||||
if (model.IsOnceQualified==true)
|
||||
if (model.IsOnceQualified == true)
|
||||
{
|
||||
Alert.ShowInTop("该共检通知单已合格,不允许修改!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
@@ -253,6 +254,10 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
{
|
||||
this.btnMenuDel.Hidden = false;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnMenuCopy.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -311,20 +316,10 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
cellStyle.WrapText = true;//自动换行
|
||||
var font = workbook.CreateFont();
|
||||
font.FontHeightInPoints = 11;
|
||||
cellStyle.SetFont(font);
|
||||
NPOI.SS.UserModel.ICellStyle cellStyle0 = workbook.CreateCellStyle();
|
||||
cellStyle0.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||
cellStyle0.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||
cellStyle0.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
|
||||
var font0 = workbook.CreateFont();
|
||||
font0.FontHeightInPoints = 12;
|
||||
font0.IsBold = true;
|
||||
cellStyle0.SetFont(font0);
|
||||
// 第二步:创建新数据行
|
||||
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
|
||||
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
|
||||
@@ -435,17 +430,17 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
var units = (from x in db.Base_Unit
|
||||
join y in db.Project_ProjectUnit
|
||||
on x.UnitId equals y.UnitId
|
||||
where y.ProjectId==this.CurrUser.LoginProjectId && y.UnitType== BLL.Const.ProjectUnitType_4
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId && y.UnitType == BLL.Const.ProjectUnitType_4
|
||||
orderby x.UnitName
|
||||
select x).FirstOrDefault();
|
||||
if (units!=null)
|
||||
if (units != null)
|
||||
{
|
||||
bookmarkUnitName.Text = units.UnitName;
|
||||
}
|
||||
}
|
||||
var projectModel = db.Base_Project.Where(x => x.ProjectId == this.CurrUser.LoginProjectId).FirstOrDefault();
|
||||
var inspectionModel = db.ProcessControl_InspectionManagement.Where(x => x.InspectionId == Id).FirstOrDefault();
|
||||
|
||||
|
||||
//项目编号
|
||||
Bookmark bookmarkProjectCode = doc.Range.Bookmarks["projectCode"];
|
||||
if (bookmarkProjectCode != null)
|
||||
@@ -575,7 +570,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
builder.StartTable();
|
||||
builder.CellFormat.Borders.LineStyle = Aspose.Words.LineStyle.Single;
|
||||
builder.CellFormat.Borders.Color = System.Drawing.Color.Black;
|
||||
|
||||
|
||||
builder.Bold = false;
|
||||
builder.RowFormat.Height = 20;
|
||||
builder.Font.Size = 10;
|
||||
@@ -591,7 +586,8 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
{
|
||||
builder.RowFormat.Height = 200 / ManagementDetaillList.Count;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
builder.RowFormat.Height = 20;
|
||||
}
|
||||
builder.CellFormat.Borders.Left.LineWidth = 1;
|
||||
@@ -602,7 +598,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
builder.CellFormat.Width = 156;
|
||||
builder.Write(ConvertControlPointType(item.ControlPointType));
|
||||
builder.CellFormat.Borders.Left.LineWidth = 0;
|
||||
// 控制点等级
|
||||
// 控制点等级
|
||||
builder.InsertCell();
|
||||
builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None;
|
||||
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
|
||||
@@ -612,11 +608,12 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
|
||||
var ControlPointType = ConvertClass(item.ControlPointType);
|
||||
#region 控制点等级
|
||||
if (ControlPointType.Contains("A") )
|
||||
if (ControlPointType.Contains("A"))
|
||||
{
|
||||
builder.Write("■A ");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
builder.Write("□A ");
|
||||
}
|
||||
if (ControlPointType.Contains("B"))
|
||||
@@ -838,8 +835,8 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
builder.Write("注:如果业主有规定,执行业主的规定。 ");
|
||||
#endregion
|
||||
|
||||
|
||||
doc.Save(newUrl);
|
||||
|
||||
doc.Save(newUrl);
|
||||
string fileName = Path.GetFileName(newUrl);
|
||||
FileInfo info = new FileInfo(newUrl);
|
||||
long fileSize = info.Length;
|
||||
@@ -860,7 +857,8 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
}
|
||||
}
|
||||
|
||||
public class WorkBranchList {
|
||||
public class WorkBranchList
|
||||
{
|
||||
public string UnitWorkId { get; set; }
|
||||
public string Branch { get; set; }
|
||||
}
|
||||
@@ -974,9 +972,84 @@ namespace FineUIPro.Web.CQMS.ProcessControl
|
||||
uname = CarryUnitIds.ToString();
|
||||
}
|
||||
return uname;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 复制
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var inspection = BLL.InspectionManagementService.GetInspectionManagementById(this.Grid1.SelectedRowID);
|
||||
if (inspection != null)
|
||||
{
|
||||
Model.ProcessControl_InspectionManagement newInspection = new Model.ProcessControl_InspectionManagement();
|
||||
newInspection.InspectionId = SQLHelper.GetNewID(typeof(Model.ProcessControl_InspectionManagement));
|
||||
newInspection.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newInspection.UnitId = inspection.UnitId;
|
||||
newInspection.CNProfessionalId = inspection.CNProfessionalId;
|
||||
newInspection.InspectionCode = inspection.InspectionCode;
|
||||
newInspection.UnitWorkId = inspection.UnitWorkId;
|
||||
newInspection.Branch = inspection.Branch;
|
||||
newInspection.ControlPointType = inspection.ControlPointType;
|
||||
newInspection.AcceptanceSite = inspection.AcceptanceSite;
|
||||
newInspection.IsOnceQualified = inspection.IsOnceQualified;
|
||||
newInspection.InspectionDate = inspection.InspectionDate;
|
||||
newInspection.AttachUrl = inspection.AttachUrl;
|
||||
newInspection.CheckDate = inspection.CheckDate;
|
||||
newInspection.CheckMan = inspection.CheckMan;
|
||||
newInspection.UnqualifiedReason = inspection.UnqualifiedReason;
|
||||
|
||||
//通知单编号后有字母递增,无则加“a”
|
||||
string fisrtE = inspection.NoticeCode.Substring(0,inspection.NoticeCode.Length - 1);
|
||||
string lastE = inspection.NoticeCode.Substring(inspection.NoticeCode.Length - 1, 1);
|
||||
bool b = Regex.IsMatch(lastE, "[a-zA-Z]");
|
||||
if (b)
|
||||
{
|
||||
int x = (int)Convert.ToByte(Convert.ToChar(lastE));
|
||||
newInspection.NoticeCode = fisrtE + Convert.ToChar(x + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
newInspection.NoticeCode = inspection.NoticeCode + "a";
|
||||
}
|
||||
|
||||
newInspection.AcceptanceCheckMan = inspection.AcceptanceCheckMan;
|
||||
newInspection.ParentDivisionProjectId = inspection.ParentDivisionProjectId;
|
||||
newInspection.CompileMan = this.CurrUser.UserId;
|
||||
newInspection.CompileDate = DateTime.Now;
|
||||
newInspection.FileType = inspection.FileType;
|
||||
newInspection.AttachUrl2 = inspection.AttachUrl2;
|
||||
BLL.InspectionManagementService.AddInspectionManagement(newInspection);
|
||||
|
||||
var details = InspectionManagementDetailService.GetInspectionDetails(inspection.InspectionId);
|
||||
if (details.Count > 0)
|
||||
{
|
||||
foreach (var item in details)
|
||||
{
|
||||
Model.ProcessControl_InspectionManagementDetail newDetail = new Model.ProcessControl_InspectionManagementDetail();
|
||||
newDetail.InspectionDetailId = SQLHelper.GetNewID(typeof(Model.ProcessControl_InspectionManagementDetail));
|
||||
newDetail.InspectionId = newInspection.InspectionId;
|
||||
newDetail.UnitWorkId = item.UnitWorkId;
|
||||
newDetail.Branch = item.Branch;
|
||||
newDetail.ControlPointType = item.ControlPointType;
|
||||
newDetail.CreateDate = DateTime.Now;
|
||||
BLL.InspectionManagementDetailService.AddInspectionDetail(newDetail);
|
||||
}
|
||||
}
|
||||
ShowNotify("复制成功!");
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user