141 lines
6.7 KiB
C#
141 lines
6.7 KiB
C#
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),
|
|
TrainNumber=x.TrainNumber,
|
|
}).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),
|
|
TrainNumber = x.TrainNumber,
|
|
}).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
|
|
{
|
|
PipelineComponentId = x.PipelineComponentId,
|
|
PipelineComponentCode = x.PipelineComponentCode,
|
|
PreUnit = "1/个",
|
|
UnitWorkName = z.UnitWorkName,
|
|
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
|
|
|
|
}).ToList();
|
|
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
|
|
if (!isPower)
|
|
{
|
|
var roleList= Person_PersonsService.GetRoleListByProjectIdPersonId(projectId, personId);
|
|
if (roleList.Contains(Const.CQEngineer))
|
|
{
|
|
isPower=true;
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds)
|
|
{
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
{
|
|
var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId);
|
|
if (table != null)
|
|
{
|
|
if (string.IsNullOrEmpty(table.PipelineComponentId))
|
|
{
|
|
table.PipelineComponentId = PipelineComponentIds;
|
|
}
|
|
else
|
|
{
|
|
HashSet<string> set = new HashSet<string>();
|
|
string[] oldIds = table.PipelineComponentId.Split(',');
|
|
foreach (var id in oldIds)
|
|
{
|
|
set.Add(id);
|
|
}
|
|
string[] newIds = PipelineComponentIds.Split(',');
|
|
foreach (var id in newIds)
|
|
{
|
|
set.Add(id);
|
|
}
|
|
table.PipelineComponentId = string.Join(",", set);
|
|
|
|
}
|
|
}
|
|
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|