rev:12-19优化项

This commit is contained in:
2025-12-18 16:12:51 +08:00
parent 86452fec64
commit 537e9ae64c
15 changed files with 304 additions and 39 deletions

View File

@@ -3,7 +3,9 @@ package org.nl.wms.basedata_manage.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -14,6 +16,10 @@ import org.nl.common.hikvision.HikvisionIsapiDigestUtil;
import org.nl.common.logging.annotation.Log;
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.springframework.core.io.UrlResource;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
@@ -26,6 +32,7 @@ import javax.annotation.Resource;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
@@ -45,6 +52,9 @@ public class BsrealStorattrController {
@Resource
private final IBsrealStorattrService iBsrealStorattrService;
@Resource
private ISchBaseTaskService iSchBaseTaskService;
@GetMapping
@Log("查询仓库")
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
@@ -90,17 +100,33 @@ public class BsrealStorattrController {
@SaIgnore
public ResponseEntity<Object> getFile(@PathVariable String filename) {
try {
String imagePath = HikvisionIsapiDigestUtil.path+ DateUtil.thisYear();
// 查询当前载具最近的一次入库任务
List<SchBaseTask> taskList = iSchBaseTaskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getVehicle_code, filename)
.eq(SchBaseTask::getIs_delete, IOSConstant.ZERO)
.eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
.in(SchBaseTask::getConfig_code, IOSConstant.IN_TYPE_CONFIG_CODE)
.orderByDesc(SchBaseTask::getCreate_time)
);
if (ObjectUtil.isEmpty(taskList)) {
throw new BadRequestException("当前载具未查询到入库任务!");
}
SchBaseTask schBaseTask = taskList.get(0);
// 年月日文件夹
String timeFile = schBaseTask.getCreate_time().substring(0, 10);
String imagePath = HikvisionIsapiDigestUtil.path + "\\" + timeFile;
//文件名称后缀是jpg具体以实际为准。文件路径是path+当前年份,在存储时也是一样
//文件会存储两份:一个是载具编号.jpg一个是载具编号_任务号.jpg载具编号的图片会进行替换为最新的
Path file = Paths.get(imagePath).resolve(filename+".jpg");
Path file = Paths.get(imagePath).resolve(schBaseTask.getTask_code()+"_"+filename+".jpg");
org.springframework.core.io.Resource resource = new UrlResource(file.toUri());
if (resource.exists() && resource.isReadable()) {
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_TYPE, Files.probeContentType(file))
.body(resource);
} else {
throw new BadRequestException("文件不存在");
throw new BadRequestException("文件不存在");
}
} catch (Exception e) {
throw new BadRequestException(e.getMessage());

View File

@@ -7,6 +7,7 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattrDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import java.util.List;
import java.util.Map;
@@ -75,5 +76,4 @@ public interface IBsrealStorattrService extends IService<BsrealStorattr> {
* @param json
*/
void changeActive(JSONObject json);
}

View File

@@ -30,7 +30,7 @@
AND ext.canuse_qty > 0
<if test="param.stor_id != null and param.stor_id != ''">
AND
attr.stor_id LIKE #{param.stor_id}
attr.stor_id = #{param.stor_id}
</if>
<if test="param.sect_id != null and param.sect_id != ''">
@@ -40,17 +40,17 @@
<if test="param.struct_code != null and param.struct_code != ''">
AND
attr.struct_code LIKE #{param.struct_code}
attr.struct_code LIKE CONCAT(#{param.struct_code},'%')
</if>
<if test="param.material_code != null and param.material_code != ''">
AND
material.material_code LIKE #{param.material_code}
material.material_code LIKE CONCAT(#{param.material_code},'%')
</if>
<if test="param.pcsn != null and param.pcsn != ''">
AND
ext.pcsn = #{param.pcsn}
ext.pcsn LIKE CONCAT(#{param.pcsn},'%')
</if>
</where>
@@ -174,6 +174,17 @@
AND
ext.pcsn LIKE #{param.pcsn}
</if>
<if test="param.begin_time != null and param.begin_time != ''">
AND
late.produce_time >= #{param.begin_time}
</if>
<if test="param.end_time != null and param.end_time != ''">
AND
late.produce_time &lt;= #{param.end_time}
</if>
</where>
ORDER BY ext.insert_time Desc
</select>
@@ -215,6 +226,16 @@
AND
ext.pcsn LIKE #{param.pcsn}
</if>
<if test="param.begin_time != null and param.begin_time != ''">
AND
late.produce_time >= #{param.begin_time}
</if>
<if test="param.end_time != null and param.end_time != ''">
AND
late.produce_time &lt;= #{param.end_time}
</if>
</where>
</select>
@@ -283,7 +304,7 @@
late.device_code = #{device_code}
</if>
</where>
ORDER BY quality_day,ex.insert_time,ex.canuse_qty
ORDER BY quality_day,late.produce_time,ex.canuse_qty
</select>
<select id="erpQueryIvt" resultType="com.alibaba.fastjson.JSONObject">

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -15,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.common.hikvision.HikvisionIsapiDigestUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
@@ -28,11 +30,21 @@ import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.basedata_manage.service.dao.mapper.BsrealStorattrMapper;
import org.nl.wms.basedata_manage.service.dao.mapper.SectattrMapper;
import org.nl.wms.basedata_manage.service.dao.mapper.StructattrMapper;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.springframework.core.io.UrlResource;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -56,6 +68,9 @@ public class BsrealStorattrServiceImpl extends ServiceImpl<BsrealStorattrMapper,
@Resource
private IStructattrService iStructattrService;
@Resource
private ISchBaseTaskService iSchBaseTaskService;
@Override
public IPage<BsrealStorattrDto> queryAll(Map whereJson, PageQuery page) {

View File

@@ -93,28 +93,37 @@ public class LcToWmsServiceImpl implements LcToWmsService {
new QueryWrapper<IOStorInvDis>().lambda()
.eq(IOStorInvDis::getTask_id, json.getString("task_id"))
);
material_info.put("pcsn", disDao.getPcsn());
material_info.put("qty", disDao.getPlan_qty());
material_info.put("qty_unit_name", disDao.getQty_unit_name());
// 查询组盘信息
GroupPlate lateDao = iMdPbGroupplateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, disDao.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, disDao.getPcsn())
.eq(GroupPlate::getMaterial_id, disDao.getMaterial_id())
);
GroupPlate lateDao = new GroupPlate();
if (ObjectUtil.isNotEmpty(disDao)) {
material_info.put("pcsn", disDao.getPcsn());
material_info.put("qty", disDao.getPlan_qty());
material_info.put("qty_unit_name", disDao.getQty_unit_name());
// 查询组盘信息
lateDao = iMdPbGroupplateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, disDao.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, disDao.getPcsn())
.eq(GroupPlate::getMaterial_id, disDao.getMaterial_id())
);
}
if (ObjectUtil.isNotEmpty(lateDao)) {
// 查询供应商
MdCsSupplierbase suppDao = iMdCsSupplierbaseService.getOne(
new QueryWrapper<MdCsSupplierbase>().lambda()
.eq(MdCsSupplierbase::getSupp_code, lateDao.getSupp_code())
);
material_info.put("supp_code", suppDao.getSupp_code());
material_info.put("supp_name", suppDao.getSupp_name());
material_info.put("quality_time", lateDao.getQuality_time());
material_info.put("produce_time", lateDao.getProduce_time());
material_info.put("status", lateDao.getQuality_type());
if (ObjectUtil.isNotEmpty(suppDao)) {
material_info.put("supp_code", suppDao.getSupp_code());
material_info.put("supp_name", suppDao.getSupp_name());
material_info.put("quality_time", lateDao.getQuality_time());
material_info.put("produce_time", lateDao.getProduce_time());
material_info.put("status", lateDao.getQuality_type());
}
}
json.put("material_info", material_info);
}
@@ -161,11 +170,13 @@ public class LcToWmsServiceImpl implements LcToWmsService {
new QueryWrapper<MdCsSupplierbase>().lambda()
.eq(MdCsSupplierbase::getSupp_code, lateDao.getSupp_code())
);
material_info.put("supp_code", suppDao.getSupp_code());
material_info.put("supp_name", suppDao.getSupp_name());
material_info.put("quality_time", lateDao.getQuality_time());
material_info.put("produce_time", lateDao.getProduce_time());
material_info.put("status", lateDao.getQuality_type());
if (ObjectUtil.isNotEmpty(suppDao)) {
material_info.put("supp_code", suppDao.getSupp_code());
material_info.put("supp_name", suppDao.getSupp_name());
material_info.put("quality_time", lateDao.getQuality_time());
material_info.put("produce_time", lateDao.getProduce_time());
material_info.put("status", lateDao.getQuality_type());
}
}
}
json.put("bear_status", bearStatus(json.getString("bear_box")));

View File

@@ -29,6 +29,13 @@ public interface PdmBomCallMaterialMapper extends BaseMapper<PdmBomCallMaterial>
*/
IPage<PdmBomCallMaterialDto> queryAllByPage(Page<PdmBomCallMaterialDto> page, @Param("param") Map whereJson);
/**
* 计算总计
* @param whereJson {}
* @return PdmBomCallMaterialDto
*/
PdmBomCallMaterialDto queryAllSumQty(@Param("param") Map whereJson);
/**
* 查询工单信息
* @param whereJson {
@@ -38,4 +45,6 @@ public interface PdmBomCallMaterialMapper extends BaseMapper<PdmBomCallMaterial>
* @return List<PdmBomCallMaterialDto>
*/
List<PdmBomCallMaterialDto> queryBomInfo(@Param("param") JSONObject whereJson);
}

View File

@@ -39,6 +39,65 @@
bom.bom_type = #{param.bom_type}
</if>
<if test="param.begin_time != null and param.begin_time != '' ">
AND
bom.create_time >= #{param.begin_time}
</if>
<if test="param.end_time != null and param.end_time != '' ">
AND
bom.create_time &lt;= #{param.end_time}
</if>
</where>
ORDER BY bom.create_time Desc
</select>
<select id="queryAllSumQty" resultType="org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto">
SELECT
SUM(bom.call_qty) AS call_qty,
SUM(bom.real_qty) AS real_qty,
SUM(bom.real_weigh_qty) AS real_weigh_qty
FROM
pdm_bom_callmaterial bom
INNER JOIN md_me_materialbase mater ON mater.material_id = bom.material_id
<where>
1 = 1
<if test="param.material_code != null and param.material_code != ''">
AND
(mater.material_code LIKE #{param.material_code} or
mater.material_name LIKE #{param.material_code} )
</if>
<if test="param.device_code != null and param.device_code != ''">
AND
bom.device_code LIKE #{param.device_code}
</if>
<if test="param.bom_code != null and param.bom_code != ''">
AND
bom.bom_code LIKE #{param.bom_code}
</if>
<if test="param.bom_status != null and param.bom_status != ''">
AND
bom.bom_status = #{param.bom_status}
</if>
<if test="param.bom_type != null and param.bom_type != ''">
AND
bom.bom_type = #{param.bom_type}
</if>
<if test="param.begin_time != null and param.begin_time != '' ">
AND
bom.create_time >= #{param.begin_time}
</if>
<if test="param.end_time != null and param.end_time != '' ">
AND
bom.create_time &lt;= #{param.end_time}
</if>
</where>
ORDER BY bom.create_time Desc

View File

@@ -1,6 +1,7 @@
package org.nl.wms.pdm_manage.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -54,8 +55,23 @@ public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMateria
@Override
public IPage<PdmBomCallMaterialDto> queryAll(Map whereJson, PageQuery page) {
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
IPage<PdmBomCallMaterialDto> jsonObjectIPage = this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
whereJson);
List<PdmBomCallMaterialDto> records = jsonObjectIPage.getRecords();
PdmBomCallMaterialDto dtoSum = this.baseMapper.queryAllSumQty(whereJson);
if (ObjectUtil.isNotEmpty(dtoSum)) {
dtoSum.setMaterial_code("合计");
records.add(dtoSum);
} else {
if (ObjectUtil.isNotEmpty(records)) {
PdmBomCallMaterialDto dto = new PdmBomCallMaterialDto();
dto.setMaterial_code("合计");
records.add(dto);
}
}
jsonObjectIPage.setRecords(records);
return jsonObjectIPage;
}
@Override

View File

@@ -1,5 +1,8 @@
package org.nl.wms.warehouse_management.enums;
import java.util.Arrays;
import java.util.List;
/**
* @author Liuyx
* @date 2025年05月23日
@@ -125,4 +128,10 @@ public class IOSConstant {
* 物料id焊丝盘状
*/
public final static String MATERIAL_HS_PZ = "1999384605630795776";
/**
* 入库任务配置类型
*/
public final static List<String> IN_TYPE_CONFIG_CODE = Arrays.asList("DetainInTask","BackInTask","CombinedBoxInTask","HandInTask");
}