赛鼎焊接修改
This commit is contained in:
@@ -130,9 +130,29 @@ namespace BLL
|
||||
}
|
||||
table.PipelineComponentId = string.Join(",", set);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
|
||||
var newDetailList = new List<Model.HJGL_PackagingManageDetail>();
|
||||
foreach (var item in table.PipelineComponentId.Split(','))
|
||||
{
|
||||
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
|
||||
if (ComponentModel != null)
|
||||
{
|
||||
var model = new Model.HJGL_PackagingManageDetail()
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
PackagingManageId = table.PackagingManageId,
|
||||
PipelineId = ComponentModel.PipelineId,
|
||||
PipelineComponentId = item,
|
||||
CreateTime = DateTime.Now,
|
||||
};
|
||||
newDetailList.Add(model);
|
||||
}
|
||||
}
|
||||
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(table.PackagingManageId);
|
||||
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,6 +407,7 @@
|
||||
<Compile Include="HJGL\PreDesign\HJGL_MaterialService.cs" />
|
||||
<Compile Include="HJGL\PreDesign\HJGLPackagingmanagedetailService.cs" />
|
||||
<Compile Include="HJGL\PreDesign\PackagingManageService .cs" />
|
||||
<Compile Include="HJGL\PreDesign\ProductionSchedulingPlanService.cs" />
|
||||
<Compile Include="HJGL\PreDesign\TrainNumberManageService.cs" />
|
||||
<Compile Include="HJGL\PreDesign\YardPlanningService.cs" />
|
||||
<Compile Include="HJGL\PurgingCleaning\PC_ItemEndCheckService.cs" />
|
||||
|
||||
@@ -4801,6 +4801,11 @@ namespace BLL
|
||||
/// </summary>
|
||||
public const string Pipeline_ComponentPath = "File\\Excel\\DataIn\\组件管理二维码信息导入.xlsx";
|
||||
|
||||
/// <summary>
|
||||
/// 排产计划导出模板
|
||||
/// </summary>
|
||||
public const string HJGL_ProductionSchedulingPlanPath = "File\\Excel\\DataOut\\排产计划导出模板.xlsx";
|
||||
|
||||
|
||||
#region 焊接报表
|
||||
/// <summary>
|
||||
|
||||
@@ -231,6 +231,23 @@ namespace BLL
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteByPackagingManageId(string packagingManageId)
|
||||
{
|
||||
|
||||
var list = Funs.DB.HJGL_PackagingManageDetail.Where(x => x.PackagingManageId == packagingManageId).ToList();
|
||||
if (list.Count>0)
|
||||
{
|
||||
Funs.DB.HJGL_PackagingManageDetail.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void AddBulk(List<Model.HJGL_PackagingManageDetail> newtables)
|
||||
{
|
||||
|
||||
Funs.DB.HJGL_PackagingManageDetail.InsertAllOnSubmit(newtables);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 排产计划
|
||||
/// </summary>
|
||||
public class ProductionSchedulingPlanService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取排产计划
|
||||
/// </summary>
|
||||
/// <param name="productionSchedulingPlanId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlanById(string productionSchedulingPlanId)
|
||||
{
|
||||
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
|
||||
}
|
||||
|
||||
|
||||
public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlan(string loginProjectId, string flowingSection, string unitWorkName, string material, string caliber)
|
||||
{
|
||||
return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProjectId == loginProjectId && e.FlowNum == flowingSection && e.MainItemName == unitWorkName && e.Caliber == caliber);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加排产计划
|
||||
/// </summary>
|
||||
/// <param name="plan"></param>
|
||||
public static void AddProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan)
|
||||
{
|
||||
SGGLDB db = Funs.DB;
|
||||
Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan();
|
||||
newPlan.ProductionSchedulingPlanId = plan.ProductionSchedulingPlanId;
|
||||
newPlan.ProjectId = plan.ProjectId;
|
||||
newPlan.PipelineId = plan.PipelineId;
|
||||
newPlan.FlowNum = plan.FlowNum;
|
||||
newPlan.MainItemName = plan.MainItemName;
|
||||
newPlan.Material = plan.Material;
|
||||
newPlan.Caliber = plan.Caliber;
|
||||
newPlan.Dain = plan.Dain;
|
||||
newPlan.TotalDyne = plan.TotalDyne;
|
||||
newPlan.TotalPriority = plan.TotalPriority;
|
||||
newPlan.PriorityTotalDyne = plan.PriorityTotalDyne;
|
||||
newPlan.PlanStartDate = plan.PlanStartDate;
|
||||
newPlan.PlanEndDate = plan.PlanEndDate;
|
||||
newPlan.Days = plan.Days;
|
||||
newPlan.AvgDailyWorkload = plan.Days;
|
||||
db.HJGL_ProductionSchedulingPlan.InsertOnSubmit(newPlan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改排产计划
|
||||
/// </summary>
|
||||
/// <param name="plan"></param>
|
||||
public static void UpdateProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.HJGL_ProductionSchedulingPlan newPlan = db.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == plan.ProductionSchedulingPlanId);
|
||||
if (newPlan != null)
|
||||
{
|
||||
newPlan.PipelineId = plan.PipelineId;
|
||||
newPlan.FlowNum = plan.FlowNum;
|
||||
newPlan.MainItemName = plan.MainItemName;
|
||||
newPlan.Material = plan.Material;
|
||||
newPlan.Caliber = plan.Caliber;
|
||||
newPlan.Dain = plan.Dain;
|
||||
newPlan.TotalDyne = plan.TotalDyne;
|
||||
newPlan.TotalPriority = plan.TotalPriority;
|
||||
newPlan.PriorityTotalDyne = plan.PriorityTotalDyne;
|
||||
newPlan.PlanStartDate = plan.PlanStartDate;
|
||||
newPlan.PlanEndDate = plan.PlanEndDate;
|
||||
newPlan.Days = plan.Days;
|
||||
newPlan.AvgDailyWorkload = plan.AvgDailyWorkload;
|
||||
try
|
||||
{
|
||||
db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict);
|
||||
}
|
||||
catch (System.Data.Linq.ChangeConflictException ex)
|
||||
{
|
||||
foreach (System.Data.Linq.ObjectChangeConflict occ in db.ChangeConflicts)
|
||||
{
|
||||
//以下是解决冲突的三种方法,选一种即可
|
||||
// 使用当前数据库中的值,覆盖Linq缓存中实体对象的值
|
||||
occ.Resolve(System.Data.Linq.RefreshMode.OverwriteCurrentValues);
|
||||
// 使用Linq缓存中实体对象的值,覆盖当前数据库中的值
|
||||
occ.Resolve(System.Data.Linq.RefreshMode.KeepCurrentValues);
|
||||
// 只更新实体对象中改变的字段的值,其他的保留不变
|
||||
occ.Resolve(System.Data.Linq.RefreshMode.KeepChanges);
|
||||
}
|
||||
// 这个地方要注意,Catch方法中,我们前面只是指明了怎样来解决冲突,这个地方还需要再次提交更新,这样的话,值 //才会提交到数据库。
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除排产计划
|
||||
/// </summary>
|
||||
/// <param name="productionSchedulingPlanId"></param>
|
||||
public static void DeleteProductionSchedulingPlanById(string productionSchedulingPlanId)
|
||||
{
|
||||
SGGLDB db = Funs.DB;
|
||||
Model.HJGL_ProductionSchedulingPlan plan = db.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId);
|
||||
if (plan != null)
|
||||
{
|
||||
db.HJGL_ProductionSchedulingPlan.DeleteOnSubmit(plan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -466,6 +466,8 @@ namespace BLL
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode));
|
||||
if (!string.IsNullOrEmpty(model.WeldJointCode))
|
||||
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode));
|
||||
//构建排序
|
||||
baseQuery = baseQuery.OrderBy(x => x.PipelineId).ThenBy(x => x.WeldJointCode);
|
||||
|
||||
return baseQuery.ToList();
|
||||
}
|
||||
@@ -503,7 +505,7 @@ namespace BLL
|
||||
baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains( model.WeldJointCode));
|
||||
|
||||
// 阶段三:排序与分页控制(索引优化关键)
|
||||
var orderedQuery = baseQuery.OrderBy(x => x.WeldJointCode);
|
||||
var orderedQuery = baseQuery.OrderBy(x=>x.PipelineId).ThenBy(x => x.WeldJointCode);
|
||||
|
||||
// 阶段四:分页执行(数据库层面分页)
|
||||
var pagedData = orderedQuery
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.SS.UserModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -11,7 +15,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static class CostManageService
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取安全费用管理
|
||||
@@ -29,12 +33,12 @@ namespace BLL
|
||||
/// <param name="ProjectId"></param>
|
||||
/// <param name="UnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static decimal GetSumHSECost(string ProjectId, string UnitId, string costManageId )
|
||||
public static decimal GetSumHSECost(string ProjectId, string UnitId, string costManageId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
decimal sumCost = 0;
|
||||
var getData = from x in db.CostGoods_CostManage
|
||||
var getData = from x in db.CostGoods_CostManage
|
||||
where x.ProjectId == ProjectId && x.UnitId == UnitId && x.States == Const.State_2 && x.CostManageId != costManageId
|
||||
select x;
|
||||
if (getData.Count() > 0)
|
||||
@@ -70,12 +74,12 @@ namespace BLL
|
||||
States = costManage.States,
|
||||
CompileMan = costManage.CompileMan,
|
||||
CompileDate = costManage.CompileDate,
|
||||
NextManId= costManage.NextManId,
|
||||
NextManId = costManage.NextManId,
|
||||
};
|
||||
|
||||
db.CostGoods_CostManage.InsertOnSubmit(newCostManage);
|
||||
db.SubmitChanges();
|
||||
|
||||
|
||||
AddCostManageFlowOperate(newCostManage);
|
||||
}
|
||||
|
||||
@@ -172,7 +176,7 @@ namespace BLL
|
||||
/// <param name="costManageId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.CostGoods_CostManageFlowOperate getNowCostManageFlowOperateList(string costManageId)
|
||||
{
|
||||
{
|
||||
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
|
||||
if (getAllNoClose.Count() > 0)
|
||||
{
|
||||
@@ -190,10 +194,10 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="costManageId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.CostGoods_CostManageFlowOperate getNextCostManageFlowOperateList(string costManageId,string operaterId)
|
||||
public static Model.CostGoods_CostManageFlowOperate getNextCostManageFlowOperateList(string costManageId, string operaterId)
|
||||
{
|
||||
int minSortIndex = 1;
|
||||
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
|
||||
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
|
||||
if (getAllNoClose.Count() > 0)
|
||||
{
|
||||
var getFlowOperate = getAllNoClose.Where(x => x.OperaterId == operaterId);
|
||||
@@ -210,7 +214,7 @@ namespace BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,10 +346,10 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDatas = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && x.IsClosed==true);
|
||||
foreach ( var item in getDatas)
|
||||
var getDatas = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && x.IsClosed == true);
|
||||
foreach (var item in getDatas)
|
||||
{
|
||||
item.IsClosed= false;
|
||||
item.IsClosed = false;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
@@ -367,5 +371,107 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 推送数据到HSE系统
|
||||
/// </summary>
|
||||
public static string PushDataToHSE(string projectId, string contractNum)
|
||||
{
|
||||
try
|
||||
{
|
||||
string message = "";
|
||||
// 查询当前合同所有审核通过的数据
|
||||
var costData = from x in Funs.DB.CostGoods_CostManage
|
||||
where x.ProjectId == projectId && x.ContractNum == contractNum && x.States == Const.State_2
|
||||
orderby x.CostManageDate descending
|
||||
select x;
|
||||
|
||||
if (costData.Any())
|
||||
{
|
||||
// 获取所有附件文件
|
||||
var files = new List<object>();
|
||||
decimal totalAmount = 0;
|
||||
|
||||
foreach (var item in costData)
|
||||
{
|
||||
var fileDetails = GetBase64FilesWithDetails(item.CostManageId);
|
||||
if (fileDetails != null && fileDetails.Count > 0)
|
||||
{
|
||||
files.AddRange(fileDetails);
|
||||
totalAmount += item.SumMoney ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 构建请求体
|
||||
var requestBody = new
|
||||
{
|
||||
projectId = projectId,
|
||||
contractNo = contractNum,
|
||||
amountHSE = totalAmount.ToString(),
|
||||
files = files
|
||||
};
|
||||
var jsonBody = JsonConvert.SerializeObject(requestBody);
|
||||
// 调用HSE接口推送数据
|
||||
// TODO: 实现实际的HSE接口调用逻辑
|
||||
var url="http://172.29.60.33:8080";
|
||||
var requestGetTokenUrl = url + "/api/Token/GetToken";
|
||||
string requestGetTokenBody = "{\r\n\r\n\"username\": \"coadmin\",\r\n\r\n\"password\": \"coadminPu@2025\"\r\n\r\n}";
|
||||
var response = Funs.RequestPost(requestGetTokenUrl, "", requestGetTokenBody);
|
||||
var responseStr = JsonConvert.DeserializeObject<JObject>(response);
|
||||
if (responseStr == null || responseStr["data"].ToString() != "200")
|
||||
{
|
||||
message = "获取Pu系统Token失败";
|
||||
|
||||
}
|
||||
string accessToken = responseStr["data"]["token"].ToString();
|
||||
var requestUrl = url + "/api/PuPayCraftAmount/AddPuPayCraftAmount";
|
||||
var responseHSE = Funs.RequestPost(requestUrl, accessToken, jsonBody);
|
||||
var responseHSEStr = JsonConvert.DeserializeObject<JObject>(responseHSE);
|
||||
if (responseHSEStr == null || responseHSEStr["data"].ToString()!= "200")
|
||||
{
|
||||
message = "推送数据到HSE系统失败";
|
||||
}
|
||||
}
|
||||
return message;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录错误日志
|
||||
ErrLogInfo.WriteLog(ex.Message, ex.StackTrace);
|
||||
return "推送数据失败"+ex.Message;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取Base64编码的附件文件
|
||||
/// </summary>
|
||||
public static List<object> GetBase64FilesWithDetails(string costManageId)
|
||||
{
|
||||
var result = new List<object>();
|
||||
// 获取费用管理信息
|
||||
var costManage = GetCostManageById(costManageId);
|
||||
// 获取附件文件
|
||||
var attachments = AttachFileService.getFileUrl(costManageId);
|
||||
|
||||
if (!string.IsNullOrEmpty(attachments))
|
||||
{
|
||||
string filePath=Funs.RootPath+attachments.Split(',')[0];
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
byte[] fileBytes = File.ReadAllBytes(filePath);
|
||||
string base64Content = Convert.ToBase64String(fileBytes);
|
||||
|
||||
result.Add(new Model.PuPayCraftAmountFileInput
|
||||
{
|
||||
name = file.Name,
|
||||
content = base64Content,
|
||||
thisamount = costManage?.SumMoney?.ToString() ?? "0",
|
||||
date = costManage?.CostManageDate?.ToString("yyyy-MM-dd") ?? DateTime.Now.ToString("yyyy-MM-dd")
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static class EnvironmentalCheckService
|
||||
{
|
||||
|
||||
#region 推送环境监测数据
|
||||
|
||||
/// <summary>
|
||||
@@ -20,8 +21,8 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static ReturnData PushEnvironmentalCheckData()
|
||||
{
|
||||
var db1 = Funs.DB;
|
||||
var items = (from x in db1.EnvironmentalCheck where x.IsPushed == false select x).ToList();
|
||||
var db = Funs.DB;
|
||||
var items = (from x in db.EnvironmentalCheck where x.IsPushed == false select x).ToList();
|
||||
Model.ReturnData responeData = new Model.ReturnData();
|
||||
if (items.Count() > 0)
|
||||
{
|
||||
@@ -34,11 +35,11 @@ namespace BLL
|
||||
{//推送成功后,修改数据状态
|
||||
foreach (var item in items)
|
||||
{
|
||||
Model.EnvironmentalCheck envModel = db1.EnvironmentalCheck.FirstOrDefault(e => e.Id == item.Id);
|
||||
Model.EnvironmentalCheck envModel = db.EnvironmentalCheck.FirstOrDefault(e => e.Id == item.Id);
|
||||
if (envModel != null)
|
||||
{
|
||||
envModel.IsPushed = true;
|
||||
db1.SubmitChanges();
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,22 @@ namespace BLL
|
||||
select y).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批完成的主合同
|
||||
/// </summary>
|
||||
/// <param name="ProjectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PHTGL_Contract> GetCompletedContracts(string ProjectId)
|
||||
{
|
||||
var q= from x in Funs.DB.PHTGL_Contract
|
||||
join y in Funs.DB.PHTGL_ContractReview on x.ContractId equals y.ContractId
|
||||
where
|
||||
y.State== Const.ContractReview_Complete &&
|
||||
x.ContractAttribute==0 &&
|
||||
x.ProjectId==ProjectId
|
||||
select x;
|
||||
return q.ToList();
|
||||
}
|
||||
public static void InitAllProjectCodeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "ProjectId";
|
||||
@@ -62,7 +76,14 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitCompletedContractsDropDownList(string projectId, FineUIPro.DropDownList dropName)
|
||||
{
|
||||
dropName.DataValueField = "ContractNum";
|
||||
dropName.DataTextField = "ContractNum";
|
||||
var CompletedContractslist = GetCompletedContracts(projectId);
|
||||
dropName.DataSource = CompletedContractslist;
|
||||
dropName.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加合同基本信息
|
||||
|
||||
Reference in New Issue
Block a user