rev:代码优化
This commit is contained in:
@@ -78,6 +78,14 @@ public class OrderController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("强制完成")
|
||||
|
||||
@PostMapping("/updateOrder")
|
||||
public ResponseEntity<Object> updateOrder(@RequestBody JSONObject whereJson) {
|
||||
orderService.updateOrder(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("开始")
|
||||
|
||||
@PostMapping("/start")
|
||||
|
||||
@@ -76,6 +76,13 @@ public interface OrderService extends CommonService<OrderDto> {
|
||||
*/
|
||||
void forceFinish(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 起点终点确认
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void updateOrder(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 称重
|
||||
*
|
||||
|
||||
@@ -112,10 +112,16 @@ public class OrderDto extends CommonModel<OrderDto> implements Serializable {
|
||||
private String is_delete;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 点位编码
|
||||
* 起点编码
|
||||
*/
|
||||
private String point_code;
|
||||
private String start_device_code;
|
||||
|
||||
/**
|
||||
* 终点编码
|
||||
*/
|
||||
private String next_device_code;
|
||||
|
||||
/**
|
||||
* 明细数量
|
||||
|
||||
@@ -217,6 +217,32 @@ public class OrderServiceImpl extends CommonServiceImpl<OrderMapper, OrderDto> i
|
||||
orderMapper.updateById(orderDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrder(JSONObject whereJson) {
|
||||
String workorder_id = whereJson.getString("workorder_id");
|
||||
String start_device_code = whereJson.getString("start_device_code");
|
||||
String next_device_code = whereJson.getString("next_device_code");
|
||||
if (StrUtil.isEmpty(workorder_id)){
|
||||
throw new BadRequestException("工单号为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(start_device_code)){
|
||||
throw new BadRequestException("起点编码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)){
|
||||
throw new BadRequestException("终点编码不能为空");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
OrderDto orderDto = orderMapper.selectById(workorder_id);
|
||||
|
||||
orderDto.setStart_device_code(start_device_code);
|
||||
orderDto.setNext_device_code(next_device_code);
|
||||
orderDto.setUpdate_optid(currentUserId);
|
||||
orderDto.setUpdate_optname(currentUsername);
|
||||
orderDto.setUpdate_time(DateUtil.now());
|
||||
orderMapper.updateById(orderDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(JSONObject whereJson) {
|
||||
String workorder_id = whereJson.getString("workorder_id");
|
||||
|
||||
@@ -80,4 +80,7 @@ public class Work implements Serializable {
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
|
||||
private String next_device_code;
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public class WorkDto implements Serializable {
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
private String next_device_code;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,9 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements Wo
|
||||
if (ObjectUtil.isEmpty(work)) {
|
||||
throw new BadRequestException("不存在该配料任务");
|
||||
}
|
||||
if (CommonFinalParam.ONE.equals(work.getStatus())) {
|
||||
throw new BadRequestException("该配料任务已下发,请勿重复下发!");
|
||||
}
|
||||
String mfg_order_name = work.getMfg_order_name();
|
||||
List<Work> works = workMapper.selectList(Wrappers.lambdaQuery(Work.class).eq(Work::getMfg_order_name, mfg_order_name).eq(Work::getStatus, TaskStatus.EXECUTING.getCode()));
|
||||
if (works.size() != 0) {
|
||||
@@ -157,20 +160,33 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements Wo
|
||||
if (StrUtil.equals(CommonFinalParam.FINISHED, work.getStatus())) {
|
||||
throw new BadRequestException("该配料任务已完成!");
|
||||
}
|
||||
String resource_name = work.getResource_name();
|
||||
String mfg_order_name = work.getMfg_order_name();
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
if (ObjectUtil.isEmpty(dto)){
|
||||
throw new BadRequestException("工单不存在");
|
||||
}
|
||||
TaskDto taskDto = new TaskDto();
|
||||
taskDto.setStart_device_code("T1");
|
||||
taskDto.setNext_device_code(resource_name);
|
||||
taskDto.setTask_type(CommonFinalParam.TYPE_THREE);
|
||||
String next_device_code = work.getNext_device_code();
|
||||
String next_device_code1 = dto.getNext_device_code();
|
||||
if (StrUtil.isNotEmpty(next_device_code)) {
|
||||
taskDto.setNext_device_code(next_device_code);
|
||||
}else if (StrUtil.isNotEmpty(next_device_code1)) {
|
||||
taskDto.setNext_device_code(next_device_code1);
|
||||
}else {
|
||||
throw new BadRequestException("工单起点和终点未确认!");
|
||||
}
|
||||
|
||||
taskDto.setStart_device_code("QZJYTW2");
|
||||
taskDto.setTask_type(CommonFinalParam.ONE);
|
||||
taskDto.setAgv_system_type(CommonFinalParam.TWO);
|
||||
taskDto.setWork_id(id);
|
||||
AcsPoint point = acsPointService.findByCode("T1");
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("不存在T1点位");
|
||||
}
|
||||
if (!point.getIs_used().booleanValue() || point.getPoint_status().equals(CommonFinalParam.ONE)) {
|
||||
throw new BadRequestException("T1点位被占用");
|
||||
}
|
||||
// AcsPoint point = acsPointService.findByCode("T1");
|
||||
// if (ObjectUtil.isEmpty(point)) {
|
||||
// throw new BadRequestException("不存在T1点位");
|
||||
// }
|
||||
// if (!point.getIs_used().booleanValue() || point.getPoint_status().equals(CommonFinalParam.ONE)) {
|
||||
// throw new BadRequestException("T1点位被占用");
|
||||
// }
|
||||
try {
|
||||
taskService.create(taskDto);
|
||||
} catch (Exception e) {
|
||||
@@ -182,8 +198,6 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements Wo
|
||||
work.setStatus(TaskStatus.FINISHED.getCode());
|
||||
}
|
||||
workMapper.updateById(work);
|
||||
String mfg_order_name = work.getMfg_order_name();
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
List<Work> works = workMapper.selectList(Wrappers.lambdaQuery(Work.class).eq(Work::getMfg_order_name, mfg_order_name).eq(Work::getStatus, TaskStatus.FINISHED.getCode()));
|
||||
// 工单所有配料任务都完成,则工单状态改为已完成
|
||||
if (works.size() == dto.getDetail_count()) {
|
||||
|
||||
@@ -587,8 +587,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
task_code = CodeUtil.getNewCode("TASK_NO");
|
||||
task_code = CommonFinalParam.HYPHEN_ + task_code;
|
||||
}
|
||||
String start_device_code = dto.getStart_point_code();
|
||||
String next_device_code = dto.getNext_point_code();
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
String route_plan_code = dto.getRoute_plan_code();
|
||||
dto.setCreate_by(StrUtil.isNotEmpty(currentUsername) ? currentUsername : "LMS");
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
@@ -34,9 +34,21 @@ public class HandController {
|
||||
return new ResponseEntity<>(handService.query(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryZDDevice")
|
||||
@Log("查询终点设备")
|
||||
public ResponseEntity<Object> queryZDDevice(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(handService.queryZDDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("确认配料作业")
|
||||
@PostMapping(value = "/confirm")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(handService.confirm(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("确认配料作业")
|
||||
@PostMapping(value = "/confirmZZDevice")
|
||||
public ResponseEntity<Object> confirmZZDevice(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(handService.confirmZZDevice(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class PdaController {
|
||||
@Autowired
|
||||
private PdaService pdaService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/queryOrders")
|
||||
@Log("工单查询")
|
||||
public ResponseEntity<Object> queryOrders() {
|
||||
@@ -65,6 +67,15 @@ public class PdaController {
|
||||
return new ResponseEntity<>(pdaService.forceFinish(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("修改工单")
|
||||
|
||||
@PostMapping("/updateOrder")
|
||||
public ResponseEntity<Object> updateOrder(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaService.updateOrder(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Log("下发配料作业")
|
||||
@PostMapping(value = "/sendWork")
|
||||
public ResponseEntity<Object> sendWork(@RequestBody JSONObject whereJson) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.hand.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.hand.service.dao.vo.PdaResponseVo;
|
||||
import org.nl.hand.service.vo.WorkVo;
|
||||
@@ -10,4 +11,8 @@ public interface HandService {
|
||||
List<WorkVo> query();
|
||||
|
||||
PdaResponseVo confirm(JSONObject whereJson);
|
||||
|
||||
PdaResponseVo confirmZZDevice(JSONObject whereJson);
|
||||
|
||||
JSONArray queryZDDevice(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface PdaService {
|
||||
|
||||
PdaResponseVo forceFinish(JSONObject whereJson);
|
||||
|
||||
PdaResponseVo updateOrder(JSONObject whereJson);
|
||||
|
||||
List<WorkVo> queryWorks(JSONObject whereJson);
|
||||
|
||||
List<WorkVo> getExcWorks();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
product_name,
|
||||
description,
|
||||
resource_name,
|
||||
point_code,
|
||||
start_device_code,
|
||||
next_device_code,
|
||||
total_qty,
|
||||
Case status
|
||||
WHEN '0' THEN '就绪'
|
||||
@@ -26,7 +27,7 @@
|
||||
material_code,
|
||||
material_name,
|
||||
qty,
|
||||
resource_name,
|
||||
next_device_code,
|
||||
require_num,
|
||||
remain_num,
|
||||
Case status
|
||||
@@ -51,7 +52,7 @@
|
||||
material_code,
|
||||
material_name,
|
||||
qty,
|
||||
resource_name,
|
||||
next_device_code,
|
||||
require_num,
|
||||
remain_num,
|
||||
Case status
|
||||
@@ -61,6 +62,6 @@
|
||||
ELSE ''
|
||||
END AS status
|
||||
FROM work
|
||||
where status != '2' ORDER BY work.mfg_order_name asc ,work.seq_no asc
|
||||
where status = '1' ORDER BY work.mfg_order_name asc ,work.seq_no asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
package org.nl.hand.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.order.service.OrderService;
|
||||
import org.nl.acs.order.service.dto.OrderDto;
|
||||
import org.nl.acs.sch.task.service.WorkService;
|
||||
import org.nl.acs.sch.task.service.dao.Work;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.hand.service.HandService;
|
||||
import org.nl.hand.service.PdaService;
|
||||
import org.nl.hand.service.dao.vo.PdaResponseVo;
|
||||
@@ -20,6 +30,10 @@ public class HandServiceImpl implements HandService {
|
||||
private PdaService pdaService;
|
||||
@Autowired
|
||||
private WorkService workService;
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -36,4 +50,52 @@ public class HandServiceImpl implements HandService {
|
||||
workService.confirm(work.getWork_id());
|
||||
return PdaResponseVo.pdaResultOk("配料作业确认成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo confirmZZDevice(JSONObject whereJson) {
|
||||
if (StrUtil.isEmpty(whereJson.getString("work_code"))){
|
||||
throw new BadRequestException("配料作业编码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(whereJson.getString("next_device_code"))){
|
||||
throw new BadRequestException("终点设备编码不能为空");
|
||||
}
|
||||
Work work = workService.findByCode(whereJson.getString("work_code"));
|
||||
if (work == null){
|
||||
return PdaResponseVo.pdaResultOk("配料作业不存在");
|
||||
}
|
||||
work.setNext_device_code(whereJson.getString("next_device_code"));
|
||||
workService.update(work);
|
||||
return PdaResponseVo.pdaResultOk("终点确认完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray queryZDDevice(JSONObject whereJson) {
|
||||
String mfg_order_name = whereJson.getString("mfg_order_name");
|
||||
if (StrUtil.isEmpty(mfg_order_name)){
|
||||
throw new BadRequestException("工单号不能为空");
|
||||
}
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
String resource_name = dto.getResource_name();
|
||||
if (StrUtil.isEmpty(resource_name)){
|
||||
throw new BadRequestException("工单号为:"+mfg_order_name+"的产线ID为空");
|
||||
}
|
||||
|
||||
//查询所有设备
|
||||
List<Device> list = deviceService.lambdaQuery()
|
||||
.eq(Device::getRegion,resource_name)
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException(LangProcess.msg("error_no_regional"));
|
||||
}
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", obj.getString("device_code"));
|
||||
json.put("device_name", obj.getString("device_name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,13 @@ public class PdaServiceImpl implements PdaService {
|
||||
@Override
|
||||
public PdaResponseVo startOrder(JSONObject whereJson) {
|
||||
String mfg_order_name = whereJson.getString("mfg_order_name");
|
||||
if (StrUtil.isEmpty(mfg_order_name)){
|
||||
return PdaResponseVo.pdaResultOk("工单号为空!");
|
||||
}
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
if (ObjectUtil.isNull(dto)){
|
||||
return PdaResponseVo.pdaResultOk("工单不存在");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
dto.setStatus("1");
|
||||
@@ -69,7 +75,13 @@ public class PdaServiceImpl implements PdaService {
|
||||
@Override
|
||||
public PdaResponseVo forceFinish(JSONObject whereJson) {
|
||||
String mfg_order_name = whereJson.getString("mfg_order_name");
|
||||
if (StrUtil.isEmpty(mfg_order_name)){
|
||||
return PdaResponseVo.pdaResultOk("工单号为空!");
|
||||
}
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
if (ObjectUtil.isNull(dto)){
|
||||
return PdaResponseVo.pdaResultOk("工单不存在");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
dto.setStatus("2");
|
||||
@@ -81,6 +93,37 @@ public class PdaServiceImpl implements PdaService {
|
||||
return PdaResponseVo.pdaResultOk("工单:[" + dto.getMfg_order_name() + "]已强制完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo updateOrder(JSONObject whereJson) {
|
||||
String mfg_order_name = whereJson.getString("mfg_order_name");
|
||||
String start_device_code = whereJson.getString("start_device_code");
|
||||
String next_device_code = whereJson.getString("next_device_code");
|
||||
if (StrUtil.isEmpty(mfg_order_name)){
|
||||
return PdaResponseVo.pdaResultOk("工单号为空!");
|
||||
}
|
||||
OrderDto dto = orderService.findByCode(mfg_order_name);
|
||||
if (ObjectUtil.isNull(dto)){
|
||||
return PdaResponseVo.pdaResultOk("工单不存在");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(start_device_code)){
|
||||
return PdaResponseVo.pdaResultOk("起点编码不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_device_code)){
|
||||
return PdaResponseVo.pdaResultOk("终点编码不能为空");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
dto.setStart_device_code(start_device_code);
|
||||
dto.setNext_device_code(next_device_code);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
orderService.updateById(dto);
|
||||
return PdaResponseVo.pdaResultOk("工单:[" + dto.getMfg_order_name() + "]起点、终点已分配!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkVo> queryWorks(JSONObject whereJson) {
|
||||
if (StrUtil.isEmpty(whereJson.getString("mfg_order_name"))){
|
||||
|
||||
@@ -18,4 +18,6 @@ public class OrderVo {
|
||||
private String status;
|
||||
private String create_time;
|
||||
private String realstart_time;
|
||||
private String start_device_code;
|
||||
private String next_device_code;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class WorkVo {
|
||||
private String material_code;
|
||||
private String material_name;
|
||||
private float qty;
|
||||
private String resource_name;
|
||||
private String next_device_code;
|
||||
private int require_num;
|
||||
private int remain_num;
|
||||
private String status;
|
||||
|
||||
Reference in New Issue
Block a user