测试bug提交

This commit is contained in:
18188916393
2022-08-17 09:33:15 +08:00
parent 5a39c3c225
commit 3bd5e9827c
17 changed files with 146 additions and 299 deletions

View File

@@ -15,21 +15,25 @@ public class PointUpdateUtil {
JSONObject joo = wmsToAcsServiceImpl.queryPointStatus(arr);
JSONArray pointarr = joo.getJSONArray("data");
//JSONArray pointarr =new JSONArray();
//JSONArray pointarr =new JSONArray();
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
for (int i = 0; i < pointarr.size(); i++) {
JSONObject pointjo = pointarr.getJSONObject(i);
//String point_status = "00";
String point_status = "0"+pointjo.getString("move");
String point_status = "0" + pointjo.getString("move");
//String vehicle_code = pointjo.getString("vehicle_code");
String vehicle_code = pointjo.getString("barcode");
String device_code = pointjo.getString("device_code");
String pallet_type =pointjo.getString("pallet_type");
//将托盘类型123改为 030405,默认给01
String pallet_type = "01";
if (!StrUtil.equals("0", pointjo.getString("pallet_type"))) {
pallet_type = "0" + (pointjo.getIntValue("pallet_type") + 2);
}
pointjo.put("point_status", point_status);
JSONObject pointObj = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0);
pointObj.put("vehicle_code",vehicle_code);
pointObj.put("point_status",point_status);
pointObj.put("vehicle_type",pallet_type);
pointObj.put("vehicle_code", vehicle_code);
pointObj.put("point_status", point_status);
pointObj.put("vehicle_type", pallet_type);
pointTable.update(pointObj);
}
}

View File

@@ -86,8 +86,14 @@ public class StructFindUtil {
if (StrUtil.isEmpty(area_type)) {
throw new BadRequestException("区域不能为空!");
}
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "5")
.addParam("area_type", area_type).addParam("vehicle_type", vehicle_type).process().uniqueResult(0);
JSONObject result = new JSONObject();
if (StrUtil.equals("05", area_type)) {
result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "11")
.addParam("area_type", area_type).addParam("vehicle_type", vehicle_type).process().uniqueResult(0);
} else {
result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "5")
.addParam("area_type", area_type).addParam("vehicle_type", vehicle_type).process().uniqueResult(0);
}
return result;
}

View File

@@ -324,3 +324,26 @@ IF 输入.flag = "10"
ENDQUERY
ENDIF
IF 输入.flag = "11"
QUERY
SELECT DISTINCT
point.point_id AS struct_id,
point.point_code AS struct_code,
point.point_name AS struct_name,
point.vehicle_code
FROM
sch_base_point point
LEFT JOIN md_pb_vehicle vehicle ON vehicle.vehicle_code = point.vehicle_code
AND point.vehicle_code <> ''
WHERE
point.lock_type = '00'
AND point.point_status = '01'
OPTION 输入.area_type <> ""
point.area_type = 输入.area_type
ENDOPTION
OPTION 输入.vehicle_type <> ""
point.vehicle_type = 输入.vehicle_type
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -11,7 +11,7 @@ public interface WmsToJnService {
/**
* WMS同步jn日计划
*
* @param jsonObject 条件
* @param
* @return Map<String, Object>
*/
@@ -19,11 +19,36 @@ public interface WmsToJnService {
/**
* WMS同步jn物料
*
* @param jsonObject 条件
* @param
* @return Map<String, Object>
*/
Map<String, Object> synchroMaterial(Map whereJson);
/**
* WMS 反馈设备状态(专机agv)
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> feedBackStatus(Map whereJson);
/**
* WMS 反馈物料托盘参数信息
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> feedBackGroup(Map whereJson);
/**
* WMS 反馈搬运记录
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> feedBackCarryRecord(Map whereJson);
}

View File

@@ -118,7 +118,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (StrUtil.equals(area_type, AreaEnum.YZQY.getCode()) && stewing_time <= 0) {
//1.首先更新所有输送线的点位状态
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "07").addParam("flag", "4").process().getResultJSONArray(0);
// PointUpdateUtil.updatePoint(pointarr);
PointUpdateUtil.updatePoint(pointarr);
//2.找一个合适的输送带
JSONObject pointObj = StructFindUtil.getConveyor(materiralObj);
//如果未找到合适的输送带 就去货架
@@ -159,10 +159,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
jsonObject.put("next_point_code", device_code);
produceInfoByCode = this.getProduceInfoByCode(device_code);
//假如是码垛位的上料位,则去看看有没有当前排产单生产的物料的半满托
if (StrUtil.equals(device_code, "FJJXSSLW101") ||
StrUtil.equals(device_code, "FJJXSSLW102") ||
StrUtil.equals(device_code, "FJJXSSLW301") ||
StrUtil.equals(device_code, "FJJXSSLW302")
if (StrUtil.equals(device_code, "FJJXSXLW201") ||
StrUtil.equals(device_code, "FJJXSXLW202") ||
StrUtil.equals(device_code, "FJJXSXLW301") ||
StrUtil.equals(device_code, "FJJXSXLW301")
) {
material_id = produceInfoByCode.getString("material_id");
@@ -185,13 +185,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
//需要更新覆膜机的托盘类型
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("area_type", "05").addParam("flag", "4").process().getResultJSONArray(0);
// PointUpdateUtil.updatePoint(pointarr);
PointUpdateUtil.updatePoint(pointarr);
}
if (ObjectUtil.isEmpty(produceInfoByCode)) {
throw new BadRequestException("未找到点位为'" + device_code + "'对应机械手的生产工单!");
}
jsonObject.put("vehicle_type", produceInfoByCode.getString("vehicle_type"));
//需要更新堆叠位的点位状态
JSONArray pointarr = WQL.getWO("ACSTOMES_001").addParam("point_code", "KTPDDW5").addParam("flag", "4").process().getResultJSONArray(0);
PointUpdateUtil.updatePoint(pointarr);
callEmptyVehicleTask.createTask((JSONObject) JSON.toJSON(jsonObject));
break;
//生产rgv搬运任务
@@ -209,14 +211,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
//寻找起点
//更新所有设备的点位的状态
JSONArray pointarr = pointTable.query("area_type='07' and device_point_type ='01' ").getResultJSONArray(0);
WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl();
/* JSONArray reurnPointStatusArr = wmsToAcsService.queryPointStatus(pointarr).getJSONArray("data");
for (int i = 0; i < reurnPointStatusArr.size(); i++) {
JSONObject reurnPointStatusObj = reurnPointStatusArr.getJSONObject(i);
reurnPointStatusObj.put("update_time", DateUtil.now());
pointTable.update(reurnPointStatusObj);
}*/
JSONArray pointConveyArr = pointTable.query("area_type='07' and device_point_type ='01' ").getResultJSONArray(0);
PointUpdateUtil.updatePoint(pointConveyArr);
//假如没有设置哪个输送线先出,没有按照先进先出
JSONObject param = new JSONObject();
String rule = WQLObject.getWQLObject("sys_param").query("code='is_outrule'").uniqueResult(0).getString("value");

View File

@@ -112,4 +112,19 @@ public class WmsToJnServiceImpl implements WmsToJnService {
return null;
}
@Override
public Map<String, Object> feedBackStatus(Map whereJson) {
return null;
}
@Override
public Map<String, Object> feedBackGroup(Map whereJson) {
return null;
}
@Override
public Map<String, Object> feedBackCarryRecord(Map whereJson) {
return null;
}
}

View File

@@ -16,7 +16,8 @@
输入.flag TYPEAS s_string
输入.workprocedure_id TYPEAS s_string
输入.material_id TYPEAS s_string
输入.area_type TYPEAS s_string
输入.area_type TYPEAS s_string
输入.point_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -118,6 +119,9 @@
OPTION 输入.area_type <> ""
point.area_type = 输入.area_type
ENDOPTION
OPTION 输入.point_code <> ""
point.point_code = 输入.point_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -485,7 +485,8 @@
FROM
sch_base_point point
WHERE
point_name LIKE '人工处理位%'
point_name LIKE '分拣机械手%'
and device_point_type='01'
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -186,7 +186,7 @@ public class ProducetaskServiceImpl implements ProducetaskService {
@Override
public JSONArray getDevice1() {
WQLObject wo = WQLObject.getWQLObject("pdm_base_device");
JSONArray arr = wo.query(" is_delete = '0'", "device_code").getResultJSONArray(0);
JSONArray arr = wo.query(" is_delete = '0' and is_work_device ='1'", "device_code").getResultJSONArray(0);
return arr;
}

View File

@@ -167,7 +167,8 @@ public class CallEmptyVehicleTask extends AbstractAcsTask {
public String createTask(JSONObject form) {
//请求参数 终点不能为空 起点点位为空时,托盘类型不能为空,托盘不能为空!
String next_point_code = form.getString("next_point_code");
String vehicle_code = "";
//默认给一个测试托盘
String vehicle_code = "999";
String is_auto_issue = "1";
if (StrUtil.isEmpty(next_point_code)) {
throw new BadRequestException("终点不能为空!");
@@ -194,12 +195,12 @@ public class CallEmptyVehicleTask extends AbstractAcsTask {
// 压制工序
case YZGX:
vehicle_type = VehicleTypeEnum.GTP.getCode();
start_area = AreaEnum.DKKTTPQ.getCode();
start_area = AreaEnum.DDKTTPQ.getCode();
break;
//分拣工序
case FJGX:
//托盘类型取的物料对应的木托盘类型
JSONObject produceObj = WQLObject.getWQLObject("PDM_MG_produceTask").query("device_id='" + device_id + "' and producetask_status in('03')").uniqueResult(0);
JSONObject produceObj = WQLObject.getWQLObject("PDM_MG_produceTask").query("device_id='" + device_id + "' and producetask_status in('03','04')").uniqueResult(0);
vehicle_type = produceObj.getString("vehicle_type");
start_area = AreaEnum.MTPQ.getCode();
is_auto_issue = "0";
@@ -209,7 +210,11 @@ public class CallEmptyVehicleTask extends AbstractAcsTask {
start_area = AreaEnum.DDKTTPQ.getCode();
}
JSONObject param = new JSONObject();
param.put("vehicle_type", vehicle_type);
//如果托盘类型不是02则需要加上托盘类型
if (!StrUtil.equals(vehicle_type,"02")){
param.put("vehicle_type", vehicle_type);
}
param.put("area_type", start_area);
JSONObject outStructObj = StructFindUtil.getEmptyVehicleOutStruct(param);
if (ObjectUtil.isEmpty(outStructObj)) {
@@ -217,6 +222,9 @@ public class CallEmptyVehicleTask extends AbstractAcsTask {
}
vehicle_code = outStructObj.getString("vehicle_code");
if (StrUtil.isEmpty(vehicle_code)){
vehicle_code="999";
}
//如果是托盘区域/生成一个该类型的托盘
if (StrUtil.equals(workInfo.getString("workprocedure_code"), AreaEnum.MTPQ.getCode())) {
vehicle_code = CodeUtil.getNewCode("VEHICCLE_CODE_MTP");

View File

@@ -85,6 +85,14 @@ public class SendEmptyVehicleTask extends AbstractAcsTask {
startPointObj.put("vehicle_code", "");
pointTab.update(startPointObj);
taskTab.update(jsonTask);
//将组盘表删除
WQLObject group_Table = WQLObject.getWQLObject("st_buss_vehiclegroup");
JSONObject groupObj = group_Table.query("vehicle_code='" + vehicle_code + "' and is_delete='0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(groupObj)) {
groupObj.put("is_delete", "0");
group_Table.update(groupObj);
}
}
}

View File

@@ -39,7 +39,7 @@ public interface PointService {
/**
* 根据编码查询
* @param code code
* @param code
* @return Point
*/
PointDto findByCode(String code);

View File

@@ -1,261 +0,0 @@
package org.nl.wms.sch.task;
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.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SecurityUtils;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.dto.PointDto;
import org.nl.wms.sch.service.impl.PointServiceImpl;
import org.nl.wms.st.ivt.IvtChangeTypeEnum;
import org.nl.wms.st.ivt.StoreIvtServiceImpl;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.transaction.annotation.Transactional;
/**
* 入库任务生成
*/
public class InTask extends AbstractAcsTask {
private final String THIS_CLASS = InTask.class.getName();
@Transactional
@Override
public void updateTaskStatus(JSONObject taskObj, String status) {
/**
*改变任务状态
**/
String task_id = taskObj.getString("task_id");
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
//更新任务状态为执行中
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
}
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
// 更新任务状态为完成
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("taskfinish_mode", taskObj.getString("taskfinish_mode"));
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("remark", "任务执行完成");
///审核单据 增加库存 改变主表的状态
JSONObject disjo = WQLObject.getWQLObject("st_buss_iostoredis").query("task_id='" + task_id + "'").uniqueResult(0);
String bill_uuid = disjo.getString("bill_uuid");
WQLObject mstTab = WQLObject.getWQLObject("st_buss_iostoremst");
WQLObject dtlTab = WQLObject.getWQLObject("st_buss_iostoredtl");
//审核 加库存可和用数量
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
disjo.put("is_finishtask", "1");
WQLObject.getWQLObject("st_buss_iostoredis").update(disjo);
String billdtl_uuid = disjo.getString("billdtl_uuid");
String realassign_qty = disjo.getString("realassign_qty");
String next_point_code = disjo.getString("next_point_code");
String start_point_code = disjo.getString("start_point_code");
JSONObject param = new JSONObject();
param.put("material_uuid", disjo.getString("material_uuid"));
param.put("bill_uuid", bill_uuid);
param.put("qty_unit_uuid", disjo.getString("qty_unit_uuid"));
param.put("pcsn", disjo.getString("pcsn"));
param.put("change_qty", realassign_qty);
param.put("vehicle_code", disjo.getString("vehicle_code"));
param.put("barcode", disjo.getString("barcode"));
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_uuid", nextPointDto.getPoint_uuid());
ivtService.addIvtFlow(param, IvtChangeTypeEnum.ADD_IVT_AND_CAN_USE);
JSONObject dtlObj = dtlTab.query("billdtl_uuid='" + billdtl_uuid + "'").uniqueResult(0);
JSONObject disjoo = WQLObject.getWQLObject("st_buss_iostoredis").query("billdtl_uuid='" + billdtl_uuid + "' and is_finishtask<>'1' and is_delete<>'1'").uniqueResult(0);
//假如所有的分配都完成了任务,更新明细表
double qty = Double.valueOf(dtlObj.getString("qty"));
double assign_qty = Double.valueOf(dtlObj.getString("assign_qty"));
if (ObjectUtil.isEmpty(disjoo) && (qty == assign_qty)) {
dtlObj.put("bill_status", "40");
dtlObj.put("is_can_back", "1");
dtlTab.update(dtlObj);
}
//该表主表的状态
if (StrUtil.isNotEmpty(bill_uuid)) {
JSONObject mstObj = mstTab.query("bill_uuid='" + bill_uuid + "'").uniqueResult(0);
JSONObject dtlObj1 = dtlTab.query("bill_uuid='" + bill_uuid + "' and bill_status<>'40'").uniqueResult(0);
if (ObjectUtil.isNull(dtlObj1)) {
mstObj.put("bill_status", "40");
mstTab.update(mstObj);
}
}
//解锁仓位,托盘信息,回写到点位上去
String vehicle_code = jsonTask.getString("vehicle_code");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
JSONObject endpointObj = pointTab.query("point_code='" + jsonTask.getString("next_point_code") + "'").uniqueResult(0);
endpointObj.put("lock_type", "00");
endpointObj.put("point_status", "02");
endpointObj.put("vehicle_code", vehicle_code);
pointTab.update(endpointObj);
JSONObject startPointObj = pointTab.query("point_code='" + jsonTask.getString("start_point_code") + "'").uniqueResult(0);
startPointObj.put("lock_type", "00");
startPointObj.put("point_status", "00");
startPointObj.put("vehicle_code", "");
pointTab.update(startPointObj);
//修改任务表状态为 完成
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
}
}
@Override
public void findStartPoint() {
}
@Transactional
@Override
public void findNextPoint() {
String task_status = TaskStatusEnum.SURE_START.getCode();
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
WQLObject disTab = WQLObject.getWQLObject("st_buss_IOStoreDis");
WQLObject dtlTab = WQLObject.getWQLObject("st_buss_iostoredtl");
JSONArray taskArry = taskTab.query("task_status='" + task_status + "' AND handle_class='" + THIS_CLASS + "' AND is_delete='0' ").getResultJSONArray(0);
for (int i = 0; i < taskArry.size(); i++) {
JSONObject jsonTask = taskArry.getJSONObject(i);
String task_id = jsonTask.getString("task_id");
JSONArray disarr = disTab.query("task_id='" + task_id + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(disarr)) {
continue;
}
//寻找一个合适的仓位
JSONObject param = new JSONObject();
param.put("area_type", jsonTask.getString("buss_area_type"));
param.put("height", disarr.getJSONObject(0).getString("height"));
JSONObject structObj = new JSONObject();
/* JSONArray structarr = StructFindUtil.getInStruct(param);
if (ObjectUtil.isEmpty(structarr)) {
continue;
}
structObj = structarr.getJSONObject(0);*/
String struct_code = structObj.getString("struct_code");
String bill_uuid = "";
for (int j = 0; j < disarr.size(); j++) {
JSONObject json = disarr.getJSONObject(j);
bill_uuid = json.getString("bill_uuid");
json.put("task_id", task_id);
json.put("next_point_code", struct_code);
disTab.update(json);
String billdtl_uuid = json.getString("billdtl_uuid");
//修改明细表中的状态
JSONObject dtlObj = dtlTab.query("billdtl_uuid='" + billdtl_uuid + "'").uniqueResult(0);
dtlObj.put("bill_status", "30");
dtlTab.update(dtlObj);
}
//该表主表的状态
WQLObject mstTab = WQLObject.getWQLObject("st_buss_IOStoreMst");
if (!StrUtil.isEmpty(bill_uuid)) {
JSONObject mstObj = mstTab.query("bill_uuid='" + bill_uuid + "'").uniqueResult(0);
JSONObject dtlObj = dtlTab.query("bill_uuid='" + bill_uuid + "' and bill_status<>'30' and bill_status<>'40'").uniqueResult(0);
if (dtlObj == null) {
mstObj.put("bill_status", "30");
mstTab.update(mstObj);
}
}
//加锁
JSONObject pointObj = pointTab.query("point_code ='" + struct_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(pointObj)) {
continue;
}
pointObj.put("lock_type", "01");
pointTab.update(pointObj);
//更新任务
jsonTask.put("next_point_code", struct_code);
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
taskTab.update(jsonTask);
}
}
@Override
public String createTask(JSONObject form) {
JSONObject taskObj = new JSONObject();
//申请任务的时候ACS会传任务标识
if (StrUtil.isNotEmpty(form.getString("task_id"))) {
taskObj.put("task_id", form.getString("task_id"));
} else {
taskObj.put("task_id", IdUtil.getSnowflake(1, 1).nextId() + "");
}
String task_status = TaskStatusEnum.SURE_START.getCode();
String next_point_code = form.getString("next_point_code");
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
taskObj.put("task_type", TaskTypeEnum.IN_TASK.getCode());
taskObj.put("acs_task_type", form.getString("acs_task_type"));
String taskdtl_type = "";
taskObj.put("taskdtl_type", taskdtl_type);
//终点不为空,则代表起点终点都确定,
if (!StrUtil.isEmpty(next_point_code)) {
task_status = TaskStatusEnum.START_AND_POINT.getCode();
}
taskObj.put("task_status", task_status);
taskObj.put("start_point_code", form.getString("start_point_code"));
taskObj.put("next_point_code", form.getString("next_point_code"));
taskObj.put("vehicle_code", form.getString("vehicle_code"));
taskObj.put("create_name", SecurityUtils.getNickName());
taskObj.put("create_id", SecurityUtils.getCurrentUserId());
taskObj.put("create_time", DateUtil.now());
taskObj.put("update_optid",SecurityUtils.getCurrentUserId());
taskObj.put("update_name", SecurityUtils.getNickName());
taskObj.put("update_time", DateUtil.now());
taskObj.put("handle_class", THIS_CLASS);
//任务基础表【sch_base_task】
WQLObject.getWQLObject("sch_base_task").insert(taskObj);
return taskObj.getString("task_id");
}
@Override
public void forceFinish(String task_id) {
if (StrUtil.isEmpty(task_id)) {
throw new BadRequestException("任务id不能为空");
}
JSONObject taskjo = WQLObject.getWQLObject("sch_base_task").query("task_id='" + task_id + "'").uniqueResult(0);
taskjo.getString("taskfinish_mode");
this.updateTaskStatus(taskjo, TaskStatusEnum.FINISHED.getCode());
}
@Override
public void pullBack(String task_id) {
}
@Override
public void cancel(String task_id) {
}
}