This commit is contained in:
2022-11-20 16:54:50 +08:00
187 changed files with 6597 additions and 1566 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getUser = db.Person_Persons.FirstOrDefault(x =>( x.Account == userInfo.Account || x.Telephone == userInfo.Telephone || x.PersonName == userInfo.Account)
&& x.Password == Funs.EncryptionPassword(userInfo.Password) && (!x.IsPost.HasValue || x.IsPost == true) && x.RoleIds != null);
&& x.Password == Funs.EncryptionPassword(userInfo.Password) && (!x.IsPost.HasValue || x.IsPost == true)
&& (x.Account != null || x.PersonId == Const.hfnbdId || x.PersonId == Const.sysglyId));
if (getUser != null)
{
Model.UserItem newItem = new Model.UserItem();
+81
View File
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace BLL
{
public class APIHJGLIndexService
{
public static Model.HJGLIndexItem GetJGLIndexItem(string projectid)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.HJGLIndexItem hJGLIndexItem = new Model.HJGLIndexItem();
var PipeRate1 = BLL.HJGL_WeldingReportService.GetPipeRate_finished(projectid);
var PipeRate2 = BLL.HJGL_WeldingReportService.GetPipeRate_unfinished(projectid);
var getCH_CheckItemList = (from x in Funs.DB.HJGL_Batch_NDEItem
join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
join z in Funs.DB.View_HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId
join line in Funs.DB.HJGL_Pipeline on z.PipelineId equals line.PipelineId
where z.ProjectId == projectid
select new Model.sp_index_HJGLItem
{
ProjectId = line.ProjectId,
ID = x.NDEItemID,
UnitId = line.UnitId, ///重定义单位
UnitName = z.UnitName,
WorkAreaId = line.UnitId, /// 重定义区域
MaterialId = line.UnitWorkId, ///重定义材质
CHT_TotalFilm = x.TotalFilm,
CHT_PassFilm = x.PassFilm,
Specification = z.Specification,
WeldTypeCode = z.WeldTypeCode,
JointAttribute = z.JointAttribute,
UnitWorkName = z.UnitWorkName,
MaterialCode = z.MaterialCode
}).ToList();
var tb_type06 = getCH_CheckItemList.GroupBy(x => x.JointAttribute).Select(x => new {
JointAttribute = x.Key,
Current_pass_film = x.Sum(m => m.CHT_PassFilm) ?? 0,
Cht_totalfilm = x.Sum(m => m.CHT_TotalFilm) ?? 0
});
var GC_model = tb_type06.Where(x => x.JointAttribute == "预制口").FirstOrDefault();
var XC_model = tb_type06.Where(x => x.JointAttribute == "安装口").FirstOrDefault();
double PassRate1 = 0;
double PassRate2 = 0;
if (GC_model!=null &&GC_model.Cht_totalfilm>0)
{
PassRate1 = Math.Round((100 * GC_model.Current_pass_film * 1.0) / GC_model.Cht_totalfilm, 1);
}
if (XC_model!=null&& XC_model.Cht_totalfilm > 0)
{
PassRate2 = Math.Round((100 * XC_model.Current_pass_film * 1.0) / XC_model.Cht_totalfilm, 1);
}
hJGLIndexItem.GCFirstPassRate = PassRate1.ToString()+" %";
hJGLIndexItem.XCFirstPassRate = PassRate2.ToString()+" %";
hJGLIndexItem.GCProgress = BLL.HJGL_WeldingReportService.GetGCRate_finished(projectid).ToString() + "/" + HJGL_WeldingReportService.GetSumSize(projectid, 1).ToString() + " DIN";
hJGLIndexItem.XCProgress = BLL.HJGL_WeldingReportService.GetXCRate_finished(projectid).ToString() + "/" + HJGL_WeldingReportService.GetSumSize(projectid, 2).ToString() + " DIN";
if (PipeRate1 + PipeRate2 == 0)
{
hJGLIndexItem.PipePrefabricationRate = "0 %";
}
else
{
hJGLIndexItem.PipePrefabricationRate = Math.Floor(Math.Round(decimal.Parse((PipeRate1 / (PipeRate1 + PipeRate2)).ToString("0.000")), 2) * 100).ToString()+" %";
}
hJGLIndexItem.GCWelderEfficacy = HJGL_WeldingReportService.GetWelderEfficacy_GC(projectid).ToString()+" DIN/天";
hJGLIndexItem.XCWelderEfficacy = HJGL_WeldingReportService.GetWelderEfficacy_XC(projectid).ToString()+" DIN/天";
return hJGLIndexItem;
}
}
}
}
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace BLL
{
public class APIPackagingManageService
{
public static List<Model.PackagingManageDetailItem> GetPackagingManageList(string projectId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var q = (from x in db.HJGL_PackagingManage
join n in db.Base_Project on x.ProjectId equals n.ProjectId
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
from t in tt.DefaultIfEmpty()
where x.ProjectId == projectId
select new PackagingManageDetailItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
StackingPosition = x.StackingPosition,
State= x.State,
ReceiveMan=t.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate)
}).Distinct();
return q.ToList();
}
}
public static Model.PackagingManageItem GetPackagingInformationById(string projectId,string personId, string packagingManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
PackagingManageItem packagingManageItem = new PackagingManageItem();
var q = (from x in db.HJGL_PackagingManage
join n in db.Base_Project on x.ProjectId equals n.ProjectId
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
from t in tt.DefaultIfEmpty()
where x.PackagingManageId == packagingManageId
select new PackagingManageDetailItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ProjectId = x.ProjectId,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
StackingPosition = x.StackingPosition,
State =x.State,
ReceiveMan = t.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate)
}).FirstOrDefault();
var tb_packing = (from x in db.HJGL_PackagingManage where x.PackagingManageId==packagingManageId select x ).FirstOrDefault() ;
var PipelineComponentIdList = tb_packing.PipelineComponentId.Split(',');
var packagingPrepipeItem = (from x in db.HJGL_Pipeline_Component
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.WBS_UnitWork on y.UnitWorkId equals z.UnitWorkId
where PipelineComponentIdList.Contains(x.PipelineComponentId)
select new PackagingPrepipeItem
{
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = "1/个",
UnitWorkName = z.UnitWorkName,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
}).ToList();
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
packagingManageItem.packagingManageDetailItem = q;
packagingManageItem.packagingPrepipeItems = packagingPrepipeItem;
packagingManageItem.isPower = isPower;
return packagingManageItem;
}
}
public static void GetPackingInfoConfirmArrival(string packagingManageId,string PersonId)
{
var q= BLL.HJGL_PackagingmanageService.GetHJGL_PackagingManageById(packagingManageId);
if (q!=null)
{
q.State = HJGL_PackagingmanageService.state_2;
q.ReceiveMan = PersonId;
q.ReceiveDate = DateTime.Now;
HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(q);
}
}
}
}
@@ -0,0 +1,87 @@
using NPOI.OpenXmlFormats.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace BLL
{
public class APIPipelineComponentService
{
public static List<PipelineComponentItem> GetPackagingManageList(string projectid)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var q = (from x in db.HJGL_Pipeline_Component
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Unit on x.PreUnit equals z.UnitId into tt
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into pp
from t in tt.DefaultIfEmpty()
from p in pp.DefaultIfEmpty()
where y.ProjectId == projectid
select new PipelineComponentItem
{
PipelineComponentId = x.PipelineComponentId,
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = t.UnitName,
DrawingName = x.DrawingName,
BoxNumber = x.BoxNumber,
State = x.State,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate) ,
QRCode = x.QRCode,
ReceiveMan=p.PersonName,
ReceiveDate= string.Format("{0:g}", x.ReceiveDate)
}).Distinct();
return q.ToList();
}
}
public static PipelineComponentDetail GetPipelineComponentById(string projectId, string personId, string PipelineComponentId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
PipelineComponentDetail pipelineComponentDetail = new PipelineComponentDetail();
var q = (from x in db.HJGL_Pipeline_Component
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.Base_Unit on x.PreUnit equals z.UnitId into tt
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into pp
from t in tt.DefaultIfEmpty()
from p in pp.DefaultIfEmpty()
where x.PipelineComponentId== PipelineComponentId
select new PipelineComponentItem
{
PipelineComponentId = x.PipelineComponentId,
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = t.UnitName,
DrawingName = x.DrawingName,
BoxNumber = x.BoxNumber,
State = x.State,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
QRCode = x.QRCode,
ReceiveMan = p.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate)
}).FirstOrDefault();
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
pipelineComponentDetail.pipelineComponentItem = q;
pipelineComponentDetail.isPower=isPower;
return pipelineComponentDetail;
}
}
public static void GetComponentConfirmArrival(string PipelineComponentId,string PersonId)
{
var q = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(PipelineComponentId);
if (q != null)
{
q.State = HJGL_PipelineComponentService.state_1;
q.ReceiveMan = PersonId;
q.ReceiveDate = DateTime.Now;
HJGL_PipelineComponentService.UpdatePipelineComponent(q);
}
}
}
}
@@ -163,7 +163,7 @@ namespace BLL
{
if (getTestPlan.TestEndTime > DateTime.Now)
{
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == getTestPlan.TestPlanId && x.UserType == testRecord.UserType);
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == getTestPlan.TestPlanId && (x.UserType == testRecord.UserType || x.UserType == null));
if (getTestPlanTraining.Count() > 0)
{
int cout1 = getTestPlanTraining.Sum(x => x.TestType1Count ?? 0);
@@ -294,7 +294,7 @@ namespace BLL
var item = db.Test_TestRecordItem.FirstOrDefault(x => x.TestRecordId == testRecordId);
if (item == null)
{
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == testPlanId && x.UserType == getTestRecord.ManType);
var getTestPlanTraining = db.Test_TestPlanTraining.Where(x => x.TestPlanId == testPlanId && (x.UserType == getTestRecord.ManType || x.UserType == null));
if (getTestPlanTraining.Count() > 0)
{
List<Model.Training_TestTrainingItem> getTestTrainingItemList = new List<Model.Training_TestTrainingItem>();
+10
View File
@@ -99,6 +99,11 @@
<Reference Include="office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
</Reference>
@@ -148,6 +153,7 @@
<Reference Include="ThoughtWorks.QRCode">
<HintPath>..\FineUIPro\Reference BLL\ThoughtWorks.QRCode.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="API\APIBaseInfoService.cs" />
@@ -159,9 +165,12 @@
<Compile Include="API\APIUnitService.cs" />
<Compile Include="API\APIUpLoadFileService.cs" />
<Compile Include="API\APIUserService.cs" />
<Compile Include="API\HJGL\APIHJGLIndexService.cs" />
<Compile Include="API\HJGL\APIHotProcessHardService.cs" />
<Compile Include="API\HJGL\APINDETrustService.cs" />
<Compile Include="API\HJGL\APIPackagingManageService.cs" />
<Compile Include="API\HJGL\APIPipeJointService.cs" />
<Compile Include="API\HJGL\APIPipelineComponentService.cs" />
<Compile Include="API\HJGL\APIPreWeldingDailyService.cs" />
<Compile Include="API\HJGL\APIReportQueryService.cs" />
<Compile Include="API\HJGL\APITestPackageService.cs" />
@@ -356,6 +365,7 @@
<Compile Include="HJGL\TestPackage\TestPackageApproveService.cs" />
<Compile Include="HJGL\TestPackage\TestPackageAuditService.cs" />
<Compile Include="HJGL\TestPackage\TestPackageEditService.cs" />
<Compile Include="HJGL\WeldingManage\HJGL_WeldingReportService.cs" />
<Compile Include="HJGL\WeldingManage\PipelineComponentService.cs" />
<Compile Include="HJGL\WeldingManage\PipelineMatService.cs" />
<Compile Include="HJGL\WeldingManage\PipelineService.cs" />
+1 -1
View File
@@ -3024,7 +3024,7 @@
/// <summary>
/// PDMS输出(设计)数据导入模板
/// </summary>
public const string PDMSPipelineTemplateUrl = "File\\Excel\\DataIn\\PDMS输出(设计)数据模板.xls";
public const string PDMSPipelineTemplateUrl = "File\\Excel\\DataIn\\PDMS输出(设计)数据模板.xlsx";
/// <summary>
/// 施工计划模板
/// </summary>
+28 -9
View File
@@ -1,7 +1,9 @@
using System;
using NPOI.OpenXmlFormats.Shared;
using System;
using System.IO;
using System.Text;
using ThoughtWorks.QRCode.Codec;
using QRCoder;
namespace BLL
{
@@ -49,6 +51,16 @@ namespace BLL
return null;
}
}
/*
public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor, [Bitmap icon=null], [int iconSizePercent=15], [int iconBorderWidth=6], [bool drawQuietZones=true])
int pixelsPerModule:生成二维码图片的像素大小;
Color darkColor:二维码图像暗色,一般设置为Color.Black。
Color lightColor:二维码图像亮色, 一般设置为Color.White。
Bitmap icon:二维码中间水印图标。
int iconSizePercent:水印图标的大小比例。
int iconBorderWidth:水印图标的边框。不能设为0,否则会显示“参数错误”,程序运行出错。
bool drawQuietZones:静止区,即是否绘画二维码的空白边框区域,默认为true。
*/
public static string CreateCode_Simple(string nr,string filename)
{
try
@@ -56,14 +68,21 @@ namespace BLL
string imageUrl = string.Empty;
if (!string.IsNullOrEmpty(nr))
{
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);
//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);
QRCoder.QRCode qRCode = new QRCoder.QRCode();
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(nr, QRCodeGenerator.ECCLevel.Q);
QRCode qrcode = new QRCode(qrCodeData);
System.Drawing.Image image = qrcode.GetGraphic(100);
string filepath = Funs.RootPath + UploadFileService.QRCodeImageFilePath;
//如果文件夹不存在,则创建
if (!Directory.Exists(filepath))
+44
View File
@@ -1,10 +1,13 @@
namespace BLL
{
using MiniExcelLibs;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -184,6 +187,16 @@ namespace BLL
return;
}
/// <summary>
/// 为目标下拉框加上选择内容
/// </summary>
/// <param name="DLL">目标下拉框</param>
public static void FineUIPleaseSelectNull(FineUIPro.DropDownList DDL, string text)
{
DDL.Items.Insert(0, new FineUIPro.ListItem(text, null));
return;
}
/// <summary>
/// 为目标下拉框加上 "重新编制" 项
/// </summary>
@@ -1151,6 +1164,37 @@ namespace BLL
dv.RowFilter = $"({filterRule})";
return dv.ToTable();
}
public static IEnumerable<dynamic> QueryWithoutEmptyRow(Stream stream, bool useHeaderRow, string sheetName, ExcelType excelType, string startCell, IConfiguration configuration)
{
var rows = stream.Query(useHeaderRow, sheetName, excelType, startCell, configuration);
foreach (IDictionary<string, object> row in rows)
{
if (row.Keys.Any(key => row[key] != null))
yield return row;
}
}
/// <summary>
/// 用于Linq的去重,扩展方法需要放到静态类中
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="TKey"></typeparam>
/// <param name="source"></param>
/// <param name="keySelector"></param>
/// <returns></returns>
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
HashSet<TKey> seenKeys = new HashSet<TKey>();
foreach (TSource element in source)
{
if (seenKeys.Add(keySelector(element)))
{
yield return element;
}
}
}
}
}
+2 -2
View File
@@ -138,8 +138,8 @@
public static ListItem[] IsPostDropList()
{
ListItem[] lis = new ListItem[2];
lis[0] = new ListItem("在", BLL.Const._True);
lis[1] = new ListItem("离", BLL.Const._False);
lis[0] = new ListItem("在", BLL.Const._True);
lis[1] = new ListItem("离", BLL.Const._False);
return lis;
}
#endregion
+27 -2
View File
@@ -43,10 +43,10 @@ namespace BLL
/// <param name="FileName"></param>
/// <param name="project"></param>
/// <returns></returns>
public static Model.HJGL_DataImport GetLatestFileByFileName(string FileName, string project)
public static Model.HJGL_DataImport GetLatestFileByFileName(string FileName,string ImportType, string project)
{
var q = (from x in Funs.DB.HJGL_DataImport
where x.FileName.Contains(FileName) && x.ProjectId == project
where x.FileName.Contains(FileName) && x.ProjectId == project&&x.ImportType==ImportType
select x
).OrderByDescending(x => x.Version).FirstOrDefault();
return q;
@@ -70,6 +70,9 @@ namespace BLL
case "3":
TypeName = "管道预制加工图";
break;
case "4":
TypeName = "ISO施工轴测图";
break;
}
}
@@ -166,6 +169,28 @@ namespace BLL
var newVersion = MaxVersion + 0.1m;
return newVersion;
}
public static string Getlatest3DModelNameByUnitWorkId(string UnitWorkId )
{
string result = "";
var q = (from x in Funs.DB.HJGL_DataImport
join y in Funs.DB.Base_DesignProfessional on x.DesignProfessionalId equals y.DesignProfessionalId into mm
from m in mm.DefaultIfEmpty()
where x.UnitWorkId == UnitWorkId && x.ImportType == "1" && m.ProfessionalName.Contains("管道")
group x by x.UnitWorkId into tt
from t in tt.DefaultIfEmpty()
select new
{
FileName = (from x2 in tt where x2.Version == tt.Max(x => x.Version ) select x2.FileName).FirstOrDefault()
}
).FirstOrDefault();
//where t.Key == UnitWorkId & x.FileType == "1" select x.Version).Distinct().ToList();
if (q!=null&&!string.IsNullOrEmpty(q.FileName))
{
result=q.FileName.Substring (0,q.FileName.LastIndexOf('.'));
}
return result;
}
public static void InitVersionDownList(FineUIPro.DropDownList dropName, string UnitWorkId)
{
+42 -29
View File
@@ -136,7 +136,7 @@ namespace BLL
FROM dbo.HJGL_PipeLineMat pipe
LEFT JOIN dbo.HJGL_MaterialCodeLib lib ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline line ON pipe.PipelineId=line.PipelineId
WHERE line.PipeArea=@PipeArea and line.State=1
WHERE line.PipeArea=@PipeArea
group by lib.MaterialCode,lib.MaterialName,lib.MaterialUnit, lib.MaterialSpec,lib.MaterialMade) as aa on mat.MaterialCode=aa.MaterialCode
where mat.projectid=@Projectid and Ins.State=@State
group by mat.MaterialCode,lib.MaterialName,lib.MaterialSpec,lib.MaterialMade,lib.MaterialUnit,aa.num
@@ -227,50 +227,63 @@ namespace BLL
public static bool isInStockByPipeline(string pipelineid,string projectid)
{
bool state = true ;
var q = from x in Funs.DB.HJGL_PipeLineMat where x.PipelineId==pipelineid
group x by x.MaterialCode into s
select new
{
MaterialCode = s.Key,
Number = s.Sum(p => p.Number)
};//获取管线所用材料
if (q!=null&&q.Count() >0) //判断管线是否有关联材料
try
{
var pipemodel = BLL.PipelineService.GetPipelineByPipelineId(pipelineid);
List<Model.MaterialStockItem> list = GetMaterialStockItems(projectid, pipemodel.PipeArea);
if (list!=null &&list.Count > 0) //判断是否有库存信息
{
foreach (var item in q)
{
var StockMater = list.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault();
if (StockMater!=null) //判断该材料是否存在库存
var q = from x in Funs.DB.HJGL_PipeLineMat
where x.PipelineId == pipelineid
group x by x.MaterialCode into s
select new
{
var StockNum = StockMater.MaterialNum;
if ((decimal)item.Number > StockNum) //实际大于库存
MaterialCode = s.Key,
Number = s.Sum(p => p.Number)
};//获取管线所用材料
if (q != null && q.Count() > 0) //判断管线是否有关联材料
{
var pipemodel = BLL.PipelineService.GetPipelineByPipelineId(pipelineid);
List<Model.MaterialStockItem> list = GetMaterialStockItems(projectid, pipemodel.PipeArea);
if (list != null && list.Count > 0) //判断是否有库存信息
{
foreach (var item in q)
{
var StockMater = list.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault();
if (StockMater != null) //判断该材料是否存在库存
{
var StockNum = StockMater.MaterialNum;
if ((decimal)item.Number > StockNum) //实际大于库存
{
state = false; //库存不足
}
}
else
{
state = false; //库存不足
}
}
else
{
state = false; //库存不足
}
}
else
{
state = false; //库存不足
}
}
else
{
state = false; //库存不足
state = false; //库存不足
}
}
else
{
state = false; //库存不足
}
catch (System.Exception ex)
{
state = false;
ErrLogInfo.WriteLog(ex.ToString ());
}
return state;
}
@@ -12,8 +12,28 @@ using System.Text;
namespace BLL
{
public static class HJGL_PackagingmanageService
{
public class PackagingManageItem
{
public string PackagingManageId { get; set; }
public string PackagingCode { get; set; }
public string ProjectId { get; set; }
public string ProjectName { get; set; }
public string ContactName { get; set; }
public string ContactPhone { get; set; }
public string StackingPosition { get; set; }
public int? State { get; set; }
public string ReceiveMan { get; set; }
public string ReceiveDate { get; set; }
public string PlanStartDate { get; set; }
}
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 未到场
@@ -87,6 +107,46 @@ namespace BLL
{
return db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId);
}
public static string GetMinPlanStartDate(string PackagingManageId)
{
string PlanStartDate = "";
DataTable tb = BLL.HJGL_PackagingmanageService.GetPackagingDetailById(PackagingManageId);
var dtTable = tb.AsEnumerable().OrderBy(o => o["PlanStartDate"]).CopyToDataTable();
if (dtTable.Rows != null && dtTable.Rows.Count > 0)
{
PlanStartDate = dtTable.Rows[0]["PlanStartDate"].ToString();
}
return PlanStartDate;
}
public static List<PackagingManageItem> GetPackagingManageList(string projectId,string PackagingCode)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var q = (from x in db.HJGL_PackagingManage
join n in db.Base_Project on x.ProjectId equals n.ProjectId
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
from t in tt.DefaultIfEmpty()
where x.ProjectId == projectId
&&(string.IsNullOrEmpty(PackagingCode)|| x.PackagingCode.Contains(PackagingCode) )
select new PackagingManageItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
StackingPosition = x.StackingPosition,
State = x.State,
ReceiveMan = t.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate),
PlanStartDate = GetMinPlanStartDate(x.PackagingManageId),
}).Distinct();
return q.ToList();
}
}
/// <summary>
/// 形成出库单
/// </summary>
@@ -113,7 +173,7 @@ namespace BLL
if (!string .IsNullOrEmpty(model.PipelineComponentId))
{
var PipelineComponentIds = model.PipelineComponentId.Split(',');
string strSql = @"select com.PipelineComponentId, com.PipelineComponentCode,com.PlanStartDate,unitwork.UnitWorkName,'1' as num ,'个' as CU
string strSql = @"select com.PipelineComponentId, com.PipelineComponentCode,pipe.PlanStartDate,unitwork.UnitWorkName,'1' as num ,'个' as CU
from HJGL_Pipeline_Component com
left join HJGL_Pipeline pipe on com.PipelineId=pipe.PipelineId
left join WBS_UnitWork unitwork on pipe.UnitWorkId=unitwork.UnitWorkId
@@ -158,6 +218,8 @@ namespace BLL
ContactName = newtable.ContactName,
ContactPhone = newtable.ContactPhone,
Remark = newtable.Remark,
ReceiveDate = newtable.ReceiveDate,
ReceiveMan = newtable.ReceiveMan,
};
db.HJGL_PackagingManage.InsertOnSubmit(table);
db.SubmitChanges();
@@ -179,6 +241,8 @@ namespace BLL
table.ContactName = newtable.ContactName;
table.ContactPhone = newtable.ContactPhone;
table.Remark = newtable.Remark;
table.ReceiveMan=newtable.ReceiveMan;
table.ReceiveDate=newtable.ReceiveDate;
db.SubmitChanges();
}
@@ -14,10 +14,10 @@ namespace BLL
{
return Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.YardPlanningId == YardPlanningId);
}
public static Model.HJGL_YardPlanning GetHJGL_YardPlanningByProjectId(string projectId)
public static Model.HJGL_YardPlanning GetHJGL_YardPlanningByProjectId(string projectId,string unitworkid)
{
return Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectId);
return Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectId && e.UnitWorkId == unitworkid);
}
/// <summary>
/// 保存应急流程图
@@ -25,9 +25,9 @@ namespace BLL
/// <param name="projectid"></param>
/// <param name="unitid"></param>
/// <param name="imgurl"></param>
public static void SavePic(string projectid, string imgurl)
public static void SavePic(string projectid,string unitworkid, string imgurl)
{
var model = Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectid);
var model = Funs.DB.HJGL_YardPlanning.FirstOrDefault(e => e.ProjectId == projectid && e.UnitWorkId==unitworkid);
if (model != null)
{
model.FlowChartPic = imgurl;
@@ -38,6 +38,7 @@ namespace BLL
Model.HJGL_YardPlanning table = new Model.HJGL_YardPlanning();
table.YardPlanningId = SQLHelper.GetNewID(typeof(Model.HJGL_YardPlanning));
table.ProjectId = projectid;
table.UnitWorkId = unitworkid;
table.FlowChartPic = imgurl;
Funs.DB.HJGL_YardPlanning.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
@@ -51,6 +52,7 @@ namespace BLL
table.ProjectId = newtable.ProjectId;
table.Remark = newtable.Remark;
table.FlowChartPic = newtable.FlowChartPic;
table.UnitWorkId = newtable.UnitWorkId;
Funs.DB.HJGL_YardPlanning.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
}
@@ -66,6 +68,7 @@ namespace BLL
table.ProjectId = newtable.ProjectId;
table.Remark = newtable.Remark;
table.FlowChartPic = newtable.FlowChartPic;
table.UnitWorkId = newtable.UnitWorkId;
Funs.DB.SubmitChanges();
}
@@ -0,0 +1,213 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class HJGL_WeldingReportService
{
/// <summary>
/// 根据类型获取总达因数(0总达因,1预制口总达因,2安装口总达因)
/// </summary>
/// <param name="projectId"></param>
/// <param name="type">0总达因,1预制口总达因,2安装口总达因</param>
/// <returns></returns>
public static decimal GetSumSize(string projectId,int type)
{
decimal result = 0;
var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId);
if (getWelds.Count() > 0)
{
switch (type)
{
case 0:
result = getWelds.Sum(x => x.Size ?? 0); //项目总达因数
break;
case 1:
if (getWelds.Where(x => x.JointAttribute == "预制口").Count() > 0)
{
result = getWelds.Where(x => x.JointAttribute == "预制口").Sum(x => x.Size ?? 0);
}
break;
case 2:
if (getWelds.Where(x => x.JointAttribute == "安装口").Count() > 0)
{
result = getWelds.Where(x => x.JointAttribute == "安装口").Sum(x => x.Size ?? 0);
}
break;
}
}
return result;
}
/// <summary>
/// 工厂预制完成数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetGCRate_finished(string projectId)
{
decimal result = 0;
var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId);
if (getWelds.Count() > 0)
{
var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null);
if (getWeldsOk.Count() > 0)
{
var GCModel = getWeldsOk.Where(x => x.JointAttribute == "预制口");
if (GCModel.Count() > 0)
{
result = GCModel.Sum(x => x.Size ?? 0);
}
}
}
return result;
}
/// <summary>
/// 工厂预制未完成数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetGCRate_unfinished(string projectId)
{
decimal result = 0;
result = GetSumSize(projectId, 1) - GetGCRate_finished(projectId);
return result;
}
/// <summary>
/// 现场安装完成数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetXCRate_finished(string projectId)
{
decimal result = 0;
var getWelds = Funs.DB.HJGL_WeldJoint.Where(x => x.ProjectId == projectId);
if (getWelds.Count() > 0)
{
var getWeldsOk = getWelds.Where(x => x.WeldingDailyId != null);
if (getWeldsOk.Count() > 0)
{
var GCModel = getWeldsOk.Where(x => x.JointAttribute == "安装口");
if (GCModel.Count() > 0)
{
result = GCModel.Sum(x => x.Size ?? 0);
}
}
}
return result;
}
/// <summary>
/// 现场安装未完成数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetXCRate_unfinished(string projectId)
{
decimal result = 0;
result = GetSumSize(projectId, 2) - GetXCRate_finished(projectId);
return result;
}
/// <summary>
/// 管道完成预制数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetPipeRate_finished(string projectId)
{
decimal result = 0;
result = GetGCRate_finished(projectId);
return result;
}
/// <summary>
/// 管道未完成预制数
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetPipeRate_unfinished(string projectId)
{
decimal result = 0;
result = GetSumSize(projectId, 0) - GetPipeRate_finished(projectId);
return result;
}
/// <summary>
/// 焊工功效
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetWelderEfficacy(string projectId)
{
decimal result = 0;
var db = Funs.DB;
var q = (from x in db.HJGL_WeldJoint
join y in db.HJGL_WeldingDaily on x.WeldingDailyId equals y.WeldingDailyId
where x.ProjectId ==projectId
group x by x.ProjectId into g
select new
{
TotalDin = g.Sum(x => x.Size),
worktime = g.Select(x=>x.WeldingDailyId).Distinct().Count(),
}) ;
foreach (var item in q)
{
result = decimal.Divide((decimal)item.TotalDin, item.worktime) ;
}
return decimal.Truncate(result);
}
public static decimal GetWelderEfficacy_GC(string projectId)
{
decimal result = 0;
var db = Funs.DB;
var q = (from x in db.HJGL_WeldJoint
join y in db.HJGL_WeldingDaily on x.WeldingDailyId equals y.WeldingDailyId
where x.ProjectId == projectId && x.JointAttribute=="预制口"
group x by x.ProjectId into g
select new
{
TotalDin = g.Sum(x => x.Size),
worktime = g.Select(x => x.WeldingDailyId).Distinct().Count(),
});
foreach (var item in q)
{
result = decimal.Divide((decimal)item.TotalDin, item.worktime);
}
return decimal.Truncate(result);
}
public static decimal GetWelderEfficacy_XC(string projectId)
{
decimal result = 0;
var db = Funs.DB;
var q = (from x in db.HJGL_WeldJoint
join y in db.HJGL_WeldingDaily on x.WeldingDailyId equals y.WeldingDailyId
where x.ProjectId == projectId && x.JointAttribute == "安装口"
group x by x.ProjectId into g
select new
{
TotalDin = g.Sum(x => x.Size),
worktime = g.Select(x => x.WeldingDailyId).Distinct().Count(),
});
foreach (var item in q)
{
result = decimal.Divide((decimal)item.TotalDin, item.worktime);
}
return decimal.Truncate(result);
}
}
}
@@ -93,6 +93,7 @@ namespace BLL
{
model.PipelineId = PipelineId;
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-'));
model.State = state_0;
UpdatePipelineComponent(model);
}
@@ -102,6 +103,7 @@ namespace BLL
model.PipelineComponentId = SQLHelper.GetNewID();
model.PipelineId = PipelineId;
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-'));
model.State = state_0;
AddPipelineComponent(model);
}
@@ -131,6 +133,8 @@ namespace BLL
newPipeline.ActStartDate = pipeline.ActStartDate;
newPipeline.ActEndDate = pipeline.ActEndDate;
newPipeline.DrawingName = pipeline.DrawingName;
newPipeline.ReceiveMan= pipeline.ReceiveMan;
newPipeline.ReceiveDate= pipeline.ReceiveDate;
db.HJGL_Pipeline_Component.InsertOnSubmit(newPipeline);
db.SubmitChanges();
}
@@ -158,15 +162,19 @@ namespace BLL
newPipeline.ActStartDate = pipeline.ActStartDate;
newPipeline.ActEndDate = pipeline.ActEndDate;
newPipeline.DrawingName = pipeline.DrawingName;
newPipeline.ReceiveMan = pipeline.ReceiveMan;
newPipeline.ReceiveDate = pipeline.ReceiveDate;
db.SubmitChanges();
}
}
public static void UpdateOutState(string pipelineComponentId)
public static void UpdateOutState(string pipelineComponentId,string BoxNumber)
{
var q=GetPipelineComponentById(pipelineComponentId);
if (q.State==state_1)
{
q.State = state_2;
q.BoxNumber=BoxNumber;
UpdatePipelineComponent(q);
}
@@ -229,6 +237,16 @@ namespace BLL
select x).ToList();
return q;
}
public static List<Model.HJGL_Pipeline_Component> GetComponentByPipelineId(string PipelineId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.HJGL_Pipeline_Component
where x.PipelineId == PipelineId
select x).OrderBy(x=>x.PlanStartDate).ToList();
return q;
}
/// <summary>
/// 管线下拉框
+156 -3
View File
@@ -1,11 +1,16 @@
using MiniExcelLibs;
using Microsoft.Office.Interop.Word;
using Microsoft.SqlServer.Dts.Runtime;
using MiniExcelLibs;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using static BLL.PipelineService;
namespace BLL
{
@@ -19,6 +24,29 @@ namespace BLL
/// 现场安装
/// </summary>
public const string PipeArea_FIELD = "2";
/// <summary>
/// 实际日期类型
/// </summary>
public enum ActDateType
{
/// <summary>
/// 实际开始日期(预制)
/// </summary>
ActDateStart_Shop,
/// <summary>
/// 实际完成日期(预制)
/// </summary>
ActDateEnd_Shop ,
/// <summary>
/// 实际开始日期(安装)
/// </summary>
ActDateStart_FIELD ,
/// <summary>
/// 实际完成日期(安装)
/// </summary>
ActDateEnd_FIELD ,
}
public static ListItem[] GetPipeArea()
{
ListItem[] list = new ListItem[2];
@@ -36,10 +64,130 @@ namespace BLL
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipelineId);
}
public static void GetStateByPipelineId(string pipelineId)
{//< f:ListItem Value = "0" Text = "未开始" />
// < f:ListItem Value = "1" Text = "未开始且延误" />
// < f:ListItem Value = "2" Text = "开始" />
// < f:ListItem Value = "3" Text = "已开始且延误" />
// < f:ListItem Value = "4" Text = "完成" />
var mdoel = GetPipelineByPipelineId(pipelineId);
var PlanStartDate = mdoel.PlanStartDate;
var PlanEndDate = mdoel.PlanEndDate;
var ActStartDate = new DateTime?();
var ActEndDate = new DateTime?();
if (!string .IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD)))
{
ActStartDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateStart_FIELD));
}
if (!string.IsNullOrEmpty(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD)))
{
ActEndDate = Convert.ToDateTime(GetDateByPipelineId(pipelineId, ActDateType.ActDateEnd_FIELD));
}
if (ActStartDate==null&&DateTime.Compare(DateTime.Now,PlanStartDate.Value)<0)
{
mdoel.State = 0;
}
else if(ActStartDate == null && DateTime.Compare(DateTime.Now, PlanStartDate.Value) > 0)
{
mdoel.State = 1;
}
else if (ActStartDate!=null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value)<0 && ActEndDate==null)
{
mdoel.State = 2;
}
else if (ActStartDate != null && DateTime.Compare(ActStartDate.Value, PlanStartDate.Value) > 0 && ActEndDate == null)
{
mdoel.State = 3;
}
else if (ActEndDate != null)
{
mdoel.State = 4;
}
UpdatePipeline(mdoel);
}
public static string GetDateByPipelineId(object pipelineId, ActDateType actDateType)
{
string result ="";
string _pipelineId = pipelineId.ToString();
string ActDateStart_Shop = "";
string ActDateEnd_Shop = "";
string ActDateStart_FIELD = "";
string ActDateEnd_FIELD = "";
var pipemodel = GetPipelineByPipelineId(_pipelineId);
var joints = BLL.WeldJointService.GetWeldJointsByPipelineId(_pipelineId);
int joint_Shop_count = joints.Where(x => x.JointAttribute == "预制口").Count();
int joint_Field_count = joints.Where(x => x.JointAttribute == "安装口").Count();
var TaskJoints = (from x in Funs.DB.View_HJGL_WeldingTask where x.ProjectId == pipemodel.ProjectId && x.PipelineCode == pipemodel.PipelineCode
select x).ToList();
var TaskJoints_Shop = TaskJoints.Where(x => x.JointAttribute == "预制口").ToList();
var TaskJoints_Field= TaskJoints.Where(x => x.JointAttribute == "安装口").ToList();
if (TaskJoints_Shop.Count>0)
{
ActDateStart_Shop = TaskJoints_Shop.OrderBy(x => x.TaskDate).First().TaskDate.Value.ToShortDateString();
}
if (joint_Shop_count== TaskJoints_Shop.Count&& joint_Shop_count>0)
{
ActDateEnd_Shop = TaskJoints_Shop.OrderByDescending(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString();
}
if (TaskJoints_Field.Count > 0)
{
ActDateStart_FIELD = TaskJoints_Field.OrderBy(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString();
}
if (joint_Field_count == TaskJoints_Field.Count && joint_Field_count > 0)
{
ActDateEnd_FIELD = TaskJoints_Field.OrderByDescending(x => x.TaskDate).First().TaskDate.Value.Date.ToShortDateString();
}
switch (actDateType)
{
case ActDateType.ActDateStart_Shop:
result = ActDateStart_Shop;
break;
case ActDateType.ActDateEnd_Shop:
result = ActDateEnd_Shop;
break;
case ActDateType.ActDateStart_FIELD:
result = ActDateStart_FIELD;
break;
case ActDateType.ActDateEnd_FIELD:
result = ActDateEnd_FIELD;
break;
}
return result;
}
public static Model.HJGL_Pipeline GetPipelineByPipelineCode(string pipelineCode)
{
return Funs.DB.HJGL_Pipeline.FirstOrDefault(e => e.PipelineCode == pipelineCode);
}
public static List<View_HJGL_Pipeline> GetView_HJGL_Pipelines(View_HJGL_Pipeline model)
{
var db = Funs.DB;
var pipelineList =( from x in db.View_HJGL_Pipeline
where
(string.IsNullOrEmpty(model.ProjectId) || x.ProjectId.Contains(model.ProjectId))
&& (string.IsNullOrEmpty(model.UnitWorkId) || x.UnitWorkId.Contains(model.UnitWorkId))
&& (string.IsNullOrEmpty(model.PipelineCode) || x.PipelineCode.Contains(model.PipelineCode))
&& (string.IsNullOrEmpty(model.SingleName) || x.SingleName.Contains(model.SingleName))
&& (string.IsNullOrEmpty(model.DesignPress) || x.DesignPress.Contains(model.DesignPress))
&& (string.IsNullOrEmpty(model.MaterialCode) || x.MaterialCode.Contains(model.MaterialCode))
select x).ToList();
if (model.IsFinished!=null)
{
if (model.IsFinished==true)
{
pipelineList= pipelineList.Where(x => x.IsFinished == true).ToList();
}
else
{
pipelineList = pipelineList.Where(x => x.IsFinished == false||x.IsFinished==null).ToList();
}
}
return pipelineList;
}
/// <summary>
/// 根据unitworkId获取所有管线
/// </summary>
@@ -103,6 +251,7 @@ namespace BLL
,line.ActStartDate
,line.ActEndDate
,line.IsFinished
,line.FlowingSection
,com.PipelineComponentId
,com.PreUnit
,com.PipelineComponentCode
@@ -129,7 +278,7 @@ namespace BLL
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
tb.TableName = "Data";
var value = new Dictionary<string, object>()
{
@@ -182,6 +331,7 @@ namespace BLL
,line.ActStartDate
,line.ActEndDate
,line.IsFinished
,line.FlowingSection
,unit.UnitWorkName
from HJGL_Pipeline line
left join WBS_UnitWork unit on line.UnitWorkId=unit.UnitWorkId
@@ -195,7 +345,7 @@ namespace BLL
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
tb.TableName = "Data";
var value = new Dictionary<string, object>()
{
@@ -269,6 +419,7 @@ namespace BLL
newPipeline.PCtype = pipeline.PCtype;
newPipeline.MaterialId = pipeline.MaterialId;
newPipeline.State = pipeline.State;
newPipeline.FlowingSection=pipeline.FlowingSection;
db.HJGL_Pipeline.InsertOnSubmit(newPipeline);
db.SubmitChanges();
}
@@ -313,6 +464,8 @@ namespace BLL
newPipeline.ActEndDate = pipeline.ActEndDate;
newPipeline.WBSId = pipeline.WBSId;
newPipeline.State = pipeline.State;
newPipeline.FlowingSection = pipeline.FlowingSection;
try
{
db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
@@ -54,7 +54,11 @@ namespace BLL
var q = (from x in Funs.DB.HJGL_WeldJoint where x.WeldingDailyId == weldingDailyId orderby x.PipelineId, x.WeldJointCode select x).ToList();
return q;
}
public static List<Model.HJGL_WeldJoint> GetWeldJointsByPipelineId(string PipelineId)
{
var q = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == PipelineId select x).ToList();
return q;
}
/// <summary>
/// 添加
/// </summary>
@@ -74,6 +78,7 @@ namespace BLL
Material2Id = weldJoint.Material2Id,
Thickness = weldJoint.Thickness,
Dia = weldJoint.Dia,
DNDia=weldJoint.DNDia,
Size = weldJoint.Size,
DetectionTypeId = weldJoint.DetectionTypeId,
JointArea = weldJoint.JointArea,
@@ -95,13 +100,21 @@ namespace BLL
PreTemperature = weldJoint.PreTemperature,
Remark = weldJoint.Remark,
IsTwoJoint = weldJoint.IsTwoJoint,
SubmitMan = weldJoint.SubmitMan
SubmitMan = weldJoint.SubmitMan,
TwoJointType=weldJoint.TwoJointType
};
db.HJGL_WeldJoint.InsertOnSubmit(newWeldJoint);
db.SubmitChanges();
}
public static void AddBulkWeldJoint(List<Model.HJGL_WeldJoint> weldJoints)
{
Model.SGGLDB db = Funs.DB;
db.HJGL_WeldJoint.InsertAllOnSubmit(weldJoints);
db.SubmitChanges();
}
/// <summary>
/// 修改
/// </summary>
@@ -121,6 +134,7 @@ namespace BLL
newWeldJoint.Material2Id = weldJoint.Material2Id;
newWeldJoint.Thickness = weldJoint.Thickness;
newWeldJoint.Dia = weldJoint.Dia;
newWeldJoint.DNDia = weldJoint.DNDia;
newWeldJoint.Size = weldJoint.Size;
newWeldJoint.DetectionTypeId = weldJoint.DetectionTypeId;
newWeldJoint.JointArea = weldJoint.JointArea;
@@ -146,6 +160,8 @@ namespace BLL
newWeldJoint.Remark = weldJoint.Remark;
newWeldJoint.AttachUrl = weldJoint.AttachUrl;
newWeldJoint.SubmitMan = weldJoint.SubmitMan;
newWeldJoint.TwoJointType = weldJoint.TwoJointType;
db.SubmitChanges();
}
}
@@ -369,7 +385,18 @@ namespace BLL
var q = (from x in Funs.DB.View_HJGL_WeldJoint where x.PipelineId == pipelineId orderby x.WeldJointCode select x).ToList();
return q;
}
public static List<Model.View_HJGL_WeldJoint> GetViewWeldJointsBymodel(Model.View_HJGL_WeldJoint model)
{
var q = (from x in Funs.DB.View_HJGL_WeldJoint
where
(string.IsNullOrEmpty(model.ProjectId) || x.ProjectId.Contains(model.ProjectId))
&& (string.IsNullOrEmpty(model.UnitWorkId) || x.UnitWorkId.Contains(model.UnitWorkId))
&& (string.IsNullOrEmpty(model.PipelineId) || x.PipelineId.Contains(model.PipelineId))
&& (string.IsNullOrEmpty(model.PipelineCode) || x.PipelineCode.Contains(model.PipelineCode))
&& (string.IsNullOrEmpty(model.WeldJointCode) || x.WeldJointCode.Contains(model.WeldJointCode))
orderby x.WeldJointCode select x).ToList();
return q;
}
/// <summary>
/// 根据壁厚计算焊口达因
/// </summary>
@@ -60,6 +60,7 @@ namespace BLL
x.Major,
x.LimitDate,
x.Url,
db.AttachFile.First(u => u.ToKeyId == x.PersonQualityId).AttachUrl,
};
}
#endregion
@@ -128,7 +128,7 @@ namespace BLL
db.SubmitChanges();
////在岗
if (sitePerson.States == Const.ProjectPersonStates_1)
if (sitePerson.States == Const.ProjectPersonStates_1 )
{
Model.SitePerson_PersonItem newPersonItem = new Model.SitePerson_PersonItem
{
@@ -143,8 +143,8 @@ namespace BLL
RoleId = sitePerson.RoleIds,
InTime = sitePerson.InTime,
};
AddPersonItem(newPersonItem);
AddPersonItem(newPersonItem);
var getOtherPersons = db.SitePerson_Person.Where(x => x.IdentityCard == sitePerson.IdentityCard && x.ProjectId != sitePerson.ProjectId && x.States == Const.ProjectPersonStates_1);
if (getOtherPersons.Count() > 0)
{
@@ -157,6 +157,7 @@ namespace BLL
db.SubmitChanges();
}
}
getPersons.CurrentProjectId = sitePerson.ProjectId;
getPersons.CurrentProjectRoleId = sitePerson.RoleIds;
getPersons.CurrentProjectWorkPostId = sitePerson.WorkPostId;
@@ -191,70 +192,79 @@ namespace BLL
newitem.PersonName = getPerson.PersonName;
newitem.IdentityCard = getPerson.IdentityCard;
}
var getPersonItem = db.SitePerson_PersonItem.FirstOrDefault(x => x.PersonId == getPerson.PersonId
&& x.InTime <= newitem.InTime && (x.OutTime > newitem.InTime || !x.OutTime.HasValue));
if (getPersonItem != null)
{
getPersonItem.OutTime = null;
db.SubmitChanges();
}
else
{
Model.SitePerson_PersonItem newPersonItem = new Model.SitePerson_PersonItem
{
PersonItemId = newitem.PersonItemId,
PersonId = newitem.PersonId,
PersonName = newitem.PersonName,
IdentityCard = newitem.IdentityCard,
InTime = newitem.InTime,
// OutTime = newitem.OutTime,
// OutResult = newitem.OutResult,
};
if (!string.IsNullOrEmpty(newitem.ProjectId))
{
newPersonItem.ProjectId = newitem.ProjectId;
newPersonItem.ProjectName = ProjectService.GetProjectNameByProjectId(newitem.ProjectId);
}
else
{
newPersonItem.ProjectId = null;
newPersonItem.ProjectName = newitem.ProjectName;
}
if (!string.IsNullOrEmpty(newitem.UnitId))
{
newPersonItem.UnitId = newitem.UnitId;
newPersonItem.UnitName = UnitService.GetUnitNameByUnitId(newitem.UnitId);
}
else
{
newPersonItem.UnitId = null;
newPersonItem.UnitName = newitem.UnitName;
}
if (!string.IsNullOrEmpty(newitem.WorkPostId))
{
newPersonItem.WorkPostId = newitem.WorkPostId;
newPersonItem.WorkPostName = WorkPostService.getWorkPostNameById(newitem.WorkPostId);
}
else
{
newPersonItem.WorkPostId = null;
newPersonItem.WorkPostName = newitem.WorkPostName;
}
if (!string.IsNullOrEmpty(newitem.TeamGroupId))
{
newPersonItem.TeamGroupId = newitem.TeamGroupId;
newPersonItem.TeamGroupName = TeamGroupService.GetTeamGroupNameByTeamGroupId(newitem.TeamGroupId);
}
else
{
newPersonItem.TeamGroupId = null;
newPersonItem.TeamGroupName = newitem.TeamGroupName;
}
if (!string.IsNullOrEmpty(newitem.RoleId))
{
newPersonItem.RoleId = newitem.RoleId;
newPersonItem.RoleName = RoleService.getRoleNamesRoleIds(newitem.RoleId);
}
else
{
newPersonItem.RoleId = null;
newPersonItem.RoleName = newitem.RoleName;
}
Model.SitePerson_PersonItem newPersonItem = new Model.SitePerson_PersonItem
{
PersonItemId = newitem.PersonItemId,
PersonId = newitem.PersonId,
PersonName = newitem.PersonName,
IdentityCard = newitem.IdentityCard,
InTime = newitem.InTime,
OutTime = newitem.OutTime,
OutResult = newitem.OutResult,
};
if (!string.IsNullOrEmpty(newitem.ProjectId))
{
newPersonItem.ProjectId = newitem.ProjectId;
newPersonItem.ProjectName = ProjectService.GetProjectNameByProjectId(newitem.ProjectId);
db.SitePerson_PersonItem.InsertOnSubmit(newPersonItem);
db.SubmitChanges();
}
else
{
newPersonItem.ProjectId =null;
newPersonItem.ProjectName = newitem.ProjectName;
}
if (!string.IsNullOrEmpty(newitem.UnitId))
{
newPersonItem.UnitId = newitem.UnitId;
newPersonItem.UnitName = UnitService.GetUnitNameByUnitId(newitem.UnitId);
}
else
{
newPersonItem.UnitId = null;
newPersonItem.UnitName = newitem.UnitName;
}
if (!string.IsNullOrEmpty(newitem.WorkPostId))
{
newPersonItem.WorkPostId = newitem.WorkPostId;
newPersonItem.WorkPostName = WorkPostService.getWorkPostNameById(newitem.WorkPostId);
}
else
{
newPersonItem.WorkPostId = null;
newPersonItem.WorkPostName = newitem.WorkPostName;
}
if (!string.IsNullOrEmpty(newitem.TeamGroupId))
{
newPersonItem.TeamGroupId = newitem.TeamGroupId;
newPersonItem.TeamGroupName = TeamGroupService.GetTeamGroupNameByTeamGroupId(newitem.TeamGroupId);
}
else
{
newPersonItem.TeamGroupId = null;
newPersonItem.TeamGroupName = newitem.TeamGroupName;
}
if (!string.IsNullOrEmpty(newitem.RoleId))
{
newPersonItem.RoleId = newitem.RoleId;
newPersonItem.RoleName = RoleService.getRoleNamesRoleIds(newitem.RoleId);
}
else
{
newPersonItem.RoleId = null;
newPersonItem.RoleName = newitem.RoleName;
}
db.SitePerson_PersonItem.InsertOnSubmit(newPersonItem);
db.SubmitChanges();
}
}
#endregion
+78 -7
View File
@@ -1,4 +1,5 @@
using FineUIPro;
using Microsoft.Office.Interop.Excel;
using Model;
using System;
using System.Collections;
@@ -57,8 +58,12 @@ namespace BLL
}
if (!string.IsNullOrEmpty(projetcId) && projetcId != Const._Null)
{
getDataList = getDataList.Where(e => e.CurrentProjectId == projetcId);
getDataList = from x in getDataList
join y in db.SitePerson_PersonItem on x.PersonId equals y.PersonId
where y.ProjectId == projetcId && !y.OutTime.HasValue
select x;
}
if (!string.IsNullOrEmpty(personType) && personType != Const._Null)
{
getDataList = getDataList.Where(e => e.PersonType == personType);
@@ -71,6 +76,7 @@ namespace BLL
{
getDataList = getDataList.Where(e => e.IdentityCard.Contains(idCard));
}
if (!string.IsNullOrEmpty(isPost) && isPost != "-1" && isPost != Const._Null)
{
if (isPost == Const._True)
@@ -112,9 +118,9 @@ namespace BLL
x.RoleIds,
RoleName = RoleService.getRoleNamesRoleIds(x.RoleIds),
x.CurrentProjectId,
CurrentProjectName = db.Base_Project.First(u => u.ProjectId == x.CurrentProjectId).ShortName,
CurrentProjectName = getCurrentProjectName(x.PersonId),
x.CurrentProjectWorkPostId,
CurrentProjectWorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(x.CurrentProjectWorkPostId),
CurrentProjectWorkPostName = getCurrentProjectWorkPostName(x.PersonId),
IsPost = x.IsPost ?? true,
x.SignatureUrl,
x.Address,
@@ -139,7 +145,47 @@ namespace BLL
};
}
#endregion
#region
/// <summary>
///
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectName(string PersonId)
{
var getItem = Funs.DB.SitePerson_PersonItem.FirstOrDefault(u => u.PersonId == PersonId && !u.OutTime.HasValue);
if (getItem != null)
{
return ProjectService.GetShortNameByProjectId(getItem.ProjectId);
}
else
{
return null;
}
}
/// <summary>
///
/// </summary>
/// <param name="WorkPostId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectWorkPostName( string PersonId)
{
var getItem = Funs.DB.SitePerson_PersonItem.FirstOrDefault(u => u.PersonId == PersonId && !u.OutTime.HasValue);
if (getItem != null)
{
return WorkPostService.getWorkPostNamesWorkPostIds(getItem.WorkPostId);
}
else
{
return null;
}
}
#endregion
#region
/// <summary>
/// 根据主键获取人员信息
@@ -152,6 +198,32 @@ namespace BLL
}
#endregion
/// <summary>
/// 根据主键,项目id判断当前人单位是否是总包单位
/// </summary>
/// <param name="PersonId"></param>
/// <param name="ProjectId"></param>
/// <returns></returns>
public static bool IsGeneralUnitByPersonId(string PersonId,string ProjectId)
{
bool result = false;
var PersonEntity = GetPerson_PersonsById(PersonId);
if (PersonEntity!=null)
{
var pUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(e => e.ProjectId == ProjectId && e.UnitId == PersonEntity.UnitId);
if (pUnit != null)
{
if (pUnit.UnitType == Const.ProjectUnitType_1 )
{
result = true;
}
}
}
return result;
}
#region
/// <summary>
/// 根据身份证号码获取人员信息
@@ -478,7 +550,7 @@ namespace BLL
{
var getPersons = from x in db.Person_Persons
where x.PersonId != Const.hfnbdId && x.PersonId != Const.sedinId
&& (x.IsPost == true || !x.IsPost.HasValue) && x.RoleIds != null
&& (x.IsPost == true || !x.IsPost.HasValue) && x.Account != null
select x;
if (listUnitIds.Count() > 0)
{
@@ -614,7 +686,7 @@ namespace BLL
WorkDate = person.WorkDate,
RetirementDate = person.RetirementDate,
RelativeName = person.RelativeName,
RelativeTel = person.RelativeTel,
RelativeTel = person.RelativeTel,
};
if (string.IsNullOrEmpty(person.QRCodeAttachUrl))
@@ -863,7 +935,6 @@ namespace BLL
newPerson.RetirementDate = person.RetirementDate;
newPerson.RelativeName = person.RelativeName;
newPerson.RelativeTel = person.RelativeTel;
// newPerson.IsCardNoOK = IDCardValid.CheckIDCard(person.IdentityCard);
if (string.IsNullOrEmpty(person.QRCodeAttachUrl))
{
+51 -3
View File
@@ -24,7 +24,8 @@ namespace BLL
/// </summary>
private static IQueryable<Model.Person_Persons> getDataLists = from x in db.Person_Persons
where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN
&& x.DepartId == Const.Depart_constructionId && (!x.IsPost.HasValue || x.IsPost == true)
&& x.DepartId == Const.Depart_constructionId
&& x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false)
select x;
/// <summary>
@@ -79,22 +80,69 @@ namespace BLL
x.DepartId,
x.WorkPostId,
WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId),
x.Major,
x.PostTitleId,
PostTitleName = PostTitleService.getPostTitleNameById(x.PostTitleId),
x.IsOffice,
x.RoleIds,
RoleName = RoleService.getRoleNamesRoleIds(x.RoleIds),
x.CurrentProjectId,
CurrentProjectName = db.Base_Project.First(u => u.ProjectId == x.CurrentProjectId).ShortName,
LastProjectName = getCurrentProjectName(x.PersonId),
x.CurrentProjectWorkPostId,
CurrentProjectWorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(x.CurrentProjectWorkPostId),
LastWorkPostName = getCurrentProjectWorkPostName(x.PersonId),
IsPost = x.IsPost ?? true,
IsPostName = x.IsPost == false ? "否" : "是",
x.SignatureUrl,
x.CertificateId,
};
}
#endregion
#region
/// <summary>
///
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectName(string PersonId)
{
var getItem = (from x in Funs.DB.SitePerson_PersonItem where x.PersonId == PersonId
orderby x.InTime descending
select x).FirstOrDefault();
if (getItem != null)
{
return ProjectService.GetShortNameByProjectId(getItem.ProjectId);
}
else
{
return null;
}
}
/// <summary>
///
/// </summary>
/// <param name="WorkPostId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectWorkPostName(string PersonId)
{
var getItem = (from x in Funs.DB.SitePerson_PersonItem
where x.PersonId == PersonId
orderby x.InTime descending
select x).FirstOrDefault();
if (getItem != null)
{
return WorkPostService.getWorkPostNamesWorkPostIds(getItem.WorkPostId);
}
else
{
return null;
}
}
#endregion
/// <summary>
/// 添加分流管理
/// </summary>
@@ -39,7 +39,7 @@ namespace BLL
Model.Project_Sys_Set Model_JointCompleteColor = BLL.Project_SysSetService.GetSysSetBySetName("焊口已完成", projectId);
if (Model_JointCompleteColor != null)
{
colorModel.JointNOCompleteColor = Model_JointCompleteColor.SetValue;
colorModel.JointCompleteColor = Model_JointCompleteColor.SetValue;
}
return colorModel;
+8 -11
View File
@@ -236,20 +236,17 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var units = (from x in db.Base_Unit
orderby x.UnitCode
select x).ToList();
if (!string.IsNullOrEmpty(projectId))
var units = from x in db.Base_Unit
select x;
if (!string.IsNullOrEmpty(projectId) && projectId != Const._Null)
{
units = (from x in units
join y in db.Project_ProjectUnit on x.UnitId equals y.UnitId
where y.ProjectId == projectId
select x).ToList();
units = from x in units
join y in db.Project_ProjectUnit on x.UnitId equals y.UnitId
where y.ProjectId == projectId
select x;
}
units = units.OrderBy(x => x.UnitCode).ToList();
return units;
return units.OrderBy(x => x.UnitCode).ToList(); ;
}
}
+1 -1
View File
@@ -195,7 +195,7 @@ namespace BLL
string clientId = SynchroSet.ClientId;
string userName = SynchroSet.UserName;
string password = Funs.EncryptionPassword(SynchroSet.Password);
string timestamp = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now.AddMinutes(-2));
string timestamp = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now.AddMinutes(-3));
string sign = Funs.EncryptionPassword(clientId + userName + password + timestamp);
var getToken = new
{