rev: rgv四点任务,迁移到包装线任务下发信号给RGV功能
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -140,9 +141,12 @@ public class UserController {
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel = Collections.min(roleService.findByUsersId(UserInfoUtil.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
Integer optLevel = Collections.min(roleService.findByUsersId(id).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername());
|
||||
List<RoleSmallDto> usersId = roleService.findByUsersId(id);
|
||||
if (ObjectUtil.isNotEmpty(usersId)) {
|
||||
Integer optLevel = Collections.min(usersId.stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足,不能删除:" + userService.findById(id).getUsername());
|
||||
}
|
||||
}
|
||||
}
|
||||
userService.delete(ids);
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -165,6 +166,11 @@ public class MaterialServiceImpl implements MaterialService {
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
// 查找工单上物料id相同
|
||||
WQLObject pdmMgProducetask = WQLObject.getWQLObject("pdm_mg_producetask");
|
||||
Map ma = new HashMap<>();
|
||||
ma.put("vehicle_type", dto.getVehicle_type());
|
||||
pdmMgProducetask.update(ma, "material_id = '" + dto.getMaterial_id() + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
package org.nl.wms.ext.acs.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.annotation.rest.AnonymousPostMapping;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Override
|
||||
@Transactional
|
||||
public Map<String, Object> receiveTaskFromAcsTrans(Map jsonObject) {
|
||||
log.debug("ACS的receiveTaskFromAcs请求参数为:" + jsonObject);
|
||||
log.debug("ACS的receiveTaskFromAcs请求参数为:" + jsonObject);
|
||||
String device_code = (String) jsonObject.get("device_code");
|
||||
String type = (String) jsonObject.get("type");
|
||||
String group_id = (String) jsonObject.get("group_id");
|
||||
@@ -104,6 +104,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject structivtTable = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
WQLObject groupTab = WQLObject.getWQLObject("st_buss_vehiclegroup");
|
||||
|
||||
switch (type) {
|
||||
// 送料入库
|
||||
@@ -118,10 +119,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (StrUtil.equals(area_type, AreaEnum.BTHCQ.getCode())) {
|
||||
fmjToPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
// 生成到包装位的任务时,下发托盘类型给RGV
|
||||
String point_id = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("point_id");
|
||||
String material_id = structivtTable.query("struct_id ='" + point_id + "'").uniqueResult(0).getString("material_id");
|
||||
JSONObject jsonObject3 = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0);
|
||||
// 查找组盘
|
||||
JSONObject groupObj = groupTab.query("vehicle_code = '" + jsonObject3.getString("vehicle_code") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(groupObj)) {
|
||||
throw new BadRequestException("找不到组盘信息,载具号:" + jsonObject3.getString("vehicle_code"));
|
||||
}
|
||||
String material_id = groupObj.getString("material_id");
|
||||
JSONObject materiralObj1 = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
// 寻找对应的托盘类型
|
||||
// 寻找对应的托盘类型 - 托盘类型对应转换
|
||||
String vehicle_type = vehicleService.getVehicleType(materiralObj1.getString("vehicle_type"));
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
JSONArray array = new JSONArray();
|
||||
@@ -132,6 +138,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
wmsToAcsServiceImpl.action(array);
|
||||
break;
|
||||
}
|
||||
// ==========================
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
throw new BadRequestException("托盘是否满托不能为空!");
|
||||
}
|
||||
@@ -148,6 +155,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
&& !StrUtil.equals(device_code.substring(0, 4), "BTHC")) {
|
||||
material_id = materialObj.getString("material_id");
|
||||
}
|
||||
|
||||
// 如果是出窑输送线 要从组盘表里面去找物料
|
||||
if (StrUtil.equals(device_code, "CYSSX101")) {
|
||||
String vehicle_code = jsonObject.get("vehicle_code").toString();
|
||||
@@ -174,6 +182,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONObject materiralObj = WQLObject.getWQLObject("md_me_material").query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
Double stewing_time = materiralObj.getDouble("stewing_time");
|
||||
jsonObject.put("stewing_time", stewing_time);
|
||||
|
||||
// 假如是压制下料的几个位置,则要考虑是入输送线 还是入立体库
|
||||
if (StrUtil.equals(area_type, AreaEnum.YZQY.getCode()) && stewing_time <= 0) {
|
||||
// 1.首先更新所有输送线的点位状态
|
||||
@@ -204,32 +213,36 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ==========================
|
||||
// 假如是分拣机械手的下料位置,并且是满托,则去包装线
|
||||
if (StrUtil.equals("1", is_full) && StrUtil.equals(area_type, AreaEnum.FJQY.getCode())) {
|
||||
// 起点
|
||||
String vehicle_code = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("vehicle_code");
|
||||
jsonObject.put("vehicle_code", vehicle_code);
|
||||
|
||||
produceInfoByCode = this.getProduceInfoByCode(device_code);
|
||||
jsonObject.put("vehicle_type", produceInfoByCode.getString("vehicle_type"));
|
||||
toPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
|
||||
// 生成到包装位的任务时,下发托盘类型给RGV
|
||||
JSONObject vehicleObj = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code='" + vehicle_code + "'", "create_time desc").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(vehicleObj)) {
|
||||
String vehicle_type = vehicleService.getVehicleType(vehicleObj.getString("vehicle_type"));
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
JSONArray array = new JSONArray();
|
||||
jsonObject1.put("device_code", "RGV2");
|
||||
jsonObject1.put("code", "to_container_type");
|
||||
jsonObject1.put("value", vehicle_type);
|
||||
array.add(jsonObject1);
|
||||
try {
|
||||
wmsToAcsServiceImpl.action(array);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// JSONObject vehicleObj = WQLObject.getWQLObject("md_pb_vehicle").query("vehicle_code='" + vehicle_code + "'", "create_time desc").uniqueResult(0);
|
||||
// if (ObjectUtil.isNotEmpty(vehicleObj)) {
|
||||
// String vehicle_type = vehicleService.getVehicleType(vehicleObj.getString("vehicle_type"));
|
||||
// JSONObject jsonObject1 = new JSONObject();
|
||||
// JSONArray array = new JSONArray();
|
||||
// jsonObject1.put("device_code", "RGV2");
|
||||
// jsonObject1.put("code", "to_container_type");
|
||||
// jsonObject1.put("value", vehicle_type);
|
||||
// array.add(jsonObject1);
|
||||
// try {
|
||||
// wmsToAcsServiceImpl.action(array);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// 假如是分拣机械手的下料位置,则需要将点位上的托盘号写入
|
||||
if (StrUtil.equals(area_type, AreaEnum.FJQY.getCode())) {
|
||||
String vehicle_code = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("vehicle_code");
|
||||
|
||||
@@ -62,6 +62,8 @@ public abstract class AbstractAcsTask {
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setStart_device_code(json.getString("start_point_code"));
|
||||
taskDto.setNext_device_code(json.getString("next_point_code"));
|
||||
taskDto.setStart_device_code2(json.getString("start_point_code2"));
|
||||
taskDto.setNext_device_code2(json.getString("next_point_code2"));
|
||||
taskDto.setVehicle_code(json.getString("vehicle_code"));
|
||||
arr.add(taskDto);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import java.util.HashMap;
|
||||
public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = FmjToPackIngTask.class.getName();
|
||||
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
@@ -51,12 +50,6 @@ public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("update_optid", UserInfoUtil.getCurrentUserId());
|
||||
map.put("update_optname", UserInfoUtil.getNickName());
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("bill_status", "40");
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").update(map, "task_id='" + jsonTask.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
@@ -74,41 +67,6 @@ public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
startPointObj.put("vehicle_code", "");
|
||||
startPointObj.put("update_time", DateUtil.now());
|
||||
pointTab.update(startPointObj);
|
||||
///审核单据 增加库存 改变出入库表的状态
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject mstObj = mstTab.query("task_id='" + task_id + "' and is_delete='0'").uniqueResult(0);
|
||||
//审核 加库存可和用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
mstObj.put("bill_status", "50");
|
||||
mstObj.put("confirm_optid", UserInfoUtil.getCurrentUserId());
|
||||
mstObj.put("confirm_optname", UserInfoUtil.getNickName());
|
||||
mstObj.put("confirm_time", DateUtil.now());
|
||||
mstTab.update(mstObj);
|
||||
|
||||
String iostorinv_id = mstObj.getString("iostorinv_id");
|
||||
String next_point_code = mstObj.getString("end_point_code");
|
||||
String start_point_code = mstObj.getString("start_point_code");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", mstObj.getString("material_id"));
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", mstObj.getString("qty_unit_id"));
|
||||
param.put("pcsn", mstObj.getString("pcsn"));
|
||||
param.put("change_qty", mstObj.getString("qty"));
|
||||
param.put("vehicle_code", mstObj.getString("vehicle_code"));
|
||||
param.put("workprocedure_id", mstObj.getString("ivt_workprocedure_id"));
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
PointDto nextPointDto = pointService.findByCode(next_point_code);
|
||||
if (ObjectUtil.isNull(nextPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
}
|
||||
PointDto startPointDto = pointService.findByCode(start_point_code);
|
||||
if (ObjectUtil.isNull(startPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
}
|
||||
param.put("struct_id", startPointDto.getPoint_id());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_IVT);
|
||||
|
||||
|
||||
//调用mes接口
|
||||
HashMap map = new HashMap();
|
||||
map.put("vehicle_code",jsonTask.getString("vehicle_code"));
|
||||
@@ -132,20 +90,11 @@ public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
public String createTask(JSONObject form) {
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject ivt_table = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
JSONObject start_pointObj = point_table.query("point_code='" + start_point_code + "'").uniqueResult(0);
|
||||
String struct_id = start_pointObj.getString("point_id");
|
||||
JSONObject ivtObj = ivt_table.query("struct_id ='" + struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtObj)) {
|
||||
throw new BadRequestException("仓位为'" + start_point_code + "'未找到库存信息!");
|
||||
}
|
||||
String next_point_code = "BZSLW";
|
||||
String material_id = ivtObj.getString("material_id");
|
||||
String qty = ivtObj.getString("canuse_qty");
|
||||
String pcsn = ivtObj.getString("pcsn");
|
||||
String vehicle_code = ivtObj.getString("vehicle_code");
|
||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
String vehicle_code=start_pointObj.getString("vehicle_code");
|
||||
|
||||
String next_point_code = "BZSLW";
|
||||
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
@@ -156,48 +105,12 @@ public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
//创建出库单据
|
||||
JSONObject iosObj = new JSONObject();
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
iosObj.put("iostorinv_id", iostorinv_id);
|
||||
iosObj.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
iosObj.put("io_type", "1");
|
||||
iosObj.put("bill_type", BillTypeEnum.FJCK.getCode());
|
||||
iosObj.put("workprocedure_id", WorkProcedureEnum.BZGX.getId());
|
||||
iosObj.put("ivt_workprocedure_id", WorkProcedureEnum.FJGX.getId());
|
||||
iosObj.put("material_id", material_id);
|
||||
iosObj.put("vehicle_code", vehicle_code);
|
||||
iosObj.put("producetask_id", ivtObj.getString("producetask_id"));
|
||||
iosObj.put("qty", qty);
|
||||
iosObj.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
//默认是分配状态
|
||||
iosObj.put("bill_status", "20");
|
||||
iosObj.put("start_point_code", start_point_code);
|
||||
iosObj.put("end_point_code", next_point_code);
|
||||
iosObj.put("start_area", start_pointObj.getString("area_type"));
|
||||
iosObj.put("end_area", "28");
|
||||
iosObj.put("create_mode", "01");
|
||||
iosObj.put("task_id", task_id);
|
||||
iosObj.put("pcsn", pcsn);
|
||||
iosObj.put("create_id", "1");
|
||||
iosObj.put("create_name", "管理员");
|
||||
iosObj.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").insert(iosObj);
|
||||
|
||||
//加锁
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point").update(lock_map, "point_code = '" + start_point_code + "'");
|
||||
//减少库存可用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", material_id);
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
param.put("change_qty", qty);
|
||||
param.put("struct_id", start_pointObj.getString("point_id"));
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("workprocedure_id", WorkProcedureEnum.FJGX.getId());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_CAN_USE);
|
||||
|
||||
|
||||
PointService pointService = SpringContextHolder.getBean(PointService.class);
|
||||
PointDto startPoint = pointService.findByCode(start_point_code);
|
||||
|
||||
@@ -4,17 +4,27 @@ 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.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.UserInfoUtil;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.common.PointUpdateUtil;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.database.service.VehicleService;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToJnServiceImpl;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.AreaEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -30,6 +40,8 @@ import java.util.HashMap;
|
||||
@Slf4j
|
||||
public class ToPackIngTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = ToPackIngTask.class.getName();
|
||||
private final VehicleService vehicleService;
|
||||
private final WmsToAcsServiceImpl wmsToAcsServiceImpl;
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
@@ -51,6 +63,8 @@ public class ToPackIngTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
String startPointCode2 = jsonTask.getString("start_point_code2");
|
||||
String nextPointCode2 = jsonTask.getString("next_point_code2");
|
||||
// 更新任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("taskfinish_mode", taskObj.getString("taskfinish_mode"));
|
||||
@@ -65,6 +79,21 @@ public class ToPackIngTask extends AbstractAcsTask {
|
||||
// startPointObj.put("vehicle_code", "");
|
||||
startPointObj.put("update_time", DateUtil.now());
|
||||
pointTab.update(startPointObj);
|
||||
JSONObject startPointCode2Obj = pointTab.query("point_code='" + startPointCode2 + "'").uniqueResult(0);
|
||||
JSONObject nextPointCode2Obj = pointTab.query("point_code='" + nextPointCode2 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(startPointCode2Obj)) {
|
||||
startPointCode2Obj.put("lock_type", "00");
|
||||
startPointCode2Obj.put("point_status", "00");
|
||||
startPointCode2Obj.put("vehicle_code", "");
|
||||
startPointCode2Obj.put("update_time", DateUtil.now());
|
||||
pointTab.update(startPointCode2Obj);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(nextPointCode2Obj)) {
|
||||
nextPointCode2Obj.put("lock_type", "00");
|
||||
nextPointCode2Obj.put("point_status", "00");
|
||||
nextPointCode2Obj.put("update_time", DateUtil.now());
|
||||
pointTab.update(nextPointCode2Obj);
|
||||
}
|
||||
|
||||
/* // 假如起点是码垛位置则不需要更新
|
||||
if (!(StrUtil.equals(jsonTask.getString("start_point_code"), "FJJXSXLW201")
|
||||
@@ -115,6 +144,7 @@ public class ToPackIngTask extends AbstractAcsTask {
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
// 请求参数 载具、起点 物料,数量,客户,批次,创建方式 是否满托不能为空! 终点可以不为空时,入库单据编号不能为空
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
@@ -154,6 +184,76 @@ public class ToPackIngTask extends AbstractAcsTask {
|
||||
taskObj.put("create_id", UserInfoUtil.getCurrentUserId());
|
||||
taskObj.put("create_time", DateUtil.now());
|
||||
taskObj.put("is_delete", "0");
|
||||
// 寻找空载具,并设置得到的覆膜机位置
|
||||
// 线找是否有半托缓存
|
||||
String material_id = form.getString("material_id");
|
||||
String vehicle_type = form.getString("vehicle_type");
|
||||
String start_area = "";
|
||||
String point = "";
|
||||
String workprocedure_id = WorkProcedureEnum.FJGX.getId();
|
||||
JSONObject joo = pointTable.query("point_code='" + start_point_code + "'").uniqueResult(0);
|
||||
JSONObject jsonObject1 = WQL.getWO("ACSTOMES_001").addParam("flag", "1").addParam("workprocedure_id", workprocedure_id).addParam("material_id", material_id).addParam("device_id", joo.getString("device_id")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject1)) {
|
||||
// 如果有库存,则出半满托盘
|
||||
// 叫料出库
|
||||
point = jsonObject1.getString("point_code");
|
||||
vehicle_code = jsonObject1.getString("vehicle_code");
|
||||
vehicle_type = jsonObject1.getString("vehicle_type");
|
||||
taskObj.put("start_point_code2", jsonObject1.getString("point_code"));
|
||||
taskObj.put("next_point_code2", start_point_code);
|
||||
} else {
|
||||
// 找空木托盘
|
||||
// 需要更新覆膜机的托盘类型
|
||||
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "05").addParam("flag", "4")
|
||||
.process().getResultJSONArray(0);
|
||||
PointUpdateUtil.updatePoint(pointarr);
|
||||
// 需要更新堆叠位的点位状态
|
||||
JSONArray pointarr2 = WQL.getWO("ACSTOMES_001").addParam("point_code", "KTPDDW5").addParam("flag", "4")
|
||||
.process().getResultJSONArray(0);
|
||||
PointUpdateUtil.updatePoint(pointarr2);
|
||||
JSONObject workInfo = WQL.getWO("QSTRUCT_RULE").addParam("flag", "1").addParam("code", start_point_code)
|
||||
.process().uniqueResult(0);
|
||||
String device_id = workInfo.getString("device_id");
|
||||
JSONObject produceObj = WQLObject.getWQLObject("PDM_MG_produceTask").query("device_id='"
|
||||
+ device_id + "' and producetask_status in('02','03','04')").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(produceObj))
|
||||
throw new BadRequestException("设备未设置工单或者工单状态不正确,请检查LMS设备工单状态!");
|
||||
vehicle_type = produceObj.getString("vehicle_type");
|
||||
start_area = AreaEnum.MTPQ.getCode();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
param.put("area_type", start_area);
|
||||
param.put("point_code", start_point_code);
|
||||
JSONObject outStructObj = StructFindUtil.getEmptyVehicleOutStruct(param); // 找覆膜点
|
||||
if (ObjectUtil.isEmpty(outStructObj)) {
|
||||
throw new BadRequestException("未找到合适的空托盘点位");
|
||||
}
|
||||
point = outStructObj.getString("struct_code");
|
||||
taskObj.put("start_point_code2", outStructObj.getString("struct_code"));
|
||||
taskObj.put("next_point_code2", start_point_code);
|
||||
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_MTP");
|
||||
}
|
||||
// 把载具类型给RGV
|
||||
JSONObject js = new JSONObject();
|
||||
JSONArray array = new JSONArray();
|
||||
js.put("device_code", "RGV2");
|
||||
js.put("code", "to_container_type");
|
||||
js.put("value", vehicle_type);
|
||||
array.add(js);
|
||||
try {
|
||||
wmsToAcsServiceImpl.action(array);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// todo: start_point_code设置新的载具类型和载具编码
|
||||
joo.put("vehicle_code", vehicle_code);
|
||||
joo.put("vehicle_type", vehicle_type);
|
||||
WQLObject.getWQLObject("sch_base_point").update(joo);
|
||||
// 锁住点位
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point")
|
||||
.update(lock_map, "point_code = '" + point + "'");
|
||||
taskTable.insert(taskObj);
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ public class TaskDto implements Serializable {
|
||||
|
||||
/** 终点 */
|
||||
private String next_point_code;
|
||||
/** 起点 */
|
||||
private String start_point_code2;
|
||||
|
||||
/** 终点 */
|
||||
private String next_point_code2;
|
||||
|
||||
/** 载具编码 */
|
||||
private String vehicle_code;
|
||||
|
||||
@@ -14,6 +14,10 @@ public class AcsTaskDto {
|
||||
private String start_device_code;
|
||||
//下一点
|
||||
private String next_device_code;
|
||||
//起点
|
||||
private String start_device_code2;
|
||||
//下一点
|
||||
private String next_device_code2;
|
||||
//载具号
|
||||
private String vehicle_code;
|
||||
//载具类型
|
||||
|
||||
@@ -60,7 +60,8 @@ public class StructivtServiceImpl implements StructivtService {
|
||||
JSONArray newContent = new JSONArray();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
Integer stewing_time = Integer.parseInt(jsonObject.getString("stewing_time"));
|
||||
Integer stewing_time = Integer.parseInt(ObjectUtil.isNotEmpty(jsonObject.getString("stewing_time"))
|
||||
? jsonObject.getString("stewing_time") : "0");
|
||||
String instorage_time = jsonObject.getString("instorage_time");
|
||||
String now = DateUtil.now();
|
||||
try {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user