opt: pc操作屏,手持功能修改
This commit is contained in:
@@ -78,7 +78,7 @@ public class LogAspect {
|
||||
// Log log = new Log("INFO", System.currentTimeMillis() - comming);
|
||||
// logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
|
||||
// }
|
||||
}catch (Exception ex){
|
||||
} catch (Exception ex){
|
||||
|
||||
StringBuffer errorStack = new StringBuffer();
|
||||
errorStack.append("<br/>【异常堆栈:");
|
||||
|
||||
@@ -12,6 +12,7 @@ public enum RegionEnum {
|
||||
ZDFJ("分拣工序","111-08"),
|
||||
DDLK("堆叠笼框工序","111-20"),
|
||||
NBJG("内部加工区","111-10"),
|
||||
WXJG("外协加工区","111-12"),
|
||||
;
|
||||
private final String region_name;
|
||||
private final String region_code;
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -27,6 +28,8 @@ import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.system.service.user.dto.SysUserDetail;
|
||||
import org.nl.system.service.user.dto.UserQuery;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -56,6 +59,9 @@ public class MobileAuthorizationController {
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@PostMapping(value = "/login")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||
@@ -74,12 +80,13 @@ public class MobileAuthorizationController {
|
||||
if (!userInfo.getIs_used()) {
|
||||
throw new BadRequestException("账号未激活");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(authUser.getDevice())){
|
||||
Object regin_code = redisUtils.get("JT_"+authUser.getUsername());
|
||||
if (regin_code!=null){
|
||||
|
||||
if (StringUtils.isNotEmpty(authUser.getDevice())) {
|
||||
Object regin_code = redisUtils.get("JT_" + authUser.getUsername());
|
||||
if (regin_code != null) {
|
||||
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
|
||||
}else {
|
||||
redisUtils.set("JT_"+authUser.getUsername(),authUser.getDevice());
|
||||
} else {
|
||||
redisUtils.set("JT_" + authUser.getUsername(), authUser.getDevice());
|
||||
}
|
||||
}
|
||||
// 登录输入,登出删除
|
||||
@@ -95,25 +102,35 @@ public class MobileAuthorizationController {
|
||||
.setDevice("PE") // 此次登录的客户端设备类型, 用于[同端互斥登录]时指定此次登录的设备类型
|
||||
.setExtra("loginInfo", user) // Token挂载的扩展参数 (此方法只有在集成jwt插件时才会生效)
|
||||
);
|
||||
UserQuery query=new UserQuery();
|
||||
UserQuery query = new UserQuery();
|
||||
query.setBlurry(user.getUsername());
|
||||
PageQuery page=new PageQuery();
|
||||
PageQuery page = new PageQuery();
|
||||
List<SysUserDetail> userDetail = userService.getUserDetail(query, page);
|
||||
String roles="";
|
||||
for(SysRole role:userDetail.get(0).getRoles()){
|
||||
if(ObjectUtil.isNotEmpty(role.getRemark())){
|
||||
roles+=role.getRemark()+',';
|
||||
String roles = "";
|
||||
for (SysRole role : userDetail.get(0).getRoles()) {
|
||||
if (ObjectUtil.isNotEmpty(role.getRemark())) {
|
||||
roles += role.getRemark() + ',';
|
||||
}
|
||||
}
|
||||
SchBasePoint schBasePoint = new SchBasePoint();
|
||||
if(StrUtil.isNotEmpty(authUser.getDevice())){
|
||||
schBasePoint = iSchBasePointService.selectByPointCode(authUser.getDevice());
|
||||
}
|
||||
|
||||
// 返回 token 与 用户信息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("roles", permissionList);
|
||||
jsonObject.put("user", userInfo);
|
||||
String finalRoles = roles;
|
||||
JSONObject authInfo = new JSONObject(2) {{
|
||||
SchBasePoint finalSchBasePoint = schBasePoint;
|
||||
JSONObject authInfo = new JSONObject(6) {{
|
||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||
put("user", jsonObject);
|
||||
put("roles", finalRoles);
|
||||
if(ObjectUtil.isNotEmpty(finalSchBasePoint)){
|
||||
put("ext_data", finalSchBasePoint.getRegion_points());
|
||||
put("point_code", finalSchBasePoint.getPoint_code());
|
||||
put("point_name", finalSchBasePoint.getPoint_name());
|
||||
}
|
||||
}};
|
||||
|
||||
return ResponseEntity.ok(authInfo);
|
||||
@@ -123,10 +140,10 @@ public class MobileAuthorizationController {
|
||||
@PostMapping(value = "/loginOut")
|
||||
@SaIgnore
|
||||
@Log("PC登出")
|
||||
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser){
|
||||
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser) {
|
||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||
redisUtils.del("JT_"+authUser.getUsername());
|
||||
return new ResponseEntity(TableDataInfo.build(),HttpStatus.OK);
|
||||
redisUtils.del("JT_" + authUser.getUsername());
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//@Component
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
public class JobRunner implements ApplicationRunner {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.system.service.user.dao;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -135,5 +137,12 @@ public class SysUser implements Serializable {
|
||||
*/
|
||||
private String extuser_id;
|
||||
|
||||
/**
|
||||
* 关联设备
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<String> device;
|
||||
|
||||
private String devices;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ package org.nl.system.service.user.impl;
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.beanutils.ConvertUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.FileProperties;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -77,58 +80,69 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public void create(Map userDetail) {
|
||||
SysUser username = this.getOne(Wrappers.lambdaQuery(SysUser.class)
|
||||
.eq(SysUser::getUsername, userDetail.get("username")));
|
||||
if (ObjectUtil.isEmpty(username)) {
|
||||
throw new BadRequestException("用户名已存在");
|
||||
}
|
||||
SysUser sysUser = new SysUser();
|
||||
BeanUtils.populate(sysUser,userDetail);
|
||||
BeanUtils.populate(sysUser, userDetail);
|
||||
// 默认密码 123456
|
||||
if (ObjectUtil.isEmpty(sysUser.getPassword())) {
|
||||
sysUser.setPassword(SaSecureUtil.md5BySalt("123456", "salt"));
|
||||
} else {
|
||||
sysUser.setPassword(SaSecureUtil.md5BySalt(sysUser.getPassword(), "salt"));
|
||||
}
|
||||
sysUser.setDevices(JSONObject.toJSONString(sysUser.getDevice()));
|
||||
String userId = IdUtil.getStringId();
|
||||
sysUser.setUser_id(userId);
|
||||
this.save(sysUser);
|
||||
if (userDetail.get("depts") !=null){
|
||||
deptService.saveUserDeptRelation(userId,(List)userDetail.get("depts"));
|
||||
};
|
||||
if (userDetail.get("roles") !=null){
|
||||
roleService.saveUserRoleRelation(userId,(List)userDetail.get("roles"));
|
||||
};
|
||||
if (userDetail.get("depts") != null) {
|
||||
deptService.saveUserDeptRelation(userId, (List) userDetail.get("depts"));
|
||||
}
|
||||
;
|
||||
if (userDetail.get("roles") != null) {
|
||||
roleService.saveUserRoleRelation(userId, (List) userDetail.get("roles"));
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(Map userDetail) {
|
||||
if(CollectionUtils.isEmpty(userDetail) || ObjectUtil.isEmpty(userDetail.get("user_id"))){
|
||||
if (CollectionUtils.isEmpty(userDetail) || ObjectUtil.isEmpty(userDetail.get("user_id"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
SysUser sysUser = new SysUser();
|
||||
org.springframework.beans.BeanUtils.copyProperties(userDetail,sysUser);
|
||||
org.springframework.beans.BeanUtils.copyProperties(userDetail, sysUser);
|
||||
//转换器
|
||||
ConvertUtils.register((aClass, o) -> {
|
||||
try {
|
||||
if (o == null){ return null; }
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
return new SimpleDateFormat("yyyy-MM-dd").parse(o.toString());
|
||||
}catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}, Date.class);
|
||||
try {
|
||||
BeanUtils.populate(sysUser,userDetail);
|
||||
}catch (Exception ex){
|
||||
BeanUtils.populate(sysUser, userDetail);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
sysUser.setUpdate_time(new Date());
|
||||
sysUser.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
this.updateById(sysUser);
|
||||
if (userDetail.get("deptIds")!=null){
|
||||
if (userDetail.get("deptIds") != null) {
|
||||
deptService.delUserDeptRelation(sysUser.getUser_id());
|
||||
deptService.saveUserDeptRelation(sysUser.getUser_id(), (List) userDetail.get("deptIds"));
|
||||
};
|
||||
if (userDetail.get("rolesIds") !=null){
|
||||
}
|
||||
;
|
||||
if (userDetail.get("rolesIds") != null) {
|
||||
roleService.delUserRoleRelation(sysUser.getUser_id());
|
||||
roleService.saveUserRoleRelation(sysUser.getUser_id(),(List) userDetail.get("rolesIds"));
|
||||
roleService.saveUserRoleRelation(sysUser.getUser_id(), (List) userDetail.get("rolesIds"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackTaskStatusRequest;
|
||||
import org.nl.wms.ext.connector.service.WmsToConnectorService;
|
||||
import org.nl.wms.ext.connector.service.dto.ConnectorDto;
|
||||
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.ext.sorting.service.impl.WmsToSortingService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
@@ -55,6 +56,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -100,6 +102,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
@Autowired
|
||||
private IMdBaseMaterialService iMdBaseMaterialService;
|
||||
@Autowired
|
||||
private FabServiceImpl FabServiceImpl;
|
||||
|
||||
/**
|
||||
* 初始化反射方法
|
||||
@@ -396,6 +400,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
json.put("task_code", schBaseTask.getTask_code());
|
||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||
}
|
||||
List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBaseTask.getVehicle_code());
|
||||
//同步fab工序流程
|
||||
FabServiceImpl.syncFab(list);
|
||||
} else if ("2".equals(is_connector)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("vehicle_code", schBaseTask.getVehicle_code());
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.ext.connector.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@@ -19,4 +21,11 @@ public interface WmsToConnectorService {
|
||||
* @return
|
||||
*/
|
||||
AcsResponse feedAgvFinishTask(JSONObject json);
|
||||
|
||||
/**
|
||||
* 向connector反馈物料加工状态,并获取物料下道工序和交期时间
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
JSONObject applyRegionAndDueDate(JSONObject json);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,19 @@ package org.nl.wms.ext.connector.service.impl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.core.utils.ObjectUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.ext.connector.service.WmsToConnectorService;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||
import org.nl.wms.sch.task_manage.task.ConnectorUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@@ -36,5 +43,28 @@ public class WmsToConnectorServiceImpl implements WmsToConnectorService {
|
||||
return acsResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject applyRegionAndDueDate(JSONObject json) {
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
Param isInvokeConnector = sysParamService.findByCode(GeneralDefinition.IS_INVOKE_CONNECTOR);
|
||||
if (ObjectUtil.isNotEmpty(isInvokeConnector) && GeneralDefinition.YES.equals(isInvokeConnector.getValue())) {
|
||||
String api = "/iot/agvarrive";
|
||||
JSONObject jsonObject = ConnectorUtil.notifyConnector3(api, json);
|
||||
return jsonObject;
|
||||
} else if (ObjectUtil.isNotEmpty(isInvokeConnector) && GeneralDefinition.NO.equals(isInvokeConnector.getValue())) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
JSONArray objects = new JSONArray();
|
||||
jsonObject.put("status",200);
|
||||
jsonObject1.put("due_date","");
|
||||
jsonObject1.put("next_region_code","");
|
||||
jsonObject1.put("order_code","");
|
||||
objects.add(jsonObject1);
|
||||
jsonObject.put("data",objects);
|
||||
return jsonObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.nl.wms.ext.fab.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -10,12 +13,15 @@ import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.wms.ext.connector.service.WmsToConnectorService;
|
||||
import org.nl.wms.ext.fab.service.dto.*;
|
||||
import org.nl.wms.ext.fab.service.impl.FabServiceImpl;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dto.PointMaterialInfo;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -23,9 +29,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "fab相关接口")
|
||||
@@ -40,114 +45,141 @@ public class FabController {
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Autowired
|
||||
private FabServiceImpl fabService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
||||
@Autowired
|
||||
private WmsToConnectorService wmsToConnectorService;
|
||||
|
||||
|
||||
/**
|
||||
* 设备工序列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("设备工序列表")
|
||||
@GetMapping("/regionList")
|
||||
public ResponseEntity<TableDataInfo<List<LB>>> regionList(){
|
||||
public ResponseEntity<TableDataInfo<List<LB>>> regionList() {
|
||||
List<SchBaseRegion> regionList = iSchBaseRegionService.getRegionList(new SchBaseRegion());
|
||||
List result = new ArrayList<>();
|
||||
for (SchBaseRegion schBaseRegion : regionList) {
|
||||
result.add(MapOf.of("label",schBaseRegion.getRegion_name(),"value",schBaseRegion.getRegion_code()));
|
||||
result.add(MapOf.of("label", schBaseRegion.getRegion_name(), "value", schBaseRegion.getRegion_code()));
|
||||
}
|
||||
return new ResponseEntity(TableDataInfo.build(result), HttpStatus.OK);
|
||||
return new ResponseEntity(TableDataInfo.build(result), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工序获取设备点位信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("根据工序获取设备点位信息")
|
||||
@GetMapping("/regionPoints")
|
||||
//{"OUT1":"333","OUT2":"222","N1":"123","N2":"ltd"}
|
||||
// [{"num":"1","type":"IN","device_code":"222","vehicle_type","1"}]
|
||||
public ResponseEntity<Map> regionPoints(String regionCode){
|
||||
Assert.notBlank(regionCode,"请求参数不能为空");
|
||||
// [{"num":"1","name":"IN","device_code":"222","type","1"}]
|
||||
public ResponseEntity<Map> regionPoints(String pointCode) {
|
||||
Assert.notBlank(pointCode, "请求参数不能为空");
|
||||
//TODO:改成查设备配置
|
||||
SchBaseRegion baseRegion = iSchBaseRegionService.getOne(new QueryWrapper<SchBaseRegion>().eq("region_code", regionCode));
|
||||
String regionPoints = baseRegion.getRegion_points();
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new QueryWrapper<SchBasePoint>().eq("point_code", pointCode));
|
||||
String regionPoints = schBasePoint.getRegion_points();
|
||||
List<DeviceConfig> deviceConfigs = JSONArray.parseArray(regionPoints, DeviceConfig.class);
|
||||
return new ResponseEntity(deviceConfigs, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工序查询订单
|
||||
*
|
||||
* @param regionCode
|
||||
* @return
|
||||
*/
|
||||
@Log("根据工序查询工单")
|
||||
@GetMapping("/regionOrder")
|
||||
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode){
|
||||
public ResponseEntity<TableDataInfo<OrderMater>> regionOrder(String regionCode) {
|
||||
List<OrderMater> structList = iSchBasePointService.getStructList(regionCode, null);
|
||||
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工单查询匹配库存
|
||||
*
|
||||
* @param order
|
||||
* @param regionCode
|
||||
* @return
|
||||
*/
|
||||
@Log("根据工单查询匹配库存")
|
||||
@GetMapping("/getMaterListByOrder")
|
||||
public ResponseEntity<TableDataInfo<List<OrderMater>>> getMaterListByOrder(String order,String regionCode){
|
||||
public ResponseEntity<TableDataInfo<List<OrderMater>>> getMaterListByOrder(String order, String regionCode) {
|
||||
List<OrderMater> structList = iSchBasePointService.getStructList(regionCode, null);
|
||||
return new ResponseEntity(TableDataInfo.build(structList), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼叫库存物料
|
||||
*
|
||||
* @param MaterInfo
|
||||
* @return
|
||||
*/
|
||||
@Log("呼叫库存物料")
|
||||
@PostMapping("/callMater")
|
||||
public ResponseEntity<TableDataInfo> callMater(@RequestBody CallMaterVo MaterInfo){
|
||||
JSONObject toJSON = (JSONObject)JSON.toJSON(MaterInfo);
|
||||
fabService.createAgvTask(toJSON,"cmt");
|
||||
public ResponseEntity<TableDataInfo> callMater(@RequestBody CallMaterVo MaterInfo) {
|
||||
JSONObject toJSON = (JSONObject) JSON.toJSON(MaterInfo);
|
||||
fabService.createAgvTask(toJSON, "cmt");
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 呼叫空料框
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("呼叫空料框")
|
||||
@PostMapping("/callEmp")
|
||||
public ResponseEntity<TableDataInfo> callEmp(@RequestBody CallEmpVo callEmpVo){
|
||||
JSONObject toJSON = (JSONObject)JSON.toJSON(callEmpVo);
|
||||
fabService.createAgvTask(toJSON,"cnt");
|
||||
public ResponseEntity<TableDataInfo> callEmp(@RequestBody CallEmpVo callEmpVo) {
|
||||
JSONObject toJSON = (JSONObject) JSON.toJSON(callEmpVo);
|
||||
fabService.createAgvTask(toJSON, "cnt");
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 叫料点回库
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("叫料点回库")
|
||||
@PostMapping("/sendVehicle")
|
||||
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehicleVo sendVehicleVo){
|
||||
JSONObject toJSON = (JSONObject)JSON.toJSON(sendVehicleVo);
|
||||
Integer qty = sendVehicleVo.getMaterial_qty();
|
||||
if (qty.intValue()==0){
|
||||
fabService.createAgvTask(toJSON,"snt");
|
||||
}else {
|
||||
fabService.createAgvTask(toJSON,"smt");
|
||||
public ResponseEntity<TableDataInfo> sendVehicle(@RequestBody SendVehiclesVo sendVehiclesVo) {
|
||||
JSONObject toJSON = (JSONObject) JSON.toJSON(sendVehiclesVo);
|
||||
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getSendVehicleVoList();
|
||||
if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!");
|
||||
AtomicReference<Boolean> flag = new AtomicReference<>(false);
|
||||
sendVehicleVoList.stream().forEach(sendVehicleVo1 -> {
|
||||
if (sendVehicleVo1.getMaterial_qty() != 0) {
|
||||
flag.set(true);
|
||||
}
|
||||
});
|
||||
if (!flag.get()) {
|
||||
fabService.createAgvTask(toJSON, "snt");
|
||||
} else {
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehiclesVo.getDevice_code());
|
||||
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||
List<String> materiales = new ArrayList<>();
|
||||
sendVehicleVoList.stream().forEach(send -> {
|
||||
materiales.add(JSONObject.toJSONString(send));
|
||||
});
|
||||
toJSON.put("material_info", materiales);
|
||||
//TODO:修改物料信息
|
||||
fabService.createAgvTask(toJSON, "smt");
|
||||
}
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 载具类型列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("载具类型列表")
|
||||
@PostMapping("/vehicleType")
|
||||
public ResponseEntity<TableDataInfo<List<LB>>> vehicleType(){
|
||||
public ResponseEntity<TableDataInfo<List<LB>>> vehicleType() {
|
||||
List<LB> result = new ArrayList<>();
|
||||
for (VehicleTypeEnum value : VehicleTypeEnum.values()) {
|
||||
result.add(LB.builder().label(value.getVehicleName()).value(value.getVehicleCode()).build());
|
||||
@@ -157,15 +189,94 @@ public class FabController {
|
||||
|
||||
/**
|
||||
* 工序下料
|
||||
* @param MaterInfo
|
||||
*
|
||||
* @param materInfo
|
||||
* @return
|
||||
*/
|
||||
@Log("工序下料")
|
||||
@PostMapping("/sendMater")
|
||||
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo MaterInfo){
|
||||
JSONObject toJSON = (JSONObject)JSON.toJSON(MaterInfo);
|
||||
fabService.createAgvTask(toJSON,"smt");
|
||||
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
|
||||
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
||||
//TODO:待确定
|
||||
List<String> material_info = materInfo.getMaterial_info();
|
||||
if (CollUtil.isEmpty(material_info)) throw new BadRequestException("物料信息为空,请确认!");
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
material_info.stream().forEach(material -> {
|
||||
JSONObject jsonObject = JSONObject.parseObject(material);
|
||||
map.put("order_code", jsonObject.getString("order_code"));
|
||||
map.put("qty", jsonObject.getString("material_qty"));
|
||||
jsonArray.add(map);
|
||||
});
|
||||
json.put("vehicle_code", materInfo.getVehicle_code());
|
||||
json.put("region_code", materInfo.getRegion_code());
|
||||
json.put("materials", jsonArray);
|
||||
JSONObject jsonObject = wmsToConnectorService.applyRegionAndDueDate(json);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 200) {
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
data.stream().forEach(material -> {
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(StrUtil.toString(material));
|
||||
material_info.stream().forEach(material1 -> {
|
||||
JSONObject jsonObject2 = JSONObject.parseObject(StrUtil.toString(material1));
|
||||
if (jsonObject2.getString("order_code").equals(jsonObject1.getString("order_code"))) {
|
||||
jsonObject2.put("due_date", jsonObject1.getString("due_date"));
|
||||
jsonObject2.put("region_code", jsonObject1.getString("next_region_code"));
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 400) {
|
||||
throw new BadRequestException(jsonObject.getString("msg"));
|
||||
}
|
||||
toJSON.put("region_code", JSONObject.parseObject(material_info.get(0)).getString("region_code"));
|
||||
fabService.createAgvTask(toJSON, "smt");
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
//TODO: 根据物料查主盘信息; 当前工序查所有物料 ->
|
||||
|
||||
/**
|
||||
* 选择登录设备
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log("选择登录设备")
|
||||
@GetMapping("/signDevice")
|
||||
public ResponseEntity<TableDataInfo> chooseSignDevice() {
|
||||
List<Map> maps = iSchBasePointService.selectJobDevice();
|
||||
return new ResponseEntity(maps, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单号
|
||||
*
|
||||
* @param sendVehicleVo
|
||||
* @return
|
||||
*/
|
||||
@Log("查询订单号")
|
||||
@PostMapping("/orders")
|
||||
public ResponseEntity<TableDataInfo> selectOrders(@RequestBody SendVehicleVo sendVehicleVo) {
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code());
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!");
|
||||
List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBasePoint.getVehicle_code());
|
||||
HashSet<String> keys = new HashSet<>();
|
||||
list.stream().forEach(item -> {
|
||||
keys.add(item);
|
||||
});
|
||||
return new ResponseEntity(keys, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询载具物料信息
|
||||
*
|
||||
* @param materialVo
|
||||
* @return
|
||||
*/
|
||||
@Log("查询载具物料信息")
|
||||
@PostMapping("/material")
|
||||
public ResponseEntity<TableDataInfo> selectMaterial(@RequestBody SendMaterVo materialVo) {
|
||||
List<Map> maps = iSchBaseVehiclematerialgroupService.selectMaterialByVehicleCode(materialVo.getVehicle_code());
|
||||
return new ResponseEntity(maps, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||
import org.nl.wms.ext.fab.service.dao.FabConsumptionDo;
|
||||
import org.nl.wms.ext.fab.service.dto.OrderMater;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -23,4 +24,7 @@ public interface FabRequestMapper {
|
||||
*/
|
||||
@DS("sqlserver")
|
||||
List<FabConsumptionDo> getMWorkOrderInfos(@Param("regionCode") String regionCode);
|
||||
|
||||
@DS("sqlserver")
|
||||
List<OrderMater> selectCraftByOrderCode(List<String> orders);
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ public class CallEmpVo {
|
||||
/**
|
||||
* 设备工序
|
||||
*/
|
||||
private String regin_code;
|
||||
private String region_code;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.ext.fab.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SendMaterVo {
|
||||
/**
|
||||
@@ -40,4 +42,11 @@ public class SendMaterVo {
|
||||
* 是否报功
|
||||
*/
|
||||
public Boolean has_work = true;
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
public List<String> material_info;
|
||||
|
||||
public String due_date;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.ext.fab.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SendVehicleVo {
|
||||
|
||||
@@ -17,5 +19,13 @@ public class SendVehicleVo {
|
||||
* 设备工序
|
||||
*/
|
||||
public String region_code;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String order_code;
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
List<SendVehicleVo> sendVehicleVoList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.ext.fab.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SendVehiclesVo {
|
||||
|
||||
/**
|
||||
* 地面点位(IN1,IN2)
|
||||
*/
|
||||
public String device_code;
|
||||
/**
|
||||
* 设备工序
|
||||
*/
|
||||
public String region_code;
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
List<SendVehicleVo> sendVehicleVoList;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,11 @@ package org.nl.wms.ext.fab.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import nl.basjes.shaded.org.springframework.util.Assert;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
@@ -49,60 +54,98 @@ public class FabServiceImpl {
|
||||
|
||||
|
||||
public void syncFab(List<String> orders) {
|
||||
//1.connector下料调用同步:从fab同步订单工艺流及交期
|
||||
//2.后续就都不同步了,唯一有交互的只有报工:
|
||||
//3.pc操作下料的时候根据订单工序:自动选择当前工序的下一道工序,点击下料完成
|
||||
/**
|
||||
* 800:1.冲压,2.分拣3,折弯,4.激光5.外协
|
||||
*
|
||||
*/
|
||||
|
||||
if (CollectionUtils.isEmpty(orders)){
|
||||
//1.查询库存中所有800号,
|
||||
if (CollectionUtils.isEmpty(orders)) {
|
||||
//1.查询库存中所有800号,
|
||||
// 2.根据800号查询fab数据库,
|
||||
//3.根据组盘记录表工序,及交期,以及has_work已生成
|
||||
// List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.groupOrderCode();
|
||||
// for (SchBaseVehiclematerialgroup schBaseVehiclematerialgroup : list) {
|
||||
//
|
||||
// }
|
||||
List<OrderMater> orderMaters = fabRequestMapper.selectCraftByOrderCode(orders);
|
||||
}
|
||||
}
|
||||
|
||||
public void createAgvTask(JSONObject form,String type) {
|
||||
public void createAgvTask(JSONObject form, String type) {
|
||||
JSONObject param = new JSONObject();
|
||||
switch (type){
|
||||
switch (type) {
|
||||
case "cmt":
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_code")}, "参数不能为空!");
|
||||
CallMaterVo callMaterVo = form.toJavaObject(CallMaterVo.class);
|
||||
param.put("device_code",callMaterVo.getPoint_code());
|
||||
param.put("config_code","PcOperationCMTask");
|
||||
param.put("region_code",callMaterVo.getRegion_code());
|
||||
param.put("vehicle_code",callMaterVo.getVehicle_code());
|
||||
param.put("ext_data",callMaterVo);
|
||||
param.put("device_code", callMaterVo.getPoint_code());
|
||||
param.put("config_code", "PcOperationCMTask");
|
||||
param.put("region_code", callMaterVo.getRegion_code());
|
||||
param.put("vehicle_code", callMaterVo.getVehicle_code());
|
||||
param.put("ext_data", callMaterVo);
|
||||
pcOperationCMTask.apply(param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, callMaterVo.getDevice_code())
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
|
||||
.eq(SchBasePoint::getVehicle_code, callMaterVo.getVehicle_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
break;
|
||||
case "cnt":
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("vehicle_type"),
|
||||
form.getString("region_code")}, "参数不能为空!");
|
||||
CallEmpVo callEmpVo = form.toJavaObject(CallEmpVo.class);
|
||||
param.put("device_code",callEmpVo.getDevice_code());
|
||||
param.put("config_code","CALLEMPTYTask");
|
||||
param.put("region_code",callEmpVo.getRegin_code());
|
||||
param.put("ext_data",callEmpVo);
|
||||
param.put("device_code", callEmpVo.getDevice_code());
|
||||
param.put("config_code", "TOSTOREHOUSETask");
|
||||
param.put("region_code", callEmpVo.getRegion_code());
|
||||
param.put("vehicle_type", callEmpVo.getVehicle_type());
|
||||
param.put("ext_data", callEmpVo);
|
||||
callEmptyTask.apply(param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, callEmpVo.getDevice_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
break;
|
||||
case "smt":
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
|
||||
SendMaterVo sendMaterVo = form.toJavaObject(SendMaterVo.class);
|
||||
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", sendMaterVo.getVehicle_code()));
|
||||
param.put("device_code",sendMaterVo.getDevice_code());
|
||||
param.put("config_code","PcOperationSMTTask");
|
||||
param.put("ext_data",sendMaterVo);
|
||||
param.put("region_code",sendMaterVo.getRegion_code());
|
||||
param.put("vehicle_code",sendMaterVo.getVehicle_code());
|
||||
param.put("vehicle_type",vehicle.getVehicle_type());
|
||||
param.put("device_code", sendMaterVo.getDevice_code());
|
||||
param.put("ext_data", sendMaterVo);
|
||||
param.put("region_code", sendMaterVo.getRegion_code());
|
||||
if (sendMaterVo.getRegion_code().equals(RegionEnum.NBJG.getRegion_code()) || sendMaterVo.getRegion_code().equals(RegionEnum.WXJG.getRegion_code())) {
|
||||
param.put("config_code", "ProcessingSMTTask");
|
||||
} else {
|
||||
param.put("config_code", "PcOperationSMTTask");
|
||||
}
|
||||
param.put("vehicle_code", sendMaterVo.getVehicle_code());
|
||||
param.put("vehicle_type", vehicle.getVehicle_type());
|
||||
pcOperationSMTTask.apply(param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, sendMaterVo.getDevice_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
break;
|
||||
case "snt":
|
||||
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
|
||||
SendVehicleVo sendVehicleVo = form.toJavaObject(SendVehicleVo.class);
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code());
|
||||
param.put("device_code",sendVehicleVo.getDevice_code());
|
||||
param.put("region_code",sendVehicleVo.getRegion_code());
|
||||
param.put("config_code","PcOperationSNTTask");
|
||||
param.put("vehicle_code",schBasePoint.getVehicle_code());
|
||||
param.put("vehicle_type",schBasePoint.getVehicle_type());
|
||||
param.put("ext_data",sendVehicleVo);
|
||||
param.put("device_code", sendVehicleVo.getDevice_code());
|
||||
param.put("region_code", sendVehicleVo.getRegion_code());
|
||||
param.put("config_code", "PcOperationSNTTask");
|
||||
param.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||
param.put("vehicle_type", schBasePoint.getVehicle_type());
|
||||
param.put("ext_data", sendVehicleVo);
|
||||
pcOperationSNTTask.apply(param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, sendVehicleVo.getDevice_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("任务类型错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,9 @@ import org.nl.wms.ext.handheld.service.HandheldService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
@@ -103,4 +102,39 @@ public class HandheldController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getRegionCode")
|
||||
@Log("查询工序")
|
||||
@ApiOperation("查询工序")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getRegionCodeByOrderCode(@RequestBody JSONObject orderCode) {
|
||||
return new ResponseEntity<>(handheldService.regionCodeByOrderCode(orderCode.getString("orderCode")),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateOrder")
|
||||
@Log("修改订单工序")
|
||||
@ApiOperation("修改订单工序")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> updateRegionCodeByOrder(@RequestBody JSONObject json) {
|
||||
handheldService.updateRegionCodeByOrder(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getUserOrDevice")
|
||||
@Log("查询用户的关联设备")
|
||||
@ApiOperation("查询用户的关联设备")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> selectUserOrDeviceByUserId(@RequestBody JSONObject json) {
|
||||
List<JSONObject> list = handheldService.selectUserOrDevice(json);
|
||||
return new ResponseEntity<>(list,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceInLogin")
|
||||
@Log("选择设备之后登录")
|
||||
@ApiOperation("选择设备之后登录")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> deviceInLogin(@RequestBody JSONObject json) {
|
||||
JSONObject list = handheldService.deviceInLogin(json);
|
||||
return new ResponseEntity<>(list,HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.ext.handheld.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@@ -59,4 +61,30 @@ public interface HandheldService {
|
||||
* @return
|
||||
*/
|
||||
Object pointStatus(JSONObject param);
|
||||
|
||||
/**
|
||||
* 根据订单号查找下一道工序
|
||||
* @param orderCode
|
||||
*/
|
||||
String regionCodeByOrderCode(String orderCode);
|
||||
|
||||
/**
|
||||
* 修改订单工序
|
||||
* @param json
|
||||
*/
|
||||
void updateRegionCodeByOrder(JSONObject json);
|
||||
|
||||
/**
|
||||
* 查询用户的关联设备
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> selectUserOrDevice(JSONObject json);
|
||||
|
||||
/**
|
||||
* 选择设备之后登录
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
JSONObject deviceInLogin(JSONObject json);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -11,9 +12,11 @@ import nl.basjes.shaded.org.springframework.util.Assert;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.connector.service.WmsToConnectorService;
|
||||
import org.nl.wms.ext.handheld.service.HandheldService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
@@ -28,7 +31,7 @@ import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
@@ -48,15 +51,23 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
@Autowired
|
||||
private WmsToConnectorService wmsToConnectorService;
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
|
||||
@Override
|
||||
public void emptyCageStorageTask(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_list")
|
||||
}, "参数不能为空!");
|
||||
JSONArray vehicle_list = param.getJSONArray("vehicle_list");
|
||||
String vehicle = param.getString("vehicle_list");
|
||||
String device_code = param.getString("device_code");
|
||||
if (vehicle_list.size() != 2 && vehicle_list.size() != 4) {
|
||||
String[] vehicle_list = null;
|
||||
if(vehicle.contains(",")){
|
||||
vehicle_list = vehicle.split(",");
|
||||
}
|
||||
if (vehicle_list.length != 2 && vehicle_list.length != 4) {
|
||||
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!");
|
||||
}
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
@@ -67,8 +78,8 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "EMPTYCAGETask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_qty", vehicle_list.size());
|
||||
jo.put("vehicle_code", vehicle_list);
|
||||
jo.put("vehicle_qty", vehicle_list.length);
|
||||
jo.put("vehicle_code", vehicle);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
@@ -80,27 +91,60 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
|
||||
@Override
|
||||
public void cageBlankingTask(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("region_code"),}, "当前点位或目的地不能为空!");
|
||||
if (!param.getString("region_code").equals(RegionEnum.NBJG.getRegion_code())) {
|
||||
Assert.noNullElements(new Object[]{param.getString("vehicle_code"), param.getString("material_code")
|
||||
, param.getString("material_qty"), param.getString("order_code")}, "参数不能为空!");
|
||||
}
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")},
|
||||
"当前点位或目的地不能为空!");
|
||||
JSONArray materials = param.getJSONArray("material");
|
||||
String device_code = param.getString("device_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String material_qty = param.getString("material_qty");
|
||||
String material_code = param.getString("material_code");
|
||||
/*String material_qty = param.getString("material_qty");
|
||||
String material_code = param.getString("material_code");*/
|
||||
String region_code = param.getString("region_code");
|
||||
String order_code = param.getString("order_code");
|
||||
/*String order_code = param.getString("order_code");*/
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
materials.stream().forEach(material2 -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material2), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
map.put("order_code", jsonObject.getString("order_code"));
|
||||
map.put("qty", jsonObject.getString("material_qty"));
|
||||
jsonArray.add(map);
|
||||
});
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("region_code", region_code);
|
||||
json.put("materials", jsonArray);
|
||||
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json);
|
||||
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) {
|
||||
JSONArray date = json1.getJSONArray("data");
|
||||
date.stream().forEach(date1 -> {
|
||||
JSONObject json2 = JSONObject.parseObject(StrUtil.toString(date1));
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
if (jsonObject.getString("order_code").equals(json2.getString("order_code"))) {
|
||||
jsonObject.put("due_date", json2.getString("due_date"));
|
||||
jsonObject.put("region_code", json2.getString("next_region_code"));
|
||||
}
|
||||
});
|
||||
});
|
||||
region_code = JSONObject.parseObject(StrUtil.toString(date.get(0))).getString("region_code");
|
||||
} else if (ObjectUtil.isNotEmpty(json1)) {
|
||||
throw new BadRequestException(json1.getString("msg"));
|
||||
}
|
||||
param.put("material", materials);
|
||||
if (!param.getString("region_code").equals(RegionEnum.NBJG.getRegion_code())) {
|
||||
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
|
||||
}
|
||||
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "BLANKINGTask");
|
||||
if (RegionEnum.NBJG.getRegion_code().equals(region_code) || RegionEnum.WXJG.getRegion_code().equals(region_code)) {
|
||||
jo.put("config_code", "ProcessingSMTTask");
|
||||
} else {
|
||||
jo.put("config_code", "BLANKINGTask");
|
||||
}
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("region_code", region_code);
|
||||
@@ -108,12 +152,21 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
connectorTask.apply(jo);
|
||||
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(Integer.parseInt(material_qty));
|
||||
schBaseVehiclematerialgroup.setMaterial_code(material_code);
|
||||
schBaseVehiclematerialgroup.setOrder_code(order_code);
|
||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty"));
|
||||
schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code"));
|
||||
schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code"));
|
||||
schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date"));
|
||||
schBaseVehiclematerialgroup.setRegion_code(jsonObject.getString("region_code"));
|
||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
});
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,9 +223,9 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String device_code = param.getString("device_code");
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_code);
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
|
||||
if(!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode())
|
||||
|| !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())){
|
||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
|
||||
if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode())
|
||||
|| !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) {
|
||||
throw new BadRequestException("不是料架,生成搬运任务失败!");
|
||||
}
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
@@ -210,17 +263,80 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
|
||||
@Override
|
||||
public Object pointStatus(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("point_code"),param.getString("point_status")}, "参数不能为空!");
|
||||
Assert.noNullElements(new Object[]{param.getString("point_code"), param.getString("point_status")}, "参数不能为空!");
|
||||
String point_code = param.getString("point_code");
|
||||
String point_status = param.getString("point_status");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(point_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code,point_code)
|
||||
.set(SchBasePoint::getPoint_status,point_status)
|
||||
.set(SchBasePoint::getIs_lock,false)
|
||||
.set(SchBasePoint::getVehicle_code,null)
|
||||
);
|
||||
.eq(SchBasePoint::getPoint_code, point_code)
|
||||
.set(SchBasePoint::getPoint_status, point_status)
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String regionCodeByOrderCode(String orderCode) {
|
||||
if (StrUtil.isNotEmpty(orderCode)) {
|
||||
List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getOrder_code, orderCode)
|
||||
.orderByAsc(SchBaseVehiclematerialgroup::getDue_date)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
return list.get(0).getRegion_code();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateRegionCodeByOrder(JSONObject json) {
|
||||
Assert.noNullElements((Collection<?>) json, "参数不能为空!");
|
||||
JSONArray material_info = json.getJSONArray("material_info");
|
||||
material_info.stream().forEach(material -> {
|
||||
JSONObject jsonObject = JSONObject.parseObject(StrUtil.toString(material));
|
||||
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getString("order_code"))
|
||||
.set(SchBaseVehiclematerialgroup::getDue_date, jsonObject.getString("due_date"))
|
||||
.set(SchBaseVehiclematerialgroup::getRegion_code, jsonObject.getString("region_code"))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> selectUserOrDevice(JSONObject json) {
|
||||
Assert.notNull(json.getString("username"), "用户名不能为空!");
|
||||
SysUser username = iSysUserService.getOne(Wrappers.lambdaQuery(SysUser.class)
|
||||
.eq(SysUser::getUsername, json.getString("username")));
|
||||
if (ObjectUtil.isEmpty(username)) return null;
|
||||
List<String> list = JSONUtil.toList(username.getDevices(), String.class);
|
||||
JSONObject map = new JSONObject();
|
||||
List<JSONObject> jsonList = new ArrayList<>();
|
||||
list.stream().forEach(device -> {
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
map.put("device_code", device);
|
||||
map.put("device_name", schBasePoint.getPoint_name());
|
||||
jsonList.add(map);
|
||||
}
|
||||
});
|
||||
return jsonList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject deviceInLogin(JSONObject json) {
|
||||
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code"));
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("device_code", schBasePoint.getPoint_code());
|
||||
map.put("device_name", schBasePoint.getPoint_name());
|
||||
map.put("region_points", schBasePoint.getRegion_points());
|
||||
return map;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,4 +67,17 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
|
||||
void updateByVehicleCode(String vehicle_code, String data);
|
||||
|
||||
List selectByJobName(String jobName);
|
||||
|
||||
/**
|
||||
* 根据载具号查找订单号
|
||||
* @param vehicle_code
|
||||
*/
|
||||
List<String> selectOrdersByVehicleCode(String vehicle_code);
|
||||
|
||||
/**
|
||||
* 根据载具号查找物料信息
|
||||
* @param vehicle_code
|
||||
* @return
|
||||
*/
|
||||
List<Map> selectMaterialByVehicleCode(String vehicle_code);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,14 @@ package org.nl.wms.sch.group.service.dao.mapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.group.service.dto.SchBaseVehiclematerialgroupQuery;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
@@ -16,4 +21,7 @@ public interface SchBaseVehiclematerialgroupMapper extends BaseMapper<SchBaseVeh
|
||||
|
||||
SchBaseVehiclematerialgroup getGroup(JSONObject entity);
|
||||
|
||||
List<String> selectOrders(String vehicle_code);
|
||||
|
||||
List<Map> selectMaterialByVehicleCode(String vehicle_code);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup">
|
||||
SELECT vg.*
|
||||
, ma.material_name
|
||||
, ma.material_code
|
||||
, ma.material_spec
|
||||
, po.region_name
|
||||
, ma.material_name
|
||||
, ma.material_code
|
||||
, ma.material_spec
|
||||
, po.region_name
|
||||
FROM sch_base_vehiclematerialgroup vg
|
||||
LEFT JOIN md_base_material ma ON vg.material_id = ma.material_id
|
||||
LEFT JOIN sch_base_point po ON vg.region_code = po.region_code
|
||||
@@ -23,13 +23,14 @@
|
||||
</if>
|
||||
<if test="query.region_code != null">
|
||||
AND vg.point_code IN (
|
||||
SELECT p.point_code
|
||||
FROM sch_base_point p
|
||||
WHERE p.region_code = #{query.region_code}
|
||||
SELECT p.point_code
|
||||
FROM sch_base_point p
|
||||
WHERE p.region_code = #{query.region_code}
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="getGroup" resultType="org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup" parameterType="com.alibaba.fastjson.JSONObject">
|
||||
<select id="getGroup" resultType="org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup"
|
||||
parameterType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT vg.*
|
||||
, ma.material_name
|
||||
, ma.material_code
|
||||
@@ -49,4 +50,23 @@
|
||||
</if>
|
||||
AND vg.group_bind_material_status = '2'
|
||||
</select>
|
||||
<select id="selectOrders" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
SELECT sbv.order_code
|
||||
FROM sch_base_vehiclematerialgroup sbv
|
||||
WHERE sbv.vehicle_code = #{vehicle_code}
|
||||
</select>
|
||||
<select id="selectMaterialByVehicleCode" resultType="java.util.Map" parameterType="java.lang.String">
|
||||
SELECT
|
||||
sbv.order_code,
|
||||
SUM(sbv.material_qty) AS total_material_qty
|
||||
FROM
|
||||
sch_base_vehiclematerialgroup sbv
|
||||
WHERE 1 = 1
|
||||
<if test="vehicle_code != null">
|
||||
AND sbv.vehicle_code = #{vehicle_code}
|
||||
</if>
|
||||
GROUP BY
|
||||
sbv.order_code
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.sch.group.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -25,9 +26,11 @@ import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.group.service.dto.SchBaseVehiclematerialgroupQuery;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -46,6 +49,8 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
|
||||
@Autowired
|
||||
private IMdBaseMaterialService iMdBaseMaterialService;
|
||||
@Autowired
|
||||
private ProcessFlowService processFlowService;
|
||||
|
||||
|
||||
@Autowired
|
||||
@@ -141,4 +146,27 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectOrdersByVehicleCode(String vehicle_code) {
|
||||
return vehiclematerialgroupMapper.selectOrders(vehicle_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> selectMaterialByVehicleCode(String vehicle_code) {
|
||||
List<Map> maps = vehiclematerialgroupMapper.selectMaterialByVehicleCode(vehicle_code);
|
||||
maps.stream().forEach(orderList -> {
|
||||
List<SchBaseVehiclematerialgroup> order_code = vehiclematerialgroupMapper.selectList(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getOrder_code, orderList.get("order_code"))
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||
if(CollUtil.isNotEmpty(order_code)){
|
||||
orderList.put("region_code",order_code.get(0).getRegion_code());
|
||||
}
|
||||
HashMap<String,String> processFlow = processFlowService.selectProcessFlowByOrder(orderList.get("order_code"));
|
||||
if(CollUtil.isNotEmpty(processFlow)){
|
||||
orderList.put("due_date",processFlow.get("due_date"));
|
||||
}
|
||||
});
|
||||
return maps;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -187,4 +187,15 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
*/
|
||||
List<String> getByRegionCode(String region_code);
|
||||
|
||||
/**
|
||||
* 查找地面区域的空点位
|
||||
* @param targetRegionCode
|
||||
* @param value
|
||||
*/
|
||||
SchBasePoint selectGroundByRegionCode(String targetRegionCode, String value);
|
||||
|
||||
/**
|
||||
* 选择登录设备
|
||||
*/
|
||||
List<Map> selectJobDevice();
|
||||
}
|
||||
|
||||
@@ -159,4 +159,7 @@ public class SchBasePoint implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "工序点位信息")
|
||||
private String region_points;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.point.service.dto.PointMaterialInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -27,4 +28,5 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
|
||||
List<String> selectByRegionCode(@Param("region_code") String region_code);
|
||||
|
||||
List<Map> selectJobDevice();
|
||||
}
|
||||
|
||||
@@ -55,4 +55,7 @@
|
||||
where
|
||||
sbp.region_code = #{region_code}
|
||||
</select>
|
||||
<select id="selectJobDevice" resultType="java.util.Map">
|
||||
select sbp.point_code,sbp.point_name from sch_base_point sbp where is_lock = true and region_code = 'GZQ' and region_points is not null
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -414,16 +414,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.orderByDesc(SchBasePoint::getIn_order_seq));
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
/*if (schBasePoints.size() == 1 && isVehicle) {
|
||||
if (schBasePoint.getVehicle_qty() <= 1) {
|
||||
task.setRemark("没有多余空笼框,待补充!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("没有多余空笼框,待补充!", task.getConfig_code() + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
Gson gson = new Gson();
|
||||
Type setType = new TypeToken<List<String>>() {
|
||||
}.getType();
|
||||
@@ -464,6 +454,23 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
return pointMapper.selectByRegionCode(region_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectGroundByRegionCode(String targetRegionCode, String value) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, value)
|
||||
.isNull(SchBasePoint::getVehicle_code)
|
||||
.eq(StrUtil.isNotBlank(targetRegionCode), SchBasePoint::getRegion_code, targetRegionCode)
|
||||
.orderByAsc(SchBasePoint::getIn_order_seq));
|
||||
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> selectJobDevice() {
|
||||
return pointMapper.selectJobDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderMater> getStructList(String region_code, String vehicle_type) {
|
||||
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.sch.process_flow.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.process_flow.service.dto.ProcessFlow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProcessFlowService extends IService<ProcessFlow> {
|
||||
|
||||
/**
|
||||
* 根据订单号查找工艺流
|
||||
* @param order_code
|
||||
* @return
|
||||
*/
|
||||
HashMap<String,String> selectProcessFlowByOrder(Object order_code);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package org.nl.wms.sch.process_flow.service.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_process_flow")
|
||||
public class ProcessFlow {
|
||||
|
||||
/**
|
||||
* 工艺id
|
||||
*/
|
||||
private String craft_id;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String order_code;
|
||||
/**
|
||||
* 工艺流程
|
||||
*/
|
||||
private String process_flow;
|
||||
/**
|
||||
* 交付时间
|
||||
*/
|
||||
private String due_date;
|
||||
/**
|
||||
*创建人
|
||||
*/
|
||||
private String create_name;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_name;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.wms.sch.process_flow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.sch.process_flow.service.ProcessFlowService;
|
||||
import org.nl.wms.sch.process_flow.service.dto.ProcessFlow;
|
||||
import org.nl.wms.sch.process_flow.service.mapper.ProcessFlowMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@Service
|
||||
public class ProcessFlowServiceImpl extends ServiceImpl<ProcessFlowMapper, ProcessFlow> implements ProcessFlowService {
|
||||
|
||||
@Autowired
|
||||
private ProcessFlowMapper processFlowMapper;
|
||||
|
||||
@Override
|
||||
public HashMap<String,String> selectProcessFlowByOrder(Object order_code) {
|
||||
return processFlowMapper.selectProcessFlow(order_code);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.sch.process_flow.service.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.sch.process_flow.service.dto.ProcessFlow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProcessFlowMapper extends BaseMapper<ProcessFlow> {
|
||||
|
||||
/**
|
||||
* 查询流程信息
|
||||
* @param order_code
|
||||
* @return
|
||||
*/
|
||||
HashMap<String,String> selectProcessFlow(@Param("order_code") Object order_code);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch.process_flow.service.mapper.ProcessFlowMapper">
|
||||
|
||||
<select id="selectProcessFlow" resultType="java.util.HashMap" parameterType="java.lang.Object">
|
||||
select sbpf.process_flow,sbpf.due_date from sch_base_process_flow sbpf where sbpf.order_code = #{order_code}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -110,11 +110,9 @@ public abstract class AbstractTask {
|
||||
list.add(taskDto);
|
||||
JSONObject result = AcsUtil.notifyAcs("api/wms/task", list);
|
||||
if (HttpStatus.OK.value() == result.getInteger("status")) {
|
||||
for (SchBaseTask schBaseTask : taskList) {
|
||||
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode());
|
||||
schBaseTask.setRemark(" ");
|
||||
taskService.update(schBaseTask);
|
||||
}
|
||||
task.setTask_status(TaskStatus.ISSUED.getCode());
|
||||
task.setRemark(" ");
|
||||
taskService.update(task);
|
||||
} else if (HttpStatus.BAD_REQUEST.value() == result.getInteger("status")) {
|
||||
task.setRemark(result.getString("message"));
|
||||
taskService.update(task);
|
||||
|
||||
@@ -59,6 +59,10 @@ public class GeneralDefinition {
|
||||
/** 是否连接 */
|
||||
public static final String IS_CONNECT_ACS = "is_connect_acs";
|
||||
public static final String IS_CONNECT_CONNECTOR = "is_connect_connector";
|
||||
/**
|
||||
* 是否调用connector小插件
|
||||
*/
|
||||
public static final String IS_INVOKE_CONNECTOR = "is_invoke_connector";
|
||||
/** ACS路径 */
|
||||
public static final String ACS_URL = "acs_url";
|
||||
/**
|
||||
|
||||
@@ -4,9 +4,11 @@ package org.nl.wms.sch.task_manage.task;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
@@ -15,7 +17,9 @@ import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ACS连接工具类:
|
||||
@@ -83,10 +87,10 @@ public class ConnectorUtil {
|
||||
String connectorUrl = connectorUrlObj.getValue();
|
||||
JSONObject result;
|
||||
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
|
||||
return AcsResponse.requestRefuse("未连接ACS!");
|
||||
return AcsResponse.requestRefuse("未连接Connector!");
|
||||
}
|
||||
String url = connectorUrl + api;
|
||||
log.info("反馈connector到达取货点的参数为:{},接口路径:{}", JSON.toJSONString(object),url);
|
||||
log.info("向connector申请物料下道工序和交期时间:{},接口路径:{}", JSON.toJSONString(object),url);
|
||||
AcsResponse resultForAcs;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
@@ -139,4 +143,56 @@ public class ConnectorUtil {
|
||||
}
|
||||
return resultForAcs;
|
||||
}
|
||||
|
||||
public static <T> JSONObject notifyConnector3(String api, T object) {
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
//判断是否连接ACS系统
|
||||
Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.IS_CONNECT_CONNECTOR);
|
||||
if (ObjectUtil.isEmpty(isConnectConnector)) {
|
||||
Map<String, Object> map = MapOf.of(
|
||||
"status", HttpStatus.BAD_REQUEST.value(),
|
||||
"message", "参数表中:" + GeneralDefinition.IS_CONNECT_CONNECTOR + "不存在"
|
||||
);
|
||||
return new JSONObject(map);
|
||||
}
|
||||
String isConnect = isConnectConnector.getValue();
|
||||
//ACS地址:127.0.0.1:8010
|
||||
Param connectorUrlObj = sysParamService.findByCode(GeneralDefinition.CONNECTOR_URL);
|
||||
if (ObjectUtil.isEmpty(connectorUrlObj)) {
|
||||
Map<String, Object> map = MapOf.of(
|
||||
"status", HttpStatus.BAD_REQUEST.value(),
|
||||
"message", "参数表中:" + GeneralDefinition.CONNECTOR_URL + "不存在"
|
||||
);
|
||||
return new JSONObject(map);
|
||||
}
|
||||
String connectorUrl = connectorUrlObj.getValue();
|
||||
JSONObject result;
|
||||
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
|
||||
Map<String, Object> map = MapOf.of(
|
||||
"status", HttpStatus.BAD_REQUEST.value(),
|
||||
"message", "未连接Connector!"
|
||||
);
|
||||
return new JSONObject(map);
|
||||
}
|
||||
String url = connectorUrl + api;
|
||||
log.info("向connector申请物料下道工序和交期时间:{},接口路径:{}", JSON.toJSONString(object),url);
|
||||
AcsResponse resultForAcs;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(object))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("反馈connector到达取货点的响应参数为:{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
log.error("连接失败:{}", msg);
|
||||
Map<String, Object> map = MapOf.of(
|
||||
"status", HttpStatus.BAD_REQUEST.value(),
|
||||
"message", "wang"
|
||||
);
|
||||
return new JSONObject(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,22 +65,13 @@ public class EmptyCageTask extends AbstractTask {
|
||||
// 查询是空料笼还是,空料架
|
||||
String vehicle_type = task.getVehicle_type();
|
||||
String vehicle_code = task.getVehicle_code();
|
||||
if (StrUtil.isNotEmpty(vehicle_code)) {
|
||||
JSONArray json = JSONUtil.parseArray(vehicle_code);
|
||||
String s = json.get(0, String.class);
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(s);
|
||||
if (StrUtil.isNotEmpty(vehicle_code) && vehicle_code.contains(",")) {
|
||||
String[] split = vehicle_code.split(",");
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(split[0]);
|
||||
vehicle_type = mdBaseVehicle.getVehicle_type();
|
||||
}
|
||||
SchBasePoint schBasePoint = null;
|
||||
switch (vehicle_type) {
|
||||
/*case "S04":
|
||||
//空料架
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.OUT_OF_STOCK.getValue(), task.getVehicle_type(), 1);
|
||||
break;
|
||||
case "S06":
|
||||
//空料架
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.OUT_OF_STOCK.getValue(), task.getVehicle_type(), 1);
|
||||
break;*/
|
||||
case "R01":
|
||||
//RO1空料容
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
@@ -55,8 +57,15 @@ public class ToStoreHouseTask extends AbstractTask {
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.EMPTY_PALLETS.getValue()
|
||||
,task.getVehicle_type(),0);
|
||||
SchBasePoint schBasePoint = null;
|
||||
if (task.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode()) || task.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())) {
|
||||
schBasePoint = schBasePointService.selectByEmptyCage(RegionEnum.DDLK.getRegion_code(),
|
||||
task.getVehicle_type(),GoodsEnum.EMPTY_PALLETS.getValue(),true,task);
|
||||
} else {
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.EMPTY_PALLETS.getValue()
|
||||
, task.getVehicle_type(), 1);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
@@ -73,9 +82,9 @@ public class ToStoreHouseTask extends AbstractTask {
|
||||
taskService.updateById(task);
|
||||
|
||||
|
||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
/*schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());*/
|
||||
schBasePoint.setPoint_status(GoodsEnum.OUT_OF_STOCK.getValue());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
|
||||
@@ -56,7 +56,6 @@ public class PcOperationCMTask extends AbstractTask {
|
||||
// 获取任务:叫满眶时候已经确认物料
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
// 找起点
|
||||
CallMaterVo callMaterVo = JSONObject.parseObject(task.getRequest_param(), CallMaterVo.class);
|
||||
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", callMaterVo.getVehicle_code()));
|
||||
@@ -72,6 +71,7 @@ public class PcOperationCMTask extends AbstractTask {
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",TaskStatus.CREATED.getCode())
|
||||
.set("point_code1",structPoint.getPoint_code())
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -68,12 +71,13 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||
//判断是否指定到外协区
|
||||
String targetRegionCode = sendMaterVo.getTarget_region_code();
|
||||
//TODO: 分配逻辑
|
||||
SchBasePoint schBasePoint = null;
|
||||
if (!StringUtils.isEmpty(targetRegionCode)){
|
||||
if (!StringUtils.isEmpty(targetRegionCode)) {
|
||||
|
||||
}else {
|
||||
} else {
|
||||
// 根据对接位查找对应的载具类型
|
||||
schBasePoint = schBasePointService.selectByRegionCode(task.getRegion_code(),task.getVehicle_code(),"1");
|
||||
schBasePoint = schBasePointService.selectByRegionCode(task.getRegion_code(), task.getVehicle_code(), "1");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
@@ -83,17 +87,30 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
List<SendMaterVo> sendMaterVos = null;
|
||||
if (CollUtil.isNotEmpty(sendMaterVo.getMaterial_info())) {
|
||||
sendMaterVo.getMaterial_info().stream().forEach(sendMater -> {
|
||||
SendMaterVo sendMaterVo1 = BeanUtil.copyProperties(sendMater, SendMaterVo.class);
|
||||
sendMaterVos.add(sendMaterVo1);
|
||||
});
|
||||
}
|
||||
//删除组盘记录生成新的
|
||||
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code",sendMaterVo.getVehicle_code()));
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(sendMaterVo.getVehicle_code());
|
||||
schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code());
|
||||
schBaseVehiclematerialgroup.setMaterial_id(sendMaterVo.getMaterial_id());
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(sendMaterVo.getMaterial_qty());
|
||||
schBaseVehiclematerialgroup.setRegion_code(sendMaterVo.getRegion_code());
|
||||
schBaseVehiclematerialgroup.setOrder_code(sendMaterVo.getOrder_code());
|
||||
schBaseVehiclematerialgroup.setHas_work(sendMaterVo.getHas_work());
|
||||
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code", sendMaterVo.getVehicle_code()));
|
||||
if(CollUtil.isNotEmpty(sendMaterVos)){
|
||||
SchBasePoint finalSchBasePoint = schBasePoint;
|
||||
sendMaterVos.stream().forEach(smv -> {
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(sendMaterVo.getVehicle_code());
|
||||
schBaseVehiclematerialgroup.setPoint_code(finalSchBasePoint.getPoint_code());
|
||||
schBaseVehiclematerialgroup.setMaterial_id(smv.getMaterial_id());
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(smv.getMaterial_qty());
|
||||
schBaseVehiclematerialgroup.setRegion_code(smv.getRegion_code());
|
||||
schBaseVehiclematerialgroup.setOrder_code(smv.getOrder_code());
|
||||
schBaseVehiclematerialgroup.setDue_date(smv.getDue_date());
|
||||
schBaseVehiclematerialgroup.setHas_work(sendMaterVo.getHas_work());
|
||||
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
});
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
@@ -104,6 +121,7 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
//更新点位
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class PcOperationSNTTask extends AbstractTask {
|
||||
|
||||
//更新点位信息
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setIs_lock(true);
|
||||
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.pcoperation;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.wms.PointStatusEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.fab.service.dto.SendMaterVo;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料下料转运在外协内部加工区
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(value = "ProcessingSMTTask")
|
||||
public class ProcessingSMTTask extends AbstractTask {
|
||||
|
||||
|
||||
private static final String TASK_CONFIG_CODE = "ProcessingSMTTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
|
||||
for (SchBaseTask task : tasks) {
|
||||
|
||||
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||
//判断是否指定到外协区
|
||||
String targetRegionCode = sendMaterVo.getTarget_region_code();
|
||||
if (StringUtils.isBlank(targetRegionCode)) {
|
||||
task.setRemark("未指定区域!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未指定区域!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
//TODO: 分配逻辑
|
||||
SchBasePoint schBasePoint = schBasePointService.selectGroundByRegionCode(targetRegionCode, GoodsEnum.OUT_OF_STOCK.getValue());
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
//删除组盘记录生成新的
|
||||
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code", sendMaterVo.getVehicle_code()));
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.updateById(task);
|
||||
|
||||
//更新点位
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
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));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.updateById(schBasePoint2);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.nl.wms.sch.vehicle.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.sch.vehicle.service.IBmVehicleInfoService;
|
||||
import org.nl.wms.sch.vehicle.service.dto.VehicleQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 载具信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/bmVehicleInfo")
|
||||
public class BmVehicleInfoController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IBmVehicleInfoService vehicleInfoService;
|
||||
|
||||
|
||||
@GetMapping("/vehicleInfo")
|
||||
public ResponseEntity<Object> vehicleInfo(String vehicle_code) {
|
||||
return new ResponseEntity<>(vehicleInfoService.vehileInfo(vehicle_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询载具")
|
||||
public ResponseEntity<Object> query(VehicleQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(vehicleInfoService.page(page.build(), query.build())), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增载具")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject map) {
|
||||
return new ResponseEntity<>(vehicleInfoService.create(map), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改载具")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody JSONObject dto) {
|
||||
vehicleInfoService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除载具")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
vehicleInfoService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改点位启用状态")
|
||||
public ResponseEntity<Object> changeActive(@RequestBody JSONObject json) {
|
||||
vehicleInfoService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getVehicle/{code}")
|
||||
@Log("获取起始载具号")
|
||||
public ResponseEntity<Object> getVehicle(@PathVariable String code) {
|
||||
JSONObject json = vehicleInfoService.getVehicle(code);
|
||||
return new ResponseEntity<>(json, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/updateVehicleMaterial")
|
||||
public ResponseEntity<Object> updateVehicleInfo(@RequestBody JSONObject form) {
|
||||
vehicleInfoService.updateVehicleMaterial(form);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.nl.wms.sch.vehicle.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo;
|
||||
import org.nl.wms.sch.vehicle.service.dto.VehicleQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 载具信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface IBmVehicleInfoService extends IService<BmVehicleInfo> {
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param map /
|
||||
*/
|
||||
JSONArray create(JSONObject map);
|
||||
/**
|
||||
* 获取载具上物料信息
|
||||
* @param vehile_code
|
||||
* @return
|
||||
*/
|
||||
BmVehicleInfo vehileInfo(String vehile_code);
|
||||
|
||||
void updateVehicleMaterial(JSONObject vorm);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param query 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Page queryAll(VehicleQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<StoragevehicleinfoDto>
|
||||
*/
|
||||
List<BmVehicleInfo> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param storagevehicle_id ID
|
||||
* @return BmVehicleInfo
|
||||
*/
|
||||
Object findById(Long storagevehicle_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return BmVehicleInfo
|
||||
*/
|
||||
BmVehicleInfo findByCode(String code);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(JSONObject dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 多修改启用状态
|
||||
* @param json /
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
/**
|
||||
* 获取起始载具号
|
||||
* @param code /
|
||||
*/
|
||||
JSONObject getVehicle(String code);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package org.nl.wms.sch.vehicle.service.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 载具信息表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_base_vehicle")
|
||||
public class BmVehicleInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
@TableId
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具名称
|
||||
*/
|
||||
private String vehicle_name;
|
||||
/**
|
||||
* 载具名称
|
||||
*/
|
||||
private String vehicle_type;
|
||||
|
||||
/**
|
||||
* 一维码
|
||||
*/
|
||||
private String one_code;
|
||||
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
private String two_code;
|
||||
|
||||
/**
|
||||
* RFID编码
|
||||
*/
|
||||
private String rfid_code;
|
||||
|
||||
/**
|
||||
* 添加人
|
||||
*/
|
||||
private String create_name;
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean is_used;
|
||||
|
||||
|
||||
/**
|
||||
* 载具宽度
|
||||
*//*
|
||||
private Integer w;
|
||||
|
||||
|
||||
*//**
|
||||
* 载具长度
|
||||
*//*
|
||||
private Integer l;
|
||||
|
||||
*//**
|
||||
* 载具高度
|
||||
*//*
|
||||
private Integer h;
|
||||
|
||||
*//**
|
||||
* 载具重量(kg)
|
||||
*//*
|
||||
private Integer weight;*/
|
||||
|
||||
|
||||
/**
|
||||
* 载具是否超仓位
|
||||
*/
|
||||
private String overstruct_type;
|
||||
|
||||
/**
|
||||
* 占仓位数
|
||||
*/
|
||||
private BigDecimal occupystruct_qty;
|
||||
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private JSONObject ext_id;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.sch.vehicle.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 载具信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface BmVehicleInfoMapper extends BaseMapper<BmVehicleInfo> {
|
||||
|
||||
BmVehicleInfo vehileInfo(String vehicle_code);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.sch.vehicle.service.dao.mapper.BmVehicleInfoMapper">
|
||||
|
||||
<select id="vehileInfo" resultType="org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo">
|
||||
select *
|
||||
from md_pb_storagevehicleinfo
|
||||
where md_pb_storagevehicleinfo.storagevehicle_code = #{vehicle_code}
|
||||
and md_pb_storagevehicleinfo.is_delete = false
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.nl.wms.sch.vehicle.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class VehicleQuery extends BaseQuery<BmVehicleInfo> {
|
||||
|
||||
private String vehicle_code_begin;
|
||||
private String vehicle_code;
|
||||
private String vehicle_code_end;
|
||||
private String vehicle_type;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("vehicle_code_begin", QParam.builder().k(new String[]{"vehicle_code"}).type(QueryTEnum.EQ).build());
|
||||
super.doP.put("vehicle_code_end", QParam.builder().k(new String[]{"vehicle_code"}).type(QueryTEnum.LE).build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package org.nl.wms.sch.vehicle.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.wms.sch.vehicle.service.IBmVehicleInfoService;
|
||||
import org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo;
|
||||
import org.nl.wms.sch.vehicle.service.dao.mapper.BmVehicleInfoMapper;
|
||||
import org.nl.wms.sch.vehicle.service.dto.VehicleQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 载具信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Service
|
||||
public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, BmVehicleInfo> implements IBmVehicleInfoService {
|
||||
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
|
||||
@Override
|
||||
public BmVehicleInfo vehileInfo(String vehicle_code) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code",vehicle_code));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray create(JSONObject map) {
|
||||
BmVehicleInfo one = this.getOne(new QueryWrapper<BmVehicleInfo>()
|
||||
.eq("vehicle_code", map.getString("vehicle_code")));
|
||||
if (!ObjectUtil.isEmpty(one)) {
|
||||
throw new BadRequestException("此载具已存在");
|
||||
}
|
||||
//转编码类型:
|
||||
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("para1", map.getString("vehicle_type")));
|
||||
if (dict==null){
|
||||
throw new BadRequestException("此载具类型"+map.getString("vehicle_type")+"没有配置字典值");
|
||||
}
|
||||
JSONArray resultCodeArr = new JSONArray();
|
||||
int num = MapUtil.getInt(map, "num");
|
||||
for (int i = 0; i < num; i++) {
|
||||
BmVehicleInfo entity = new BmVehicleInfo();
|
||||
entity.setVehicle_code(CodeUtil.getNewCode(map.getString("vehicle_type")));
|
||||
entity.setVehicle_name(entity.getVehicle_name());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_name(DateUtil.now());
|
||||
entity.setVehicle_type(dict.getValue());
|
||||
this.save(entity);
|
||||
resultCodeArr.add(entity.getVehicle_code());
|
||||
}
|
||||
return resultCodeArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateVehicleMaterial(JSONObject vorm) {
|
||||
/* Assert.notNull(vorm.getString("storagevehicle_code"),"请求参数载具编号不能为空");
|
||||
storagevehicleextService.remove(new QueryWrapper<MdPbStoragevehicleext>()
|
||||
.eq("storagevehicle_code",vorm.getString("storagevehicle_code")));
|
||||
if (StringUtils.isEmpty(vorm.getString("material_code"))){
|
||||
return;
|
||||
}
|
||||
MdMeMaterialbase one = iMdMeMaterialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>()
|
||||
.eq("material_code", vorm.getString("material_code"))
|
||||
.eq("is_delete",false));
|
||||
if (one==null){
|
||||
throw new BadRequestException("当前物料编号不存在:"+vorm.getString("material_code"));
|
||||
}
|
||||
MdPbStoragevehicleext vehicleMaterial = new MdPbStoragevehicleext();
|
||||
vehicleMaterial.setStoragevehicle_id(vorm.getString("storagevehicle_id"));
|
||||
vehicleMaterial.setStoragevehicle_code(vorm.getString("storagevehicle_code"));
|
||||
vehicleMaterial.setStorage_qty(vorm.getBigDecimal("storage_qty"));
|
||||
vehicleMaterial.setWeight(vorm.getBigDecimal("weight"));
|
||||
vehicleMaterial.setMaterial_id(one.getMaterial_id());
|
||||
vehicleMaterial.setMaterial_code(one.getMaterial_code());
|
||||
vehicleMaterial.setMaterial_spec(one.getMaterial_spec());
|
||||
vehicleMaterial.setQty_unit_id(one.getBase_unit_id());
|
||||
vehicleMaterial.setPcsn(vorm.getString("pcsn"));
|
||||
vehicleMaterial.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
vehicleMaterial.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
vehicleMaterial.setUpdate_time(DateUtil.now());
|
||||
storagevehicleextService.save(vehicleMaterial);*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Page queryAll(VehicleQuery query, PageQuery page) {
|
||||
return this.page(page.build(), query.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BmVehicleInfo> queryAll(Map whereJson) {
|
||||
List<BmVehicleInfo> list = this.list();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object findById(Long storagevehicle_id) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("storagevehicle_id",storagevehicle_id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BmVehicleInfo findByCode(String code) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code",code));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(JSONObject dto) {
|
||||
BmVehicleInfo entity = dto.toJavaObject(BmVehicleInfo.class);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
if (ids.length>0){
|
||||
this.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(JSONObject json) {
|
||||
|
||||
BmVehicleInfo entity = json.toJavaObject(BmVehicleInfo.class);
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getVehicle(String code) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("value", CodeUtil.getNewCode(code));
|
||||
return json;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user