2023-11-08
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user