功能新增

This commit is contained in:
hongchao 2025-03-28 18:24:38 +08:00
parent 184de4ced1
commit a23effb2ca
8 changed files with 144 additions and 202 deletions

View File

@ -22,6 +22,8 @@ public class SltAgreementApply {
*协议id
*/
private String agreementId;
private List<String> agreementIds;
/**
* 项目名称
*/

View File

@ -205,7 +205,7 @@ public class PoiOutPage {
return workbook;
}
public static HSSFWorkbook excelForcheckTwo(List<Map<String, Object>> result, List<String> list, String filename, String projectName, String unit, BigDecimal totalCost) {
public static HSSFWorkbook excelForcheckTwo(List<Map<String, Object>> result, List<String> list, String filename, String projectName, String unit, BigDecimal totalCost,int type) {
// 创建工作簿和工作表
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
@ -223,7 +223,7 @@ public class PoiOutPage {
// 填充标题行
int rowNum = 0;
rowNum = createTitleRowStyle(sheet, rowNum, filename, titleStyle, list.size());
rowNum = createProjectAndUnitRow(sheet, rowNum, projectName, unit, titleStyle, list.size());
rowNum = createProjectAndUnitRow(sheet, rowNum, projectName, unit, titleStyle, list.size(),type);
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, list, headerStyle);
@ -283,7 +283,7 @@ public class PoiOutPage {
// 填充标题行
int rowNum = 0;
rowNum = createTitleRowStyle(sheet, rowNum, filename, titleStyle, listLease.size());
rowNum = createProjectAndUnitRow(sheet, rowNum, projectName, unit, titleStyle, listLease.size());
rowNum = createProjectAndUnitRow(sheet, rowNum, projectName, unit, titleStyle, listLease.size(),1);
/**
* 租赁费用明细
@ -905,7 +905,7 @@ public class PoiOutPage {
/**
* 创建结算单位和结算工程行
*/
private static int createProjectAndUnitRow(HSSFSheet sheet, int rowNum, String projectName, String unitName,HSSFCellStyle titleStyle, int nColumn) {
private static int createProjectAndUnitRow(HSSFSheet sheet, int rowNum, String projectName, String unitName,HSSFCellStyle titleStyle, int nColumn,int type) {
// 第一行结算单位
HSSFRow row1 = sheet.createRow(rowNum++);
row1.setHeightInPoints(30);
@ -949,7 +949,12 @@ public class PoiOutPage {
redStyle.setFont(font);
cell6.setCellStyle(redStyle); // 应用红色字体样式
if(type==1){
cell6.setCellValue("01");
}else{
cell6.setCellValue("03");
}
// 添加边框
CellRangeAddress cellRange1 = new CellRangeAddress(rowNum - 2, rowNum - 2, 0, 1);

View File

@ -125,7 +125,7 @@ public class RepairAuditDetailsController extends BaseController {
* 修饰任务审核
*/
@ApiOperation("修饰任务审核")
@Log(title = "修饰任务审核", businessType = BusinessType.UPDATE)
@Log(title = "修饰任务审核", businessType = BusinessType.MATERIAL)
@PostMapping("/audit")
public AjaxResult audit(@RequestBody ScrapAudit scrapAudit) throws Exception {
return toAjax(repairAuditDetailsService.auditRepair(scrapAudit));

View File

@ -203,7 +203,7 @@ public class SltAgreementInfoController extends BaseController {
results.add(maps);
}
List<String> headers = receiveDetailsHeader(type,0);
HSSFWorkbook workbook = PoiOutPage.excelForcheckTwo(results, headers, filename,projectName,unitName,totalCost);
HSSFWorkbook workbook = PoiOutPage.excelForcheckTwo(results, headers, filename,projectName,unitName,totalCost,type);
OutputStream out = null;
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.addHeader("Content-Disposition",
@ -241,7 +241,6 @@ public class SltAgreementInfoController extends BaseController {
if(type==1){
// maps.put("unitName", bean.getUnitName());
// maps.put("projectName", bean.getProjectName());
if (flag==0){
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
maps.put("nuitName", bean.getNuitName());
@ -257,88 +256,22 @@ public class SltAgreementInfoController extends BaseController {
maps.put("monthCosts", bean.getRealCosts());
maps.put("nowCosts", bean.getRealCosts());
maps.put("remark", bean.getRemark());
}else {
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("leasePrice", bean.getLeasePrice());
// maps.put("num", bean.getNum());
// maps.put("startTime", bean.getStartTime()==null ? null:dateFormat.format(bean.getStartTime()));
// maps.put("endTime", bean.getEndTime()==null ? null:dateFormat.format(bean.getEndTime()));
// maps.put("leaseDays", bean.getLeaseDays());
// maps.put("costs", bean.getCosts().setScale(2, RoundingMode.HALF_UP));
// maps.put("t1", "");
}
}else if(type==2) {
// if(flag==0){
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("costs", bean.getCosts());
// }else{
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("costs", bean.getCosts());
// maps.put("t1", "");
// maps.put("t2", "");
// maps.put("t3", "");
// maps.put("t4", "");
// maps.put("t5", "");
// }
}else if(type==3) {
// if(flag==0){
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("partType", bean.getPartType());
// maps.put("costs", bean.getCosts());
// }else{
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("partType", bean.getPartType());
// maps.put("costs", bean.getCosts());
// maps.put("t1", "");
// maps.put("t2", "");
// maps.put("t3", "");
// maps.put("t4", "");
// }
}else if(type==4){
// if(flag==0){
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("partType", bean.getPartType());
// maps.put("costs", bean.getCosts());
// }else{
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getMtUnitName());
// maps.put("num", bean.getNum());
// maps.put("partType", bean.getPartType());
// maps.put("costs", bean.getCosts());
// maps.put("t1", "");
// maps.put("t2", "");
// maps.put("t3", "");
// maps.put("t4", "");
// }
} else if(type==5){
// maps.put("typeName", bean.getTypeName());
// maps.put("modelName", bean.getModelName());
// maps.put("mtUnitName", bean.getUnitName());
// maps.put("leasePrice", bean.getLeasePrice());
// maps.put("num", bean.getReduceNum());
// maps.put("startTime", bean.getStartTime()==null ? null:dateFormat.format(bean.getStartTime()));
// maps.put("endTime", bean.getEndTime()==null ? null:dateFormat.format(bean.getEndTime()));
// maps.put("leaseDays", bean.getDays());
// maps.put("remark", bean.getRemark());
// maps.put("costs", bean.getLeaseMoney().setScale(2, RoundingMode.HALF_UP));
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
maps.put("nuitName", bean.getNuitName());
maps.put("num", bean.getNum());
maps.put("leasePrice", bean.getLeasePrice());
maps.put("startTime", bean.getStartTime());
maps.put("endTime", bean.getEndTime());
maps.put("leaseDays", bean.getLeaseDays());
maps.put("costs", bean.getCosts().setScale(2, RoundingMode.HALF_UP));
maps.put("trimDay", bean.getTrimDay());
maps.put("realDays", bean.getRealDays());
maps.put("realCosts", bean.getRealCosts());
maps.put("monthCosts", bean.getRealCosts());
maps.put("nowCosts", bean.getRealCosts());
maps.put("remark", bean.getRemark());
}
return maps;
}
@ -381,77 +314,23 @@ public class SltAgreementInfoController extends BaseController {
list.add("租赁费用(元)");
list.add(" ");
}
}else if(type==2){
if(flag==0){
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("丢失数量");
list.add("丢失费用(元)");
}else{
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("丢失数量");
list.add("丢失费用(元)");
list.add(" ");
list.add(" ");
list.add(" ");
list.add(" ");
list.add(" ");
}
}else if(type==3){
if(flag==0){
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("维修数量");
list.add("是否收费");
list.add("维修费用(元)");
}else{
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("维修数量");
list.add("是否收费");
list.add("维修费用(元)");
list.add("");
list.add("");
list.add("");
list.add(" ");
}
}else if(type==4){
if(flag==0){
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("报废数量");
list.add("是否收费");
list.add("报废费用(元)");
}else{
list.add("设备名称");
list.add("规格型号");
list.add("计量单位");
list.add("报废数量");
list.add("是否收费");
list.add("报废费用(元)");
list.add("");
list.add("");
list.add("");
list.add(" ");
}
}else if (type==5){
list.add("设备名称");
list.add("规格型号");
list.add("单位");
list.add("租赁单价");
list.add("减免数量");
list.add("减免开始日期");
list.add("减免结束日期");
list.add("减免天数");
list.add("减免原因");
list.add("减免费用(元)");
list.add("数量");
list.add("台班费单价(元/天)");
list.add("起租日期");
list.add("终止日期");
list.add("应结算天数");
list.add("应结算金额(元)");
list.add("调整天数");
list.add("实际结算天数");
list.add("实际结算金额(元)");
list.add("月结已入账金额(元)");
list.add("本次结算金额(元)");
list.add("备注");
}
return list;
}
@ -462,9 +341,27 @@ public class SltAgreementInfoController extends BaseController {
@Log(title = "租赁明细导出", businessType = BusinessType.EXPORT)
@PostMapping("/exportLeaseThree")
@RequiresPermissions("ndertake:export_2")
public void exportLeaseThree(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
public void exportLeaseThree(HttpServletResponse response, @RequestBody List<AgreementInfo> list) throws Exception {
List<String> projectNames = new ArrayList<>();
List<String> unitNames = new ArrayList<>();
String fileName = "重庆市送变电工程有限公司设备租赁结算单";
//设置单位和工程名称
for (AgreementInfo info : list) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
}
List<SltAgreementInfo> explist = sltAgreementInfoService.getLeaseListThree(list);
String projectName = handleData(projectNames);
String unitName = handleData(unitNames);
BigDecimal totalCost = BigDecimal.valueOf(0.00);
for (SltAgreementInfo sltAgreementInfo : explist) {
totalCost = totalCost.add(sltAgreementInfo.getRealCosts());
}
List<LeaseInfo> leaseInfoList = Convert.toList(LeaseInfo.class, explist);
expOutExcel(response,leaseInfoList,fileName,projectName,unitName,totalCost,3);
ExcelUtil<LeaseInfo> util = new ExcelUtil<LeaseInfo>(LeaseInfo.class);
util.exportExcel(response, leaseInfoList, "租赁明细导出");
}

View File

@ -158,4 +158,9 @@ public interface RepairAuditDetailsMapper
List<RepairContent> getRepairContent(ScrapApplyDetailsVO scrapApplyDetailsVO);
List<FileInfo> getfileList(RepairAuditDetails auditDetails);
int updateRepairInBound(RepairAuditDetails bean);
int addStorageNum(RepairAuditDetails bean);
}

View File

@ -208,6 +208,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
public int auditRepair(ScrapAudit scrapAudit) throws Exception {
String checkResult = scrapAudit.getCheckResult();
List<RepairAuditDetails> auditDetailList = scrapAudit.getAuditDetailList();
if(auditDetailList!=null){
for (RepairAuditDetails repairAuditDetails : auditDetailList) {
// 添加附件
List<FileInfo> fileList = repairAuditDetails.getFileList();
@ -224,6 +225,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
}
}
}
}
List<Long> taskIdList = scrapAudit.getTaskIdList();
Integer b = 0;
for (Long taskId : taskIdList) {
@ -262,42 +264,56 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
scrapNumList = repairAuditDetailsMapper.selectScrapNumByTaskId(taskId);
}
if (repairInputList != null && repairInputList.size() > 0) {
if (repairInputList.get(0).getCompanyId() != null) {
companyId = repairInputList.get(0).getCompanyId();
//遍历repairInputList 数量/编码
for (RepairAuditDetails repairAuditDetails : repairInputList) {
//判断是否包含编号 1.包含 修改状态为在库 15 2.不包含
if (repairAuditDetails.getMaId()!=null) {
repairAuditDetailsMapper.updateRepairInBound(repairAuditDetails);
}
// 增加库存
int numTemp = repairAuditDetailsMapper.addStorageNum(repairAuditDetails);
if(numTemp==0){
throw new Exception("修改库存数量失败");
}
}
taskCode = purchaseCodeRule("R", 50);
taskStatus = 53;
taskType = 50;
long inputTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
for (RepairAuditDetails inputDetails : repairInputList) {
Integer repairNum = inputDetails.getRepairedNum();
// 创建修饰后入库任务
if (repairNum.compareTo(b) > 0) {
// 添加修试后入库任务
RepairInputDetails repairInputDetails = new RepairInputDetails();
repairInputDetails.setTaskId(inputTaskId);
repairInputDetails.setAuditId(inputDetails.getId());
repairInputDetails.setRepairId(inputDetails.getRepairId());
repairInputDetails.setRepairNum(inputDetails.getRepairedNum());
repairInputDetails.setTypeId(inputDetails.getTypeId());
repairInputDetails.setMaId(inputDetails.getMaId());
repairInputDetails.setStatus("0");
repairInputDetails.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
repairInputDetails.setCreateTime(new Date());
repairInputDetails.setCompanyId((long) companyId);
repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
}
repairAuditDetailsMapper.updateRepairCost(inputDetails, status);
// 根据repairId找到taskId和 typeId maid
List<String> repairApplyRecordId = repairAuditDetailsMapper.getRepairApplyRecordId(inputDetails.getRepairId());
// 再去repair_apply_record 中查并给一个标识表示审核完成
for (String id : repairApplyRecordId) {
repairAuditDetailsMapper.updateRecodeStatus(id);
}
}
}
// if (repairInputList != null && repairInputList.size() > 0) {
// if (repairInputList.get(0).getCompanyId() != null) {
// companyId = repairInputList.get(0).getCompanyId();
// }
//
// taskCode = purchaseCodeRule("R", 50);
// taskStatus = 53;
// taskType = 50;
// long inputTaskId = genTask(taskCode, taskType, taskStatus, tmTaskAgreement, companyId);
// for (RepairAuditDetails inputDetails : repairInputList) {
// Integer repairNum = inputDetails.getRepairedNum();
// // 创建修饰后入库任务
// if (repairNum.compareTo(b) > 0) {
// // 添加修试后入库任务
// RepairInputDetails repairInputDetails = new RepairInputDetails();
// repairInputDetails.setTaskId(inputTaskId);
// repairInputDetails.setAuditId(inputDetails.getId());
// repairInputDetails.setRepairId(inputDetails.getRepairId());
// repairInputDetails.setRepairNum(inputDetails.getRepairedNum());
// repairInputDetails.setTypeId(inputDetails.getTypeId());
// repairInputDetails.setMaId(inputDetails.getMaId());
// repairInputDetails.setStatus("0");
// repairInputDetails.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
// repairInputDetails.setCreateTime(new Date());
// repairInputDetails.setCompanyId((long) companyId);
// repairTestInputMapper.insertRepairInputDetails(repairInputDetails);
// }
// repairAuditDetailsMapper.updateRepairCost(inputDetails, status);
// // 根据repairId找到taskId和 typeId maid
// List<String> repairApplyRecordId = repairAuditDetailsMapper.getRepairApplyRecordId(inputDetails.getRepairId());
// // 再去repair_apply_record 中查并给一个标识表示审核完成
// for (String id : repairApplyRecordId) {
// repairAuditDetailsMapper.updateRecodeStatus(id);
// }
// }
// }
if (scrapNumList != null && scrapNumList.size() > 0) {
if (scrapNumList.get(0).getCompanyId() != null) {
companyId = scrapNumList.get(0).getCompanyId();

View File

@ -43,4 +43,8 @@ public class ScrapAudit {
@ApiModelProperty(value = "处置情况")
private Integer disposition;
/** 操作前库存 */
private int preStoreNum;
/** 操作后库存 */
private int postStoreNum;
}

View File

@ -539,4 +539,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<update id="updateRepairInBound">
update ma_machine
set ma_status = 15
where ma_id = #{maId}
</update>
<update id="addStorageNum">
update
ma_type
set
num = (ifnull(num,0)) + #{repairedNum}
where type_id = #{typeId}
</update>
</mapper>