apt:输送线任务改成异步调用/刻字空框送回不做点位校验;
This commit is contained in:
@@ -73,4 +73,11 @@ public interface WmsToAcsService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject request(JSONObject arr,String url);
|
||||
|
||||
/**
|
||||
* 异步入库
|
||||
* @param arr
|
||||
* @param url
|
||||
*/
|
||||
void asyncRequest(JSONObject arr,String url);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
package org.nl.wms.ext_manage.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
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.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.AcsUtil;
|
||||
import org.nl.common.utils.AsyncHttpRequest;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
@Service
|
||||
@@ -145,5 +154,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService{
|
||||
public JSONObject request(JSONObject arr, String url) {
|
||||
return AcsUtil.notifyAcs(url, arr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void asyncRequest(JSONObject arr, String api) {
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_ACS").getValue();
|
||||
if (StrUtil.equals(StatusEnum.STATUS_FLASE.getCode(), isConnect)) {
|
||||
return;
|
||||
}
|
||||
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
|
||||
Future<HttpResponse> execute = AsyncHttpRequest.post(acsUrl + api, arr.toString()).execute(null);
|
||||
log.info("异步下发ACS参数----------------------------------------+"+acsUrl+",---"+arr.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.mps_manage.other.service.orderExt.IMpsSaleOrderIcExtService;
|
||||
import org.nl.wms.mps_manage.other.service.orderExt.dao.MpsSaleOrderIcExt;
|
||||
import org.nl.wms.mps_manage.saleorder.service.IMpsSaleOrderService;
|
||||
import org.nl.wms.mps_manage.saleorder.service.dao.MpsSaleOrder;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -37,7 +41,7 @@ public class MpsSaleOrderIcExtController {
|
||||
@Autowired
|
||||
private IMpsSaleOrderIcExtService extService;
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
private IMpsSaleOrderService saleOrderService;
|
||||
|
||||
@PostMapping
|
||||
@Log("新增订单扩展表")
|
||||
@@ -51,9 +55,13 @@ public class MpsSaleOrderIcExtController {
|
||||
@Log("新增订单扩展表")
|
||||
//("新增订单扩展表")
|
||||
public ResponseEntity<Object> query(@RequestBody JSONObject whereJson) {
|
||||
MpsSaleOrderIcExt one = extService.getOne(new QueryWrapper<MpsSaleOrderIcExt>()
|
||||
Map<String, Object> map = extService.getMap(new QueryWrapper<MpsSaleOrderIcExt>()
|
||||
.eq("sale_id", whereJson.getString("sale_id")).eq("material_code", whereJson.getString("material_code")));
|
||||
return new ResponseEntity<>(one,HttpStatus.OK);
|
||||
if (map==null){
|
||||
MpsSaleOrder saleOrder = saleOrderService.getById(whereJson.getString("sale_id"));
|
||||
map= MapOf.of("sale_code",saleOrder.getSale_code(),"material_code",whereJson.getString("material_code"),"bar_code","","print_no",0,"orderext_id","");
|
||||
}
|
||||
return new ResponseEntity<>(map,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getExtList")
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
@@ -38,10 +39,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@@ -191,14 +190,48 @@ public class TmpKZController {
|
||||
@Log("手动送空框")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendVechile(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/kz/resend")
|
||||
@Log("刻字任务重新下发")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> resend(@RequestBody JSONObject param){
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
SchBaseTask baseTask = taskService.getById(param.getString("task_id"));
|
||||
if (baseTask.getTask_status().equals(StatusEnum.TASK_FINISH.getCode())){
|
||||
throw new BadRequestException("任务已经完成");
|
||||
};
|
||||
if (baseTask.getTask_type().equals(AcsTaskEnum.TASK_Engrave_CALL.getCode())){
|
||||
//下发
|
||||
Map<String,String> qtyArr = JSONObject.parseObject(baseTask.getQtyArr(), Map.class);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("start_point_code", baseTask.getPoint_code1());
|
||||
jo.put("task_code", baseTask.getTask_code());
|
||||
jo.put("all_weight", baseTask.getMaterial_qty().intValue());
|
||||
String[] to_sort_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
String[] to_devices_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
String[] to_weight_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
List<String> sort = qtyArr.keySet().stream().sorted(Comparator.comparingInt(key -> Integer.valueOf(key.substring(key.lastIndexOf("_") + 1)))).collect(Collectors.toList());
|
||||
for (int i1 = 0; i1 < sort.size(); i1++) {
|
||||
String key = sort.get(i1);
|
||||
to_sort_array[i1] = String.valueOf(i1+1);
|
||||
to_devices_array[i1] = String.valueOf(key);
|
||||
to_weight_array[i1] = String.valueOf(new BigDecimal(qtyArr.get(key)));
|
||||
}
|
||||
jo.put("to_sort_array", Arrays.stream(to_sort_array).collect(Collectors.joining(",")));
|
||||
jo.put("to_devices_array",Arrays.stream(to_devices_array).collect(Collectors.joining(",")));
|
||||
jo.put("to_weight_array", Arrays.stream(to_weight_array).collect(Collectors.joining(",")));
|
||||
JSONObject result = wmsToAcsService.request(jo, "api/wms/engravingIn");
|
||||
if (!result.getString("status").equals("200")){
|
||||
log.error("刻字上料输送线任务下发异常:{}",result.getString("message"));
|
||||
baseTask.setRemark(result.getString("message"));
|
||||
taskService.updateById(baseTask);
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
}
|
||||
}else {
|
||||
taskService.operation(MapOf.of("method_name","immediateNotifyAcs","task_id",param.getString("task_id")));
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,12 +98,7 @@ public class EngraveSendEmpTask extends AbstractAcsTask {
|
||||
String start_point_code = param.getString("device_code");
|
||||
//?刻字满料请求:可以存在多个任务?
|
||||
List<SchBaseTask> list = taskService.list(new QueryWrapper<SchBaseTask>()
|
||||
.lt("task_status", StatusEnum.TASK_FINISH.getCode())
|
||||
.and(wa->wa
|
||||
.eq("point_code1", param.getString("device_code"))
|
||||
.or()
|
||||
.eq("point_code3", param.getString("device_code")))
|
||||
);
|
||||
.lt("task_status", StatusEnum.TASK_FINISH.getCode()).eq("task_type",AcsTaskEnum.TASK_Engrave_EMPTY.getCode()));
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException(String.format("设备%s存在未完成任务"+list.stream().map(SchBaseTask::getTask_id).collect(Collectors.toList()).toString(), param.getString("device_code")));
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ public class EngraveTranSportTask extends AbstractAcsTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService materialbaseService;
|
||||
@Autowired
|
||||
private WmsToAcsService wms;
|
||||
@@ -94,22 +92,17 @@ public class EngraveTranSportTask extends AbstractAcsTask {
|
||||
String[] to_sort_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
String[] to_devices_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
String[] to_weight_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||
int i=0;
|
||||
List<String> sort = qtyArr.keySet().stream().sorted(Comparator.comparingInt(key -> Integer.valueOf(key.substring(key.lastIndexOf("_") + 1)))).collect(Collectors.toList());
|
||||
for (int i1 = 0; i1 < sort.size(); i1++) {
|
||||
String key = sort.get(i1);
|
||||
to_sort_array[i] = String.valueOf(i1+1);
|
||||
to_devices_array[i] = String.valueOf(key);
|
||||
to_weight_array[i] = String.valueOf(new BigDecimal(qtyArr.get(key)));
|
||||
to_sort_array[i1] = String.valueOf(i1+1);
|
||||
to_devices_array[i1] = String.valueOf(key);
|
||||
to_weight_array[i1] = String.valueOf(new BigDecimal(qtyArr.get(key)));
|
||||
}
|
||||
jo.put("to_sort_array", Arrays.stream(to_sort_array).collect(Collectors.joining(",")));
|
||||
jo.put("to_devices_array",Arrays.stream(to_devices_array).collect(Collectors.joining(",")));
|
||||
jo.put("to_weight_array", Arrays.stream(to_weight_array).collect(Collectors.joining(",")));
|
||||
JSONObject result = wms.request(jo, "api/wms/engravingIn");
|
||||
if (!result.getString("status").equals("200")){
|
||||
log.error("刻字上料输送线任务下发异常:{}",result.getString("message"));
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
}
|
||||
wms.asyncRequest(jo, "api/wms/engravingIn");
|
||||
taskService.save(baseTask);
|
||||
return baseTask.getTask_id();
|
||||
}catch (Exception ex){
|
||||
|
||||
Reference in New Issue
Block a user