SGGL_SHJ/SGGL/BLL/API/HJGL/APIPipelineComponentService.cs

88 lines
4.0 KiB
C#
Raw Normal View History

2022-10-11 17:12:13 +08:00
using NPOI.OpenXmlFormats.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2022-10-11 17:12:13 +08:00
using Model;
namespace BLL
{
public class APIPipelineComponentService
{
2022-10-11 17:12:13 +08:00
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
2022-10-15 15:40:49 +08:00
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into pp
from t in tt.DefaultIfEmpty()
from p in pp.DefaultIfEmpty()
2022-10-11 17:12:13 +08:00
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,
2022-10-19 15:49:56 +08:00
PlanStartDate = string.Format("{0:g}", y.PlanStartDate) ,
2022-10-11 17:12:13 +08:00
QRCode = x.QRCode,
2022-10-15 15:40:49 +08:00
ReceiveMan=p.PersonName,
2022-10-19 15:49:56 +08:00
ReceiveDate= string.Format("{0:g}", x.ReceiveDate)
2022-10-11 17:12:13 +08:00
}).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
2022-10-15 15:40:49 +08:00
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into pp
2022-10-11 17:12:13 +08:00
from t in tt.DefaultIfEmpty()
2022-10-15 15:40:49 +08:00
from p in pp.DefaultIfEmpty()
2022-10-11 17:12:13 +08:00
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,
2022-10-19 15:49:56 +08:00
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
2022-10-11 17:12:13 +08:00
QRCode = x.QRCode,
2022-10-15 15:40:49 +08:00
ReceiveMan = p.PersonName,
2022-10-19 15:49:56 +08:00
ReceiveDate = string.Format("{0:g}", x.ReceiveDate)
2022-10-11 17:12:13 +08:00
}).FirstOrDefault();
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
pipelineComponentDetail.pipelineComponentItem = q;
pipelineComponentDetail.isPower=isPower;
return pipelineComponentDetail;
}
}
2022-10-15 15:40:49 +08:00
public static void GetComponentConfirmArrival(string PipelineComponentId,string PersonId)
2022-10-11 17:12:13 +08:00
{
var q = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(PipelineComponentId);
if (q != null)
{
q.State = HJGL_PipelineComponentService.state_1;
2022-10-15 15:40:49 +08:00
q.ReceiveMan = PersonId;
q.ReceiveDate = DateTime.Now;
2022-10-11 17:12:13 +08:00
HJGL_PipelineComponentService.UpdatePipelineComponent(q);
}
}
}
}