opt:拣选出库,ACS交互
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
package org.nl.common.base;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.unit.DataUnit;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -127,6 +125,14 @@ public class ResponseData<T> implements Serializable {
|
||||
rspData.setRespCode(1);
|
||||
return new ResponseEntity(rspData, org.springframework.http.HttpStatus.OK);
|
||||
}
|
||||
public static ResponseEntity ReqError(String msg) {
|
||||
ResponseData rspData = new ResponseData<>();
|
||||
rspData.setCode(HttpStatus.BAD_REQUEST.value());
|
||||
rspData.setMessage(msg);
|
||||
rspData.setRespMsg(msg);
|
||||
rspData.setRespCode(1);
|
||||
return new ResponseEntity(rspData, org.springframework.http.HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
public static ResponseEntity buildMsg(String msg) {
|
||||
ResponseData rspData = new ResponseData<>();
|
||||
rspData.setCode(HttpStatus.OK.value());
|
||||
|
||||
@@ -55,17 +55,16 @@ public class AcsUtil {
|
||||
final HttpResponse execute = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute();
|
||||
JSONObject result = JSONObject.parseObject(execute.body());
|
||||
if (execute.getStatus() == HttpStatus.OK.value()){
|
||||
JSONObject result = JSONObject.parseObject(execute.body());
|
||||
final Integer status = result.getInteger("status");
|
||||
if (Integer.valueOf(HttpStatus.OK.value()).equals(status)){
|
||||
return ResponseData.build(HttpStatus.OK);
|
||||
}else {
|
||||
JSONObject errorMap = result.getJSONObject("data");
|
||||
return ResponseData.build(errorMap,HttpStatus.BAD_REQUEST);
|
||||
return ResponseData.ReqError(result.getString("message"));
|
||||
}
|
||||
}else {
|
||||
return ResponseData.build("接口请求异常",HttpStatus.CONFLICT);
|
||||
return ResponseData.ReqError(result.getString("message"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//网络不通
|
||||
|
||||
@@ -305,6 +305,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse backMaterial(JSONObject whereJson) {
|
||||
String structCode = whereJson.getString("struct_code");
|
||||
String vehicleCode = whereJson.getString("vehicle_code");
|
||||
@@ -318,10 +319,11 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
if (!iStructattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getStoragevehicle_code, vehicleCode)
|
||||
.eq(Structattr::getStruct_code, structCode)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.and(w -> w.isNull(Structattr::getStoragevehicle_code)
|
||||
.or().eq(Structattr::getStoragevehicle_code, ""))
|
||||
|
||||
)) throw new BadRequestException("库位不存在或被占用");
|
||||
)) throw new BadRequestException("库位不存在或被占用,任务未完成");
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.core.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.core.tasks.PdaPointTask;
|
||||
import org.nl.wms.sch_manage.service.core.tasks.VehicleOutTask;
|
||||
@@ -150,6 +151,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -103,12 +103,12 @@ public abstract class AbstractTask {
|
||||
.set(SchBaseTask::getRemark,"")
|
||||
.in(SchBaseTask::getTask_code,taskDtoList.stream().map(AcsTaskDto::getTask_code).collect(Collectors.toList())));
|
||||
}else {
|
||||
JSONObject body = (JSONObject) response.getBody();
|
||||
JSONObject body = JSONObject.parseObject(JSONObject.toJSONString(response.getBody())) ;
|
||||
for (String code : body.keySet()) {
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getRemark,body.getString(code))
|
||||
.set(SchBaseTask::getRemark,body.getString("respMsg"))
|
||||
.set(SchBaseTask::getUpdate_time,DateUtil.now())
|
||||
.eq(SchBaseTask::getTask_code,code));
|
||||
.eq(SchBaseTask::getTask_id,task_id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.IdUtil;;
|
||||
@@ -46,7 +47,11 @@ public class StOutTask extends AbstractTask {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(json.getString("TaskCode"));
|
||||
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||
if (StringUtils.isEmpty(json.getString("task_status"))) {
|
||||
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||
} else {
|
||||
task.setTask_status(json.getString("task_status"));
|
||||
}
|
||||
task.setConfig_code(json.getString("task_type"));
|
||||
task.setPoint_code1(json.getString("PickingLocation"));
|
||||
task.setPoint_code2(json.getString("PlacedLocation"));
|
||||
|
||||
@@ -609,6 +609,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
for (String storageVehicleCode : groupDis.keySet()) {
|
||||
List<IOStorInvDis> disList = groupDis.get(storageVehicleCode);
|
||||
IOStorInvDis item = disList.get(0);
|
||||
Structattr struct = iStructattrService.findByCode(item.getStruct_code());
|
||||
Sectattr sect = iSectattrService.findById(struct.getSect_id());
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STOutTask");
|
||||
@@ -616,6 +618,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("PickingLocation", item.getStruct_code());
|
||||
task_form.put("PlacedLocation", pointCode);
|
||||
task_form.put("vehicle_code", item.getStoragevehicle_code());
|
||||
if (IOSEnum.ST_SECT_TYPE.code("暂存区").equals(sect.getSect_type_attr())) task_form.put("task_status", TaskStatus.EXECUTING.getCode());
|
||||
String task_id = stOutTask.create(task_form);
|
||||
ioStorInvDisMapper.update(null,new LambdaUpdateWrapper<IOStorInvDis>()
|
||||
.set(IOStorInvDis::getTask_id,task_id)
|
||||
@@ -743,6 +746,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(disList)) {
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
if (groupPlateList.stream().anyMatch(item -> item.getFrozen_qty().compareTo(item.getQty()) != 0)){
|
||||
return;
|
||||
|
||||
}
|
||||
//完成任务,解锁仓位绑定载具号
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,null)
|
||||
@@ -751,18 +761,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
.set(Structattr::getStoragevehicle_code,null)
|
||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getStruct_code,task.getPoint_code1()));
|
||||
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code())
|
||||
iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getStoragevehicle_code,task.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
if (groupPlateList.stream().anyMatch(item -> item.getFrozen_qty().compareTo(item.getQty()) != 0)){
|
||||
iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getStoragevehicle_code,task.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
return;
|
||||
|
||||
}
|
||||
disFinish(disList);
|
||||
}
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user