增加焊接任务单打印

This commit is contained in:
2024-11-06 16:03:58 +08:00
parent 92f20a5913
commit 693c914869
9 changed files with 359 additions and 10 deletions
@@ -52,8 +52,7 @@ namespace BLL
from t in tt.DefaultIfEmpty()
from p in pp.DefaultIfEmpty()
join unitwork in db.WBS_UnitWork on y.UnitWorkId equals unitwork.UnitWorkId into unitworks
from unitwork in unitworks.DefaultIfEmpty()
from unitwork in unitworks.DefaultIfEmpty()
where x.PipelineComponentId== PipelineComponentId
select new PipelineComponentItem
{
@@ -62,8 +61,7 @@ namespace BLL
PreUnit = t.UnitName,
DrawingName = x.DrawingName,
BoxNumber = x.BoxNumber,
State = x.State,
StateStr = HJGL_PipelineComponentService.GetState().FirstOrDefault(q=>q.Value==x.State.ToString()).Text.Trim(),
State = x.State,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
QRCode = x.QRCode,
ReceiveMan = p.PersonName,
@@ -71,9 +69,17 @@ namespace BLL
UnitWorkName=unitwork.UnitWorkName,
Remark = x.Remark
}).FirstOrDefault();
if (q != null)
{
q.StateStr = HJGL_PipelineComponentService.GetState()
.FirstOrDefault(x => x.Value == q.State.ToString())
?.Text.Trim();
}
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
pipelineComponentDetail.pipelineComponentItem = q;
pipelineComponentDetail.isPower=isPower;
pipelineComponentDetail.isPower = isPower;
return pipelineComponentDetail;
}
@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Media.Animation;
namespace BLL
{
@@ -132,6 +133,70 @@ namespace BLL
}
}
public static decimal? GetPipeMatch(string pipelineId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>();
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
string warehouseCode = PipelineService
.GetPipeArea().FirstOrDefault(x => x.Value == pipelineModel.PipeArea.ToString())
?.Text;
// 获取所需材料列表
var requiredMaterials = (from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
join m in db.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId
where z.PipelineId== pipelineId && x.PrefabricatedComponents != "" //x.PrefabricatedComponents!="" 用于筛选非散件材料
select new Tw_PipeMatMatchOutput
{
Id = Guid.NewGuid().ToString(),
PipelineId = x.PipelineId,
PipelineCode = z.PipelineCode,
UnitWorkId = z.UnitWorkId,
UnitWorkName = m.UnitWorkName,
PrefabricatedComponents = x.PrefabricatedComponents,
MaterialCode = x.MaterialCode,
MaterialName = y.MaterialName,
MaterialSpec = y.MaterialSpec,
MaterialUnit = y.MaterialUnit,
MaterialDef = y.MaterialDef,
NeedNum = x.Number,
}
).ToList();
Tw_MaterialStockOutput tw_MaterialStockOutput = new Tw_MaterialStockOutput();
tw_MaterialStockOutput.WarehouseCode = warehouseCode;
var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(tw_MaterialStockOutput).ToList();//获取库存列表
// 模拟库存管理
foreach (var material in requiredMaterials)
{
var thisMaterialStockNum = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode)?.StockNum ?? 0;
if (thisMaterialStockNum >= material.NeedNum)
{
material.MatchNum = material.NeedNum;
material.MatchRate = 1;
material.MatchRateString = "100%";
}
else
{
material.MatchNum = thisMaterialStockNum < 0 ? 0 : thisMaterialStockNum;
material.MatchRate = (material.NeedNum == 0 ? 0 : material.MatchNum ?? 0 / material.NeedNum);
material.MatchRateString = Math.Round((decimal)material.MatchRate * 100, 2).ToString() + "%";
}
//修改stockList对应的库存数量
var stock = stockList.FirstOrDefault(x => x.PipeLineMatCode == material.MaterialCode);
if (stock != null)
{
stock.StockNum -= material.MatchNum;
}
}
twPipeMatMatchOutputs = requiredMaterials;
var result = twPipeMatMatchOutputs.Count==0?0: twPipeMatMatchOutputs.Sum(x=>x.MatchRate)/ twPipeMatMatchOutputs.Count;
return result;
}
}
public static List<Tw_PipeMatMatchOutput> GetMatMatchByOutPlanMasterId(string outPlanMasterId)
{
+1 -1
View File
@@ -547,7 +547,7 @@ namespace BLL
{
return;
}
string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMMMdd}", date);
string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMdd}", date);
//判断是否已经生成过出库计划单
var queryIsExitInMaster = new Tw_InOutMasterOutput();
queryIsExitInMaster.WeldTaskId = WeldTaskId;