init project

This commit is contained in:
zhangzhiqiang
2023-05-04 13:56:29 +08:00
parent 16906b4039
commit abc2af1ceb
8 changed files with 46 additions and 18 deletions

View File

@@ -49,7 +49,7 @@ public class AgvInstService {
// 没有则创建缓存架任务
public void fullMaster(JSONObject task){
String point_code = task.getString("point_code1");
String quantity = task.getString("quantity");
String quantity = task.getString("material_qty");
SchBasePoint devicePoint = basePointService.getOne(new QueryWrapper<SchBasePoint>()
.eq("point_code", point_code)
.eq("is_delete", "0")

View File

@@ -25,13 +25,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService{
for (Object o : arr) {
JSONObject task = (JSONObject) o;
JSONObject param = new JSONObject(MapOf.of("task_id", task.getString("task_id")
, "acs_task_type", task.getString("acs_task_type")
, "task_type", task.getString("acs_task_type")//垃圾
, "task_code", task.getString("task_code")
, "start_point_code", task.getString("point_code1")//起点
, "put_point_code", task.getString("point_code2")//到料
, "next_point_code", task.getString("point_code3")//空盘返回点
, "task_group_id", StringUtils.isBlank(task.getString("task_group_id"))? IdUtil.getStringId():task.getString("task_group_id")
, "task_type", task.getString("task_type")
, "priority", task.getString("priority")
, "is_send", task.getString("is_send")
, "vehicle_code", task.getString("vehicle_code")

View File

@@ -3,6 +3,8 @@ package org.nl.wms.product_manage.sch.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.AcsTaskEnum;
@@ -68,18 +70,22 @@ public class SpeMachineryTask extends AbstractAcsTask {
String type = param.getString("type");
JSONObject order = WQLObject.getWQLObject("PDM_produce_workOrder").query("workorder_code = '" + param.getString("workorder_code") + "' and is_delete = 0 and workorder_status != "+StatusEnum.TASK_FINISH.getCode()).uniqueResult(0);
Assert.notNull(order, String.format("下发工单%s不存在未完成工单", param.getString("workorder_code")));
JSONArray chectIndDatabase = WQLObject.getWQLObject("SCH_BASE_Task").query((AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type) ? "point_code1" : "point_code2") + "= '" + point_code + "' and task_status < " + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(chectIndDatabase)){
Assert.notNull(order, String.format("设备%s存在未完成任务", param.getString("point_code")));
}
JSONObject form = null;
if (AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type)){
JSONObject empPoint = WQL.getWO("sch_point").addParamMap(MapOf.of("flag", "2", "point_code", point_code, "point_type", StatusEnum.POINT_LOCATION_EMP.getCode())).process().uniqueResult(0);
form = new JSONObject(MapOf.of("start_point_code",point_code,
"next_point_code","","return_point_code", empPoint,"vehicle_code",
"","product_area","quantity", quantity,order.getString("product_area"),"type",type,"material_id", order.getString("material_id")));
"next_point_code","","return_point_code", empPoint.getString("point_code"),"vehicle_code",
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
}
if (AcsTaskEnum.REQUEST_CALLTYPE_EMP.getCode().equals(type)){
form = new JSONObject(MapOf.of("start_point_code","",
"next_point_code",point_code,"return_point_code", "","vehicle_code",
"","product_area","quantity", quantity,order.getString("product_area"),"type",type,"material_id", order.getString("material_id")));
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
}
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = packageParam(form, taskId);
@@ -111,6 +117,7 @@ public class SpeMachineryTask extends AbstractAcsTask {
task.put("vehicle_code2", form.getString("vehicle_code2"));
task.put("vehicle_code", form.getString("vehicle_code"));
task.put("material_id", form.getString("material_id"));
task.put("material_qty", form.getString("quantity"));
task.put("handle_class", this.getClass().getName());
task.put("finished_type", "1");
task.put("is_delete", StatusEnum.LOCK_OFF.getCode());
@@ -161,6 +168,7 @@ public class SpeMachineryTask extends AbstractAcsTask {
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));
break;
default:
log.error(OPT_NAME+"未定义任务状态:{}",sta);
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
@@ -196,6 +204,7 @@ public class SpeMachineryTask extends AbstractAcsTask {
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));
break;
default:
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
}

View File

@@ -6,12 +6,16 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
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.ext.acs.service.WmsToAcsService;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@@ -80,7 +84,8 @@ public class TaskScheduleService {
List<Object> notMerge = new ArrayList<>();//单独下发的任务
List<Object> Merge = new ArrayList<>();//单独下发的任务
List<Object> waitingTask = new ArrayList<>();//可合并,但是只有单条任务
Map<String, String> taskGroupMap = new HashMap<>();
Map<String, String> taskGroupMap = array.stream().filter(a-> StringUtils.isNotEmpty(((JSONObject)a).getString("task_group_id"))).collect(HashMap::new, (k, v) -> k.put(((JSONObject)v).getString("task_id"), ((JSONObject)v).getString("task_group_id")), HashMap::putAll);
for (Object o : array) {
String taskGroupId = IdUtil.getStringId();
JSONObject task = (JSONObject) o;
@@ -122,6 +127,9 @@ public class TaskScheduleService {
String waitingTaskId = waitingTask.stream().map(a -> ((JSONObject) a).getString("task_id")).collect(Collectors.joining(","));
String MergeId = Merge.stream().map(a -> ((JSONObject) a).getString("task_id")).collect(Collectors.joining(","));
log.info("TaskScheduleService#taskPublish notMerge:{},waitingTask:{},merge:{}",notMergeID,waitingTaskId,MergeId);
notMerge.forEach(a->{
((JSONObject)a).put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
});
Merge.addAll(notMerge);
JSONArray jsonArray = new JSONArray(Merge);
//批量更新任务状态is_send,task_group_id
@@ -132,7 +140,11 @@ public class TaskScheduleService {
taskTable.update(task1,"task_id = '"+task1.getString("task_id")+"'");
}
//缓存线任务待确认是否生成多个
wmsToAcsService.issueTaskToAcs(jsonArray);
Map<String, Object> resp = wmsToAcsService.issueTaskToAcs(jsonArray);
// if (((int)resp.get("status")) == (HttpStatus.BAD_REQUEST.value())){
// Object errArr = resp.get("errArr");
// throw new BadRequestException(String.valueOf(resp.get("message")));
// }
}
}
}

View File

@@ -105,7 +105,7 @@
ENDOPTION
GROUP BY
device_code
HAVING currentQty> 输入.qty
HAVING currentQty >= 输入.qty
ENDSELECT
ENDQUERY
ENDIF
@@ -136,7 +136,7 @@
LEFT JOIN sch_base_point ON sch_base_region.region_code = sch_base_point.region_code
LEFT JOIN sch_base_point b ON sch_base_region.region_code = b.region_code AND b.point_code IN ( 输入.point_codes )
WHERE
sch_base_region.MERGE = '1'
sch_base_region.is_merge = '1'
AND sch_base_point.point_code IN ( 输入.point_codes )
GROUP BY sch_base_point.point_code
ENDSELECT

View File

@@ -52,13 +52,8 @@
<result column="updateTime" property="updateTime" />
<result column="extpersonId" property="extpersonId" />
<result column="extuserId" property="extuserId" />
<collection property="depts" ofType="org.nl.wms.system_manage.service.dept.dao.SysDept">
<id property="deptId" column="deptId"/>
<result column="deptName" property="name"/>
</collection>
<collection property="roles" ofType="org.nl.wms.system_manage.service.role.dao.SysRole">
<id property="roleId" column="roleId"/>
</collection>
<collection property="depts" ofType="org.nl.wms.system_manage.service.dept.dao.SysDept" column="userId" select="selectDept"></collection>
<collection property="roles" ofType="org.nl.wms.system_manage.service.role.dao.SysRole" column="userId" select="selectRole"></collection>
</resultMap>
<select id="getUserDetail" resultMap="UserDetail">
SELECT
@@ -90,7 +85,20 @@
</if>
</where>
</select>
<select id="selectDept" resultType="org.nl.wms.system_manage.service.dept.dao.SysDept">
select
sys_dept.dept_id as deptId,
sys_dept.name as name
from sys_dept
left join sys_user_dept
on sys_user_dept.dept_id = sys_dept.dept_id
where user_id = #{userId}
</select>
<select id="selectRole" resultType="org.nl.wms.system_manage.service.role.dao.SysRole">
select role_id as roleId
from sys_users_roles
where user_id = #{userId}
</select>
<select id="getDetailForMap" resultType="java.util.Map">
SELECT
<include refid="Base_Column_List"/>