任务修改
This commit is contained in:
@@ -194,6 +194,12 @@
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.sap.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class SapToLmsController {
|
||||
private final SapToLmsService sapToLmsService;
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getMaterialInfo")
|
||||
@Log("SAP给LMS推送物料信息")
|
||||
@ApiOperation("SAP给LMS推送物料信息")
|
||||
@@ -30,6 +32,7 @@ public class SapToLmsController {
|
||||
return new ResponseEntity<>(sapToLmsService.getMaterialInfo(rows), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getDeliveryInfo")
|
||||
@Log("SAP给LMS推送交货单信息")
|
||||
@ApiOperation("SAP给LMS推送物料信息")
|
||||
@@ -37,6 +40,7 @@ public class SapToLmsController {
|
||||
return new ResponseEntity<>(sapToLmsService.getDeliveryInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/getReturnDeliveryInfo")
|
||||
@Log("SAP给LMS推送退货交货单信息")
|
||||
@ApiOperation("SAP给LMS推送退货交货单信息")
|
||||
|
||||
@@ -7,6 +7,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.sap.service.SapToLmsService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@@ -14,6 +16,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
@Override
|
||||
public JSONObject getMaterialInfo(JSONArray rows) {
|
||||
if (ObjectUtil.isEmpty(rows)) {
|
||||
@@ -30,6 +33,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
return jo;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
@Override
|
||||
public JSONObject getDeliveryInfo(JSONObject jo) {
|
||||
|
||||
@@ -46,6 +50,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||
@Override
|
||||
public JSONObject getReturnDeliveryInfo(JSONObject jo) {
|
||||
/**
|
||||
|
||||
@@ -6,11 +6,14 @@ package org.nl.wms.log;
|
||||
* @Date: 2022/10/11
|
||||
*/
|
||||
public enum LokiLogType {
|
||||
DEFAULT( "默认"),
|
||||
LMS_TO_MES( "LMS请求MES"),
|
||||
MES_TO_LMS( "MES请求LMS");
|
||||
DEFAULT("默认"),
|
||||
LMS_TO_MES("LMS请求MES"),
|
||||
MES_TO_LMS("MES请求LMS"),
|
||||
LMS_TO_SAP("LMS请求MES"),
|
||||
SAP_TO_LMS("MES请求LMS");
|
||||
|
||||
private String desc;
|
||||
|
||||
LokiLogType(String desc) {
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "子卷套管")
|
||||
@Api(tags = "子卷出站")
|
||||
@RequestMapping("api/pda/out")
|
||||
@Slf4j
|
||||
public class OutController {
|
||||
@@ -32,8 +32,8 @@ public class OutController {
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("套轴确认")
|
||||
@ApiOperation("套轴确认")
|
||||
@Log("子卷出站")
|
||||
@ApiOperation("子卷出站")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
outService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -17,6 +17,6 @@ public interface OutService {
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject confirm(JSONObject whereJson);
|
||||
void confirm(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package org.nl.wms.pda.mps.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.K;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.pda.mps.service.OutService;
|
||||
import org.nl.wms.pda.mps.service.ShippingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -33,11 +37,40 @@ public class OutServiceImpl implements OutService {
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject confirm(JSONObject whereJson) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("code", "1");
|
||||
result.put("desc", "查询成功");
|
||||
return result;
|
||||
public void confirm(JSONObject whereJson) {
|
||||
String point_code = whereJson.getString("point_code");
|
||||
|
||||
//查询该点位对应的机台编号
|
||||
JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='"+point_code+"' OR down_point_code ='"+point_code+"'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(cut_ivt)){
|
||||
throw new BadRequestException("未查询到对应的分切机!");
|
||||
}
|
||||
|
||||
String ext_code = cut_ivt.getString("ext_code");
|
||||
|
||||
//查询该机台编号已经配送完成,套轴完成但是未完成的分切计划
|
||||
JSONObject slitting = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("resource_name = '"+ext_code+"' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND status = '1'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(slitting)){
|
||||
throw new BadRequestException("该分切机没有对应完成配送完成的气涨轴!");
|
||||
}
|
||||
|
||||
String qzzno = slitting.getString("qzzno");
|
||||
|
||||
//查询该气涨轴所在输送线位置
|
||||
JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("qzzno = '"+qzzno+"' AND point_status = '03'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(delivery_point)){
|
||||
throw new BadRequestException("未查询到对应的输送线点位!");
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code1",delivery_point.getString("point_code"));
|
||||
jo.put("point_code2",point_code);
|
||||
jo.put("point_code3",point_code);
|
||||
jo.put("point_code4",delivery_point.getString("point_code"));
|
||||
jo.put("task_type","010403");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.pda.mps.service.CasingService;
|
||||
import org.nl.wms.pda.mps.service.ShippingService;
|
||||
import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -20,6 +21,7 @@ import java.util.HashMap;
|
||||
@Slf4j
|
||||
public class ShippingServiceImpl implements ShippingService {
|
||||
|
||||
private final CutConveyorTask cutConveyorTask;
|
||||
|
||||
@Override
|
||||
public JSONArray queryMaterialInfo(JSONObject whereJson) {
|
||||
@@ -52,7 +54,11 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
}
|
||||
|
||||
//如果查询到给ACS下发一个输送线任务
|
||||
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("point_code1",empty_vehicle.getString("point_code"));
|
||||
form.put("point_code2","SS01");
|
||||
form.put("task_type","010401");
|
||||
cutConveyorTask.createTask(form);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,6 +83,11 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
.addParam("flag", "4").process().uniqueResult(0);
|
||||
|
||||
//下发输送线任务
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("point_code1","SS02");
|
||||
form.put("point_code2",empty_point.getString("point_code"));
|
||||
form.put("task_type","010401");
|
||||
cutConveyorTask.createTask(form);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,137 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CutConveyorTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = CutConveyorTask.class.getName();
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status,"0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '"+task_id+"'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010401")){
|
||||
// 校验终点是否存在
|
||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("未找到可用点位:" + point_code2);
|
||||
}
|
||||
|
||||
// 更新分切输送库存状态
|
||||
jsonIvt.put("point_status", "01");
|
||||
ivtTab.update(jsonIvt);
|
||||
}
|
||||
if (jsonTask.getString("task_type").equals("010402")){
|
||||
// 校验终点是否存在
|
||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("未找到可用点位:" + point_code2);
|
||||
}
|
||||
|
||||
// 更新分切输送库存状态
|
||||
jsonIvt.put("point_status", "03");
|
||||
ivtTab.update(jsonIvt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", "01");
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority","1" );
|
||||
json.put("acs_task_type","5" );
|
||||
tab.insert(json);
|
||||
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CutTrussTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = CutTrussTask.class.getName();
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status,"0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '"+task_id+"'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010403")){
|
||||
// 校验终点是否存在
|
||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("未找到可用点位:" + point_code2);
|
||||
}
|
||||
|
||||
// 更新分切输送库存状态
|
||||
jsonIvt.put("point_status", "01");
|
||||
ivtTab.update(jsonIvt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", "01");
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("point_code3", form.getString("point_code3"));
|
||||
json.put("point_code4", form.getString("point_code4"));
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority","1" );
|
||||
json.put("acs_task_type","5" );
|
||||
tab.insert(json);
|
||||
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user