rev:接口联调
This commit is contained in:
@@ -40,8 +40,8 @@ public enum AcsTaskEnum {
|
||||
STATUS_FINISH("2","完成"),
|
||||
STATUS_CANNEL("3","取消"),
|
||||
//专机请求
|
||||
REQUEST_CALLTYPE_FULL("1","专机满料请求"),
|
||||
REQUEST_CALLTYPE_EMP("2","专机缺料请求"),
|
||||
REQUEST_CALLTYPE_FULL("2","专机满料请求"),
|
||||
REQUEST_CALLTYPE_EMP("1","专机缺料请求"),
|
||||
REQUEST_PLOTTER_SEND_FULL("3","刻字满料请求"),
|
||||
REQUEST_PLOTTER_CALL_EMP("4","刻字缺空框请求"),
|
||||
REQUEST_WARP_CALL_FULL("5","包装缺料请求"),
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.ql.IPdmQlOptionService;
|
||||
import org.nl.system.service.ql.dao.PdmQlOption;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/4/25 15:40
|
||||
*/
|
||||
public class OptionRecord {
|
||||
|
||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||
|
||||
public static void record(OptionEnum type, Buss classname, String order, Map option){
|
||||
EXECUTOR.execute(()->{
|
||||
IPdmQlOptionService bean = SpringContextHolder.getBean(IPdmQlOptionService.class);
|
||||
PdmQlOption qlOption = new PdmQlOption();
|
||||
if (option !=null){
|
||||
qlOption.setOptionDate(JSON.toJSONString(option));
|
||||
}
|
||||
qlOption.setOrderno(order);
|
||||
qlOption.setType(type.name());
|
||||
qlOption.setCreateTime(new Date());
|
||||
qlOption.setCreateId(SecurityUtils.getCurrentUserId());
|
||||
qlOption.setCreateId(SecurityUtils.getCurrentNickName());
|
||||
qlOption.setBussclass(classname.name());
|
||||
bean.save(qlOption);
|
||||
});
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OptionEnum{
|
||||
ADDOP,
|
||||
DELETEOP,
|
||||
UPDATEOP,
|
||||
}
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum Buss{
|
||||
WORKORDER,
|
||||
MATERIAL,
|
||||
VECHILE,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.system.controller.ql;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 操作记录表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-04-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pdmQlOption")
|
||||
public class PdmQlOptionController {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.system.service.ql;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.system.service.ql.dao.PdmQlOption;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 操作记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-04-25
|
||||
*/
|
||||
public interface IPdmQlOptionService extends IService<PdmQlOption> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.system.service.ql.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 操作记录表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-04-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pdm_ql_option")
|
||||
public class PdmQlOption implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private String optionId;
|
||||
|
||||
/**
|
||||
* 检测类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 单据
|
||||
*/
|
||||
private String orderno;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private String optionDate;
|
||||
/**
|
||||
* 业务类
|
||||
*/
|
||||
private String bussclass;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.system.service.ql.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.system.service.ql.dao.PdmQlOption;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 操作记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-04-25
|
||||
*/
|
||||
public interface PdmQlOptionMapper extends BaseMapper<PdmQlOption> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.ql.dao.mapper.PdmQlOptionMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.system.service.ql.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.system.service.ql.IPdmQlOptionService;
|
||||
import org.nl.system.service.ql.dao.PdmQlOption;
|
||||
import org.nl.system.service.ql.dao.mapper.PdmQlOptionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 操作记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-04-25
|
||||
*/
|
||||
@Service
|
||||
public class PdmQlOptionServiceImpl extends ServiceImpl<PdmQlOptionMapper, PdmQlOption> implements IPdmQlOptionService {
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.nl.wms.pda.service.CacheLineHandService;
|
||||
import org.nl.wms.sch.tasks.SpeMachineryTask;
|
||||
import org.nl.wms.sch.tasks.TaskScheduleService;
|
||||
import org.nl.wms.sch.tasks.WashMachineryTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -30,7 +31,6 @@ import java.util.Map;
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "acs接收wms")
|
||||
@RequestMapping("/api/acsToWms/task")
|
||||
@Slf4j
|
||||
@@ -71,7 +71,7 @@ public class AcsToWmsController {
|
||||
@Log("ACS给WMS下发工单完成状态")
|
||||
@ApiOperation("ACS给WMS下发工单完成状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> orderFinish(@RequestBody JSONObject param) {
|
||||
public ResponseEntity<Object> orderStatus(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.orderStatus(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -133,4 +133,11 @@ public class AcsToWmsController {
|
||||
washMachineryTask.createTask(new JSONObject(MapOf.of("device_code","QX03")));
|
||||
return null;
|
||||
}
|
||||
@PostMapping("/taskPublish")
|
||||
@Log("向wms反实施数量")
|
||||
@ApiOperation("向wms反订单实施数量")
|
||||
@SaIgnore
|
||||
public void taskScheduleService(){
|
||||
taskScheduleService.taskPublish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.enums.WorkerOrderEnum;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.OptionRecord;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -32,7 +33,9 @@ import org.nl.wms.sch.tasks.WashMachineryTask;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -54,6 +57,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
|
||||
public static Map<AcsTaskEnum, AbstractAcsTask> Task_Collent = new HashMap<>();
|
||||
@Autowired
|
||||
@Lazy
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private CacheLineHandService cacheLineHandService;
|
||||
@@ -214,21 +218,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
public Map<String, Object> orderStatus(JSONObject orderJson) {
|
||||
JSONObject result = new JSONObject();
|
||||
try {
|
||||
String workorder_id = orderJson.getString("workorder_id");
|
||||
String order_status = orderJson.getString("status");
|
||||
String real_qty = orderJson.getString("real_qty");
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_produce_workOrder");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("workorder_id", workorder_id);
|
||||
map.put("order_status", order_status);
|
||||
map.put("update_id", 1001001);
|
||||
map.put("real_qty", real_qty);
|
||||
map.put("workorder_id", orderJson.getString("workorder_id"));
|
||||
map.put("workorder_status", orderJson.getString("status"));
|
||||
map.put("update_id", "1");
|
||||
map.put("real_qty", orderJson.getString("real_qty"));
|
||||
map.put("current_device_code", "");
|
||||
map.put("update_name", "acs");
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("realproduceend_date", DateUtil.now());
|
||||
wo.update(map, "workorder_id = '" + workorder_id + "'");
|
||||
|
||||
WQLObject.getWQLObject("PDM_produce_workOrder").update(map, "workorder_id = '" + orderJson.getString("workorder_id") + "'");
|
||||
OptionRecord.record(OptionRecord.OptionEnum.UPDATEOP, OptionRecord.Buss.WORKORDER,orderJson.getString("workorder_id"),MapOf.of("workorder_status", orderJson.getString("status")));
|
||||
} catch (Exception e){
|
||||
result.put("status", 400);
|
||||
result.put("message", e.getMessage());
|
||||
@@ -250,7 +250,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
String workorder_code = param.getString("workorder_code");
|
||||
String status_type = param.getString("status_type");
|
||||
String start_time = param.getString("start_time");
|
||||
String err_status_id = param.getString("err_status_id");
|
||||
String err_status_id = param.getString("error_code");//关联pdm_bi_devicerunerrorlink获取异常信息
|
||||
JSONObject lastRecord = devRecordTab.query("device_code = '" + device_code + "' order by order_num desc limit 1").uniqueResult(0);
|
||||
if (lastRecord!=null){
|
||||
lastRecord.put("end_time",DateUtil.now());
|
||||
@@ -263,6 +263,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void feedDevQty(Map param) {
|
||||
WQLObject deviceTab = WQLObject.getWQLObject("pdm_bi_device");
|
||||
if (CollectionUtils.isEmpty(param)){
|
||||
@@ -271,8 +272,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
Iterator iterator = param.keySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
String deviceCode = (String)iterator.next();
|
||||
String qty = String.valueOf(param.get(deviceCode));
|
||||
deviceTab.update(MapOf.of("deviceinstor_qty",qty),"device_code = '"+deviceCode+"'");
|
||||
if (!StringUtils.isEmpty(deviceCode)){
|
||||
String qty = String.valueOf(param.get(deviceCode));
|
||||
deviceTab.update(MapOf.of("deviceinstor_qty",qty),"device_code = '"+deviceCode+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,6 +307,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void feedOrderRealQty(JSONObject param) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
|
||||
if (CollectionUtils.isEmpty(param)){
|
||||
@@ -311,9 +315,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
}
|
||||
Iterator<String> iterator = param.keySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
String workorder_id = iterator.next();
|
||||
String real_qty = param.getString(workorder_id);
|
||||
wo.update(MapOf.of("real_qty",real_qty),"workorder_id = '"+workorder_id+"'");
|
||||
String workorderCode = iterator.next();
|
||||
String real_qty = param.getString(workorderCode);
|
||||
wo.update(MapOf.of("real_qty",real_qty),"workorder_code = '"+workorderCode+"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,23 +50,23 @@ public class AgvInstService {
|
||||
//4.有则创建agv指令,
|
||||
// 没有则创建缓存架任务
|
||||
public void fullMaster(JSONObject task){
|
||||
final String OPT_NAME = "满料请求:";
|
||||
WQLObject basePoint = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
WQLObject cacheLineSearch = WQLObject.getWQLObject("SCH_cacheLine_region_relation");
|
||||
String point_code = task.getString("start_point_code");
|
||||
String quantity = task.getString("quantity");
|
||||
JSONObject devicePoint = basePoint.query("point_code = '" + point_code + "' and is_delete = 0 and is_used = 1").uniqueResult(0);
|
||||
JSONObject devicePoint = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "' and is_delete = 0 and is_used = 1").uniqueResult(0);
|
||||
String nextPoint;
|
||||
//判断缓存线是不是去深坑清洗:深坑区域15个点:判断空的物料坑位:
|
||||
String cacheVehile = "";
|
||||
if (devicePoint.getString("next_region_code").equals(ConstantParam.SK_REGION)){
|
||||
JSONArray nextPointList = WQL.getWO("sch_point").addParamMap(MapOf.of("flag","7","region_code", devicePoint.getString("next_region_code"),"qty",quantity)).process().getResultJSONArray(0);
|
||||
//查询生坑重量是否超限:深坑需要乘以系数
|
||||
JSONArray nextPointList = WQL.getWO("sch_point").addParamMap(MapOf.of("flag","7","region_code", devicePoint.getString("next_region_code"),"qty",Integer.valueOf(quantity)*ConstantParam.MATERAIL_RATIO)).process().getResultJSONArray(0);
|
||||
if (nextPointList.size() == 0){
|
||||
throw new BadRequestException(OPT_NAME+"深坑区域:"+devicePoint.getString("next_region_code")+"无可用点位");
|
||||
throw new BadRequestException("深坑清洗储料仓:"+devicePoint.getString("next_region_code")+"无可用点位");
|
||||
}
|
||||
nextPoint = nextPointList.getJSONObject(0).getString("point_code");
|
||||
}else {
|
||||
//专机的话:需要判断专机上料口物料是否满足数量
|
||||
JSONArray nextPointList = WQL.getWO("sch_point").addParamMap(MapOf.of("flag","3","region_code", devicePoint.getString("next_region_code"),"qty",quantity)).process().getResultJSONArray(0);
|
||||
if (nextPointList.size() == 0){
|
||||
JSONObject cacheLine = cacheLineSearch.query("region_code = '"+devicePoint.getString("region_code")+"'").uniqueResult(0);
|
||||
@@ -74,16 +74,16 @@ public class AgvInstService {
|
||||
//满料请求:查询缓存线空载具列表
|
||||
cacheVehile = getEmpCacheVehile(nextPoint, null);
|
||||
if (StringUtils.isBlank(cacheVehile)) {
|
||||
throw new BadRequestException(OPT_NAME+"缓存线:"+nextPoint+"没有可用空载具");
|
||||
throw new BadRequestException("缓存线:"+nextPoint+"没有可用空载具");
|
||||
}
|
||||
}else {
|
||||
nextPoint = nextPointList.getJSONObject(0).getString("point_code");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isBlank(nextPoint)){
|
||||
throw new BadRequestException(OPT_NAME+"设备:"+point_code+"没有可用点位");
|
||||
throw new BadRequestException("设备:"+point_code+"没有可用点位");
|
||||
}
|
||||
basePoint.update(MapOf.of("lock_type",StatusEnum.LOCK_ON.getCode(),"point_code = '"+nextPoint+"'"));
|
||||
WQLObject.getWQLObject("sch_base_point").update(MapOf.of("task_id",task.getString("task_id"),"lock_type",StatusEnum.LOCK_ON.getCode(),"point_code = '"+nextPoint+"'"));
|
||||
task.put("vehicle_code",cacheVehile);
|
||||
task.put("next_point_code",nextPoint);
|
||||
task.put("task_status",StatusEnum.TASK_START_END_P.getCode());
|
||||
@@ -95,35 +95,29 @@ public class AgvInstService {
|
||||
//2.根据当前设备绑定的物料id,从缓存线中获取相同物料对应载具列表
|
||||
//3.agv根据对应载具列表行进扫码匹配:匹配到对应物料则创建点对点任务
|
||||
public void callMatter(JSONObject task){
|
||||
final String OPT_NAME = "专机缺料请求:";
|
||||
WQLObject basePointTable = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||
WQLObject cacheLineTable = WQLObject.getWQLObject("SCH_cacheLine_region_relation");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_base_task");
|
||||
//参数
|
||||
String material_id = task.getString("material_id");
|
||||
|
||||
JSONObject devicePoint = basePointTable.query("point_code = '" + task.getString("next_point_code") + "' and is_delete = 0 and is_used = 1").uniqueResult(0);
|
||||
|
||||
JSONObject cacheLine = cacheLineTable.query("region_code = '"+devicePoint.getString("region_code")+"' and is_active = '"+StatusEnum.STATUS_TRUE.getCode()+"'").uniqueResult(0);
|
||||
Assert.notNull(cacheLine, String.format(OPT_NAME+"区域%s对应缓存线信息不存在", devicePoint.getString("region_code")));
|
||||
JSONObject devicePoint = WQLObject.getWQLObject("SCH_BASE_Point").query("point_code = '" + targetDevice + "' and is_delete = 0 and is_used = 1").uniqueResult(0);
|
||||
JSONObject cacheLine = WQLObject.getWQLObject("SCH_cacheLine_region_relation").query("region_code = '"+devicePoint.getString("region_code")+"' and is_active = '"+StatusEnum.STATUS_TRUE.getCode()+"'").uniqueResult(0);
|
||||
Assert.notNull(cacheLine, String.format("区域%s对应缓存线信息不存在", devicePoint.getString("region_code")));
|
||||
//缓存线位置编码 :缺料请求获取缓存线满载具列表
|
||||
String startPoint = cacheLine.getString("cacheline_code");
|
||||
String cacheVehile = getEmpCacheVehile(startPoint, material_id);
|
||||
if (StringUtils.isBlank(cacheVehile)) {
|
||||
throw new BadRequestException(OPT_NAME+"缓存线:"+startPoint+"没有可用载具");
|
||||
throw new BadRequestException("缓存线:"+startPoint+"没有物料"+material_id+"对应可用载具");
|
||||
}
|
||||
//判断当前物料载具已经任务分配数量:如果>物料已经分配任务。说明满了,不允许再分配
|
||||
JSONArray allocateTask = taskTable.query("point_code1 = '" + startPoint + "' and material_id = '" + material_id + "' and task_status <" + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
|
||||
JSONArray allocateTask = WQLObject.getWQLObject("SCH_base_task").query("point_code1 = '" + startPoint + "' and material_id = '" + material_id + "' and task_status <" + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
|
||||
if (allocateTask.size()>=cacheVehile.split(",").length){
|
||||
log.error(OPT_NAME+"callMatter 缓存线:{}上含有物料:{}的载具分配完,任务id:{}",startPoint,material_id,allocateTask.stream().map(o-> ((JSONObject)o).getString("task_id")).collect(Collectors.joining(",")));
|
||||
throw new BadRequestException(String.format(OPT_NAME+"缓存线%s上含物料%s的载具已分配完",startPoint,material_id));
|
||||
log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完,任务id:{}",startPoint,material_id,allocateTask.stream().map(o-> ((JSONObject)o).getString("task_id")).collect(Collectors.joining(",")));
|
||||
throw new BadRequestException(String.format("缓存线%s上含物料%s的载具已分配完",startPoint,material_id));
|
||||
}
|
||||
task.put("vehicle_code",cacheVehile);
|
||||
task.put("start_point_code",startPoint);
|
||||
task.put("return_point_code",startPoint);
|
||||
task.put("task_status",StatusEnum.TASK_START_END_P.getCode());
|
||||
task.put("update_time", DateUtil.now());
|
||||
taskTable.update(task);
|
||||
WQLObject.getWQLObject("SCH_base_task").update(task);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ProduceWorkorderController {
|
||||
produceWorkorderService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/submits")
|
||||
@PostMapping("/create")
|
||||
@Log("新增工单管理")
|
||||
@ApiOperation("新增工单管理")
|
||||
//@PreAuthorize("@el.check('produceWorkorder:add')")
|
||||
|
||||
@@ -14,9 +14,11 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.enums.WorkerOrderEnum;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.OptionRecord;
|
||||
import org.nl.common.utils.api.CommonResult;
|
||||
import org.nl.common.utils.api.RestBusinessTemplate;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -323,28 +325,44 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult<Map<String,Object>> openStart(JSONObject param) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
|
||||
//获取前台传入的开工的工单信息
|
||||
String workorder_id = param.getString("workorder_id");
|
||||
String device_code = param.getString("device_code");
|
||||
//1-创建、2-下发、3-生产中、4-暂停、5-完成
|
||||
JSONObject result = wo.query("current_device_code = '" + device_code + "' and workorder_status in ('2','3','4') and workorder_id != '" + workorder_id + "'").uniqueResult(0);
|
||||
JSONObject result = WQLObject.getWQLObject("pdm_produce_workorder").query("current_device_code = '" + param.getString("device_code") + "' and workorder_status in ('2','3','4') and workorder_id != '" + workorder_id + "'").uniqueResult(0);
|
||||
//判断该工单状态
|
||||
if(ObjectUtil.isNotEmpty(result)) {
|
||||
throw new BadRequestException("已有工单选择该设备开工,请更换开工设备!");
|
||||
}
|
||||
//TODO:开工时修改生产班次工单表 生产设备、以及工单状态
|
||||
wo.update(MapOf.of("workorder_id", workorder_id, "workorder_status", WorkerOrderEnum.SEND.getCode(), "update_id", currentUserId, "update_name", nickName, "update_time", DateUtil.now()));
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject order = new JSONObject(MapOf.of("workorder_id", workorder_id, "type", WorkerOrderEnum.SEND.getCode()));
|
||||
JSONObject order = packageForm(workorder_id);
|
||||
array.add(order);
|
||||
//下发acs
|
||||
Map<String,Object> resp = wmsToAcsService.orderStatusUpdate(array);
|
||||
WQLObject.getWQLObject("pdm_produce_workorder").update(MapOf.of("workorder_id", workorder_id, "workorder_status", WorkerOrderEnum.SEND.getCode(), "update_id", SecurityUtils.getCurrentUserId(), "update_name", SecurityUtils.getCurrentNickName(), "update_time", DateUtil.now()));
|
||||
Map<String,Object> resp = wmsToAcsService.order(array);
|
||||
//TODO:记录表记录操作
|
||||
OptionRecord.record(OptionRecord.OptionEnum.UPDATEOP, OptionRecord.Buss.WORKORDER,workorder_id,MapOf.of("workorder_status", WorkerOrderEnum.SEND.getCode()));
|
||||
return RestBusinessTemplate.execute(() -> resp);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JSONObject packageForm(String workorder_id) {
|
||||
JSONObject workOrder = WQLObject.getWQLObject("pdm_produce_workorder").query(" workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
JSONObject form = new JSONObject();
|
||||
JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + workOrder.getString("material_id") + "'").uniqueResult(0);
|
||||
JSONObject device_code = WQLObject.getWQLObject("pdm_bi_device").query("device_code = '" +workOrder.getString("current_device_code")+ "'").uniqueResult(0);
|
||||
form.put("workorder_id",workOrder.get("workorder_id"));
|
||||
form.put("workorder_code",workOrder.get("workorder_code"));
|
||||
form.put("qty", workOrder.getString("plan_qty"));
|
||||
form.put("outupperlimit_qty",device_code.getString("outupperlimit_qty"));
|
||||
form.put("material_id",workOrder.get("material_id"));
|
||||
form.put("material_name",material.get("material_name"));
|
||||
form.put("material_code",material.get("material_code"));
|
||||
form.put("material_spec",material.get("material_spec"));
|
||||
form.put("device_code",workOrder.getString("current_device_code"));
|
||||
form.put("is_needmove",workOrder.getString("is_needmove"));
|
||||
return form;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报工操作
|
||||
*
|
||||
|
||||
@@ -109,9 +109,8 @@ public class SpeMachineryTask extends AbstractAcsTask {
|
||||
task.put("material_id", reqestPram.getString("material_id"));
|
||||
task.put("handle_class", this.getClass().getName());
|
||||
task.put("finished_type", "1");
|
||||
task.put("is_delete", "0");
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
task.put("create_id", currentUserId);
|
||||
task.put("is_delete", StatusEnum.LOCK_OFF.getCode());
|
||||
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
task.put("update_id", currentUserId);
|
||||
task.put("update_name", SecurityUtils.getCurrentNickName());
|
||||
|
||||
Reference in New Issue
Block a user