Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -12,9 +12,11 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum AcsTaskEnum {
|
||||
UNDEFINED("0","未定义类型"),
|
||||
//任务类型
|
||||
//任务类型:3个点,任务编号,无需载具
|
||||
PRODUCT_MAC("1","专机-专机任务"),
|
||||
//3个点,任务编号,缓存线空载具列表
|
||||
PRODUCT_CACHE("2","专机-缓存线任务"),
|
||||
//3个点,任务编号,缓存线满料载具列表
|
||||
CACHELINE_OUT("3","缓存线出库任务"),
|
||||
|
||||
//回调状态
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.AcsUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -17,6 +18,19 @@ import java.util.Map;
|
||||
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> issueTaskToAcs(JSONArray arr) {
|
||||
JSONArray form = new JSONArray();
|
||||
for (Object o : arr) {
|
||||
JSONObject task = (JSONObject) o;
|
||||
JSONObject param = new JSONObject(MapOf.of("task_id", task.getString("task_id")
|
||||
, "task_type", task.getString("task_type")
|
||||
, "start_point_code", task.getString("point_code1")
|
||||
, "next_point_code", task.getString("point_code2")
|
||||
, "return_point_code", task.getString("point_code3")
|
||||
, "task_group_id", task.getString("task_group_id")
|
||||
, "vehicle_code", task.getString("vehicle_code")
|
||||
));
|
||||
form.add(param);
|
||||
}
|
||||
String api = "api/wms/task";
|
||||
return AcsUtil.notifyAcs(api, arr);
|
||||
}
|
||||
|
||||
@@ -42,31 +42,24 @@
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
PDM_BI_Device device
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.search <> ""
|
||||
(device.device_code like "%" 输入.search "%" or
|
||||
device.device_name like "%" 输入.search "%")
|
||||
ENDOPTION
|
||||
OPTION 输入.workprocedure_id <> ""
|
||||
(device.workprocedure_id = 输入.workprocedure_id)
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
device.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
PDM_BI_Device device
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.search <> ""
|
||||
(device.device_code like "%" 输入.search "%" or
|
||||
device.device_name like "%" 输入.search "%")
|
||||
ENDOPTION
|
||||
OPTION 输入.workprocedure_id <> ""
|
||||
(device.workprocedure_id = 输入.workprocedure_id)
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
device.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
UPDATE pdm_bi_device
|
||||
SET deviceoutstor_qty = deviceoutstor_qty
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -46,6 +46,7 @@ public class TaskScheduleService {
|
||||
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray all = taskTable.query("task_type < '" + StatusEnum.TASK_PUBLISH + "'").getResultJSONArray(0);
|
||||
//分区域:不同区域调用不同acs接口
|
||||
log.info("TaskScheduleService#taskPublish all_task:{}",all.size());
|
||||
Map<String, List<Object>> areaCollent = all.stream().collect(Collectors.groupingBy(o -> ((JSONObject) o).getString("product_area")));
|
||||
for (String area : areaCollent.keySet()) {
|
||||
List<Object> array = areaCollent.get(area);
|
||||
@@ -56,9 +57,9 @@ public class TaskScheduleService {
|
||||
Map<String, List<Object>> pointRegionCollent = needMergeCollect.stream().collect(Collectors.groupingBy(o -> ((JSONObject) o).getString("point_code")));
|
||||
Set<String> mergePointCollent = needMergeCollect.stream().map(item -> ((JSONObject) item).getString("point_code")).collect(Collectors.toSet());
|
||||
//合并下发的任务
|
||||
ArrayList<JSONObject> notMerge = new ArrayList<>();//单独下发的任务
|
||||
ArrayList<JSONObject> Merge = new ArrayList<>();//单独下发的任务
|
||||
ArrayList<JSONObject> waitingTask = new ArrayList<>();//可合并,但是只有单条任务
|
||||
List<Object> notMerge = new ArrayList<>();//单独下发的任务
|
||||
List<Object> Merge = new ArrayList<>();//单独下发的任务
|
||||
List<Object> waitingTask = new ArrayList<>();//可合并,但是只有单条任务
|
||||
Map<String, String> taskGroupMap = new HashMap<>();
|
||||
for (Object o : array) {
|
||||
String taskGroupId = IdUtil.getStringId();
|
||||
@@ -88,7 +89,7 @@ public class TaskScheduleService {
|
||||
}
|
||||
//开始下发:处理waitingTask:如果创建时间>2分钟:则改单独下发
|
||||
if (waitingTask.size()>1){
|
||||
List<JSONObject> needPublish = waitingTask.stream().filter(a -> a.getString("create_time") == DateUtil.now()).collect(Collectors.toList());
|
||||
List<Object> needPublish = waitingTask.stream().filter(a -> ((JSONObject)a).getString("create_time") == DateUtil.now()).collect(Collectors.toList());
|
||||
notMerge.addAll(needPublish);
|
||||
}
|
||||
String notMergeID = notMerge.stream().map(a -> ((JSONObject) a).getString("task_id")).collect(Collectors.joining(","));
|
||||
@@ -98,18 +99,8 @@ public class TaskScheduleService {
|
||||
//下发任务:一次暂时下发十条:同一个区域任务不超过10条
|
||||
JSONArray form = new JSONArray();
|
||||
Merge.addAll(notMerge);
|
||||
for (JSONObject task : Merge) {
|
||||
JSONObject param = new JSONObject(MapOf.of("task_id", task.getString("task_id")
|
||||
, "task_type", task.getString("task_type")
|
||||
, "start_point_code", task.getString("point_code1")
|
||||
, "next_point_code", task.getString("point_code2")
|
||||
, "return_point_code", task.getString("point_code3")
|
||||
, "task_group_id", task.getString("task_group_id")
|
||||
, "vehicle_code", task.getString("vehicle_code")
|
||||
));
|
||||
form.add(param);
|
||||
}
|
||||
wmsToAcsService.issueTaskToAcs(form);
|
||||
JSONArray jsonArray = new JSONArray(Merge);
|
||||
wmsToAcsService.issueTaskToAcs(jsonArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user