opt:盘点优化
This commit is contained in:
@@ -14,7 +14,9 @@ import org.nl.wms.basedata.st.service.UserStorService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -196,4 +198,18 @@ public class UserStorServiceImpl implements UserStorService {
|
||||
return in_stor_id;
|
||||
}
|
||||
|
||||
public List<String> getInStor2() {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId().toString();
|
||||
WQLObject userStorTab = WQLObject.getWQLObject("st_ivt_userstor");
|
||||
|
||||
JSONArray userStorArr = userStorTab.query("user_id = '" + currentUserId + "'").getResultJSONArray(0);
|
||||
// 将仓库id拼成字符串
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int i = 0; i < userStorArr.size(); i++) {
|
||||
JSONObject json = userStorArr.getJSONObject(i);
|
||||
list.add(json.getString("stor_id"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.st.instor.check.contronller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.st.instor.service.CheckService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -25,8 +27,8 @@ public class CheckController {
|
||||
|
||||
@GetMapping
|
||||
@Log("查询盘点单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(checkService.pageQuery(whereJson, page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(checkService.pageQuery(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getDtlView")
|
||||
@@ -37,8 +39,8 @@ public class CheckController {
|
||||
|
||||
@GetMapping("/getExceptionDispose")
|
||||
@Log("查询盘点单明细异常")
|
||||
public ResponseEntity<Object> getExceptionDispose(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(checkService.getExceptionDispose(whereJson, page), HttpStatus.OK);
|
||||
public ResponseEntity<Object> getExceptionDispose(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(checkService.getExceptionDispose(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getOutBillDtl")
|
||||
|
||||
@@ -164,4 +164,7 @@ public class StIvtCheckMst implements Serializable {
|
||||
*/
|
||||
private String syscompanyid;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer pcsn_num;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.st.instor.check.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
@@ -159,6 +160,13 @@ public class StIvtCheckdtl implements Serializable {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_code;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_name;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,13 @@ package org.nl.wms.st.instor.check.service.dao.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.wms.st.instor.check.service.dao.StIvtCheckMst;
|
||||
import org.nl.wms.st.instor.check.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.st.outbill.service.dto.OutBillQueryPageParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -14,5 +20,7 @@ import org.nl.wms.st.instor.check.service.dao.StIvtCheckMst;
|
||||
*/
|
||||
public interface StIvtCheckMstMapper extends BaseMapper<StIvtCheckMst> {
|
||||
|
||||
List<String> recordQuery(List<String> ids);
|
||||
|
||||
IPage<StIvtCheckdtl> getExceptionDispose(IPage<StIvtIostorinv> pages, OutBillQueryPageParam paramMap);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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="org.nl.wms.st.instor.check.service.dao.mapper.StIvtCheckMstMapper">
|
||||
|
||||
<select id="recordQuery" resultType="String">
|
||||
SELECT
|
||||
dtl.check_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN st_ivt_checkdtl dtl ON sub.package_box_sn = dtl.storagevehicle_code
|
||||
WHERE
|
||||
1 = 1
|
||||
and dtl.check_id in
|
||||
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getExceptionDispose" resultType="org.nl.wms.st.instor.check.service.dao.StIvtCheckdtl">
|
||||
SELECT
|
||||
dtl.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
ST_IVT_CheckDtl dtl
|
||||
LEFT JOIN md_me_materialbase mater ON dtl.material_id = mater.material_id
|
||||
WHERE
|
||||
dtl.check_result = '2'
|
||||
and dtl.status in ('4','5')
|
||||
<if test="paramMap.box_no != null and paramMap.box_no !=''">
|
||||
AND dtl.storagevehicle_code like '%${paramMap.box_no}%'
|
||||
</if>
|
||||
<if test="paramMap.bill_code != null and paramMap.bill_code !=''">
|
||||
AND dtl.check_code = #{paramMap.bill_code}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,8 +2,11 @@ package org.nl.wms.st.instor.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.st.instor.check.service.dao.StIvtCheckMst;
|
||||
import org.nl.wms.st.instor.check.service.dao.StIvtCheckdtl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -18,7 +21,7 @@ public interface CheckService extends IService<StIvtCheckMst> {
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> pageQuery(Map whereJson, Pageable page);
|
||||
IPage<StIvtCheckMst> pageQuery(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
@@ -36,7 +39,7 @@ public interface CheckService extends IService<StIvtCheckMst> {
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getExceptionDispose(Map whereJson, Pageable page);
|
||||
IPage<StIvtCheckdtl> getExceptionDispose(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
|
||||
@@ -9,9 +9,15 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
|
||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
@@ -25,6 +31,7 @@ import org.nl.wms.st.instor.check.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.st.instor.check.service.dao.mapper.StIvtCheckMstMapper;
|
||||
import org.nl.wms.st.instor.check.service.dao.mapper.StIvtCheckdtlMapper;
|
||||
import org.nl.wms.st.instor.service.CheckService;
|
||||
import org.nl.wms.st.outbill.service.dto.OutBillQueryPageParam;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -48,46 +55,43 @@ public class CheckServiceImpl extends ServiceImpl<StIvtCheckMstMapper, StIvtChec
|
||||
private StIvtCheckdtlMapper stIvtCheckdtlMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
map.put("flag", "1");
|
||||
if (StrUtil.isNotEmpty(map.get("check_code"))) {
|
||||
map.put("check_code", "%" + map.get("check_code") + "%");
|
||||
}
|
||||
public IPage<StIvtCheckMst> pageQuery(Map whereJson, PageQuery page) {
|
||||
LambdaQueryWrapper<StIvtCheckMst> wrapper = new LambdaQueryWrapper<StIvtCheckMst>();
|
||||
//获取人员对应的仓库
|
||||
UserStorServiceImpl userStorService = new UserStorServiceImpl();
|
||||
String in_stor_id = userStorService.getInStor();
|
||||
List<String> in_stor_id = userStorService.getInStor2();
|
||||
wrapper.in(ObjectUtil.isNotEmpty(in_stor_id),StIvtCheckMst::getStor_id,in_stor_id)
|
||||
.like(ObjectUtil.isNotEmpty(whereJson.get("check_code")),StIvtCheckMst::getCheck_code,whereJson.get("check_code"))
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("check_type")),StIvtCheckMst::getCheck_type,whereJson.get("check_type"))
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("create_mode")),StIvtCheckMst::getCreate_mode,whereJson.get("create_mode"))
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("stor_id")),StIvtCheckMst::getStor_id,whereJson.get("stor_id"))
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("status")),StIvtCheckMst::getStatus,whereJson.get("status"))
|
||||
.gt(ObjectUtil.isNotEmpty(whereJson.get("begin_time")),StIvtCheckMst::getInput_time,whereJson.get("begin_time"))
|
||||
.lt(ObjectUtil.isNotEmpty(whereJson.get("end_time")),StIvtCheckMst::getInput_time,whereJson.get("end_time"))
|
||||
.orderByDesc(StIvtCheckMst::getCheck_code);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(in_stor_id)) {
|
||||
map.put("in_stor_id", in_stor_id);
|
||||
|
||||
IPage<StIvtCheckMst> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
|
||||
IPage<StIvtCheckMst> ret = stIvtCheckMstMapper.selectPage(pages,wrapper);
|
||||
|
||||
List<StIvtCheckMst> list = ret.getRecords();
|
||||
|
||||
List<String> strs = list.stream().map(plan -> plan.getCheck_id()).collect(Collectors.toList());
|
||||
if(strs.size()>0){
|
||||
List<String> sublist = stIvtCheckMstMapper.recordQuery(strs);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
StIvtCheckMst json = list.get(i);
|
||||
|
||||
// 匹配相同check_id的数据条数
|
||||
int pcsn_num = (int) sublist.stream()
|
||||
.filter(row -> row.equals(json.getCheck_id()))
|
||||
.count();
|
||||
|
||||
json.setPcsn_num(pcsn_num);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject jo = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "check_code desc");
|
||||
JSONArray content = jo.getJSONArray("content");
|
||||
if (content.isEmpty()) {
|
||||
return jo;
|
||||
}
|
||||
// 拼接主表id
|
||||
String check_id = content.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.map(row -> row.getString("check_id"))
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
JSONArray resultJSONArray = WQL.getWO("QST_IVT_CHECK").addParam("flag", "13").addParam("check_id_in", "(" + check_id + ")").process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject json = content.getJSONObject(i);
|
||||
|
||||
// 匹配相同check_id的数据条数
|
||||
int pcsn_num = (int) resultJSONArray.stream()
|
||||
.map(row -> (JSONObject) row)
|
||||
.filter(row -> row.getString("check_id").equals(json.getString("check_id")))
|
||||
.count();
|
||||
|
||||
json.put("pcsn_num", pcsn_num);
|
||||
}
|
||||
return jo;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,21 +117,15 @@ public class CheckServiceImpl extends ServiceImpl<StIvtCheckMstMapper, StIvtChec
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExceptionDispose(Map whereJson, Pageable page) {
|
||||
public IPage<StIvtCheckdtl> getExceptionDispose(Map whereJson, PageQuery page) {
|
||||
String box_no = MapUtil.getStr(whereJson, "box_no");
|
||||
String check_code = MapUtil.getStr(whereJson, "check_code");
|
||||
OutBillQueryPageParam param = new OutBillQueryPageParam();
|
||||
param.setBill_code(check_code);
|
||||
param.setBox_no(box_no);
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("check_code", check_code);
|
||||
map.put("flag", "10");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(box_no)) {
|
||||
map.put("box_no", "%" + box_no + "%");
|
||||
}
|
||||
|
||||
JSONObject json = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "dtl.seq_no ASC");
|
||||
|
||||
return json;
|
||||
IPage<StIvtIostorinv> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
return stIvtCheckMstMapper.getExceptionDispose(pages, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,49 +64,6 @@
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
checkmst.check_id AS id,
|
||||
checkmst.*
|
||||
FROM
|
||||
ST_IVT_CheckMst checkmst
|
||||
WHERE
|
||||
checkmst.is_delete = '0'
|
||||
and checkmst.stor_id in 输入.in_stor_id
|
||||
|
||||
OPTION 输入.check_code <> ""
|
||||
checkmst.check_code like 输入.check_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.check_type <> ""
|
||||
checkmst.check_type = 输入.check_type
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.stor_id <> ""
|
||||
checkmst.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.create_mode <> ""
|
||||
checkmst.create_mode = 输入.create_mode
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.status <> ""
|
||||
checkmst.status = 输入.status
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.begin_time <> ""
|
||||
checkmst.input_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_time <> ""
|
||||
checkmst.input_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
@@ -379,22 +336,3 @@
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT
|
||||
sub.*,
|
||||
dtl.check_id
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN st_ivt_checkdtl dtl ON sub.package_box_sn = dtl.storagevehicle_code
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
OPTION 输入.check_id_in <> ""
|
||||
dtl.check_id in 输入.check_id_in
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user