change - 查询物料安装情况接口

master
yinq 7 months ago
parent 0c1011f411
commit b8599d2bb4

@ -18,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* MESController
@ -210,4 +211,14 @@ public class MesApiController extends BaseController {
return success(productPlanService.assignTask(mesAssignTaskVo));
}
/**
*
* @param hashMap (installType=1,installType=2)
* @return
*/
@GetMapping(("/selectMaterialInstallationCircumstance"))
public AjaxResult selectMaterialInstallationCircumstance(@RequestParam(required = false) Map hashMap) {
return success(productPlanService.selectMaterialInstallationCircumstance(hashMap));
}
}

@ -1,6 +1,8 @@
package com.hw.mes.mapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.hw.mes.domain.MesMaterialCheckResult;
import org.apache.ibatis.annotations.Param;
@ -85,4 +87,18 @@ public interface MesMaterialCheckResultMapper {
@Param("ancestors") String ancestors);
/**
*
* @param hashMap
* @return
*/
List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap);
/**
*
* @param hashMap
* @return
*/
List<HashMap<String, Object>> selectMaterialUnInstallationCircumstance(Map hashMap);
}

@ -1,6 +1,8 @@
package com.hw.mes.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.hw.mes.domain.MesBaseAttachInfo;
import com.hw.mes.domain.MesProductOrder;
@ -129,4 +131,10 @@ public interface IMesProductPlanService
*/
public int assignTask(MesAssignTaskVo mesAssignTaskVo);
/**
*
* @param hashMap (installType=1,installType=2)
* @return
*/
List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap);
}

@ -1,9 +1,7 @@
package com.hw.mes.service.impl;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import com.hw.common.core.constant.MesConstants;
@ -25,8 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.service.IMesProductPlanService;
@ -436,6 +432,24 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
}
/**
*
* @param hashMap (installType=1,installType=2)
* @return
*/
@Override
public List<HashMap<String, Object>> selectMaterialInstallationCircumstance(Map hashMap) {
List<HashMap<String, Object>> result = new ArrayList<>();
if (hashMap.containsKey("installType") && hashMap.get("installType").equals("1")){
result = mesMaterialCheckResultMapper.selectMaterialInstallationCircumstance(hashMap);
}
if (hashMap.containsKey("installType") && hashMap.get("installType").equals("2")
&& hashMap.containsKey("planDetailId") && hashMap.containsKey("materialBomId")){
result = mesMaterialCheckResultMapper.selectMaterialUnInstallationCircumstance(hashMap);
}
return result;
}
// public String executeAssignTaskResultTask() {
// ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

@ -97,4 +97,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where mmb.ancestors like concat(#{ancestors}, '%') and mmcr.plan_id = #{planId} and mmcr.plan_detail_id = #{planDetailId}
</select>
<select id="selectMaterialInstallationCircumstance" resultType="java.util.HashMap" parameterType="java.util.HashMap">
select mmcr.material_check_result_id materialCheckResultId,
mmcr.plan_id planId,
mmcr.plan_detail_id planDetailId,
mmcr.material_id materialId,
mmcr.standard_amount standardAmount,
mmcr.check_amount checkAmount,
mbmi.material_code materialCode,
mbmi.material_name materialName
from mes_material_check_result mmcr
left join mes_product_plan mpp on mpp.plan_id = mmcr.plan_id
left join mes_product_plan_detail mppd on mppd.plan_detail_id = mmcr.plan_detail_id
left join mes_base_material_info mbmi on mbmi.material_id = mmcr.material_id
<where>
<if test="planId != null "> and mmcr.plan_id = #{planId}</if>
<if test="planDetailId != null "> and mmcr.plan_detail_id = #{planDetailId}</if>
</where>
</select>
<select id="selectMaterialUnInstallationCircumstance" resultType="java.util.HashMap" parameterType="java.util.HashMap">
select sd.materialId, sd.materialCode, sd.materialName, needAmount
from (
select mbmi.material_id materialId,
mbmi.material_code materialCode,
mbmi.material_name materialName,
mmb.standard_amount standardAmount,
ifnull(mmcr.check_amount, 0) checkAmount,
mmb.standard_amount - ifnull(mmcr.check_amount, 0) needAmount
from mes_material_bom mmb
left join mes_base_material_info mbmi on mmb.material_id = mbmi.material_id
left join mes_material_check_result mmcr on plan_detail_id = #{planDetailId} and mbmi.material_id = mmcr.material_id
where mmb.ancestors like concat('%', concat(#{materialBomId}, '%'))
) sd
where sd.needAmount > 0
</select>
</mapper>

Loading…
Cancel
Save