重庆机具问题提交

This commit is contained in:
liang.chao 2024-04-20 10:42:49 +08:00
parent e4239f4955
commit 6207d42ee5
26 changed files with 542 additions and 113 deletions

View File

@ -153,7 +153,7 @@ public class LeaseOutDetails implements Serializable {
*/ */
@ApiModelProperty(value = "数据所属组织") @ApiModelProperty(value = "数据所属组织")
private Integer companyId; private Integer companyId;
@ApiModelProperty(value = "出库类型 0编码出库 1数量出库") @ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库")
private Integer manageType; private Integer manageType;
@ApiModelProperty(value = "数量出库-出库数量") @ApiModelProperty(value = "数量出库-出库数量")
private Integer inputNum; private Integer inputNum;

View File

@ -3,6 +3,9 @@ package com.bonus.sgzb.app.controller;
import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.service.*; import com.bonus.sgzb.app.service.*;
import com.bonus.sgzb.common.core.text.Convert;
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
import com.bonus.sgzb.common.core.utils.ServletUtils;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController; import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
@ -14,6 +17,9 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import static com.bonus.sgzb.common.core.constant.Constants.PAGE_NUM;
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
/** /**
* 退料接收-app * 退料接收-app
* *
@ -270,9 +276,10 @@ public class BackReceiveController extends BaseController {
@PostMapping("backReceiveRecordWeb") @PostMapping("backReceiveRecordWeb")
public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) { public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) {
try { try {
startPage();
List<BackApplyInfo> list = backReceiveService.backReceiveRecord(record); List<BackApplyInfo> list = backReceiveService.backReceiveRecord(record);
return AjaxResult.success(getDataTable(list)); Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -0,0 +1,38 @@
package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.app.service.HoldingLedgerService;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author梁超
* @date2024/4/19 - 17:43
* 综合查询
*/
@RestController
@RequestMapping("/composite")
public class CompositeQueryController extends BaseController {
@Resource
private HoldingLedgerService holdingLedgerService;
/**
* @param
* @return 抱杆台账查询
*/
@Log(title = "抱杆台账查询", businessType = BusinessType.UPDATE)
@GetMapping("/getHoldingLedger")
public AjaxResult getHoldingLedger() {
startPage();
return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger()));
}
}

View File

@ -56,6 +56,8 @@ public class BackApplyInfo {
*/ */
private String typeId; private String typeId;
private String modelId; private String modelId;
private List<MachinePart> maTypeDetails;
/** /**
* 类型名称 * 类型名称
*/ */
@ -113,6 +115,7 @@ public class BackApplyInfo {
* 机具管理方式 * 机具管理方式
*/ */
private String manageType; private String manageType;
private String type;
/** /**
* 合格数量 * 合格数量
*/ */
@ -180,4 +183,5 @@ public class BackApplyInfo {
private String startTime; private String startTime;
private String endTime; private String endTime;
private Integer flag; private Integer flag;
private Integer partNum;
} }

View File

@ -11,5 +11,8 @@ public class MachinePart {
private String typeModelName; private String typeModelName;
private String unitName; private String unitName;
private String typeName; private String typeName;
private String modelId;
private Integer parentId;
private Integer partNum; private Integer partNum;
private Integer num;
} }

View File

@ -41,6 +41,7 @@ public class TmTask implements Serializable {
*/ */
@ApiModelProperty(value = "任务类型(数据字典)") @ApiModelProperty(value = "任务类型(数据字典)")
private Integer taskType; private Integer taskType;
private List<TmTask> outboundType;
/** /**
* 任务状态(定义数据字典) * 任务状态(定义数据字典)

View File

@ -160,7 +160,7 @@ public interface BackReceiveMapper {
* @param record * @param record
* @return List<BackApplyInfo> * @return List<BackApplyInfo>
*/ */
List<BackApplyInfo> backReceiveRecord(BackApplyInfo record); BackApplyInfo backReceiveRecord(BackApplyInfo record);
/** /**
* 查询 * 查询

View File

@ -0,0 +1,20 @@
package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author梁超
* @date2024/4/19 - 17:51
*/
@Mapper
public interface HoldingLedgerMapper {
List<TmTask> getHoldingLedger();
List<TmTask> getHoldingLedgerDetail(TmTask tmTask);
MachinePart getMachineParts(TmTask typeId);
}

View File

@ -1,6 +1,8 @@
package com.bonus.sgzb.app.mapper; package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.base.api.domain.LeaseOutDetails; import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
import com.bonus.sgzb.base.api.domain.MaType; import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
@ -91,4 +93,10 @@ public interface LeaseOutDetailsMapper {
MaType selectByTypeId(@Param("record") LeaseOutDetails record); MaType selectByTypeId(@Param("record") LeaseOutDetails record);
LeaseApplyDetails getOutboundNum(LeaseOutDetails record); LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
List<TmTask> getMaTypeDetails(LeaseOutDetails record);
MachinePart getMachineParts(TmTask typeId);
int updateMaTypeStockNumCt(TmTask record);
} }

View File

@ -1,9 +1,6 @@
package com.bonus.sgzb.app.mapper; package com.bonus.sgzb.app.mapper;
import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.*;
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.base.domain.MaintenanceGang; import com.bonus.sgzb.base.domain.MaintenanceGang;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -119,4 +116,12 @@ public interface TmTaskMapper {
List<TmTask> getMaTypeDetails(LeaseApplyDetails leaseApplyDetails); List<TmTask> getMaTypeDetails(LeaseApplyDetails leaseApplyDetails);
MachinePart getMachineParts(TmTask typeId); MachinePart getMachineParts(TmTask typeId);
List<TmTask> getMaTypeDetailsByTypeId(BackApplyInfo backApplyInfo);
List<TmTask> getManageTypeByTypeId(TmTask tmTask);
int getCountMachine(BackApplyInfo record);
int getCountMachineByPidAndTid(MachinePart machinePart);
} }

View File

@ -0,0 +1,13 @@
package com.bonus.sgzb.app.service;
import com.bonus.sgzb.app.domain.TmTask;
import java.util.List;
/**
* @Author梁超
* @date2024/4/19 - 17:48
*/
public interface HoldingLedgerService{
List<TmTask> getHoldingLedger();
}

View File

@ -1,18 +1,22 @@
package com.bonus.sgzb.app.service.impl; package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.domain.BackApplyInfo; import com.bonus.sgzb.app.domain.BackApplyInfo;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.BackReceiveMapper; import com.bonus.sgzb.app.mapper.BackReceiveMapper;
import com.bonus.sgzb.app.mapper.TmTaskMapper;
import com.bonus.sgzb.app.service.BackReceiveService; import com.bonus.sgzb.app.service.BackReceiveService;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo; import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.GlobalConstants; import com.bonus.sgzb.common.core.utils.GlobalConstants;
import com.bonus.sgzb.common.core.utils.StringHelper; import com.bonus.sgzb.common.core.utils.StringHelper;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -28,6 +32,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Resource @Resource
private BackReceiveMapper backReceiveMapper; private BackReceiveMapper backReceiveMapper;
@Resource
private TmTaskMapper tmTaskMapper;
@Override @Override
public List<BackApplyInfo> getbackReceiveList(BackApplyInfo record) { public List<BackApplyInfo> getbackReceiveList(BackApplyInfo record) {
@ -36,7 +43,31 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override @Override
public List<BackApplyInfo> receiveView(BackApplyInfo record) { public List<BackApplyInfo> receiveView(BackApplyInfo record) {
return backReceiveMapper.receiveView(record); List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView(record);
int machinePartNum = 0;
for (BackApplyInfo backApplyInfo : backApplyInfoList) {
if ("2".equals(backApplyInfo.getManageType())) {
List<MachinePart> machineParts = new ArrayList<>();
List<TmTask> typeIds = tmTaskMapper.getMaTypeDetailsByTypeId(backApplyInfo);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
machinePart.setParentId(record.getId());
int countMachineByPidAndTid = tmTaskMapper.getCountMachineByPidAndTid(machinePart);
machinePartNum = typeId.getPartNum() * (int) Double.parseDouble(backApplyInfo.getPreNum());
machinePart.setPartNum(machinePartNum - countMachineByPidAndTid);
machineParts.add(machinePart);
}
backApplyInfo.setMaTypeDetails(machineParts);
int countMachine = tmTaskMapper.getCountMachine(record);
if (countMachine == machinePartNum) {
backApplyInfo.setPartNum(0);
} else {
backApplyInfo.setPartNum((int) Double.parseDouble(backApplyInfo.getPreNum()));
}
}
}
return backApplyInfoList;
} }
@Override @Override
@ -208,7 +239,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override @Override
public List<BackApplyInfo> backReceiveRecord(BackApplyInfo record) { public List<BackApplyInfo> backReceiveRecord(BackApplyInfo record) {
return backReceiveMapper.backReceiveRecord(record); String typeId = record.getTypeId();
String[] split = typeId.split(",");
List<BackApplyInfo> backApplyInfoList = new ArrayList<>();
for (String s : split) {
record.setTypeId(s);
BackApplyInfo backApplyInfo = backReceiveMapper.backReceiveRecord(record);
if (backApplyInfo != null) {
backApplyInfoList.add(backApplyInfo);
}
}
return backApplyInfoList;
} }
@Override @Override

View File

@ -0,0 +1,37 @@
package com.bonus.sgzb.app.service.impl;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.HoldingLedgerMapper;
import com.bonus.sgzb.app.service.HoldingLedgerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author梁超
* @date2024/4/19 - 17:48
*/
@Service
public class HoldingLedgerImpl implements HoldingLedgerService {
@Resource
private HoldingLedgerMapper holdingLedgerMapper;
@Override
public List<TmTask> getHoldingLedger() {
/*List<TmTask> holdingLedger = holdingLedgerMapper.getHoldingLedger();
for (TmTask tmTask : holdingLedger) {
List<TmTask> holdingLedgerDetail = holdingLedgerMapper.getHoldingLedgerDetail(tmTask);
holdingLedgerDetail.removeIf(item -> item == null);
for (TmTask typeId : holdingLedgerDetail) {
MachinePart machinePart = holdingLedgerMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum()));
machineParts.add(machinePart);
}
}*/
return null;
}
}

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.app.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.LeaseApplyDetails;
import com.bonus.sgzb.app.domain.MachinePart;
import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTask;
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper;
@ -147,11 +148,19 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
// 1判断是否重复提交 // 1判断是否重复提交
res = checkRepeatSubmit(record); res = checkRepeatSubmit(record);
if (res > 0) { if (res > 0) {
if (record.getManageType() == 1 && record.getInputNum() != null) { if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
record.setOutNum(record.getInputNum().doubleValue()); record.setOutNum(record.getInputNum().doubleValue());
} }
//2判断库存是否足够 //2判断库存是否足够
if (record.getManageType() == 2) {
res = checkStorageNumCt(record);
if (res == 0) {
throw new RuntimeException("出库失败,库存不足");
}
} else {
res = checkStorageNum(record); res = checkStorageNum(record);
}
if (res > 0) { if (res > 0) {
// 3插入出库记录修改库存修改机具状态 // 3插入出库记录修改库存修改机具状态
res = insertRecords(record); res = insertRecords(record);
@ -190,8 +199,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
// 插入领料出库明细表lease_out_details // 插入领料出库明细表lease_out_details
res = leaseOutDetailsMapper.insertSelective(record); res = leaseOutDetailsMapper.insertSelective(record);
if (res > 0) { if (res > 0) {
// 减少 (ma_type 设备规格表)的库存数量 if (record.getManageType() == 2){
// 成套机具减少 (ma_type 设备规格表)的库存数量
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum()));
typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
}
}else {
// 普通机具减少 (ma_type 设备规格表)的库存数量
res = leaseOutDetailsMapper.updateMaTypeStockNum(record); res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
}
// 更新 (ma_machine 设备表)的状态 // 更新 (ma_machine 设备表)的状态
leaseOutDetailsMapper.updateMaMachineStatus(record); leaseOutDetailsMapper.updateMaMachineStatus(record);
} }
@ -239,10 +260,32 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return 1; return 1;
} }
private int checkStorageNumCt(LeaseOutDetails record) {
double outNum = 0.1;
if (StringUtils.isNull(record)) {
return 0;
}
if (record.getOutNum() == null || record.getOutNum() < outNum) {
record.setOutNum(0.00);
}
//判断(ma_type 设备规格表)中的库存够不够出库的
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (typeId.getPartNum() * record.getOutNum()));
if (machinePart.getNum() < machinePart.getPartNum()) {
return 0;
}
}
return 1;
}
private int checkRepeatSubmit(LeaseOutDetails record) { private int checkRepeatSubmit(LeaseOutDetails record) {
String maStatus = "15"; String maStatus = "15";
int res = 0; int res = 0;
if (record.getManageType() == 1) { if (record.getManageType() == 1 || record.getManageType() == 2) {
// 如果是数量出库校验待出库数量 // 如果是数量出库校验待出库数量
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record); LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
if (details == null) { if (details == null) {

View File

@ -233,7 +233,15 @@ public class TmTaskServiceImpl implements TmTaskService {
*/ */
@Override @Override
public List<TmTask> getLeaseAuditListByOne(TmTask record) { public List<TmTask> getLeaseAuditListByOne(TmTask record) {
return tmTaskMapper.getLeaseDetailByParentId(record); List<TmTask> leaseDetailByParentId = tmTaskMapper.getLeaseDetailByParentId(record);
/* for (TmTask tmTask : leaseDetailByParentId) {
if ("2".equals(tmTask.getManageType())) {
List<TmTask> manageTypeByTypeId = tmTaskMapper.getManageTypeByTypeId(tmTask);
// 目前先默认成套只能数量出库或编码出库
tmTask.setOutboundType(manageTypeByTypeId);
}
}*/
return leaseDetailByParentId;
} }
/** /**
@ -546,8 +554,18 @@ public class TmTaskServiceImpl implements TmTaskService {
if (leaseApplyInfo != null) { if (leaseApplyInfo != null) {
// 去查询领料任务详情表 // 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo); List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) { if (leaseApplyDetails.size() > 0) {
// tmTaskMapper.getMaTypeDetails(leaseApplyDetails); for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
List<MachinePart> machineParts = new ArrayList<>();
List<TmTask> typeIds = tmTaskMapper.getMaTypeDetails(leaseApplyDetail);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum()));
machineParts.add(machinePart);
}
leaseApplyDetail.setMaTypeDetails(machineParts);
}
listLeaseDetails.addAll(leaseApplyDetails); listLeaseDetails.addAll(leaseApplyDetails);
} }
} }

View File

@ -667,7 +667,7 @@
mt2.type_name AS typeName, mt2.type_name AS typeName,
bad.pre_num as preNum, bad.pre_num as preNum,
bad.status as status, bad.status as status,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num, IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as partNum,
mt.manage_type as manageType, mt.manage_type as manageType,
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code` CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
FROM FROM
@ -797,9 +797,10 @@
SELECT SELECT
mt2.type_name AS typeName, mt2.type_name AS typeName,
mt1.type_name AS typeCode, mt1.type_name AS typeCode,
bcd.back_num as backNum, ifnull(sum( bcd.back_num ), 0) AS backNum,
mm.ma_code as maCode, mm.ma_code as maCode,
bcd.create_time AS backTime, bcd.create_time AS backTime,
bcd.type_id as modelId,
bcd.back_status AS backStatus bcd.back_status AS backStatus
FROM FROM
back_check_details bcd back_check_details bcd
@ -812,6 +813,8 @@
<if test="maCode != null and maCode != ''"> <if test="maCode != null and maCode != ''">
and mm.ma_code like concat('%', #{maCode}, '%') and mm.ma_code like concat('%', #{maCode}, '%')
</if> </if>
GROUP BY
bcd.type_id
ORDER BY ORDER BY
bcd.create_time DESC bcd.create_time DESC
</select> </select>

View File

@ -299,6 +299,14 @@
set num = #{num} set num = #{num}
where id = #{id} where id = #{id}
</update> </update>
<update id="updateMaTypeStockNumCt">
UPDATE
ma_type
SET
num = num - #{num} ,update_time = NOW()
WHERE
type_id = #{typeId}
</update>
<insert id="insertAgreementInfo"> <insert id="insertAgreementInfo">
insert into tm_task_agreement insert into tm_task_agreement
@ -390,4 +398,26 @@
FROM lease_apply_details FROM lease_apply_details
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0 WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
</select> </select>
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mws2.type_id AS typeId,
mws2.part_num AS partNum
FROM
ma_type mt1
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
WHERE
mt1.type_id = #{typeId}
</select>
<select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart">
SELECT
mt.type_name AS typeModelName,
mt.unit_name as unitName,
mt.num as num,
m2.type_name As typeName
FROM
ma_type mt
LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id
WHERE
mt.type_id = #{typeId}
</select>
</mapper> </mapper>

View File

@ -980,6 +980,7 @@
<select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart"> <select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart">
SELECT SELECT
mt.type_name AS typeModelName, mt.type_name AS typeModelName,
mt.type_id as modelId,
mt.unit_name as unitName, mt.unit_name as unitName,
m2.type_name As typeName m2.type_name As typeName
FROM FROM
@ -988,4 +989,48 @@
WHERE WHERE
mt.type_id = #{typeId} mt.type_id = #{typeId}
</select> </select>
<select id="getMaTypeDetailsByTypeId" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mws2.type_id AS typeId,
mws2.part_num AS partNum
FROM
ma_type mt1
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
WHERE
mt1.type_id = #{modelId}
</select>
<select id="getManageTypeByTypeId" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mt2.manage_type as manageType,
mws.type_id as typeId,
mt2.type_name as typeModelName,
mt3.type_name as typeName,
(lad.pre_num - ifnull(lad.al_num,0)) * mws.part_num as outNum,
ifnull(lad.al_num,0) * mws.part_num as alNum
FROM
ma_whole_set mws
LEFT JOIN lease_apply_details lad on lad.type_id = mws.parent_id
LEFT JOIN lease_apply_info lai on lad.parennt_id = lai.id
LEFT JOIN ma_type mt ON mt.type_id = mws.parent_id
LEFT JOIN ma_type mt2 on mws.type_id = mt2.type_id
LEFT JOIN ma_type mt3 on mt3.type_id = mt2.parent_id
WHERE
mt.type_id = #{typeId} and lad.parennt_id = #{parentId}
</select>
<select id="getCountMachine" resultType="java.lang.Integer">
SELECT
ifnull(sum( back_num ),0)
FROM
back_check_details
WHERE
parent_id = #{id}
</select>
<select id="getCountMachineByPidAndTid" resultType="java.lang.Integer">
SELECT
ifnull(sum( back_num ),0)
FROM
back_check_details
WHERE
parent_id = #{parentId} and type_id = #{modelId}
</select>
</mapper> </mapper>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.app.mapper.HoldingLedgerMapper">
<select id="getHoldingLedger" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mt.type_id as typeId,
mt.type_name as typeModelName,
mt2.type_name as typeName
FROM
ma_type mt
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
WHERE
mt.manage_type = 2
AND mt.LEVEL = 4
</select>
<select id="getHoldingLedgerDetail" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT
mws2.type_id AS typeId,
mws2.part_num AS partNum
FROM
ma_type mt1
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
WHERE
mt1.type_id = #{typeId}
</select>
<select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart">
SELECT
mt.type_name AS typeModelName,
mt.type_id as modelId,
mt.unit_name as unitName,
m2.type_name As typeName
FROM
ma_type mt
LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id
WHERE
mt.type_id = #{typeId}
</select>
</mapper>

View File

@ -31,6 +31,8 @@ public class BackApplyInfo extends BaseEntity {
private String badId; private String badId;
private String[] split; private String[] split;
private List<MachinePart> maTypeDetails;
/** /**
* 工程名称 * 工程名称
*/ */
@ -47,6 +49,7 @@ public class BackApplyInfo extends BaseEntity {
*/ */
@ApiModelProperty(value = "装备管理方式名称") @ApiModelProperty(value = "装备管理方式名称")
private String manageTypeName; private String manageTypeName;
private String manageType;
private int flag; private int flag;

View File

@ -0,0 +1,15 @@
package com.bonus.sgzb.material.domain;
import lombok.Data;
/**
* @Author梁超
* @date2024/4/17 - 9:04
*/
@Data
public class MachinePart {
private String typeModelName;
private String unitName;
private String typeName;
private Integer partNum;
}

View File

@ -12,13 +12,14 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* Description: 任务表tm_task * Description: 任务表tm_task
* @Author 阮世耀 *
* @Create 2023/12/13 15:14 * @Author 阮世耀
* @Version 1.0 * @Create 2023/12/13 15:14
*/ * @Version 1.0
*/
@ApiModel(description="任务表tm_task") @ApiModel(description = "任务表tm_task")
@Data @Data
public class TmTask implements Serializable { public class TmTask implements Serializable {
@ -29,202 +30,205 @@ public class TmTask implements Serializable {
/** /**
* 任务ID * 任务ID
*/ */
@ApiModelProperty(value="任务ID") @ApiModelProperty(value = "任务ID")
private Long taskId; private Long taskId;
/** /**
* 任务类型(定义数据字典) * 任务类型(定义数据字典)
*/ */
@ApiModelProperty(value="任务类型(数据字典)") @ApiModelProperty(value = "任务类型(数据字典)")
private Integer taskType; private Integer taskType;
/** /**
* 任务状态(定义数据字典) * 任务状态(定义数据字典)
*/ */
@ApiModelProperty(value="任务状态(数据字典)") @ApiModelProperty(value = "任务状态(数据字典)")
private Integer taskStatus; private Integer taskStatus;
/** /**
* 预领料合计数 * 预领料合计数
*/ */
@ApiModelProperty(value="预领料合计数") @ApiModelProperty(value = "预领料合计数")
private int preCountNum; private int preCountNum;
/** /**
* 编号 * 编号
*/ */
@ApiModelProperty(value="编号") @ApiModelProperty(value = "编号")
@Excel(name = "领料单号",sort = 1) @Excel(name = "领料单号", sort = 1)
private String code; private String code;
/** /**
* 创建者 * 创建者
*/ */
@ApiModelProperty(value="创建者") @ApiModelProperty(value = "创建者")
private String createBy; private String createBy;
/** /**
* 申请人手机号码 * 申请人手机号码
*/ */
@ApiModelProperty(value="手机号") @ApiModelProperty(value = "手机号")
private String phoneNumber; private String phoneNumber;
/** /**
* 部门名称 单位名称 * 部门名称 单位名称
*/ */
@ApiModelProperty(value="部门/单位名称") @ApiModelProperty(value = "部门/单位名称")
private String deptName; private String deptName;
/** /**
* 工程名称 * 工程名称
*/ */
@ApiModelProperty(value="工程名称") @ApiModelProperty(value = "工程名称")
@Excel(name = "领料工程",sort = 3) @Excel(name = "领料工程", sort = 3)
private String proName; private String proName;
/** /**
* 工程id * 工程id
*/ */
@ApiModelProperty(value="工程id") @ApiModelProperty(value = "工程id")
private int proId; private int proId;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value="创建时间") @ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
/** /**
* 更新者 * 更新者
*/ */
@ApiModelProperty(value="更新者") @ApiModelProperty(value = "更新者")
private String updateBy; private String updateBy;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty(value="更新时间") @ApiModelProperty(value = "更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
/** /**
* 备注 * 备注
*/ */
@ApiModelProperty(value="备注") @ApiModelProperty(value = "备注")
@Excel(name = "备注",sort = 11) @Excel(name = "备注", sort = 11)
private String remark; private String remark;
/** /**
* 数据所属组织 * 数据所属组织
*/ */
@ApiModelProperty(value="数据所属组织") @ApiModelProperty(value = "数据所属组织")
private Integer companyId; private Integer companyId;
/** /**
* 领料任务实体 * 领料任务实体
*/ */
@ApiModelProperty(value="领料任务实体") @ApiModelProperty(value = "领料任务实体")
private LeaseApplyInfo leaseApplyInfo; private LeaseApplyInfo leaseApplyInfo;
/** /**
* 领料任务实体集合 * 领料任务实体集合
*/ */
@ApiModelProperty(value="领料任务实体集合") @ApiModelProperty(value = "领料任务实体集合")
private List<LeaseApplyInfo> leaseApplyInfoList; private List<LeaseApplyInfo> leaseApplyInfoList;
/** /**
* 领料任务详情集合 * 领料任务详情集合
*/ */
@ApiModelProperty(value="领料任务详情集合") @ApiModelProperty(value = "领料任务详情集合")
private List<LeaseApplyDetails> leaseApplyDetails; private List<LeaseApplyDetails> leaseApplyDetails;
@ApiModelProperty(value="协议id") @ApiModelProperty(value = "协议id")
private Integer agreementId; private Integer agreementId;
@ApiModelProperty(value="退料人") @ApiModelProperty(value = "退料人")
private String backPerson; private String backPerson;
@ApiModelProperty(value="退料人联系电话") @ApiModelProperty(value = "退料人联系电话")
private String phone; private String phone;
@ApiModelProperty(value="退料申请时间") @ApiModelProperty(value = "退料申请时间")
private String backTime; private String backTime;
@ApiModelProperty(value="退料审核人 机具分公司审批人") @ApiModelProperty(value = "退料审核人 机具分公司审批人")
private String directAuditBy; private String directAuditBy;
@ApiModelProperty(value="退料审核时间 机具分公司审批时间") @ApiModelProperty(value = "退料审核时间 机具分公司审批时间")
private String directAuditTime; private String directAuditTime;
@ApiModelProperty(value="退料审核备注 机具分公司审批备注") @ApiModelProperty(value = "退料审核备注 机具分公司审批备注")
private String directAuditRemark; private String directAuditRemark;
@ApiModelProperty(value="往来单位id") @ApiModelProperty(value = "往来单位id")
private Long unitId; private Long unitId;
@ApiModelProperty(value="往来单位") @ApiModelProperty(value = "往来单位")
@Excel(name = "领料单位",sort = 2) @Excel(name = "领料单位", sort = 2)
private String unitName; private String unitName;
@ApiModelProperty(value="工程id") @ApiModelProperty(value = "工程id")
private Long projectId; private Long projectId;
@ApiModelProperty(value="关键字") @ApiModelProperty(value = "关键字")
private String keyWord; private String keyWord;
@ApiModelProperty(value="开始时间") @ApiModelProperty(value = "开始时间")
private String startTime; private String startTime;
@ApiModelProperty(value="结束时间") @ApiModelProperty(value = "结束时间")
private String endTime; private String endTime;
@ApiModelProperty(value="类型") @ApiModelProperty(value = "类型")
private Integer types; private Integer types;
@ApiModelProperty(value="协议编号") @ApiModelProperty(value = "协议编号")
@Excel(name = "协议号",sort = 4) @Excel(name = "协议号", sort = 4)
private String agreementCode; private String agreementCode;
@ApiModelProperty(value="领料人") @ApiModelProperty(value = "领料人")
@Excel(name = "领料人",sort = 5) @Excel(name = "领料人", sort = 5)
private String leasePerson; private String leasePerson;
@ApiModelProperty(value="领料人手机号") @ApiModelProperty(value = "领料人手机号")
@Excel(name = "联系电话",sort = 6) @Excel(name = "联系电话", sort = 6)
private String leasePhone; private String leasePhone;
@ApiModelProperty(value="申请人") @ApiModelProperty(value = "申请人")
@Excel(name = "申请人",sort = 7) @Excel(name = "申请人", sort = 7)
private String applyFor; private String applyFor;
@ApiModelProperty(value="任务状态") @ApiModelProperty(value = "任务状态")
@Excel(name = "任务状态",sort = 9) @Excel(name = "任务状态", sort = 9)
private String taskName; private String taskName;
@ApiModelProperty(value="审批状态id") @ApiModelProperty(value = "审批状态id")
private String examineStatusId; private String examineStatusId;
@ApiModelProperty(value="审批状态的备注") @ApiModelProperty(value = "审批状态的备注")
@Excel(name = "审批结果",sort = 10) @Excel(name = "审批结果", sort = 10)
private String examineStatus; private String examineStatus;
@ApiModelProperty(value="创建时间") @ApiModelProperty(value = "创建时间")
@Excel(name = "申请时间",sort = 8) @Excel(name = "申请时间", sort = 8)
private String createTimes; private String createTimes;
@ApiModelProperty(value="更新时间") @ApiModelProperty(value = "更新时间")
private String updateTimes; private String updateTimes;
@ApiModelProperty(value="公司审批人") @ApiModelProperty(value = "公司审批人")
private String companyAuditBy; private String companyAuditBy;
@ApiModelProperty(value="公司审批时间") @ApiModelProperty(value = "公司审批时间")
private String companyAuditTime; private String companyAuditTime;
@ApiModelProperty(value="公司审批备注") @ApiModelProperty(value = "公司审批备注")
private String companyAuditRemark; private String companyAuditRemark;
@ApiModelProperty(value="分管审批人") @ApiModelProperty(value = "分管审批人")
private String deptAuditBy; private String deptAuditBy;
@ApiModelProperty(value="分管审批时间") @ApiModelProperty(value = "分管审批时间")
private String deptAuditTime; private String deptAuditTime;
@ApiModelProperty(value="分管审批备注") @ApiModelProperty(value = "分管审批备注")
private String deptAuditRemark; private String deptAuditRemark;
private String partNum;
private String typeId;
} }

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.BackApplyInfo; import com.bonus.sgzb.material.domain.BackApplyInfo;
import com.bonus.sgzb.material.domain.MachinePart;
import com.bonus.sgzb.material.domain.TmTask; import com.bonus.sgzb.material.domain.TmTask;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -80,4 +81,8 @@ public interface TaskMapper {
int insertTmTaskByBackInfo(BackApplyInfo backApplyInfo); int insertTmTaskByBackInfo(BackApplyInfo backApplyInfo);
int insertAgreementByBackInfo(BackApplyInfo backApplyInfo); int insertAgreementByBackInfo(BackApplyInfo backApplyInfo);
List<TmTask> getMaTypeDetails(BackApplyInfo backApplyInfo);
MachinePart getMachineParts(TmTask typeId);
} }

View File

@ -6,6 +6,8 @@ import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.BackApplyInfo; import com.bonus.sgzb.material.domain.BackApplyInfo;
import com.bonus.sgzb.material.domain.MachinePart;
import com.bonus.sgzb.material.domain.TmTask;
import com.bonus.sgzb.material.domain.TypeTreeNode; import com.bonus.sgzb.material.domain.TypeTreeNode;
import com.bonus.sgzb.material.mapper.BackApplyMapper; import com.bonus.sgzb.material.mapper.BackApplyMapper;
import com.bonus.sgzb.material.mapper.TaskMapper; import com.bonus.sgzb.material.mapper.TaskMapper;
@ -136,13 +138,32 @@ public class BackApplyServiceImpl implements BackApplyService {
bean.setSplit(split); bean.setSplit(split);
if (companyId != null) { if (companyId != null) {
bean.setCompanyId(companyId.toString()); bean.setCompanyId(companyId.toString());
return backApplyMapper.getView(bean); List<BackApplyInfo> view = backApplyMapper.getView(bean);
return getMaTypeDetails(view);
} else { } else {
return backApplyMapper.getView(bean); List<BackApplyInfo> view = backApplyMapper.getView(bean);
return getMaTypeDetails(view);
} }
} }
private List<BackApplyInfo> getMaTypeDetails(List<BackApplyInfo> view) {
if (view.size() > 0) {
for (BackApplyInfo backApplyInfo : view) {
List<MachinePart> machineParts = new ArrayList<>();
List<TmTask> typeIds = tmTaskMapper.getMaTypeDetails(backApplyInfo);
typeIds.removeIf(item -> item == null);
for (TmTask typeId : typeIds) {
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
machinePart.setPartNum((int) (Double.parseDouble(typeId.getPartNum()) * Double.parseDouble(backApplyInfo.getPreNum())));
machineParts.add(machinePart);
}
backApplyInfo.setMaTypeDetails(machineParts);
}
}
return view;
}
@Override @Override
public List<BackApplyInfo> getViewByApply(BackApplyInfo bean) { public List<BackApplyInfo> getViewByApply(BackApplyInfo bean) {
List<BackApplyInfo> viewByApply = backApplyMapper.getViewByApply(bean); List<BackApplyInfo> viewByApply = backApplyMapper.getViewByApply(bean);

View File

@ -514,9 +514,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lot.lot_name AS lotName, lot.lot_name AS lotName,
unit.unit_name AS unitName, unit.unit_name AS unitName,
mt.type_name typeCode, mt.type_name typeCode,
mt.manage_type as manageType,
mt2.type_name AS typeName, mt2.type_name AS typeName,
bagi.agreement_code as agreementCode, bagi.agreement_code as agreementCode,
bad.pre_num AS preNum, bad.pre_num AS preNum,
bad.type_id as typeId,
bad.audit_num AS num bad.audit_num AS num
FROM FROM
back_apply_details bad back_apply_details bad
@ -819,10 +821,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select mt.manage_type AS manageType FROM ma_type mt WHERE mt.type_id = #{typeId} select mt.manage_type AS manageType FROM ma_type mt WHERE mt.type_id = #{typeId}
</select> </select>
<select id="getLeaseOutNum" resultType="java.lang.Integer"> <select id="getLeaseOutNum" resultType="java.lang.Integer">
SELECT sum(lod.out_num) FROM lease_out_details lod WHERE lod.type_id = #{typeId} SELECT IFNULL(sum(lod.out_num),0) FROM lease_out_details lod WHERE lod.type_id = #{typeId}
</select> </select>
<select id="getbackCheckNum" resultType="java.lang.Integer"> <select id="getbackCheckNum" resultType="java.lang.Integer">
SELECT sum(bcd.back_num) FROM back_check_details bcd WHERE bcd.type_id = #{typeId} SELECT IFNULL(sum(bcd.back_num),0) FROM back_check_details bcd WHERE bcd.type_id = #{typeId}
</select> </select>
</mapper> </mapper>

View File

@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="companyId" column="company_id" /> <result property="companyId" column="company_id" />
</resultMap> </resultMap>
<sql id="selectTmTaskVo"> <sql id="selectTmTaskVo">
select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id from tm_task select task_id, task_type, task_status, code, create_by, create_time, update_by, update_time, remark, company_id from tm_task
</sql> </sql>
@ -222,4 +223,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTaskNumByMonth" resultType="java.lang.Integer"> <select id="selectTaskNumByMonth" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType} select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select> </select>
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.material.domain.TmTask">
SELECT
mws2.type_id AS typeId,
mws2.part_num AS partNum
FROM
ma_type mt1
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
WHERE
mt1.type_id = #{typeId}
</select>
<select id="getMachineParts" resultType="com.bonus.sgzb.material.domain.MachinePart">
SELECT
mt.type_name AS typeModelName,
mt.unit_name as unitName,
m2.type_name As typeName
FROM
ma_type mt
LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id
WHERE
mt.type_id = #{typeId}
</select>
</mapper> </mapper>