add: 添加组盘管理中生成任务
This commit is contained in:
@@ -141,11 +141,12 @@ public class FabServiceImpl {
|
||||
pcOperationSMTTask.apply(param);
|
||||
break;
|
||||
case "snt":
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code")}, "参数不能为空!");
|
||||
SendVehicleVo sendVehicleVo = form.toJavaObject(SendVehicleVo.class);
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code());
|
||||
sendVehicleVo.setRegion_code(schBasePoint.getRegion_code());
|
||||
param.put("device_code", sendVehicleVo.getDevice_code());
|
||||
param.put("region_code", sendVehicleVo.getRegion_code());
|
||||
param.put("region_code", schBasePoint.getRegion_code());
|
||||
param.put("config_code", "PcOperationSNTTask");
|
||||
param.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||
param.put("vehicle_type", schBasePoint.getVehicle_type());
|
||||
|
||||
@@ -80,4 +80,13 @@ public class SchBaseVehiclematerialgroupController {
|
||||
public ResponseEntity<Object> selectByVehicleCode(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(schBaseVehiclematerialgroupService.selectByVehicleCode(entity), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/createTask")
|
||||
@Log("根据载具物料信息创建任务")
|
||||
@ApiOperation("根据载具物料信息创建任务")
|
||||
public ResponseEntity<Object> createTask(@RequestBody JSONObject entity){
|
||||
return new ResponseEntity<>(schBaseVehiclematerialgroupService.createTask(entity), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,4 +87,11 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
|
||||
* @return
|
||||
*/
|
||||
List<SchBaseVehiclematerialgroup> selectByVehicleCode(JSONObject entity);
|
||||
|
||||
/**
|
||||
* 根据载具号创建任务
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
Object createTask(JSONObject entity);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||
import org.nl.wms.ext.fab.service.dto.CallMaterVo;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.mapper.SchBaseVehiclematerialgroupMapper;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
@@ -28,6 +30,7 @@ import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.process_flow.service.ProcessFlowService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationCMTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -52,6 +55,10 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
private ProcessFlowService processFlowService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private PcOperationCMTask pcOperationCMTask;
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@Override
|
||||
public IPage<SchBaseVehiclematerialgroup> queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page) {
|
||||
@@ -84,6 +91,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
item.setHasChildren(true);
|
||||
item.setChildren(schBaseVehiclematerialgroups);
|
||||
}
|
||||
item.setHas_work(true);
|
||||
});
|
||||
return schBaseVehiclematerialgroupIPage;
|
||||
}
|
||||
@@ -181,6 +189,25 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
return schBaseVehiclematerialgroups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createTask(JSONObject entity) {
|
||||
Assert.noNullElements(new Object[]{entity.get("point_code2"), entity.get("vehicle_code")},"载具号不能为空!");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", entity.get("point_code2"));
|
||||
param.put("config_code", "PcOperationCMTask");
|
||||
param.put("vehicle_code", entity.get("vehicle_code"));
|
||||
param.put("ext_data", entity);
|
||||
pcOperationCMTask.apply(param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, entity.get("point_code2"))
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
vehiclematerialgroupMapper.delete(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, entity.get("vehicle_code")));
|
||||
return null;
|
||||
}
|
||||
|
||||
private Long getTime(String dateString) {
|
||||
String pattern = "yyyy-MM-dd HH:mm:ss";
|
||||
java.util.Date date = DateUtil.parse(dateString, pattern);
|
||||
|
||||
@@ -261,7 +261,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
schBasePoint.setIs_lock(true);
|
||||
update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
|
||||
@@ -278,10 +277,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq())));
|
||||
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) {
|
||||
schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq())));
|
||||
SchBasePoint schBasePoint = schBasePoints1.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
schBasePoint.setIs_lock(true);
|
||||
update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
|
||||
|
||||
@@ -100,6 +100,7 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
*/
|
||||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId);
|
||||
JSONArray res = new JSONArray();
|
||||
if (ObjectUtil.isEmpty(schBaseRegion)) return res;
|
||||
String pointStatusExplain = schBaseRegion.getPoint_status_explain();
|
||||
if (ObjectUtil.isEmpty(pointStatusExplain)) return res;
|
||||
String[] explain = pointStatusExplain.split(",");
|
||||
@@ -120,6 +121,7 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
|
||||
*/
|
||||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId);
|
||||
JSONArray res = new JSONArray();
|
||||
if (ObjectUtil.isEmpty(schBaseRegion)) return res;
|
||||
String pointTypeExplain = schBaseRegion.getPoint_type_explain();
|
||||
if (ObjectUtil.isEmpty(pointTypeExplain)) return res;
|
||||
String[] explain = pointTypeExplain.split(",");
|
||||
|
||||
@@ -132,7 +132,8 @@ public class PcOperationCMTask extends AbstractTask {
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code()));
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue()));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -132,14 +132,16 @@ public class PcOperationSNTTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code,null));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code,taskObj.getVehicle_code()));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
Reference in New Issue
Block a user