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");
}

View File

@@ -29,13 +29,21 @@
/>
</el-form-item>
<el-form-item label="机台编码">
<el-input
<el-select
v-model="query.device_code"
clearable
size="mini"
placeholder="机台编码"
@keyup.enter.native="crud.toQuery"
/>
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
<el-form-item label="工单状态">
<el-select
@@ -71,6 +79,17 @@
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
@@ -339,12 +358,41 @@ export default {
crudDeviceinfo.getDevice({}).then(res => {
this.deviceList = res
})
this.initQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
/* 搜索框创建时间默认最近一周*/
initQuery() {
const end = new Date()
const start = new Date()
const endYear = end.getFullYear()
var endMonth = end.getMonth() + 1
if (end.getMonth() + 1 < 10) {
endMonth = '0' + endMonth.toString()
}
var endDay = end.getDate()
if (end.getDate() < 10) {
endDay = '0' + endDay.toString()
}
const endDate = endYear + '-' + endMonth + '-' + endDay + ' 23:59:59'
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
const startYear = start.getFullYear()
var startMonth = start.getMonth() + 1
if (start.getMonth() + 1 < 10) {
startMonth = '0' + startMonth.toString()
}
var startDay = start.getDate()
if (start.getDate() < 10) {
startDay = '0' + startDay.toString()
}
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00'
this.$set(this.query, 'createTime', [startDate, endDate])
this.crud.toQuery()
},
queryMater(value) {
crudGroup.queryMater({ 'material_code': value }).then(row => {
this.form.material_spec = row.material_spec

View File

@@ -107,7 +107,23 @@
<el-row>
<el-col :span="8">
<el-form-item label="物料编码" prop="material_code">
<el-input v-model="form.material_code" style="width: 200px;" @change="queryMater" />
<el-select
v-model="form.material_code"
size="mini"
placeholder="全部"
style="width: 200px"
class="filter-item"
filterable
:disabled="crud.status.edit > 0"
@change="queryMater"
>
<el-option
v-for="item in materList"
:key="item.material_code"
:label="item.material_name"
:value="item.material_code"
/>
</el-select>
</el-form-item>
</el-col>
@@ -261,6 +277,7 @@ export default {
openWeighDialog: false,
loadingSendTask: false,
openParamWeigh: null,
materList: [],
rules: {
material_code: [
{ required: true, message: '物料编码不能为空', trigger: 'blur' }
@@ -275,6 +292,9 @@ export default {
}
},
created() {
crudGroup.queryMaterList({}).then(res => {
this.materList = res
})
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据

View File

@@ -197,7 +197,7 @@ const defaultForm = {
bill_status: '10',
total_qty: '0',
detail_count: '0',
bill_type: '',
bill_type: '1001',
remark: '',
biz_date: new Date(),
out_stor_id: '',

View File

@@ -45,7 +45,23 @@
</el-select>
</el-form-item>
<el-form-item label="物料编码" prop="material_code">
<el-input v-model="form.material_code" :disabled="crud.status.view > 0" style="width: 200px;" @change="queryMater" />
<el-select
v-model="form.material_code"
size="mini"
placeholder="全部"
style="width: 200px"
class="filter-item"
filterable
:disabled="crud.status.view > 0"
@change="queryMater"
>
<el-option
v-for="item in materList"
:key="item.material_code"
:label="item.material_name"
:value="item.material_code"
/>
</el-select>
</el-form-item>
<el-form-item label="物料名称" prop="material_name">
<el-input v-model="form.material_name" disabled style="width: 200px;" />
@@ -184,6 +200,7 @@ export default {
return {
dialogVisible: false,
taskStatusList: [],
materList: [],
storId: null,
materialCode: null,
structShow: false,
@@ -233,6 +250,9 @@ export default {
crudStorattr.getStor({}).then(res => {
this.storlist = res
})
crudGroup.queryMaterList({}).then(res => {
this.materList = res
})
this.getTaskStatusList()
},
getTaskStatusList() {

View File

@@ -2,7 +2,7 @@
<div class="image-modal" v-if="visible" @click.self="close">
<div class="demo-image">
<el-image
style="width: 500px; height: 500px"
style="width: 1000px; height: 600px"
:src="imageUrl"
></el-image>
</div>

View File

@@ -52,6 +52,17 @@
class="filter-item"
/>
</el-form-item>
<el-form-item label="生产时间" prop="createTime">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>
@@ -88,7 +99,7 @@
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column prop="storagevehicle_code" label="载具号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.row.vehicle_code)">{{ scope.row.storagevehicle_code }}</el-link>
<el-link type="warning" @click="toView(scope.row.storagevehicle_code)">{{ scope.row.storagevehicle_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="canuse_qty" label="可用数" :formatter="crud.formatNum3" :min-width="100" />