1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -257,7 +258,124 @@ namespace BLL
|
||||
BLL.PointBatchDetailService.AutoPoint(pointBatchId);
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 手动点口
|
||||
/// </summary>
|
||||
/// <param name="weldJointId"></param>
|
||||
/// <returns></returns>
|
||||
public static string ManualPointSave(string weldJointId)
|
||||
{
|
||||
string res = "";
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var PointBatchItemModel = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == weldJointId);
|
||||
var PointBatchId= PointBatchItemModel.PointBatchId;
|
||||
var batch = BLL.PointBatchService.GetPointBatchById(PointBatchId);
|
||||
if (!batch.EndDate.HasValue)
|
||||
{
|
||||
var weldJoint = (from x in db.View_HJGL_WeldJoint
|
||||
where x.WeldJointId == weldJointId
|
||||
select x).FirstOrDefault();
|
||||
Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", weldJoint.ProjectId);
|
||||
if (batchSet != null && weldJoint != null)
|
||||
{
|
||||
int needJointNum = 0;
|
||||
int pointNumG = 0;
|
||||
int pointNumA = 0;
|
||||
if (batchSet.SetValue.Contains("6")) //按管线组批
|
||||
{
|
||||
var pipeline = (from x in db.HJGL_Pipeline
|
||||
join y in db.HJGL_WeldJoint on x.PipelineId equals y.PipelineId
|
||||
join z in db.HJGL_Batch_PointBatchItem on y.WeldJointId equals z.WeldJointId
|
||||
where z.PointBatchId == PointBatchId
|
||||
select x).FirstOrDefault();
|
||||
if (pipeline != null)
|
||||
{
|
||||
Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
|
||||
if (rate != null)
|
||||
{
|
||||
int totalJointCount = db.HJGL_WeldJoint.Count(x => x.PipelineId == pipeline.PipelineId);
|
||||
needJointNum = Convert.ToInt32(Math.Ceiling((totalJointCount * rate.DetectionRateValue.Value) * 0.01));
|
||||
// 安装口检测数量
|
||||
pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
|
||||
// 预制口要检测的数量
|
||||
pointNumA = needJointNum - pointNumG;
|
||||
var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
|
||||
join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
|
||||
where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "安装口"
|
||||
select x).Count();
|
||||
var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
|
||||
join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
|
||||
where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "预制口"
|
||||
select x).Count();
|
||||
if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
|
||||
{
|
||||
res = "安装口已达检测标准,无需再点此安装口!";
|
||||
return res;
|
||||
}
|
||||
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
|
||||
{
|
||||
res = "预制口已达检测标准,无需再点此预制口!";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else //不按管线组批
|
||||
{
|
||||
string unitWorkId = weldJoint.UnitWorkId;
|
||||
string rateId = weldJoint.DetectionRateId;
|
||||
string detectionType = weldJoint.DetectionType;
|
||||
int totalJointNum = (from x in db.HJGL_WeldJoint
|
||||
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
||||
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionType == detectionType
|
||||
select x).Count();
|
||||
Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(rateId);
|
||||
if (rate != null)
|
||||
{
|
||||
needJointNum = Convert.ToInt32(Math.Ceiling((totalJointNum * rate.DetectionRateValue.Value) * 0.01));
|
||||
// 安装口检测数量
|
||||
pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
|
||||
// 预制口要检测的数量
|
||||
pointNumA = needJointNum - pointNumG;
|
||||
var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
|
||||
join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
|
||||
join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
|
||||
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
|
||||
&& x.PointState == "1" && z.JointAttribute == "安装口"
|
||||
select x).Count();
|
||||
var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
|
||||
join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
|
||||
join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
|
||||
where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
|
||||
&& x.PointState == "1" && z.JointAttribute == "预制口"
|
||||
select x).Count();
|
||||
if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
|
||||
{
|
||||
res = "安装口已达检测标准,无需再点此安装口!";
|
||||
return res;
|
||||
}
|
||||
if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
|
||||
{
|
||||
res = "预制口已达检测标准,无需再点此预制口!";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PointBatchDetailService.UpdatePointBatchDetail(PointBatchItemModel.PointBatchItemId, "1", System.DateTime.Now);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
res = "批已关闭,不能点口!";
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
#region 点口调整
|
||||
/// <summary>
|
||||
/// 点口调整
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace BLL
|
||||
where PipelineComponentIdList.Contains(x.PipelineComponentId)
|
||||
select new PackagingPrepipeItem
|
||||
{
|
||||
PipelineComponentId = x.PipelineComponentId,
|
||||
PipelineComponentCode = x.PipelineComponentCode,
|
||||
PreUnit = "1/个",
|
||||
UnitWorkName = z.UnitWorkName,
|
||||
@@ -101,6 +102,18 @@ namespace BLL
|
||||
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)
|
||||
{
|
||||
table.PipelineComponentId = PipelineComponentIds;
|
||||
}
|
||||
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -45,6 +46,17 @@ namespace BLL
|
||||
|
||||
#endregion 获取管线信息
|
||||
|
||||
public static Model.View_HJGL_WeldJoint GetHJGL_WeldJoint(string WeldJointId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
// 从数据库中获取符合条件的管线数据
|
||||
var weldjoint = db.View_HJGL_WeldJoint
|
||||
.Where(p => p.WeldJointId == WeldJointId)
|
||||
.FirstOrDefault();
|
||||
return weldjoint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 获取未焊接的焊口信息
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using static QRCoder.PayloadGenerator;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -254,6 +257,52 @@ namespace BLL
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static string SaveWeldingDailyByWeldJointId(string WeldJointId, string Personid, string time)
|
||||
{
|
||||
string res = "";
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var peson=db.Person_Persons.FirstOrDefault(x => x.PersonId == Personid);
|
||||
if (peson == null)
|
||||
{
|
||||
res = "人员不存在";
|
||||
return res;
|
||||
}
|
||||
var joint = db.View_HJGL_WeldJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
|
||||
if (joint == null)
|
||||
{
|
||||
res = "焊口不存在";
|
||||
return res;
|
||||
}
|
||||
var weldingDaily = db.HJGL_WeldingDaily.FirstOrDefault(x => x.WeldingDate.Value.Date == Convert.ToDateTime(time).Date);
|
||||
if (weldingDaily == null)
|
||||
{
|
||||
string perfix = string.Format("{0:yyyyMMdd}", System.DateTime.Now) + "-" + peson.PersonName + "-";
|
||||
weldingDaily = new Model.HJGL_WeldingDaily();
|
||||
weldingDaily.WeldingDailyId = Guid.NewGuid().ToString();
|
||||
weldingDaily.WeldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.HJGL_WeldingDaily", "WeldingDailyCode", joint.ProjectId, perfix);
|
||||
weldingDaily.WeldingDate = Convert.ToDateTime(time).Date;
|
||||
weldingDaily.ProjectId = joint.ProjectId;
|
||||
weldingDaily.UnitWorkId = joint.UnitWorkId;
|
||||
weldingDaily.UnitId = joint.UnitId;
|
||||
weldingDaily.Tabler = Personid;
|
||||
weldingDaily.TableDate = Convert.ToDateTime(time).Date;
|
||||
db.HJGL_WeldingDaily.InsertOnSubmit(weldingDaily);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
var batchC = BLL.Project_SysSetService.GetSysSetBySetId("5", joint.ProjectId);
|
||||
if (batchC != null)
|
||||
{
|
||||
string batchCondition = batchC.SetValue;
|
||||
InsertWeldingDailyItem(WeldJointId, Personid, Personid, joint.JointAttribute, weldingDaily.WeldingDate, batchCondition, true, weldingDaily.WeldingDailyId, joint.ProjectId);
|
||||
}
|
||||
BLL.WeldJointService.UpdateWeldJointAddG(WeldJointId, joint.JointAttribute, Const.BtnAdd);
|
||||
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#region 保存焊接日报明细
|
||||
/// <summary>
|
||||
/// 保存焊接日报明细
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class TwArrivalStatisticsService
|
||||
{
|
||||
public static IEnumerable GetStatistics(string projectid,string materialCode)
|
||||
public static List<Tw_ArrivalStatisticsOutPut> GetStatistics(string projectid,string materialCode)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -36,12 +39,12 @@ namespace BLL
|
||||
RealNum = g.Sum(x => x.ActNum) ?? 0,
|
||||
};
|
||||
|
||||
var StatisticsList =from x in NeedOutMateriaList
|
||||
var StatisticsList =(from x in NeedOutMateriaList
|
||||
join y in RealInMateriaList on x.Key equals y.Key into gg
|
||||
from y in gg.DefaultIfEmpty()
|
||||
join z in db.HJGL_MaterialCodeLib on x.Key equals z.MaterialCode into zz
|
||||
from z in zz.DefaultIfEmpty()
|
||||
select new
|
||||
select new Tw_ArrivalStatisticsOutPut
|
||||
{
|
||||
MaterialCode = x.Key,
|
||||
NeedNum = x.NeedNum,
|
||||
@@ -49,10 +52,139 @@ namespace BLL
|
||||
MaterialName = z.MaterialName,
|
||||
MaterialSpec=z.MaterialSpec,
|
||||
MaterialUnit=z.MaterialUnit,
|
||||
};
|
||||
return StatisticsList.ToList();
|
||||
MaterialDef = z.MaterialDef,
|
||||
MatchRate = (x.NeedNum == 0 ?0:Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4,MidpointRounding.ToEven)),
|
||||
}).ToList();
|
||||
foreach (var item in StatisticsList)
|
||||
{
|
||||
item.MatchRateString = Math.Round(item.MatchRate*100, 2).ToString()+"%" ;
|
||||
}
|
||||
return StatisticsList ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static List<Tw_PipeMatMatchOutput> GetPipeMatMatch(string projectid, List<string> pipelineIds,string WarehouseCode)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
|
||||
// 获取所需材料列表
|
||||
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
|
||||
where z.ProjectId == projectid && pipelineIds.Contains(z.PipelineId)
|
||||
select new Tw_PipeMatMatchOutput
|
||||
{
|
||||
Id= Guid.NewGuid().ToString(),
|
||||
PipelineId =x.PipelineId,
|
||||
PipelineCode=z.PipelineCode,
|
||||
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;
|
||||
}
|
||||
}
|
||||
results = requiredMaterials;
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static List<Tw_PipeMatMatchOutput> GetMatMatchByOutPlanMasterId(string outPlanMasterId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
|
||||
// 获取所需材料列表
|
||||
var requiredMaterials = (from x in db.Tw_InOutPlanDetail_Relation
|
||||
join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where x.InOutPlanMasterId == outPlanMasterId
|
||||
select new Tw_PipeMatMatchOutput
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
PipelineId = x.PipelineId,
|
||||
PipelineCode = z.PipelineCode,
|
||||
PrefabricatedComponents = x.PrefabricatedComponents,
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialName = y.MaterialName,
|
||||
MaterialSpec = y.MaterialSpec,
|
||||
MaterialUnit = y.MaterialUnit,
|
||||
MaterialDef = y.MaterialDef,
|
||||
NeedNum = x.Number,
|
||||
}
|
||||
).ToList();
|
||||
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
Tw_MaterialStockOutput tw_MaterialStockOutput = new Tw_MaterialStockOutput();
|
||||
tw_MaterialStockOutput.WarehouseCode = masterModle.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;
|
||||
}
|
||||
}
|
||||
results = requiredMaterials;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,26 @@ namespace BLL
|
||||
{ "补料出库" ,(int)TypeInt.补料出库},
|
||||
{ "其他出库" ,(int)TypeInt.其他出库},
|
||||
{ "散件出库" ,(int)TypeInt.散件出库}
|
||||
};
|
||||
public static Dictionary<string, int> PlanPrintMap = new Dictionary<string, int>
|
||||
{
|
||||
{ "采购通知单" ,(int)TypeInt.采购入库},
|
||||
{ "退料通知单" ,(int)TypeInt.退料入库},
|
||||
{ "其他入库通知单" ,(int)TypeInt.其他入库},
|
||||
{ "材料领用申请单" ,(int)TypeInt.领料出库},
|
||||
{ "补料申请单" ,(int)TypeInt.补料出库},
|
||||
{ "其他出库申请单" ,(int)TypeInt.其他出库},
|
||||
{ "散件出库申请单" ,(int)TypeInt.散件出库}
|
||||
};
|
||||
public static Dictionary<string, int> PrintMap = new Dictionary<string, int>
|
||||
{
|
||||
{ "采购入库单" ,(int)TypeInt.采购入库},
|
||||
{ "退料入库单" ,(int)TypeInt.退料入库},
|
||||
{ "其他入库单" ,(int)TypeInt.其他入库},
|
||||
{ "材料出库单" ,(int)TypeInt.领料出库},
|
||||
{ "补料出库单" ,(int)TypeInt.补料出库},
|
||||
{ "其他出库单" ,(int)TypeInt.其他出库},
|
||||
{ "散件出库单" ,(int)TypeInt.散件出库}
|
||||
};
|
||||
public static Dictionary<string, int> StateMap = new Dictionary<string, int>
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace BLL
|
||||
x.PrefabricatedComponents,
|
||||
x.Number,
|
||||
mat.MaterialName,
|
||||
|
||||
mat.MaterialDef
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -27,7 +27,11 @@ namespace BLL
|
||||
join y in Funs.DB.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join master in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id into masters
|
||||
from master in masters.DefaultIfEmpty()
|
||||
join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode, master.WarehouseCode } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseCode } into st
|
||||
from stock in st.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
@@ -43,6 +47,8 @@ namespace BLL
|
||||
ActNum = x.ActNum,
|
||||
PipelineComponentCode = y.PipelineComponentCode,
|
||||
MaterialName = mat.MaterialName,
|
||||
MaterialDef= mat.MaterialDef,
|
||||
StockNum = stock.StockNum ?? 0,
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using EmitMapper;
|
||||
using FineUIPro;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using NPOI.Util;
|
||||
@@ -213,10 +214,6 @@ namespace BLL
|
||||
responeData.message = "导入数据为空!";
|
||||
return responeData;
|
||||
}
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid
|
||||
};
|
||||
var warehouseCodeList = temeplateDtoIns.Select(x => x.WarehouseCode).Distinct().ToList(); //获取导入文件的仓库编号
|
||||
string errorWarehouseCode = "";
|
||||
foreach (var item in warehouseCodeList)
|
||||
@@ -251,7 +248,15 @@ namespace BLL
|
||||
return responeData;
|
||||
}
|
||||
}
|
||||
|
||||
string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId));
|
||||
foreach (var item in temeplateDtoIns)
|
||||
{
|
||||
item.CusBillCode = cusbilcode;
|
||||
}
|
||||
/*var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Select(x => x.CusBillCode).Distinct().ToList();//查询所有的编号
|
||||
var CusBillCodeList = temeplateDtoIns.Select(x => x.CusBillCode).Distinct().ToList(); //获取导入文件的编号
|
||||
var IsContain = CusBillCodeList.Intersect(queryAllresult).ToList(); //判断导入文件中是有已存在的编号
|
||||
@@ -260,7 +265,8 @@ namespace BLL
|
||||
responeData.code = 0;
|
||||
responeData.message = string.Join(",", IsContain)+ "编号已存在!";
|
||||
return responeData;
|
||||
}
|
||||
}*/
|
||||
var CusBillCodeList = temeplateDtoIns.Select(x => x.CusBillCode).Distinct().ToList(); //获取导入文件的编号
|
||||
#endregion
|
||||
//根据申请单编号分组插入数据
|
||||
foreach (var CusBillCode in CusBillCodeList)
|
||||
@@ -510,6 +516,23 @@ namespace BLL
|
||||
return cusBillCode;
|
||||
}
|
||||
|
||||
|
||||
public static string GetDataInCusBillCode(string projectid, string unitcode)
|
||||
{
|
||||
|
||||
//生成规则是20240919-unitcode-AP-GR01
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode + "-AP-GR";
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid,
|
||||
CusBillCode=cusBillCode,
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
return cusBillCode;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据任务单生成出库计划单
|
||||
/// </summary>
|
||||
@@ -655,5 +678,7 @@ namespace BLL
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ namespace BLL
|
||||
ActNum = x.ActNum,
|
||||
PipelineComponentCode = y.PipelineComponentCode,
|
||||
MaterialName = mat.MaterialName,
|
||||
MaterialDef = mat.MaterialDef
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 根据计划单生成入库单
|
||||
/// </summary>
|
||||
public static void GenInMasterByPlanId(string planId, List<Model.Tw_InputDetail> detailLists)
|
||||
public static void GenInMasterByPlanId(string planId, List<Model.Tw_InputDetail> detailLists,string remark)
|
||||
{
|
||||
//获取计划单
|
||||
var planQueryModel = new Tw_InOutMasterOutput();
|
||||
|
||||
@@ -42,7 +42,8 @@ namespace BLL
|
||||
ProjectId = x.ProjectId,
|
||||
MaterialName = mat.MaterialName,
|
||||
MaterialSpec = mat.MaterialSpec,
|
||||
MaterialUnit = mat.MaterialUnit,
|
||||
MaterialUnit = mat.MaterialUnit,
|
||||
MaterialDef = mat.MaterialDef
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
@@ -27,9 +27,11 @@ namespace BLL
|
||||
var q = from x in Funs.DB.Tw_OutputDetail
|
||||
join y in Funs.DB.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join stock in Funs.DB.Tw_MaterialStock on x.MaterialCode equals stock.PipeLineMatCode into st
|
||||
join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id into masters
|
||||
from master in masters.DefaultIfEmpty()
|
||||
join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode,master.WarehouseCode} equals new { MaterialCode=stock.PipeLineMatCode,stock.WarehouseCode } into st
|
||||
from stock in st.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
@@ -48,7 +50,8 @@ namespace BLL
|
||||
MaterialName = mat.MaterialName,
|
||||
StockNum = stock.StockNum ?? 0,
|
||||
DiffNum = (x.ActNum??0) - (x.PlanNum??0),
|
||||
}
|
||||
MaterialDef = mat.MaterialDef
|
||||
}
|
||||
;
|
||||
|
||||
return q;
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace BLL
|
||||
model.PipelineComponentId = SQLHelper.GetNewID();
|
||||
model.PipelineId = PipelineId;
|
||||
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
|
||||
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
|
||||
model.DrawingName = model_mat.PrefabricatedComponents?.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
|
||||
model.State = state_0;
|
||||
model.ProductionState = 0;
|
||||
model.IsPrint = false;
|
||||
|
||||
@@ -340,30 +340,38 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static List<string> GetNoComPipelinesByUnitWordId(string unitworkId)
|
||||
{
|
||||
var q = (from x in Funs.DB.View_HJGL_WeldJoint
|
||||
where x.UnitWorkId == unitworkId
|
||||
select new
|
||||
{
|
||||
PipelineId = x.PipelineId,
|
||||
WeldingDate = x.WeldingDate,
|
||||
PipelineCode = x.PipelineCode
|
||||
}).Distinct();
|
||||
if (q.Count() == 0)
|
||||
var q = Funs.DB.View_HJGL_WeldJoint
|
||||
.Where(x => x.UnitWorkId == unitworkId)
|
||||
.Select(x => new
|
||||
{
|
||||
x.PipelineId,
|
||||
x.WeldingDate,
|
||||
x.PipelineCode
|
||||
})
|
||||
.Distinct()
|
||||
.ToList(); // 立即执行查询并加载数据
|
||||
|
||||
if (q.Count == 0)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
var noCompipeline = from x in q
|
||||
group x by x.PipelineId into g
|
||||
select new
|
||||
{
|
||||
PipelineId = g.Key,
|
||||
Count = (from x2 in g where x2.WeldingDate != null && x2.WeldingDate != "" select x2).Count(),
|
||||
};
|
||||
var NowComPipelineCode = (from x in q
|
||||
join y in noCompipeline on x.PipelineId equals y.PipelineId
|
||||
where y.Count == 0
|
||||
select x.PipelineCode
|
||||
).Distinct().ToList();
|
||||
|
||||
// 分组并计算焊接日期不为null或空字符串的数量
|
||||
var noCompipeline = q.GroupBy(x => x.PipelineId)
|
||||
.Select(g => new
|
||||
{
|
||||
PipelineId = g.Key,
|
||||
Count = g.Count(x => !string.IsNullOrEmpty(x.WeldingDate)) // 直接计算
|
||||
})
|
||||
.ToList(); // 立即执行查询并加载数据
|
||||
|
||||
// 过滤出未完成的管道代码
|
||||
var NowComPipelineCode = noCompipeline
|
||||
.Where(y => y.Count == 0)
|
||||
.Join(q, y => y.PipelineId, x => x.PipelineId, (y, x) => x.PipelineCode)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
return NowComPipelineCode;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user