增加 出库出库单、出库备注、结算备注
This commit is contained in:
parent
27882f8aa5
commit
889168e79d
|
|
@ -210,6 +210,7 @@ public class SltAgreementInfo {
|
||||||
* 委外维修费用
|
* 委外维修费用
|
||||||
*/
|
*/
|
||||||
private String outSourceCosts;
|
private String outSourceCosts;
|
||||||
|
private String remark;
|
||||||
private String beginTime;
|
private String beginTime;
|
||||||
private String offTime;
|
private String offTime;
|
||||||
private String partModelName;
|
private String partModelName;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.bonus.sgzb.common.log.annotation.Log;
|
||||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit;
|
import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -112,6 +113,7 @@ public class LeaseOutDetailsController extends BaseController {
|
||||||
public TableDataInfo getMaMachineByRfidCode(@RequestParam(value = "rfidCode") String rfidCode) {
|
public TableDataInfo getMaMachineByRfidCode(@RequestParam(value = "rfidCode") String rfidCode) {
|
||||||
return getDataTable(leaseOutDetailsService.getMaMachineByRfidCode(rfidCode));
|
return getDataTable(leaseOutDetailsService.getMaMachineByRfidCode(rfidCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码出库列表(web)
|
* 编码出库列表(web)
|
||||||
*
|
*
|
||||||
|
|
@ -146,13 +148,26 @@ public class LeaseOutDetailsController extends BaseController {
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@PostMapping("/submitOutRfid")
|
@PostMapping("/submitOutRfid")
|
||||||
public AjaxResult submitOutRfid(@RequestBody List<LeaseOutDetails> recordList) {
|
public AjaxResult submitOutRfid(@RequestBody List<LeaseOutDetails> recordList) {
|
||||||
if (CollUtil.isEmpty(recordList)){
|
if (CollUtil.isEmpty(recordList)) {
|
||||||
return AjaxResult.error("请选择要出库的机具");
|
return AjaxResult.error("请选择要出库的机具");
|
||||||
}else {
|
} else {
|
||||||
return leaseOutDetailsService.submitOutRfid(recordList);
|
return leaseOutDetailsService.submitOutRfid(recordList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parentId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "领料出库(出库单)")
|
||||||
|
@GetMapping("/getLeaseOutOrder")
|
||||||
|
public AjaxResult getLeaseOutOrder(String parentId, String typeId) {
|
||||||
|
if (StringUtils.isBlank(parentId) || StringUtils.isBlank(typeId)) {
|
||||||
|
return AjaxResult.error("参数错误");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.success(leaseOutDetailsService.getLeaseOutOrder(parentId, typeId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 综合查询--领用记录查询
|
* 综合查询--领用记录查询
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,17 @@ public class LeaseOutDetailRecord {
|
||||||
|
|
||||||
@Excel(name = "出库人")
|
@Excel(name = "出库人")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
//工程名
|
||||||
|
private String lotName;
|
||||||
|
//单位名
|
||||||
|
private String unitName;
|
||||||
|
//领料单号
|
||||||
|
private String code;
|
||||||
|
//备注
|
||||||
|
private String remark;
|
||||||
|
// 出库时间
|
||||||
|
private String updateTime;
|
||||||
|
// 出库方式
|
||||||
|
private String manageTypeName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@ public class TmTask implements Serializable {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "领料任务详情集合")
|
@ApiModelProperty(value = "领料任务详情集合")
|
||||||
private List<LeaseApplyDetails> leaseApplyDetails;
|
private List<LeaseApplyDetails> leaseApplyDetails;
|
||||||
|
private List<LeaseOutDetailRecord> leaseOutDetailRecord;
|
||||||
|
|
||||||
@ApiModelProperty(value = "协议id")
|
@ApiModelProperty(value = "协议id")
|
||||||
private Integer agreementId;
|
private Integer agreementId;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
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.LeaseOutDetailRecord;
|
||||||
import com.bonus.sgzb.app.domain.TmTask;
|
import com.bonus.sgzb.app.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;
|
||||||
|
|
@ -49,4 +50,8 @@ public interface LeaseApplyDetailsMapper {
|
||||||
List<LeaseApplyDetails> getByParentId(Integer parentId);
|
List<LeaseApplyDetails> getByParentId(Integer parentId);
|
||||||
|
|
||||||
List<TmTask> getDetailsByApplyId(TmTask typeId);
|
List<TmTask> getDetailsByApplyId(TmTask typeId);
|
||||||
|
|
||||||
|
TmTask getOrderHead(String parentId);
|
||||||
|
|
||||||
|
List<LeaseOutDetailRecord> getOrderBody(@Param("parentId") String parentId,@Param("typeId") String typeId);
|
||||||
}
|
}
|
||||||
|
|
@ -77,4 +77,6 @@ public interface LeaseOutDetailsService {
|
||||||
AjaxResult submitOutRfid(List<LeaseOutDetails> recordList);
|
AjaxResult submitOutRfid(List<LeaseOutDetails> recordList);
|
||||||
|
|
||||||
List<TmTask> getDetailsByApplyId(TmTask id);
|
List<TmTask> getDetailsByApplyId(TmTask id);
|
||||||
|
|
||||||
|
TmTask getLeaseOutOrder(String parentId,String typeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.app.service.impl;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||||
|
import com.bonus.sgzb.app.domain.LeaseOutDetailRecord;
|
||||||
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;
|
||||||
|
|
@ -141,6 +142,14 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
return leaseApplyDetailsMapper.getDetailsByApplyId(typeId);
|
return leaseApplyDetailsMapper.getDetailsByApplyId(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TmTask getLeaseOutOrder(String parentId,String typeId) {
|
||||||
|
TmTask orderHead = leaseApplyDetailsMapper.getOrderHead(parentId);
|
||||||
|
List<LeaseOutDetailRecord> list = leaseApplyDetailsMapper.getOrderBody(parentId,typeId);
|
||||||
|
orderHead.setLeaseOutDetailRecord(list);
|
||||||
|
return orderHead;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料出库处理
|
* 领料出库处理
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,11 @@ public class StorageStatus {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "数据所属组织")
|
@ApiModelProperty(value = "数据所属组织")
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
/**
|
||||||
|
* 设备所属类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "待出库数量")
|
||||||
|
private Integer preOutNum;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,50 @@
|
||||||
AND mm.ma_code like concat('%', #{maCode}, '%')
|
AND mm.ma_code like concat('%', #{maCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getOrderHead" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||||
|
SELECT
|
||||||
|
bpl.lot_name proName,
|
||||||
|
bui.unit_name,
|
||||||
|
tt.`code`,
|
||||||
|
tt.update_time
|
||||||
|
FROM
|
||||||
|
lease_apply_info lai
|
||||||
|
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = lai.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
|
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
|
WHERE
|
||||||
|
lai.id = #{parentId}
|
||||||
|
</select>
|
||||||
|
<select id="getOrderBody" resultType="com.bonus.sgzb.app.domain.LeaseOutDetailRecord">
|
||||||
|
SELECT
|
||||||
|
bpl.lot_name,
|
||||||
|
bui.unit_name,
|
||||||
|
lod.create_time,
|
||||||
|
tt.`code`,
|
||||||
|
tt.update_time,
|
||||||
|
mt.type_name typeModelName,
|
||||||
|
mt.unit_name,
|
||||||
|
case WHEN mt.manage_type = '0' then '编号' else '计数' end manageTypeName,
|
||||||
|
mt2.type_name typeName,
|
||||||
|
lod.out_num,
|
||||||
|
lod.remark,
|
||||||
|
mm.ma_code maCode
|
||||||
|
FROM
|
||||||
|
lease_out_details lod
|
||||||
|
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
||||||
|
LEFT JOIN tm_task tt on tt.task_id = lai.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tta.task_id = lai.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
|
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
|
LEFT JOIN ma_type mt on lod.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
|
LEFT JOIN ma_machine mm on lod.ma_id = mm.ma_id
|
||||||
|
WHERE
|
||||||
|
lod.parent_id = #{parentId} and lod.type_id = #{typeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
delete from lease_apply_details
|
delete from lease_apply_details
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt.unit_name as nuitName,
|
mt.unit_name as nuitName,
|
||||||
sai.lease_price as leasePrice,
|
sai.lease_price as leasePrice,
|
||||||
sai.num as num,
|
sai.num as num,
|
||||||
|
lai.remark,
|
||||||
sai.is_slt as isSlt,
|
sai.is_slt as isSlt,
|
||||||
sai.trim_day as trimDay,
|
sai.trim_day as trimDay,
|
||||||
DATE(sai.start_time) as startTime,
|
DATE(sai.start_time) as startTime,
|
||||||
|
|
@ -361,6 +362,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sai.trim_day as trimDay,
|
sai.trim_day as trimDay,
|
||||||
sai.lease_price as leasePrice,
|
sai.lease_price as leasePrice,
|
||||||
sai.num as num,
|
sai.num as num,
|
||||||
|
lai.remark,
|
||||||
sai.is_slt as isSlt,
|
sai.is_slt as isSlt,
|
||||||
DATE(sai.start_time) as startTime,
|
DATE(sai.start_time) as startTime,
|
||||||
DATE(sai.end_time) as endTime,
|
DATE(sai.end_time) as endTime,
|
||||||
|
|
|
||||||
|
|
@ -5,139 +5,191 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="com.bonus.sgzb.material.mapper.StorageStatusMapper">
|
<mapper namespace="com.bonus.sgzb.material.mapper.StorageStatusMapper">
|
||||||
|
|
||||||
<select id="getStorageStatusList" resultType="com.bonus.sgzb.material.domain.StorageStatus">
|
<select id="getStorageStatusList" resultType="com.bonus.sgzb.material.domain.StorageStatus">
|
||||||
SELECT mt2.type_name as typeName,
|
SELECT
|
||||||
mt.type_name as typeModelName,
|
mt2.type_name AS typeName,
|
||||||
mt.unit_name as unit,
|
mt.type_name AS typeModelName,
|
||||||
CASE mt.manage_type
|
mt.unit_name AS unit,
|
||||||
WHEN 0 THEN
|
CASE
|
||||||
IFNULL(subquery0.num, 0)
|
mt.manage_type
|
||||||
ELSE
|
WHEN 0 THEN
|
||||||
IFNULL(mt.num, 0)
|
IFNULL( subquery0.num, 0 ) ELSE IFNULL( mt.num, 0 )
|
||||||
END as num,
|
END AS num,
|
||||||
IFNULL(subquery1.usNum, 0) as usNum,
|
IFNULL( subquery1.usNum, 0 ) AS usNum,
|
||||||
IFNULL(subquery2.repairNum, 0) as repairNum,
|
IFNULL( subquery2.repairNum, 0 ) AS repairNum,
|
||||||
IFNULL(subquery3.repairInputNum, 0) as repairInputNum,
|
IFNULL( subquery3.repairInputNum, 0 ) AS repairInputNum,
|
||||||
IFNULL(subquery4.inputNum, 0) as inputNum,
|
IFNULL( subquery4.inputNum, 0 ) AS inputNum,
|
||||||
IFNULL( subquery5.scrapNum, 0 ) AS scrapNum,
|
IFNULL( subquery5.scrapNum, 0 ) AS scrapNum,
|
||||||
IFNULL( subquery6.scrapNum, 0 ) AS preScrapNum,
|
IFNULL( subquery6.scrapNum, 0 ) AS preScrapNum,
|
||||||
CASE mt.manage_type
|
IFNULL( subquery7.preOutNum, 0 ) AS preOutNum,
|
||||||
WHEN 0 THEN
|
CASE
|
||||||
IFNULL(subquery0.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
mt.manage_type
|
||||||
ELSE
|
WHEN 0 THEN
|
||||||
IFNULL(mt.num, 0)+ IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0)
|
IFNULL( subquery0.num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) ELSE IFNULL( mt.num, 0 )+ IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 )
|
||||||
END as allNum,
|
END AS allNum,
|
||||||
CASE mt.manage_type
|
CASE
|
||||||
WHEN 0 THEN
|
mt.manage_type
|
||||||
'否'
|
WHEN 0 THEN
|
||||||
ELSE
|
'否' ELSE '是'
|
||||||
'是'
|
END manageType
|
||||||
END manageType
|
FROM
|
||||||
|
ma_type mt
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
mt.type_id,
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
|
count( mm.ma_id ) num
|
||||||
|
FROM
|
||||||
|
ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE
|
||||||
|
mm.ma_code IS NOT NULL
|
||||||
|
AND mm.ma_status IN ( 15 )
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
) AS subquery0 ON subquery0.type_id = mt.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
subquery1.type_id,
|
||||||
|
subquery1.typeName,
|
||||||
|
subquery1.typeModelName,
|
||||||
|
IFNULL( subquery1.outNum, 0 ) AS outNum,
|
||||||
|
IFNULL( subquery2.backNum, 0 ) AS backNum,
|
||||||
|
CASE
|
||||||
|
|
||||||
FROM ma_type mt
|
WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN
|
||||||
LEFT JOIN (SELECT mt.type_id,
|
IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0
|
||||||
mt2.type_name AS typeName,
|
END AS usNum
|
||||||
mt.type_name AS typeModelName,
|
FROM
|
||||||
count(mm.ma_id) num
|
(
|
||||||
FROM ma_machine mm
|
SELECT
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
mt.type_id,
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
mt2.type_name AS typeName,
|
||||||
WHERE mm.ma_code is not null and mm.ma_status in (15)
|
mt.type_name AS typeModelName,
|
||||||
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
SUM(
|
||||||
LEFT JOIN (SELECT subquery1.type_id,
|
IFNULL( lod.out_num, 0 )) AS outNum
|
||||||
subquery1.typeName,
|
FROM
|
||||||
subquery1.typeModelName,
|
lease_out_details lod
|
||||||
IFNULL(subquery1.outNum, 0) AS outNum,
|
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
|
||||||
IFNULL(subquery2.backNum, 0) AS backNum,
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
CASE
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
WHEN IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0 THEN
|
) AS subquery1
|
||||||
IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0)
|
LEFT JOIN (
|
||||||
ELSE 0
|
SELECT
|
||||||
END AS usNum
|
mt.type_id,
|
||||||
FROM (SELECT mt.type_id,
|
mt2.type_name AS typeName,
|
||||||
mt2.type_name AS typeName,
|
mt.type_name AS typeModelName,
|
||||||
mt.type_name AS typeModelName,
|
SUM(
|
||||||
SUM(IFNULL(lod.out_num, 0)) AS outNum
|
IFNULL( bcd.back_num, 0 )) backNum
|
||||||
FROM lease_out_details lod
|
FROM
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
|
back_check_details bcd
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
||||||
GROUP BY mt.type_id) AS subquery1
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
LEFT JOIN (SELECT mt.type_id,
|
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||||
mt2.type_name AS typeName,
|
GROUP BY
|
||||||
mt.type_name AS typeModelName,
|
mt.type_id
|
||||||
SUM(IFNULL(bcd.back_num, 0)) backNum
|
) AS subquery2 ON subquery1.type_id = subquery2.type_id
|
||||||
FROM back_check_details bcd
|
) AS subquery1 ON mt.type_id = subquery1.type_id
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
LEFT JOIN (
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
SELECT
|
||||||
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
mt.type_id,
|
||||||
GROUP BY mt.type_id) AS subquery2
|
mt2.type_name AS typeName,
|
||||||
ON subquery1.type_id = subquery2.type_id) AS subquery1
|
mt.type_name AS typeModelName,
|
||||||
ON mt.type_id = subquery1.type_id
|
SUM(
|
||||||
LEFT JOIN (SELECT mt.type_id,
|
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS repairNum
|
||||||
mt2.type_name AS typeName,
|
FROM
|
||||||
mt.type_name AS typeModelName,
|
repair_apply_details rad
|
||||||
SUM(
|
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||||
IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
IFNULL(rad.scrap_num, 0)) AS repairNum
|
WHERE
|
||||||
FROM repair_apply_details rad
|
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
GROUP BY
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
mt.type_id
|
||||||
WHERE IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) - IFNULL(rad.scrap_num, 0) > 0
|
) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||||
GROUP BY mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
|
LEFT JOIN (
|
||||||
LEFT JOIN (SELECT mt.type_id,
|
SELECT
|
||||||
mt2.type_name AS typeName,
|
mt.type_id,
|
||||||
mt.type_name AS typeModelName,
|
mt2.type_name AS typeName,
|
||||||
SUM(
|
mt.type_name AS typeModelName,
|
||||||
IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0)) AS repairInputNum
|
SUM(
|
||||||
FROM repair_input_details rid
|
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 )) AS repairInputNum
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
|
FROM
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
repair_input_details rid
|
||||||
WHERE IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) > 0
|
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
|
||||||
GROUP BY mt.type_id) AS subquery3 ON subquery3.type_id = mt.type_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
LEFT JOIN (SELECT mt.type_id,
|
WHERE
|
||||||
mt2.type_name AS typeName,
|
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) > 0
|
||||||
mt.type_name AS typeModelName,
|
GROUP BY
|
||||||
SUM(
|
mt.type_id
|
||||||
IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0)) AS inputNum
|
) AS subquery3 ON subquery3.type_id = mt.type_id
|
||||||
FROM purchase_check_details pcd
|
LEFT JOIN (
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
SELECT
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
mt.type_id,
|
||||||
WHERE IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0) > 0
|
mt2.type_name AS typeName,
|
||||||
GROUP BY mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
|
mt.type_name AS typeModelName,
|
||||||
LEFT JOIN (
|
SUM(
|
||||||
SELECT
|
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum
|
||||||
mt.type_id,
|
FROM
|
||||||
mt2.type_name AS typeName,
|
purchase_check_details pcd
|
||||||
mt.type_name AS typeModelName,
|
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
||||||
sum(IFNULL(sad.scrap_num,0)) AS scrapNum
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
FROM
|
WHERE
|
||||||
scrap_apply_details sad
|
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
|
GROUP BY
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
mt.type_id
|
||||||
WHERE
|
) AS subquery4 ON subquery4.type_id = mt.type_id
|
||||||
sad.status = 1
|
LEFT JOIN (
|
||||||
GROUP BY
|
SELECT
|
||||||
mt.type_id
|
mt.type_id,
|
||||||
) AS subquery5 ON subquery5.type_id = mt.type_id
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_name AS typeModelName,
|
||||||
LEFT JOIN (
|
sum(
|
||||||
SELECT
|
IFNULL( sad.scrap_num, 0 )) AS scrapNum
|
||||||
mt.type_id,
|
FROM
|
||||||
mt2.type_name AS typeName,
|
scrap_apply_details sad
|
||||||
mt.type_name AS typeModelName,
|
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
|
||||||
sum(IFNULL(sad.scrap_num,0)) AS scrapNum
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
FROM
|
WHERE
|
||||||
scrap_apply_details sad
|
sad.STATUS = 1
|
||||||
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
|
GROUP BY
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
mt.type_id
|
||||||
WHERE
|
) AS subquery5 ON subquery5.type_id = mt.type_id
|
||||||
sad.status = 0
|
LEFT JOIN (
|
||||||
GROUP BY
|
SELECT
|
||||||
mt.type_id
|
mt.type_id,
|
||||||
) AS subquery6 ON subquery6.type_id = mt.type_id
|
mt2.type_name AS typeName,
|
||||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
mt.type_name AS typeModelName,
|
||||||
WHERE mt.`level` = 4
|
sum(
|
||||||
and mt.del_flag = '0'
|
IFNULL( sad.scrap_num, 0 )) AS scrapNum
|
||||||
|
FROM
|
||||||
|
scrap_apply_details sad
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = sad.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE
|
||||||
|
sad.STATUS = 0
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
) AS subquery6 ON subquery6.type_id = mt.type_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
sum(
|
||||||
|
IFNULL( lad.pre_num, 0 ) - IFNULL( lad.al_num, 0 )) AS preOutNum,
|
||||||
|
lad.type_id
|
||||||
|
FROM
|
||||||
|
lease_apply_details lad
|
||||||
|
LEFT JOIN lease_apply_info lai ON lad.parennt_id = lai.id
|
||||||
|
LEFT JOIN tm_task tt ON tt.task_id = lai.task_id
|
||||||
|
WHERE
|
||||||
|
tt.task_status IN ( 30, 31, 32, 33, 34, 117 )
|
||||||
|
GROUP BY
|
||||||
|
lad.type_id
|
||||||
|
) AS subquery7 ON subquery7.type_id = mt.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE
|
||||||
|
mt.`level` = 4
|
||||||
|
AND mt.del_flag = '0'
|
||||||
<if test="typeName != null and typeName != ''">
|
<if test="typeName != null and typeName != ''">
|
||||||
and mt2.type_name like concat('%',#{typeName},'%')
|
and mt2.type_name like concat('%',#{typeName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue