焊接材料修改

This commit is contained in:
2025-02-18 17:38:49 +08:00
parent d8cd15555d
commit 96d8567515
18 changed files with 161 additions and 75 deletions
+25 -6
View File
@@ -171,15 +171,29 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var results = new List<Tw_PipeMatMatchOutput>();
var results = new List<Tw_PipeMatMatchOutput>();
string [] taskPipeLineList= null;
var inoutPlanMasterl = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
if (inoutPlanMasterl!=null)
{
if (inoutPlanMasterl.WeldTaskId.Split('|').Length==4)
{
taskPipeLineList = Funs.DB.View_HJGL_WeldingTask.Where(e =>
e.UnitWorkId == inoutPlanMasterl.WeldTaskId.Split('|')[0].ToString()
&& e.UnitId == inoutPlanMasterl.WeldTaskId.Split('|')[1].ToString()
&& e.TaskDate.Value.Date == DateTime
.ParseExact(inoutPlanMasterl.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date
&& e.SerialNumber == inoutPlanMasterl.WeldTaskId.Split('|')[3].ToString()
).Distinct().OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).ToArray();
}
}
// 获取所需材料列表
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
join t in db.HJGL_WeldTask on master.WeldTaskId equals t.WeldTaskId
where x.InOutPlanMasterId == outPlanMasterId
where x.InOutPlanMasterId == outPlanMasterId
select new Tw_PipeMatMatchOutput
{
Id = Guid.NewGuid().ToString(),
@@ -191,12 +205,17 @@ namespace BLL
MaterialSpec = y.MaterialSpec,
MaterialUnit = y.MaterialUnit,
MaterialDef = y.MaterialDef,
NeedNum = x.Number,
PipeLineSortIndex=t.PipeLineSortIndex
NeedNum = x.Number
}
).ToList();
if (taskPipeLineList != null && taskPipeLineList.Any())
{
requiredMaterials = requiredMaterials.OrderBy(x => Array.IndexOf(taskPipeLineList, x.PipelineId.ToString())).ToList();
}
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
results = GetMatMatchOutput(requiredMaterials.OrderBy(x=>x.PipelineId).ThenBy(x=>x.MaterialCode).ToList(), masterModle.WarehouseCode, masterModle.ProjectId);
results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseCode, masterModle.ProjectId);
return results;
}
+41 -14
View File
@@ -32,7 +32,7 @@ namespace BLL
{
var q = from x in Funs.DB.Tw_InOutPlanMaster
join y in Funs.DB.HJGL_WeldTask on x.WeldTaskId equals y.WeldTaskId into yy
from y in yy.DefaultIfEmpty()
from y in yy.DefaultIfEmpty()
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
from person in persons.DefaultIfEmpty()
join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons
@@ -284,8 +284,14 @@ namespace BLL
return responeData;
}
}
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的材料编码
if (typeString.Contains("采购入库") && typeString.Contains("退料入库"))
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的类型
if (typeString.Where(x=>string.IsNullOrEmpty(x)).Count()>0)
{
responeData.code = 0;
responeData.message ="导入数据中类型列不能为空!";
return responeData;
}
if (typeString.Contains("采购入库") && typeString.Contains("其他入库"))
{
responeData.code = 0;
responeData.message = errorWarehouseCode + "每次只能导入一种类型!";
@@ -350,9 +356,9 @@ namespace BLL
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.;
}
else if ("退料入库".Equals(FirstCusBillCodeDtoIns.TypeString))
else if ("其他入库".Equals(FirstCusBillCodeDtoIns.TypeString))
{
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.退;
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.;
}
else
{
@@ -555,7 +561,13 @@ namespace BLL
TwInOutplandetailService.AddList(details, planMasterModel.Id);
return message;
}
/// <summary>
/// 获取出库申请单编号
/// </summary>
/// <param name="taskCode"></param>
/// <param name="typeInt"></param>
/// <param name="category"></param>
/// <returns></returns>
public static string GetCusBillCodeByTaskCode(string taskCode,TwConst.TypeInt typeInt,TwConst.Category category )
{
string cusBillCode = "";
@@ -601,17 +613,17 @@ namespace BLL
public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString,string unitWorkCode="",string Category = "")
{
if (typeString == TwConst.TypeInt.退.ToString())
if (typeString == TwConst.TypeInt..ToString())
{
//生成规则是20240919-unitcode-AP-GR01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR";
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) ;
var queryAll = new Tw_InOutMasterOutput()
{
ProjectId = projectid,
CusBillCode = cusBillCode,
};
var queryAllresult = GetModle(queryAll).Count();
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0');
cusBillCode = cusBillCode + "-AP-" + (queryAllresult + 1).ToString().PadLeft(2, '0');
return cusBillCode;
}
else if (typeString == TwConst.TypeInt..ToString())
@@ -628,15 +640,30 @@ namespace BLL
var queryAllresult = GetModle(queryAll).Count();
if (Category == TwConst.Category..ToString())
{
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-GI-P01";
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-AP-P01";
}
else
{
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-GI-PF01";
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-AP-PF01";
}
return cusBillCode;
}
else if (typeString == TwConst.TypeInt..ToString())
{
//生成规则是20240919-01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now);
var queryAll = new Tw_InOutMasterOutput()
{
ProjectId = projectid,
CusBillCode = cusBillCode,
TypeInt = (int)TwConst.TypeInt.,
};
var queryAllresult = GetModle(queryAll).Count();
cusBillCode = cusBillCode +"-AP-"+ (queryAllresult + 1).ToString().PadLeft(2, '0');
return cusBillCode;
}
else
{
//生成规则是20240919-unitcode-AP-GR01
@@ -678,11 +705,11 @@ namespace BLL
{
return;
}
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).Select(x=>x.PipelineId).Distinct().ToList();
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x=>x.PipeLineSortIndex).Select(x=>x.PipelineId).Distinct().ToList();
//领料出库需要排除散件材料
var MaterDatial= from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
where pipelineList.Contains(x.PipelineId)
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents !=null
select new
{
x.PipelineId,
+17 -11
View File
@@ -273,16 +273,8 @@ namespace BLL
WarehouseMan = plan.WarehouseMan,
WarehouseDate = plan.WarehouseDate
};
if ((TwConst.TypeInt)plan.TypeInt!= TwConst.TypeInt.)
{
master.CusBillCode = GetCusBillCodeByTaskCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt,
(BLL.TwConst.Category)plan.Category);
}
else
{
master.CusBillCode= plan.CusBillCode.Replace("-AP", "");
}
master.CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt,
(BLL.TwConst.Category)plan.Category, plan.CusBillCode);
Add(master);
//生成明细
foreach (var detail in detailLists)
@@ -338,7 +330,15 @@ namespace BLL
TwInOutplanmasterService.Update(plan);
}
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
/// <summary>
/// 获取入库单编号
/// </summary>
/// <param name="taskCode"></param>
/// <param name="typeInt"></param>
/// <param name="category"></param>
/// <returns></returns>
/// <param name="planCusBillCode"></param>
public static string GetCusBillCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category, string planCusBillCode = "")
{
string cusBillCode = "";
switch (typeInt)
@@ -353,6 +353,12 @@ namespace BLL
cusBillCode = taskCode + "-GI-PF01-RE01";
}
break;
case TwConst.TypeInt.:
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
break;
case TwConst.TypeInt.:
cusBillCode = planCusBillCode.Replace("-AP", ""); ;
break;
}
return cusBillCode;
+21 -5
View File
@@ -78,7 +78,8 @@ namespace BLL
AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate,
WarehouseManName = warehouseperson.PersonName
WarehouseManName = warehouseperson.PersonName,
Remark=y.Remark
};
return q;
@@ -281,7 +282,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(),
InOutPlanMasterId = plan.Id,
ProjectId = plan.ProjectId,
CusBillCode = GetCusBillCodeByTaskCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category),
CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category,plan.CusBillCode),
WarehouseCode = plan.WarehouseCode,
Category = plan.Category,
Source = plan.Source,
@@ -295,7 +296,8 @@ namespace BLL
AuditMan2 = plan.AuditMan2,
AuditDate2 = plan.AuditDate2,
WarehouseMan = plan.WarehouseMan,
WarehouseDate = plan.WarehouseDate
WarehouseDate = plan.WarehouseDate,
};
Add(master);
//生成出库单明细
@@ -350,7 +352,15 @@ namespace BLL
return result;
}
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
/// <summary>
/// 获取出库单编号
/// </summary>
/// <param name="taskCode"></param>
/// <param name="typeInt"></param>
/// <param name="category"></param>
/// <returns></returns>
/// <param name="planCusBillCode"></param>
public static string GetCusBillCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category, string planCusBillCode = "")
{
string cusBillCode = "";
switch (typeInt)
@@ -377,7 +387,13 @@ namespace BLL
}
break;
case TwConst.TypeInt.:
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
break;
case TwConst.TypeInt.:
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
break;
}
return cusBillCode;
}
@@ -137,7 +137,7 @@ namespace BLL
var q = Funs.DB.HJGL_Pipeline_ComponentJoint.Where(x => x.PipelineComponentId == PipelineComponentId).ToList();
if (q.Count!=0)
{
var NotProductionNum = (from x in q where x.State == 0 select x).Count(); //未生产数量
var NotProductionNum = (from x in q where x.State == 0||x.State ==null select x).Count(); //未生产数量
var ProductionNum = (from x in q where x.State == 1 select x).Count(); //已生产数量
if (NotProductionNum == 0) //全部完成
{
@@ -93,33 +93,25 @@ namespace BLL
/// <param name="IsCheckPrint"></param>
/// <returns></returns>
public static IEnumerable<PipelineComponentPrintDto> GetPrintModelByPipelineComponentIds(
string[] PipelineComponentId, string[] PipelineId, bool IsCheckPrint)
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
where com.QRCode != ""
orderby com.PipelineComponentCode, com.PipelineId
select new PipelineComponentPrintDto
{
PipelineComponentId = com.PipelineComponentId,
@@ -138,26 +130,32 @@ namespace BLL
QRCode2 = "PrePipeline$" + com.PipelineComponentId,
MaterialCode = mater.MaterialCode,
IsPrint = com.IsPrint
};
var result = query.ToList();
if (PipelineComponentId!=null &&PipelineComponentId.Length > 0)
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();
// 按照传入的 PipelineId 顺序排序
result = result.OrderBy(x => Array.IndexOf(PipelineId, x.PipelineId.ToString())).ToList();
}
//if (IsCheckPrint != null & IsCheckPrint ==true)
//{
// result = result.Where(x => x.IsPrint==false||x.IsPrint==null).ToList();
//}
// if (IsCheckPrint != null & IsCheckPrint == true)
// {
// result = result.Where(x => x.IsPrint == false || x.IsPrint == null).ToList();
// }
return result;
}
/// <summary>
/// 判断管线组件Code是否存在