2023-11-08

This commit is contained in:
2023-11-08 17:26:59 +08:00
parent 1b7463957c
commit 11357590c9
19 changed files with 389 additions and 135 deletions
@@ -1,8 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
using Model;
using NPOI.SS.Formula.Functions;
namespace BLL
{
@@ -12,16 +15,21 @@ namespace BLL
/// 未验收
/// </summary>
public static int state_0 = 0;
/// <summary>
/// 已验收
/// </summary>
public static int state_1 = 1;
/// <summary>
/// 已装箱
/// </summary>
public static int state_2 = 2;
/// <summary>
/// 获取状态名称
/// </summary>
/// <returns></returns>
public static ListItem[] GetState()
{
ListItem[] list = new ListItem[3];
@@ -30,6 +38,10 @@ namespace BLL
list[2] = new ListItem("已出库", state_2.ToString());
return list;
}
/// <summary>
/// 生产状态
/// </summary>
/// <returns></returns>
public static ListItem[] GetProductionState()
{
ListItem[] list = new ListItem[3];
@@ -61,6 +73,81 @@ namespace BLL
{
return Funs.DB.HJGL_Pipeline_Component.FirstOrDefault(e => e.PipeLineMatId == pipeLineMatId);
}
/// <summary>
/// 获取打印实体
/// </summary>
/// <param name="PipelineComponentId"></param>
/// <param name="PipelineId"></param>
/// <param name="IsCheckPrint"></param>
/// <returns></returns>
public static IEnumerable<PipelineComponentPrintDto> GetPrintModelByPipelineComponentIds(
string[] PipelineComponentId, string[] PipelineId, bool IsCheckPrint)
{
var db = Funs.DB;
var query =
from com in db.HJGL_Pipeline_Component
join mat in db.HJGL_PipeLineMat on com.PipeLineMatId equals mat.PipeLineMatId into matJoin
from mat in matJoin.DefaultIfEmpty()
join pipe in db.HJGL_Pipeline on com.PipelineId equals pipe.PipelineId into pipeJoin
from pipe in pipeJoin.DefaultIfEmpty()
join punit in db.Base_Unit on com.PreUnit equals punit.UnitId into punitJoin
from punit in punitJoin.DefaultIfEmpty()
join aunit in db.Base_Unit on com.AssembleUnit equals aunit.UnitId into aunitJoin
from aunit in aunitJoin.DefaultIfEmpty()
join unitwork in db.WBS_UnitWork on pipe.UnitWorkId equals unitwork.UnitWorkId into unitworkJoin
from unitwork in unitworkJoin.DefaultIfEmpty()
join mater in db.Base_Material on pipe.MaterialId equals mater.MaterialId into materJoin
from mater in materJoin.DefaultIfEmpty()
where com.QRCode != ""
orderby com.PipelineComponentCode,com.PipelineId
select new PipelineComponentPrintDto
{
PipelineComponentId = com.PipelineComponentId,
PipelineComponentCode = com.PipelineComponentCode,
BoxNumber = com.BoxNumber,
UnitWorkName = unitwork.UnitWorkName,
PipelineId = com.PipelineId,
PreUnit = punit.UnitName,
AssembleUnit = aunit.UnitName,
PrefabricatedComponents = mat.PrefabricatedComponents,
QRCode = com.QRCode,
State = com.State,
PlanStartDate = string.Format("yyyy-MM-dd", pipe.PlanStartDate),
PipelineCode = pipe.PipelineCode,
FlowingSection = pipe.FlowingSection,
QRCode2 = "PrePipeline$" + com.PipelineComponentId,
MaterialCode = mater.MaterialCode,
IsPrint = com.IsPrint
};
var result = query.ToList();
if (PipelineComponentId!=null &&PipelineComponentId.Length > 0)
{
result = result.Where(x => PipelineComponentId.Contains(x.PipelineComponentId.ToString())).ToList();
}
if (PipelineId != null && PipelineId.Length > 0)
{
result = result.Where(x => PipelineId.Contains(x.PipelineId.ToString())).ToList();
}
if (IsCheckPrint != null & IsCheckPrint ==true)
{
result = result.Where(x => x.IsPrint==false||x.IsPrint==null).ToList();
}
return result;
}
/// <summary>
/// 判断管线组件Code是否存在
/// </summary>
@@ -119,6 +206,7 @@ namespace BLL
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
model.State = state_0;
model.ProductionState = 0;
model.IsPrint = false;
AddPipelineComponent(model);
}
@@ -133,6 +221,7 @@ namespace BLL
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_Pipeline_Component newPipeline = new Model.HJGL_Pipeline_Component();
pipeline.IsPrint ??= false;
newPipeline.PipelineComponentId = pipeline.PipelineComponentId;
newPipeline.PipelineId = pipeline.PipelineId;
newPipeline.PreUnit = pipeline.PreUnit;
@@ -150,6 +239,7 @@ namespace BLL
newPipeline.ReceiveMan= pipeline.ReceiveMan;
newPipeline.ReceiveDate= pipeline.ReceiveDate;
newPipeline.ProductionState= pipeline.ProductionState;
newPipeline.IsPrint= pipeline.IsPrint;
db.HJGL_Pipeline_Component.InsertOnSubmit(newPipeline);
db.SubmitChanges();
}
@@ -180,10 +270,15 @@ namespace BLL
newPipeline.ReceiveMan = pipeline.ReceiveMan;
newPipeline.ReceiveDate = pipeline.ReceiveDate;
newPipeline.ProductionState = pipeline.ProductionState;
newPipeline.IsPrint=pipeline.IsPrint;
db.SubmitChanges();
}
}
/// <summary>
/// 修改出库状态
/// </summary>
/// <param name="pipelineComponentId"></param>
/// <param name="BoxNumber"></param>
public static void UpdateOutState(string pipelineComponentId,string BoxNumber)
{
var q=GetPipelineComponentById(pipelineComponentId);
@@ -196,6 +291,24 @@ namespace BLL
}
}
/// <summary>
/// 修改打印状态
/// </summary>
/// <param name="PipelineComponentId"></param>
public static void UpdateIsPrint(string[] PipelineComponentId)
{
var componentsToUpdate = Funs.DB.HJGL_Pipeline_Component
.Where(c => PipelineComponentId.Contains(c.PipelineComponentId));
foreach (var component in componentsToUpdate)
{
component.IsPrint = true;
}
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改生产状态
/// </summary>
@@ -345,4 +458,26 @@ namespace BLL
}
}
}
public class PipelineComponentPrintDto
{
public string PipelineComponentId { get; set; }
public string PipelineComponentCode { get; set; }
public string BoxNumber { get; set; }
public string UnitWorkName { get; set; }
public string PipelineId { get; set; }
public string PreUnit { get; set; }
public string AssembleUnit { get; set; }
public string PrefabricatedComponents { get; set; }
public string QRCode { get; set; }
public int? State { get; set; }
public string PlanStartDate { get; set; }
public string PipelineCode { get; set; }
public string FlowingSection { get; set; }
public string QRCode2 { get; set; }
public string MaterialCode { get; set; }
public bool? IsPrint { get; set; }
}
}
@@ -168,7 +168,6 @@ namespace BLL
return Funs.DB.PHTGL_ContractTrack.FirstOrDefault(x => x.Id == id);
}
public static void AddPHTGL_ContractTrack(PHTGL_ContractTrack newtable)
{
var table = new PHTGL_ContractTrack
@@ -209,7 +208,14 @@ namespace BLL
PhtglContracttrackprogressService.CreateTemplateByContractTrackId(newtable.Id);
}
public static void AddBulkPHTGL_ContractTrack(List<PHTGL_ContractTrack> list)
{
Model.SGGLDB db = Funs.DB;
db.PHTGL_ContractTrack.InsertAllOnSubmit(list);
db.SubmitChanges();
}
public static void UpdatePHTGL_ContractTrack(PHTGL_ContractTrack newtable)
@@ -352,12 +358,12 @@ namespace BLL
{
var responeData = new ResponeData();
List<PHTGL_ContractTrackDtoIn> rows;
List<PHTGL_ContractTrack> goingAddList =new List<PHTGL_ContractTrack>();
var sheetNames = MiniExcel.GetSheetNames(path);
foreach (var sheet in sheetNames) ////多sheet导入
{
try
{
rows = MiniExcel.Query<PHTGL_ContractTrackDtoIn>(path, sheetName: sheet,startCell:"A2").ToList();
}
catch (Exception ex)
@@ -388,16 +394,16 @@ namespace BLL
ContractId = contractid,
ProjectId = projectid,
};
var resultModel = GetPHTGL_ContractTrackByModle(phtglContractTrack);
var resultModel = GetFirstPHTGL_ContractTrackByModle(phtglContractTrack);
item.ContractNum = ContractService.GetContractById(contractid)?.ContractNum;
if (!string.IsNullOrEmpty(item.ProjectCode) && !item.ProjectCode.Contains("-"))
{
item.ProjectCode = item.MainItemCode + "-" + item.ProjectCode;
}
if (resultModel.Any())
if (resultModel!=null)
{
item.Id = resultModel[0].Id;
item.Id = resultModel.Id;
UpdatePHTGL_ContractTrack(item);
}
else
@@ -17,8 +17,7 @@ namespace BLL
/// </summary>
public static int Count { get; set; }
public static List<PHTGL_ContractTrackProgress> GetPHTGL_ContractTrackProgressByModle(
PHTGL_ContractTrackProgress table)
public static IQueryable<PHTGL_ContractTrackProgress> GetPHTGL_ContractTrackProgressByModle( PHTGL_ContractTrackProgress table)
{
var q = from x in Funs.DB.PHTGL_ContractTrackProgress
where
@@ -31,10 +30,23 @@ namespace BLL
orderby x.Date
select x
;
return q.ToList();
return q;
}
public static PHTGL_ContractTrackProgress GetFirstOrDefaultByModle(PHTGL_ContractTrackProgress table)
{
var q = (from x in Funs.DB.PHTGL_ContractTrackProgress
where
(string.IsNullOrEmpty(table.ContractTrackProgressId) ||
x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) &&
(string.IsNullOrEmpty(table.ContractTrackId) ||
x.ContractTrackId.Contains(table.ContractTrackId)) &&
(string.IsNullOrEmpty(table.Date) ||
x.Date.Contains(table.Date))
orderby x.Date
select x).FirstOrDefault()
;
return q;
}
/// <summary>
/// 获取分页列表
/// </summary>
@@ -46,7 +58,7 @@ namespace BLL
var q = GetPHTGL_ContractTrackProgressByModle(table);
Count = q.Count();
if (Count == 0) return null;
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q
select new
+1 -1
View File
@@ -246,7 +246,7 @@ namespace BLL
var pUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(e => e.ProjectId == ProjectId && e.UnitId == PersonEntity.UnitId);
if (pUnit != null)
{
if (pUnit.UnitType == Const.ProjectUnitType_1 )
if (pUnit.UnitType == Const.ProjectUnitType_1 || pUnit.UnitType == Const.ProjectUnitType_2)
{
result = true;
}