重庆机具问题提交
This commit is contained in:
parent
e4239f4955
commit
6207d42ee5
|
|
@ -153,7 +153,7 @@ public class LeaseOutDetails implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Integer companyId;
|
||||
@ApiModelProperty(value = "出库类型 0编码出库 1数量出库")
|
||||
@ApiModelProperty(value = "出库类型 0编码出库 1数量出库 2成套出库")
|
||||
private Integer manageType;
|
||||
@ApiModelProperty(value = "数量出库-出库数量")
|
||||
private Integer inputNum;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.bonus.sgzb.app.controller;
|
|||
import com.bonus.sgzb.app.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
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.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -14,6 +17,9 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
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
|
||||
*
|
||||
|
|
@ -270,9 +276,10 @@ public class BackReceiveController extends BaseController {
|
|||
@PostMapping("backReceiveRecordWeb")
|
||||
public AjaxResult backReceiveRecordWeb(@RequestBody BackApplyInfo record) {
|
||||
try {
|
||||
startPage();
|
||||
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) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:梁超
|
||||
* @date:2024/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()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -56,6 +56,8 @@ public class BackApplyInfo {
|
|||
*/
|
||||
private String typeId;
|
||||
private String modelId;
|
||||
|
||||
private List<MachinePart> maTypeDetails;
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
|
|
@ -113,6 +115,7 @@ public class BackApplyInfo {
|
|||
* 机具管理方式
|
||||
*/
|
||||
private String manageType;
|
||||
private String type;
|
||||
/**
|
||||
* 合格数量
|
||||
*/
|
||||
|
|
@ -180,4 +183,5 @@ public class BackApplyInfo {
|
|||
private String startTime;
|
||||
private String endTime;
|
||||
private Integer flag;
|
||||
private Integer partNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,8 @@ public class MachinePart {
|
|||
private String typeModelName;
|
||||
private String unitName;
|
||||
private String typeName;
|
||||
private String modelId;
|
||||
private Integer parentId;
|
||||
private Integer partNum;
|
||||
private Integer num;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class TmTask implements Serializable {
|
|||
*/
|
||||
@ApiModelProperty(value = "任务类型(数据字典)")
|
||||
private Integer taskType;
|
||||
private List<TmTask> outboundType;
|
||||
|
||||
/**
|
||||
* 任务状态(定义数据字典)
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public interface BackReceiveMapper {
|
|||
* @param record
|
||||
* @return List<BackApplyInfo>
|
||||
*/
|
||||
List<BackApplyInfo> backReceiveRecord(BackApplyInfo record);
|
||||
BackApplyInfo backReceiveRecord(BackApplyInfo record);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
|
|
|
|||
|
|
@ -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:梁超
|
||||
* @date:2024/4/19 - 17:51
|
||||
*/
|
||||
@Mapper
|
||||
public interface HoldingLedgerMapper {
|
||||
List<TmTask> getHoldingLedger();
|
||||
|
||||
List<TmTask> getHoldingLedgerDetail(TmTask tmTask);
|
||||
|
||||
MachinePart getMachineParts(TmTask typeId);
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.sgzb.app.mapper;
|
||||
|
||||
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.MaType;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
|
|
@ -91,4 +93,10 @@ public interface LeaseOutDetailsMapper {
|
|||
MaType selectByTypeId(@Param("record") LeaseOutDetails record);
|
||||
|
||||
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
|
||||
|
||||
List<TmTask> getMaTypeDetails(LeaseOutDetails record);
|
||||
|
||||
MachinePart getMachineParts(TmTask typeId);
|
||||
|
||||
int updateMaTypeStockNumCt(TmTask record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.bonus.sgzb.app.mapper;
|
||||
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||
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.app.domain.*;
|
||||
import com.bonus.sgzb.base.domain.MaintenanceGang;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -119,4 +116,12 @@ public interface TmTaskMapper {
|
|||
List<TmTask> getMaTypeDetails(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
MachinePart getMachineParts(TmTask typeId);
|
||||
|
||||
List<TmTask> getMaTypeDetailsByTypeId(BackApplyInfo backApplyInfo);
|
||||
|
||||
List<TmTask> getManageTypeByTypeId(TmTask tmTask);
|
||||
|
||||
int getCountMachine(BackApplyInfo record);
|
||||
|
||||
int getCountMachineByPidAndTid(MachinePart machinePart);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.bonus.sgzb.app.service;
|
||||
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:梁超
|
||||
* @date:2024/4/19 - 17:48
|
||||
*/
|
||||
public interface HoldingLedgerService{
|
||||
List<TmTask> getHoldingLedger();
|
||||
}
|
||||
|
|
@ -1,18 +1,22 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
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.mapper.BackReceiveMapper;
|
||||
import com.bonus.sgzb.app.mapper.TmTaskMapper;
|
||||
import com.bonus.sgzb.app.service.BackReceiveService;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.GlobalConstants;
|
||||
import com.bonus.sgzb.common.core.utils.StringHelper;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -28,6 +32,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
@Resource
|
||||
private BackReceiveMapper backReceiveMapper;
|
||||
|
||||
@Resource
|
||||
private TmTaskMapper tmTaskMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<BackApplyInfo> getbackReceiveList(BackApplyInfo record) {
|
||||
|
|
@ -36,7 +43,31 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
@ -208,7 +239,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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:梁超
|
||||
* @date:2024/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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.app.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.mapper.LeaseApplyDetailsMapper;
|
||||
import com.bonus.sgzb.app.mapper.LeaseOutDetailsMapper;
|
||||
|
|
@ -147,11 +148,19 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
// 1、判断是否重复提交
|
||||
res = checkRepeatSubmit(record);
|
||||
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());
|
||||
}
|
||||
//2、判断库存是否足够
|
||||
if (record.getManageType() == 2) {
|
||||
res = checkStorageNumCt(record);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("出库失败,库存不足");
|
||||
}
|
||||
} else {
|
||||
res = checkStorageNum(record);
|
||||
}
|
||||
|
||||
if (res > 0) {
|
||||
// 3、插入出库记录,修改库存,修改机具状态
|
||||
res = insertRecords(record);
|
||||
|
|
@ -190,8 +199,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
// 插入领料出库明细表(lease_out_details)
|
||||
res = leaseOutDetailsMapper.insertSelective(record);
|
||||
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);
|
||||
}
|
||||
// 更新 (ma_machine 设备表)的状态
|
||||
leaseOutDetailsMapper.updateMaMachineStatus(record);
|
||||
}
|
||||
|
|
@ -239,10 +260,32 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
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) {
|
||||
String maStatus = "15";
|
||||
int res = 0;
|
||||
if (record.getManageType() == 1) {
|
||||
if (record.getManageType() == 1 || record.getManageType() == 2) {
|
||||
// 如果是数量出库校验待出库数量
|
||||
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
|
||||
if (details == null) {
|
||||
|
|
|
|||
|
|
@ -233,7 +233,15 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
*/
|
||||
@Override
|
||||
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) {
|
||||
// 去查询领料任务详情表
|
||||
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
|
||||
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
|
||||
// tmTaskMapper.getMaTypeDetails(leaseApplyDetails);
|
||||
if (leaseApplyDetails.size() > 0) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@
|
|||
mt2.type_name AS typeName,
|
||||
bad.pre_num as preNum,
|
||||
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,
|
||||
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
|
||||
FROM
|
||||
|
|
@ -797,9 +797,10 @@
|
|||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeCode,
|
||||
bcd.back_num as backNum,
|
||||
ifnull(sum( bcd.back_num ), 0) AS backNum,
|
||||
mm.ma_code as maCode,
|
||||
bcd.create_time AS backTime,
|
||||
bcd.type_id as modelId,
|
||||
bcd.back_status AS backStatus
|
||||
FROM
|
||||
back_check_details bcd
|
||||
|
|
@ -812,6 +813,8 @@
|
|||
<if test="maCode != null and maCode != ''">
|
||||
and mm.ma_code like concat('%', #{maCode}, '%')
|
||||
</if>
|
||||
GROUP BY
|
||||
bcd.type_id
|
||||
ORDER BY
|
||||
bcd.create_time DESC
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -299,6 +299,14 @@
|
|||
set num = #{num}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateMaTypeStockNumCt">
|
||||
UPDATE
|
||||
ma_type
|
||||
SET
|
||||
num = num - #{num} ,update_time = NOW()
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<insert id="insertAgreementInfo">
|
||||
insert into tm_task_agreement
|
||||
|
|
@ -390,4 +398,26 @@
|
|||
FROM lease_apply_details
|
||||
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
|
||||
</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>
|
||||
|
|
@ -980,6 +980,7 @@
|
|||
<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
|
||||
|
|
@ -988,4 +989,48 @@
|
|||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -31,6 +31,8 @@ public class BackApplyInfo extends BaseEntity {
|
|||
private String badId;
|
||||
private String[] split;
|
||||
|
||||
private List<MachinePart> maTypeDetails;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
|
|
@ -47,6 +49,7 @@ public class BackApplyInfo extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "装备管理方式名称")
|
||||
private String manageTypeName;
|
||||
private String manageType;
|
||||
|
||||
private int flag;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:梁超
|
||||
* @date:2024/4/17 - 9:04
|
||||
*/
|
||||
@Data
|
||||
public class MachinePart {
|
||||
private String typeModelName;
|
||||
private String unitName;
|
||||
private String typeName;
|
||||
private Integer partNum;
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* Description: 任务表tm_task
|
||||
*
|
||||
* @Author 阮世耀
|
||||
* @Create 2023/12/13 15:14
|
||||
* @Version 1.0
|
||||
|
|
@ -227,4 +228,7 @@ public class TmTask implements Serializable {
|
|||
@ApiModelProperty(value = "分管审批备注")
|
||||
private String deptAuditRemark;
|
||||
|
||||
private String partNum;
|
||||
private String typeId;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.sgzb.material.mapper;
|
|||
|
||||
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.domain.MachinePart;
|
||||
import com.bonus.sgzb.material.domain.TmTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -80,4 +81,8 @@ public interface TaskMapper {
|
|||
int insertTmTaskByBackInfo(BackApplyInfo backApplyInfo);
|
||||
|
||||
int insertAgreementByBackInfo(BackApplyInfo backApplyInfo);
|
||||
|
||||
List<TmTask> getMaTypeDetails(BackApplyInfo backApplyInfo);
|
||||
|
||||
MachinePart getMachineParts(TmTask typeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.security.utils.SecurityUtils;
|
||||
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.mapper.BackApplyMapper;
|
||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||
|
|
@ -136,13 +138,32 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
bean.setSplit(split);
|
||||
if (companyId != null) {
|
||||
bean.setCompanyId(companyId.toString());
|
||||
return backApplyMapper.getView(bean);
|
||||
List<BackApplyInfo> view = backApplyMapper.getView(bean);
|
||||
return getMaTypeDetails(view);
|
||||
} 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
|
||||
public List<BackApplyInfo> getViewByApply(BackApplyInfo bean) {
|
||||
List<BackApplyInfo> viewByApply = backApplyMapper.getViewByApply(bean);
|
||||
|
|
|
|||
|
|
@ -514,9 +514,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lot.lot_name AS lotName,
|
||||
unit.unit_name AS unitName,
|
||||
mt.type_name typeCode,
|
||||
mt.manage_type as manageType,
|
||||
mt2.type_name AS typeName,
|
||||
bagi.agreement_code as agreementCode,
|
||||
bad.pre_num AS preNum,
|
||||
bad.type_id as typeId,
|
||||
bad.audit_num AS num
|
||||
FROM
|
||||
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>
|
||||
<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 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>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="companyId" column="company_id" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<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
|
||||
</sql>
|
||||
|
|
@ -222,4 +223,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<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>
|
||||
<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>
|
||||
Loading…
Reference in New Issue