Browse Source

add: 添加定时删除日志文件,优化pc下料逻辑

master
yanps 2 months ago
parent
commit
962338862e
  1. 1
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  2. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java
  3. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java
  4. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java
  5. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java
  6. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java
  7. 78
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCleanFile.java
  8. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java
  9. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java
  10. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java
  11. 4
      lms/nladmin-ui/src/views/wms/produceScreen/index.vue
  12. 11
      lms/nladmin-ui/src/views/wms/sch/group/index.vue

1
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -417,6 +417,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) {
wrapper.between(Task::getCreate_time, create_time, end_time);
}
wrapper.orderByDesc(Task::getUpdate_time);
IPage<Task> taskPage = taskMapper.selectPage(queryPage, wrapper);
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(taskPage, TaskDto.class));
JSONArray array = json.getJSONArray("content");

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java

@ -17,6 +17,7 @@ public enum RegionEnum {
NBJG("内部加工区","NBJGZCQ"),
WXJG("外协加工区","WXJGZCQ"),
ZDZWQ("自动折弯区","ZDZWQ"),
NBGD("内部过道加工区","NBGDJGQ"),
;
private final String region_name;
private final String region_code;

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java

@ -222,6 +222,7 @@ public class FabController {
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
//TODO:待确定
if("1".equals(materInfo.getPoint_code())){
List<SendVehicleVo> mater = materInfo.getMater();
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
JSONObject json = new JSONObject();
@ -257,14 +258,16 @@ public class FabController {
});
toJSON.put("material_info", materiales);
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
if ("1".equals(materInfo.getPoint_code())) {
toJSON.put("region_code", StrUtil.isNotEmpty(mater.get(0).getRegion_code()) ? mater.get(0).getRegion_code() : schBasePoint.getRegion_code());
} else if ("2".equals(materInfo.getPoint_code())) {
}else{
if ("2".equals(materInfo.getPoint_code())) {
toJSON.put("region_code", RegionEnum.NBJG.getRegion_code());
} else if ("3".equals(materInfo.getPoint_code())) {
toJSON.put("region_code", RegionEnum.WXJG.getRegion_code());
} else if ("4".equals(materInfo.getPoint_code())) {
toJSON.put("region_code", RegionEnum.NBGD.getRegion_code());
}
}
fabService.createAgvTask(toJSON, "smt");
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java

@ -128,6 +128,8 @@ public class FabServiceImpl {
param.put("region_code", sendMaterVo.getRegion_code());
if (sendMaterVo.getRegion_code().equals(RegionEnum.NBJG.getRegion_code()) || sendMaterVo.getRegion_code().equals(RegionEnum.WXJG.getRegion_code())) {
param.put("config_code", "ProcessingSMTTask");
} else if (sendMaterVo.getRegion_code().equals(RegionEnum.NBGD.getRegion_code())) {
param.put("config_code", "ProcessingSMTTask");
} else {
param.put("config_code", "PcOperationSMTTask");
}

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java

@ -141,5 +141,11 @@ public class HandheldController {
return new ResponseEntity<>(handheldService.selectPointByRegion(regionCode),HttpStatus.OK);
}
@GetMapping("/createPointInPointTask")
@Log("创建点对点任务")
public ResponseEntity<Object> createPointTask(String regionCode) {
return new ResponseEntity<>(handheldService.selectPointByRegion(regionCode),HttpStatus.OK);
}
}

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java

@ -78,6 +78,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
} else {
lam.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode());
}
lam.orderByDesc(SchBaseTask::getUpdate_time);
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
schBaseTaskMapper.selectPage(pages, lam);
return pages;

78
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoCleanFile.java

@ -0,0 +1,78 @@
package org.nl.wms.sch.task_manage;
import cn.hutool.core.util.ObjectUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.reflections.Reflections;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
/**
* @author LENOVO
* 定时清理日志文件
*/
@Slf4j
@Component
@Profile("prod")
public class AutoCleanFile {
private static long DAYS_TO_MILLIS = TimeUnit.DAYS.toMillis(14);
@Value("${logging.file.path}")
private String logPath;
@SneakyThrows
public void run() {
log.info("定时清理日志文件AutoCleanFile开始:");
File directory = new File(logPath);
if (directory.exists() && directory.isDirectory()) {
cleanDirectory(directory);
} else {
System.out.println("指定的路径不存在或不是一个目录。");
}
}
// 递归清理文件夹内的过期文件
private static void cleanDirectory(File directory) {
File[] files = directory.listFiles();
if (files != null) {
long currentTime = System.currentTimeMillis();
for (File file : files) {
if (file.isDirectory()) {
// 如果是目录,递归调用
cleanDirectory(file);
} else if (file.isFile()) {
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
Param byCode = sysParamService.findByCode(GeneralDefinition.LOGIN_TIME);
if (ObjectUtil.isNotNull(byCode)) {
DAYS_TO_MILLIS = TimeUnit.DAYS.toMillis(Long.parseLong(byCode.getValue()));
}
if (currentTime - file.lastModified() > DAYS_TO_MILLIS) {
boolean deleted = file.delete();
if (deleted) {
log.info("已删除文件: " + file.getAbsolutePath());
} else {
log.info("无法删除文件: " + file.getAbsolutePath());
}
} else {
log.info("文件未超过七天, 不做任何修改: " + file.getAbsolutePath());
}
}
}
}
}
}

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java

@ -67,6 +67,10 @@ public class GeneralDefinition {
* 是否调用connector小插件
*/
public static final String IS_INVOKE_CONNECTOR = "is_invoke_connector";
/**
* 删除多少天之外的日志文件
*/
public static final String LOGIN_TIME = "log_time";
/**
* 手持登录时间
*/

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java

@ -69,11 +69,11 @@ public class PcOperationSMTTask extends AbstractTask {
for (SchBaseTask task : tasks) {
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
//判断是否指定到外协区
String targetRegionCode = sendMaterVo.getTarget_region_code();
String targetRegionCode = sendMaterVo.getRegion_code();
//TODO: 分配逻辑
SchBasePoint schBasePoint = null;
if (!StringUtils.isEmpty(targetRegionCode)) {
schBasePoint = schBasePointService.selectByRegionCode(targetRegionCode, task.getVehicle_code(), "1");
} else {
// 根据对接位查找对应的载具类型
schBasePoint = schBasePointService.selectByRegionCode(task.getRegion_code(), task.getVehicle_code(), "1");

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java

@ -62,7 +62,7 @@ public class ProcessingSMTTask extends AbstractTask {
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
//判断是否指定到外协区
String targetRegionCode = sendMaterVo.getTarget_region_code();
String targetRegionCode = sendMaterVo.getRegion_code();
if (StringUtils.isBlank(targetRegionCode)) {
task.setRemark("未指定区域!");
taskService.updateById(task);

4
lms/nladmin-ui/src/views/wms/produceScreen/index.vue

@ -224,9 +224,9 @@ export default {
popSecList: [],
currentRow: null,
value: '',
options: [{ value: 'G01', label: 'G01' }, { value: 'R01', label: 'R01' }, { value: 'R02', label: 'R02' }, { value: 'S04', label: 'S04' }, { value: 'S06', label: 'S06' }],
options: [{ value: 'G01', label: 'G01' }, { value: 'R01', label: 'R01' }, { value: 'R02', label: 'R02' }, { value: 'R03', label: 'R03' }, { value: 'S04', label: 'S04' }, { value: 'S06', label: 'S06' }],
value1: '',
options1: [{ value: '1', label: '货架' }, { value: '2', label: '内部' }, { value: '3', label: '外协' }],
options1: [{ value: '1', label: '货架' }, { value: '2', label: '内部' }, { value: '3', label: '外协' }, { value: '4', label: '内部过道' }],
value2: '',
options2: [],
vcode: '',

11
lms/nladmin-ui/src/views/wms/sch/group/index.vue

@ -292,13 +292,13 @@
<el-table-column v-if="false" prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
<el-table-column v-if="false" prop="update_time" label="修改时间" :min-width="flexWidth('update_time',crud.data,'修改时间')" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<!-- <template slot-scope="scope">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template> -->
<template slot-scope="scope">
</template>
<!-- <template slot-scope="scope">
<el-button
v-if="!!scope.row.has_work && scope.row.theLocation != null"
type="text"
@ -307,7 +307,7 @@
>
创建任务
</el-button>
</template>
</template> -->
</el-table-column>
</el-table>
<!--分页组件-->
@ -323,6 +323,7 @@ import crudSchBaseVehiclematerialgroup from './schBaseVehiclematerialgroup'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudMdBaseWorkShop from '@/views/wms/basedata/workshop/mdBaseWorkshop'
import MaterialDialog from '@/views/wms/sch/group/MaterialDialog.vue'
@ -365,7 +366,7 @@ const defaultForm = {
export default {
name: 'VehicleMaterialGroup',
dicts: ['group_status', 'group_bind_material_status'],
components: { WorkOrderDialog, MaterialDialog, pagination, crudOperation, rrOperation },
components: { WorkOrderDialog, MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({

Loading…
Cancel
Save