opt: 优化代码,更新logo展示
This commit is contained in:
@@ -191,12 +191,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,24 +204,20 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutReqUpper() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqUpper", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
} else if ("2".equals(plc_to_agv)) {
|
} else if ("2".equals(plc_to_agv)) {
|
||||||
if (plcToAgvDeviceDriver.getAGVSetOutReqLower() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutReqLower() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqLower", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetOutReqLower", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
data = feedBackStatus(data, index, 1, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,12 +363,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,24 +380,20 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInReqUpper() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqUpper", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
} else if ("2".equals(plc_to_agv)) {
|
} else if ("2".equals(plc_to_agv)) {
|
||||||
if (plcToAgvDeviceDriver.getAGVSetInReqLower() != 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInReqLower() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqLower", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVSetInReqLower", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1");
|
|
||||||
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) {
|
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) {
|
||||||
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
if (plcToAgvDeviceDriver.getAGVInOP() != 1) {
|
||||||
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
writeSignal(plcToAgvDeviceDriver, "AGVInOP", "1");
|
||||||
}
|
}
|
||||||
//plcToAgvDeviceDriver.writing("AGVInOP", "1");
|
|
||||||
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
data = feedBackStatus(data, index, 3, inst, task, 2, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -12,12 +13,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||||
import org.nl.acs.device.domain.Device;
|
import org.nl.acs.device.domain.Device;
|
||||||
import org.nl.acs.device.enums.DeviceType;
|
import org.nl.acs.device.enums.DeviceType;
|
||||||
import org.nl.acs.device.service.mapper.DeviceMapper;
|
import org.nl.acs.device.service.mapper.DeviceMapper;
|
||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.route.domain.RoutePlan;
|
||||||
import org.nl.acs.route.service.RoutePlanService;
|
import org.nl.acs.route.service.RoutePlanService;
|
||||||
import org.nl.acs.route.service.dto.RoutePlanDto;
|
import org.nl.acs.route.service.dto.RoutePlanDto;
|
||||||
import org.nl.acs.common.base.PageInfo;
|
import org.nl.acs.common.base.PageInfo;
|
||||||
@@ -55,6 +58,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author jiaolm
|
* @author jiaolm
|
||||||
* @date 2023-05-09
|
* @date 2023-05-09
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
// @CacheConfig(cacheNames = RouteLineService.CACHE_KEY)
|
// @CacheConfig(cacheNames = RouteLineService.CACHE_KEY)
|
||||||
@@ -345,36 +349,31 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(RouteLineDto dto) throws SQLException {
|
public void update(RouteLineDto dto) throws SQLException {
|
||||||
RouteLineDto entity = this.findById(dto.getLine_uuid());
|
RouteLineDto entity = this.findById(dto.getLine_uuid());
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (ObjectUtil.isEmpty(entity)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_by(currentUsername);
|
||||||
|
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_route_line");
|
|
||||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
|
||||||
//
|
|
||||||
// wo.update(json);
|
|
||||||
|
|
||||||
RouteLine routeLine = ConvertUtil.convert(dto, RouteLine.class);
|
RouteLine routeLine = ConvertUtil.convert(dto, RouteLine.class);
|
||||||
routeLineMapper.updateById(routeLine);
|
routeLineMapper.updateById(routeLine);
|
||||||
|
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(String[] ids) throws SQLException {
|
public void deleteAll(String[] ids) throws SQLException {
|
||||||
routeLineMapper.deleteBatchIds(Arrays.asList(ids));
|
routeLineMapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
//reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -413,12 +412,10 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
|||||||
//获取所有设备 (主要是设备编号,可以修改)
|
//获取所有设备 (主要是设备编号,可以修改)
|
||||||
List<Device> deviceList= new LambdaQueryChainWrapper<>(deviceMapper)
|
List<Device> deviceList= new LambdaQueryChainWrapper<>(deviceMapper)
|
||||||
.list();
|
.list();
|
||||||
JSONArray de = JSONArray.parseArray(JSON.toJSONString(deviceList));
|
|
||||||
|
|
||||||
HashMap<String, Integer> map = new HashMap<>();
|
HashMap<String, Integer> map = new HashMap<>();
|
||||||
for (int i = 0; i < de.size(); i++) {
|
for (int i = 0; i < deviceList.size(); i++) {
|
||||||
JSONObject jo = (JSONObject) de.get(i);
|
Device device = deviceList.get(i);
|
||||||
map.put(jo.getString("device_code"), i);
|
map.put(device.getDevice_code(), i);
|
||||||
}
|
}
|
||||||
int size = map.size();
|
int size = map.size();
|
||||||
//查询所有路由
|
//查询所有路由
|
||||||
@@ -446,8 +443,6 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
|||||||
smap.put("route_plan_id", routeLine.getRoute_plan_id());
|
smap.put("route_plan_id", routeLine.getRoute_plan_id());
|
||||||
n[s][e] = smap;
|
n[s][e] = smap;
|
||||||
}
|
}
|
||||||
//对数组使用Floyd(弗洛伊德)算法,求出任意两个设备之间的最短距离,不通则为null
|
|
||||||
// JSONObject json = WQLObject.getWQLObject("sys_param").query("code ='route'").uniqueResult(0);
|
|
||||||
|
|
||||||
Param param = paramService.findByCode("route");
|
Param param = paramService.findByCode("route");
|
||||||
if (ObjectUtil.isNotEmpty(param)){
|
if (ObjectUtil.isNotEmpty(param)){
|
||||||
@@ -519,18 +514,12 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void reload() throws SQLException {
|
public void reload() throws SQLException {
|
||||||
Object[] param = new Object[0];
|
List<RoutePlanDto> routePlans = this.routePlanService.queryAll((Map) null);
|
||||||
Map map = new HashMap();
|
|
||||||
List<RoutePlanDto> routePlans = this.routePlanService.queryAll(map);
|
|
||||||
Iterator var2 = routePlans.iterator();
|
Iterator var2 = routePlans.iterator();
|
||||||
while (var2.hasNext()) {
|
while (var2.hasNext()) {
|
||||||
RoutePlanDto routePlan = (RoutePlanDto) var2.next();
|
RoutePlanDto routePlan = (RoutePlanDto) var2.next();
|
||||||
Map map1 = new HashMap();
|
|
||||||
map1.put("route_plan_id", routePlan.getPlan_uuid());
|
|
||||||
|
|
||||||
replaceAccess(routePlan.getPlan_uuid());
|
replaceAccess(routePlan.getPlan_uuid());
|
||||||
this.routePlans.put(routePlan.getPlan_code(), routePlan);
|
//this.routePlans.put(routePlan.getPlan_code(), routePlan);
|
||||||
|
|
||||||
List<RouteLineDto> routeDaoList = routePlansList.stream().map(entity -> {
|
List<RouteLineDto> routeDaoList = routePlansList.stream().map(entity -> {
|
||||||
RouteLineDto routeLineDto = new RouteLineDto();
|
RouteLineDto routeLineDto = new RouteLineDto();
|
||||||
routeLineDto.setDevice_code(entity.get("device_code").toString());
|
routeLineDto.setDevice_code(entity.get("device_code").toString());
|
||||||
@@ -553,8 +542,6 @@ public class RouteLineServiceImpl extends CommonServiceImpl<RouteLineMapper, Rou
|
|||||||
}
|
}
|
||||||
routeLines.put(routePlan.getPlan_code(), list);
|
routeLines.put(routePlan.getPlan_code(), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
BIN
acs/nladmin-ui/src/assets/images/ximenzi.png
Normal file
BIN
acs/nladmin-ui/src/assets/images/ximenzi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 91 KiB |
@@ -2,11 +2,11 @@
|
|||||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBackground }">
|
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBackground }">
|
||||||
<transition name="sidebarLogoFade">
|
<transition name="sidebarLogoFade">
|
||||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
<img v-if="logo" :src="logo" class="sidebar-logo">
|
||||||
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
<img v-if="logo" :src="logo" class="sidebar-logo">
|
||||||
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||||
</router-link>
|
</router-link>
|
||||||
</transition>
|
</transition>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Logo from '@/assets/images/logo.png'
|
import Logo from '@/assets/images/ximenzi.png'
|
||||||
import variables from '@/assets/styles/variables.scss'
|
import variables from '@/assets/styles/variables.scss'
|
||||||
export default {
|
export default {
|
||||||
name: 'SidebarLogo',
|
name: 'SidebarLogo',
|
||||||
@@ -24,6 +24,13 @@ export default {
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '诺力开发平台',
|
||||||
|
logo: Logo,
|
||||||
|
title_param: 'platform'
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
variables() {
|
variables() {
|
||||||
return variables
|
return variables
|
||||||
@@ -32,13 +39,6 @@ export default {
|
|||||||
return this.$store.state.settings.sideTheme
|
return this.$store.state.settings.sideTheme
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
title: '诺力开发平台',
|
|
||||||
logo: Logo,
|
|
||||||
title_param: 'platform'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
this.getValueByCode(this.title_param).then(res => {
|
this.getValueByCode(this.title_param).then(res => {
|
||||||
this.title = res.value
|
this.title = res.value
|
||||||
@@ -70,8 +70,8 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
& .sidebar-logo {
|
& .sidebar-logo {
|
||||||
width: 32px;
|
width: 64px;
|
||||||
height: 32px;
|
height: 64px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 6px;
|
margin-right: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public enum RegionEnum {
|
|||||||
WXJG("外协加工区","WXJGZCQ"),
|
WXJG("外协加工区","WXJGZCQ"),
|
||||||
ZDZWQ("自动折弯区","ZDZWQ"),
|
ZDZWQ("自动折弯区","ZDZWQ"),
|
||||||
NBGD("内部过道加工区","NBGDJGQ"),
|
NBGD("内部过道加工区","NBGDJGQ"),
|
||||||
|
QTJG("其他加工送料暂存区","111-22"),
|
||||||
;
|
;
|
||||||
private final String region_name;
|
private final String region_name;
|
||||||
private final String region_code;
|
private final String region_code;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -34,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Api(tags = "fab相关接口")
|
@Api(tags = "fab相关接口")
|
||||||
@@ -52,6 +54,7 @@ public class FabController {
|
|||||||
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsToConnectorService wmsToConnectorService;
|
private WmsToConnectorService wmsToConnectorService;
|
||||||
|
private static final HashMap REGION_CODE = MapOf.of("货架", "1", "外协加工", "2", "内部加工", "3", "内部过道", "4","其他加工","5");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,60 +225,76 @@ public class FabController {
|
|||||||
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
|
public ResponseEntity<TableDataInfo> sendMater(@RequestBody SendMaterVo materInfo) {
|
||||||
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
JSONObject toJSON = (JSONObject) JSON.toJSON(materInfo);
|
||||||
//TODO:待确定
|
//TODO:待确定
|
||||||
if ("1".equals(materInfo.getPoint_code())) {
|
if (REGION_CODE.get("货架").equals(materInfo.getPoint_code())) {
|
||||||
List<SendVehicleVo> mater = materInfo.getMater();
|
List<SendVehicleVo> materials = materInfo.getMater();
|
||||||
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
|
if (CollUtil.isEmpty(materials)) {
|
||||||
JSONObject json = new JSONObject();
|
throw new BadRequestException("物料信息为空,请确认!");
|
||||||
JSONArray jsonArray = new JSONArray();
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
mater.stream().forEach(material -> {
|
|
||||||
map.put("order_code", material.getOrder_code());
|
|
||||||
map.put("qty", material.getMaterial_qty());
|
|
||||||
jsonArray.add(map);
|
|
||||||
});
|
|
||||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(materInfo.getDevice_code());
|
|
||||||
json.put("vehicle_code", schBasePoint.getVehicle_code());
|
|
||||||
json.put("region_code", schBasePoint.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));
|
|
||||||
mater.stream().forEach(material1 -> {
|
|
||||||
if (material1.getOrder_code().equals(jsonObject1.getString("order_code"))) {
|
|
||||||
material1.setDue_date(jsonObject1.getString("due_date"));
|
|
||||||
material1.setRegion_code(jsonObject1.getString("next_region_code"));
|
|
||||||
material1.setPriority(jsonObject1.getString("priority"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else if (ObjectUtil.isNotEmpty(jsonObject) && jsonObject.getInteger("status") == 400) {
|
|
||||||
throw new BadRequestException(jsonObject.getString("msg"));
|
|
||||||
}
|
}
|
||||||
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(materInfo.getDevice_code());
|
||||||
|
JSONObject jsonObject = wmsToConnectorService.applyRegionAndDueDate(buildRequestJson(materials, schBasePoint));
|
||||||
|
handleWmsResponse(jsonObject, materials);
|
||||||
List<String> materiales = new ArrayList<>();
|
List<String> materiales = new ArrayList<>();
|
||||||
mater.stream().forEach(material -> {
|
materials.forEach(material -> {
|
||||||
materiales.add(JSONObject.toJSONString(material));
|
materiales.add(JSONObject.toJSONString(material));
|
||||||
});
|
});
|
||||||
toJSON.put("material_info", materiales);
|
toJSON.put("material_info", materiales);
|
||||||
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
|
toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||||
toJSON.put("region_code", StrUtil.isNotEmpty(mater.get(0).getRegion_code()) ? mater.get(0).getRegion_code() : schBasePoint.getRegion_code());
|
toJSON.put("region_code", StrUtil.isNotEmpty(materials.get(0).getRegion_code()) ? materials.get(0).getRegion_code() : schBasePoint.getRegion_code());
|
||||||
} else {
|
} else {
|
||||||
if ("2".equals(materInfo.getPoint_code())) {
|
if (REGION_CODE.get("内部加工").equals(materInfo.getPoint_code())) {
|
||||||
List<SendVehicleVo> mater = materInfo.getMater();
|
List<SendVehicleVo> mater = materInfo.getMater();
|
||||||
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
|
if (CollUtil.isEmpty(mater)) throw new BadRequestException("物料信息为空,请确认!");
|
||||||
toJSON.put("material_info", mater);
|
toJSON.put("material_info", mater);
|
||||||
toJSON.put("region_code", RegionEnum.NBJG.getRegion_code());
|
toJSON.put("region_code", RegionEnum.NBJG.getRegion_code());
|
||||||
} else if ("3".equals(materInfo.getPoint_code())) {
|
} else if (REGION_CODE.get("外协加工").equals(materInfo.getPoint_code())) {
|
||||||
toJSON.put("region_code", RegionEnum.WXJG.getRegion_code());
|
toJSON.put("region_code", RegionEnum.WXJG.getRegion_code());
|
||||||
} else if ("4".equals(materInfo.getPoint_code())) {
|
} else if (REGION_CODE.get("内部过道").equals(materInfo.getPoint_code())) {
|
||||||
toJSON.put("region_code", RegionEnum.NBGD.getRegion_code());
|
toJSON.put("region_code", RegionEnum.NBGD.getRegion_code());
|
||||||
|
} else if (REGION_CODE.get("其他加工").equals(materInfo.getPoint_code())) {
|
||||||
|
toJSON.put("region_code", RegionEnum.QTJG.getRegion_code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fabService.createAgvTask(toJSON, "smt");
|
fabService.createAgvTask(toJSON, "smt");
|
||||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleWmsResponse(JSONObject response, List<SendVehicleVo> materials) {
|
||||||
|
if (ObjectUtil.isEmpty(response)) {
|
||||||
|
throw new BadRequestException("WMS服务无响应");
|
||||||
|
}
|
||||||
|
int status = response.getIntValue("status");
|
||||||
|
if (status == HttpStatus.OK.value()) {
|
||||||
|
response.getJSONArray("data").forEach(item -> {
|
||||||
|
JSONObject dataItem = (JSONObject) item;
|
||||||
|
materials.forEach(material -> {
|
||||||
|
if (dataItem.getString("order_code").equals(material.getOrder_code())) {
|
||||||
|
material.setDue_date(dataItem.getString("due_date"));
|
||||||
|
material.setRegion_code(dataItem.getString("next_region_code"));
|
||||||
|
material.setPriority(dataItem.getString("priority"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException(response.getString("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JSONObject buildRequestJson(List<SendVehicleVo> materials, SchBasePoint schBasePoint) {
|
||||||
|
JSONArray jsonArray = materials.stream().map(
|
||||||
|
material -> {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("order_code", material.getOrder_code());
|
||||||
|
map.put("qty", material.getMaterial_qty());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
).collect(Collectors.toCollection(JSONArray::new));
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("vehicle_code", schBasePoint.getVehicle_code());
|
||||||
|
json.put("region_code", schBasePoint.getRegion_code());
|
||||||
|
json.put("materials", jsonArray);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: 根据物料查主盘信息; 当前工序查所有物料 ->
|
//TODO: 根据物料查主盘信息; 当前工序查所有物料 ->
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -128,9 +128,8 @@ public class FabServiceImpl {
|
|||||||
param.put("device_code", sendMaterVo.getDevice_code());
|
param.put("device_code", sendMaterVo.getDevice_code());
|
||||||
param.put("ext_data", sendMaterVo);
|
param.put("ext_data", sendMaterVo);
|
||||||
param.put("region_code", sendMaterVo.getRegion_code());
|
param.put("region_code", sendMaterVo.getRegion_code());
|
||||||
if (sendMaterVo.getRegion_code().equals(RegionEnum.NBJG.getRegion_code()) || sendMaterVo.getRegion_code().equals(RegionEnum.WXJG.getRegion_code())) {
|
if (sendMaterVo.getRegion_code().equals(RegionEnum.NBJG.getRegion_code()) || sendMaterVo.getRegion_code().equals(RegionEnum.WXJG.getRegion_code())
|
||||||
param.put("config_code", "ProcessingSMTTask");
|
|| sendMaterVo.getRegion_code().equals(RegionEnum.NBGD.getRegion_code()) || sendMaterVo.getRegion_code().equals(RegionEnum.QTJG.getRegion_code())) {
|
||||||
} else if (sendMaterVo.getRegion_code().equals(RegionEnum.NBGD.getRegion_code())) {
|
|
||||||
param.put("config_code", "ProcessingSMTTask");
|
param.put("config_code", "ProcessingSMTTask");
|
||||||
} else {
|
} else {
|
||||||
param.put("config_code", "PcOperationSMTTask");
|
param.put("config_code", "PcOperationSMTTask");
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class HandheldController {
|
|||||||
private HandheldService handheldService;
|
private HandheldService handheldService;
|
||||||
|
|
||||||
@PostMapping("/cageFrame")
|
@PostMapping("/cageFrame")
|
||||||
@Log("外协区空笼框送回")
|
@Log("笼框补仓")
|
||||||
public ResponseEntity<Object> createEmptyCageStorageTask(@RequestBody JSONObject param) {
|
public ResponseEntity<Object> createEmptyCageStorageTask(@RequestBody JSONObject param) {
|
||||||
handheldService.emptyCageStorageTask(param);
|
handheldService.emptyCageStorageTask(param);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
private RedisUtils redisUtils;
|
private RedisUtils redisUtils;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsToAcsService wmsToAcsService;
|
private WmsToAcsService wmsToAcsService;
|
||||||
static final Map<String,String> STATUS = MapOf.of("释放","0","锁定","1");
|
static final Map<String, String> STATUS = MapOf.of("释放", "0", "锁定", "1");
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -168,38 +168,12 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
String[] vehicle_list = null;
|
String[] vehicle_list = null;
|
||||||
if (vehicle.contains(",")) {
|
if (vehicle.contains(",")) {
|
||||||
vehicle_list = vehicle.split(",");
|
vehicle_list = vehicle.split(",");
|
||||||
}
|
|
||||||
if (CollUtil.isEmpty(Arrays.asList(vehicle_list))) {
|
|
||||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle);
|
|
||||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
|
|
||||||
if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())
|
|
||||||
&& !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
|
|
||||||
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
String[] finalVehicle_list = vehicle_list;
|
vehicle_list = new String[]{vehicle};
|
||||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_list[0]);
|
|
||||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
|
|
||||||
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())) {
|
|
||||||
if (finalVehicle_list.length != 2) {
|
|
||||||
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
|
|
||||||
if (finalVehicle_list.length != 4) {
|
|
||||||
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Arrays.stream(vehicle_list).forEach(vehicleCode -> {
|
|
||||||
String vehicleCode1 = vehicleCode;
|
|
||||||
MdBaseVehicle mdBaseVehicle1 = iMdBaseVehicleService.selectByVehicleCode(vehicleCode1);
|
|
||||||
if (ObjectUtil.isEmpty(mdBaseVehicle1)) throw new BadRequestException("载具不存在!");
|
|
||||||
if (!mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())
|
|
||||||
&& !mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
|
|
||||||
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_list[0]);
|
||||||
|
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("托盘不存在!");
|
||||||
|
verifyNumber(vehicle_list, mdBaseVehicle.getVehicle_type());
|
||||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||||
AbstractTask connectorTask = taskFactory.getTask("EMPTYCAGETask");
|
AbstractTask connectorTask = taskFactory.getTask("EMPTYCAGETask");
|
||||||
@@ -214,6 +188,55 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
connectorTask.apply(jo);
|
connectorTask.apply(jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证托盘数量和类型
|
||||||
|
*
|
||||||
|
* @param vehicles 回库托盘号
|
||||||
|
* @param number 托盘数
|
||||||
|
* @param vehicleType 托盘类型
|
||||||
|
*/
|
||||||
|
private void verifyNumber(String[] vehicles, String vehicleType) {
|
||||||
|
switch(vehicleType){
|
||||||
|
case "R01":
|
||||||
|
if (vehicles.length != 2) {
|
||||||
|
throw new BadRequestException("托盘数量不匹配");
|
||||||
|
}
|
||||||
|
verifyVehicleType(vehicles, "R01");
|
||||||
|
break;
|
||||||
|
case "R02":
|
||||||
|
if (vehicles.length != 4) {
|
||||||
|
throw new BadRequestException("托盘数量不匹配");
|
||||||
|
}
|
||||||
|
verifyVehicleType(vehicles, "R02");
|
||||||
|
break;
|
||||||
|
case "S04":
|
||||||
|
if (vehicles.length != 1) {
|
||||||
|
throw new BadRequestException("托盘数量不匹配");
|
||||||
|
}
|
||||||
|
verifyVehicleType(vehicles, "S04");
|
||||||
|
break;
|
||||||
|
case "S06":
|
||||||
|
if (vehicles.length != 1) {
|
||||||
|
throw new BadRequestException("托盘数量不匹配");
|
||||||
|
}
|
||||||
|
verifyVehicleType(vehicles, "S06");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verifyVehicleType(String[] vehicles, String vehicleType) {
|
||||||
|
Arrays.stream(vehicles).forEach(vehicleCode -> {
|
||||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicleCode);
|
||||||
|
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("托盘号不存在");
|
||||||
|
if (!mdBaseVehicle.getVehicle_type().equals(vehicleType)) {
|
||||||
|
throw new BadRequestException("托盘类型不匹配");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object applyEmptyVehicle(JSONObject param) {
|
public Object applyEmptyVehicle(JSONObject param) {
|
||||||
return null;
|
return null;
|
||||||
@@ -248,6 +271,9 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
case "4":
|
case "4":
|
||||||
connectorBlanking(param, RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), device_code, vehicle_code, connectorTask);
|
connectorBlanking(param, RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), device_code, vehicle_code, connectorTask);
|
||||||
break;
|
break;
|
||||||
|
case "5":
|
||||||
|
connectorBlanking(param, RegionEnum.QTJG.getRegion_code(), device_code, vehicle_code, connectorTask);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -338,10 +364,10 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
param.put("region_code", region_code);
|
param.put("region_code", region_code);
|
||||||
param.put("materials", materials);
|
param.put("materials", materials);
|
||||||
jo.put("ext_data", param);
|
jo.put("ext_data", param);
|
||||||
|
connectorTask.apply(jo);
|
||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, device_code)
|
.eq(SchBasePoint::getPoint_code, device_code)
|
||||||
.set(SchBasePoint::getIs_lock, true));
|
.set(SchBasePoint::getIs_lock, true));
|
||||||
connectorTask.apply(jo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,11 +655,11 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
List<Map> maps = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(list);
|
List<Map> maps = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(list);
|
||||||
HashSet<Map> keys = new HashSet<>();
|
HashSet<Map> keys = new HashSet<>();
|
||||||
maps.stream().forEach(item -> {
|
maps.stream().forEach(item -> {
|
||||||
keys.add(MapOf.of("material_id", item.get("material_id"),"material_path", item.get("material_path")));
|
keys.add(MapOf.of("material_id", item.get("material_id"), "material_path", item.get("material_path")));
|
||||||
});
|
});
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("vehiclePath",maps.get(0).get("vehicle_path"));
|
json.put("vehiclePath", maps.get(0).get("vehicle_path"));
|
||||||
json.put("materialList",keys);
|
json.put("materialList", keys);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -220,4 +220,15 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SchBasePoint selectPointByEmpAndRegion(String region_code, String vehicle_code, String s);
|
SchBasePoint selectPointByEmpAndRegion(String region_code, String vehicle_code, String s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询堆叠点位
|
||||||
|
* @param region_code 工序
|
||||||
|
* @param pointType 点位类型
|
||||||
|
* @param vehicleCode 托盘号
|
||||||
|
* @param i 排序
|
||||||
|
* @param i1 排序
|
||||||
|
* @return 点位对象
|
||||||
|
*/
|
||||||
|
SchBasePoint selectStackPoint(String region_code, String pointType, String vehicleCode, int is_vehicle, int i1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
select point_code, point_name, point_status
|
select point_code, point_name, point_status
|
||||||
from sch_base_point
|
from sch_base_point
|
||||||
where region_code = #{regionCode}
|
where region_code = #{regionCode}
|
||||||
|
AND is_used = true
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
.or(ObjectUtil.isNotEmpty(blurry), lam1 -> lam1.like(SchBasePoint::getPoint_name, blurry))
|
.or(ObjectUtil.isNotEmpty(blurry), lam1 -> lam1.like(SchBasePoint::getPoint_name, blurry))
|
||||||
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBasePoint::getWorkshop_code, workshop_code)
|
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBasePoint::getWorkshop_code, workshop_code)
|
||||||
.eq(ObjectUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code)
|
.eq(ObjectUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code)
|
||||||
.eq(ObjectUtil.isNotEmpty(point_type), SchBasePoint::getPoint_type, point_type)
|
.eq(ObjectUtil.isNotEmpty(point_type), SchBasePoint::getCan_vehicle_type, point_type)
|
||||||
.eq(ObjectUtil.isNotEmpty(point_status), SchBasePoint::getPoint_status, point_status)
|
.eq(ObjectUtil.isNotEmpty(point_status), SchBasePoint::getPoint_status, point_status)
|
||||||
.eq(ObjectUtil.isNotEmpty(is_used), SchBasePoint::getIs_used, is_used)
|
.eq(ObjectUtil.isNotEmpty(is_used), SchBasePoint::getIs_used, is_used)
|
||||||
.eq(ObjectUtil.isNotEmpty(lock_type), SchBasePoint::getIs_lock, lock_type)
|
.eq(ObjectUtil.isNotEmpty(lock_type), SchBasePoint::getIs_lock, lock_type)
|
||||||
@@ -254,46 +254,43 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) {
|
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) {
|
||||||
synchronized (lock2) {
|
synchronized (lock2) {
|
||||||
//查询载具的类型
|
//查询载具的类型
|
||||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicleCode);
|
||||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||||
//查询满足条件的站点
|
SchBasePoint schBasePoint = getSchBasePoint(region_code, piont_type, mdBaseVehicle);
|
||||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
if(ObjectUtil.isEmpty(schBasePoint)){
|
||||||
.eq(SchBasePoint::getIs_lock, false)
|
schBasePoint = getSchBasePoint(null, piont_type, mdBaseVehicle);
|
||||||
.isNull(SchBasePoint::getVehicle_code)
|
|
||||||
.eq(SchBasePoint::getPoint_type, piont_type)
|
|
||||||
.eq(SchBasePoint::getRegion_code, region_code)
|
|
||||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
|
||||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
|
||||||
.eq(SchBasePoint::getIs_used, true));
|
|
||||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
|
||||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
|
||||||
schBasePoint.setIs_lock(true);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
pointMapper.updateById(schBasePoint);
|
|
||||||
return schBasePoint;
|
|
||||||
}
|
|
||||||
/*SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0);
|
|
||||||
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!");*/
|
|
||||||
//分配载具类型相同的站点
|
|
||||||
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getIs_lock, false)
|
|
||||||
.isNull(SchBasePoint::getVehicle_code)
|
|
||||||
.eq(SchBasePoint::getPoint_type, piont_type)
|
|
||||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
|
||||||
.eq(SchBasePoint::getIs_used, true)
|
|
||||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
|
||||||
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) {
|
|
||||||
/*schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq())));*/
|
|
||||||
SchBasePoint schBasePoint = schBasePoints1.get(0);
|
|
||||||
schBasePoint.setIs_lock(true);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
pointMapper.updateById(schBasePoint);
|
|
||||||
return schBasePoint;
|
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) return schBasePoint;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取空点位
|
||||||
|
* @param regionCode
|
||||||
|
* @param pointType
|
||||||
|
* @param mdBaseVehicle
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private SchBasePoint getSchBasePoint(String regionCode, String pointType, MdBaseVehicle mdBaseVehicle) {
|
||||||
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getIs_lock, false)
|
||||||
|
.isNull(SchBasePoint::getVehicle_code)
|
||||||
|
.eq(SchBasePoint::getPoint_type, pointType)
|
||||||
|
.eq(StrUtil.isNotEmpty(regionCode),SchBasePoint::getRegion_code, regionCode)
|
||||||
|
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||||
|
.eq(SchBasePoint::getIs_used, true));
|
||||||
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||||
|
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||||
|
schBasePoint.setIs_lock(true);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
pointMapper.updateById(schBasePoint);
|
||||||
|
return schBasePoint;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchBasePoint selectByPointCode(String start_device_code) {
|
public SchBasePoint selectByPointCode(String start_device_code) {
|
||||||
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class)
|
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||||
@@ -450,9 +447,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
.orderByDesc(SchBasePoint::getIn_order_seq));
|
.orderByDesc(SchBasePoint::getIn_order_seq));
|
||||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||||
/*Gson gson = new Gson();
|
|
||||||
Type setType = new TypeToken<List<String>>() {
|
|
||||||
}.getType();*/
|
|
||||||
List<String> msg = new ArrayList<>();
|
List<String> msg = new ArrayList<>();
|
||||||
String vehicles = schBasePoint.getVehicles();
|
String vehicles = schBasePoint.getVehicles();
|
||||||
boolean contains = vehicles.contains(",");
|
boolean contains = vehicles.contains(",");
|
||||||
@@ -611,6 +605,27 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SchBasePoint selectStackPoint(String regionCode, String pointStatus, String vehicleType, int seq, int point_type) {
|
||||||
|
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getIs_lock, false)
|
||||||
|
.eq(SchBasePoint::getIs_used, true)
|
||||||
|
.eq(SchBasePoint::getPoint_status, pointStatus)
|
||||||
|
.eq(SchBasePoint::getCan_vehicle_type, vehicleType)
|
||||||
|
.eq(SchBasePoint::getPoint_type, point_type)
|
||||||
|
.eq(SchBasePoint::getRegion_code, regionCode)
|
||||||
|
.isNull(seq == 2, SchBasePoint::getVehicles)
|
||||||
|
.isNull(seq == 1, SchBasePoint::getVehicle_code)
|
||||||
|
.orderByAsc( SchBasePoint::getIn_order_seq));
|
||||||
|
SchBasePoint schBasePoint = (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null;
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
schBasePoint.setIs_lock(true);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
return schBasePoint;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderMater> getStructList(String pointCode, String vehicle_type) {
|
public List<OrderMater> getStructList(String pointCode, String vehicle_type) {
|
||||||
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
|
//1.查询的结果一个托盘有多个800,PC需要怎么展示?
|
||||||
|
|||||||
@@ -213,5 +213,8 @@ public class GeneralDefinition {
|
|||||||
|
|
||||||
public static final Map<String,List<String>> CYZZD01 = MapOf.of("CYZZD01", ListUtil.of("CYXLDJW01", "CYXLDJW02"));
|
public static final Map<String,List<String>> CYZZD01 = MapOf.of("CYZZD01", ListUtil.of("CYXLDJW01", "CYXLDJW02"));
|
||||||
public static final Map<String,List<String>> CYZZD02 = MapOf.of("CYZZD02", ListUtil.of("CYXLDJW03", "CYXLDJW04"));
|
public static final Map<String,List<String>> CYZZD02 = MapOf.of("CYZZD02", ListUtil.of("CYXLDJW03", "CYXLDJW04"));
|
||||||
|
/**
|
||||||
|
* 是否打印
|
||||||
|
*/
|
||||||
|
public static final String IS_PRINT = "is_print";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,176 +0,0 @@
|
|||||||
/*
|
|
||||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
|
||||||
|
|
||||||
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.exception.BadRequestException;
|
|
||||||
import org.nl.system.service.notice.ISysNoticeService;
|
|
||||||
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;
|
|
||||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
|
||||||
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;
|
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @author LENOVO
|
|
||||||
* 手持呼叫空料笼
|
|
||||||
*//*
|
|
||||||
|
|
||||||
@Component("CALLEMPTYTask")
|
|
||||||
public class CallEmptyTask extends AbstractTask {
|
|
||||||
|
|
||||||
private static final String TASK_CONFIG_CODE = "CALLEMPTYTask";
|
|
||||||
@Autowired
|
|
||||||
private ISchBasePointService pointService;
|
|
||||||
@Autowired
|
|
||||||
private ISchBaseTaskService taskService;
|
|
||||||
@Autowired
|
|
||||||
private ISchBaseTaskconfigService taskConfigService;
|
|
||||||
@Autowired
|
|
||||||
private ISysNoticeService noticeService;
|
|
||||||
@Autowired
|
|
||||||
private ISchBasePointService schBasePointService;
|
|
||||||
@Autowired
|
|
||||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void create() throws BadRequestException {
|
|
||||||
// 获取任务
|
|
||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
|
||||||
// 配置信息
|
|
||||||
for (SchBaseTask task : tasks) {
|
|
||||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code());
|
|
||||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) {
|
|
||||||
task.setRemark("载具号不存在!");
|
|
||||||
taskService.updateById(task);
|
|
||||||
// 消息通知
|
|
||||||
noticeService.createNotice("载具号不存在!", TASK_CONFIG_CODE + task.getTask_code(),
|
|
||||||
NoticeTypeEnum.WARN.getCode());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue()
|
|
||||||
, mdBaseVehicle.getVehicle_type(), 1,1);
|
|
||||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
|
||||||
task.setRemark("未找到所需点位!");
|
|
||||||
taskService.updateById(task);
|
|
||||||
// 消息通知
|
|
||||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
|
||||||
NoticeTypeEnum.WARN.getCode());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 设置终点并修改创建成功状态
|
|
||||||
task.setPoint_code1(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.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::getVehicle_code, null)
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
|
||||||
.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::getVehicle_code, taskObj.getVehicle_code())
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
|
||||||
.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) {
|
|
||||||
// 获取参数
|
|
||||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint1)) {
|
|
||||||
schBasePoint1.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint1);
|
|
||||||
schBasePointService.updateById(schBasePoint1);
|
|
||||||
}
|
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
|
||||||
schBasePoint.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
schBasePointService.updateById(schBasePoint);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -10,6 +10,7 @@ import org.nl.common.enums.GoodsEnum;
|
|||||||
import org.nl.common.enums.VehicleTypeEnum;
|
import org.nl.common.enums.VehicleTypeEnum;
|
||||||
import org.nl.common.enums.region.RegionEnum;
|
import org.nl.common.enums.region.RegionEnum;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.config.MapOf;
|
||||||
import org.nl.system.service.notice.ISysNoticeService;
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||||
@@ -30,7 +31,9 @@ import org.nl.wms.util.TaskUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手持创建空料笼入库
|
* 手持创建空料笼入库
|
||||||
@@ -53,6 +56,8 @@ public class EmptyCageTask extends AbstractTask {
|
|||||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||||
|
private static final HashMap<String,Integer> IS_VEHICLE = MapOf.of("vehicles",2,"vehicle_code",1);
|
||||||
|
private static final HashMap<String,Integer> POINT_TYPE = MapOf.of("空托盘",0,"满托盘",1);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void create() throws BadRequestException {
|
protected void create() throws BadRequestException {
|
||||||
@@ -60,36 +65,24 @@ public class EmptyCageTask extends AbstractTask {
|
|||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
// 配置信息
|
// 配置信息
|
||||||
for (SchBaseTask task : tasks) {
|
for (SchBaseTask task : tasks) {
|
||||||
TaskUtils.setUpdateByAcs(task);
|
String vehicle_type = getVehicleType(task);
|
||||||
// 查询是空料笼还是,空料架
|
|
||||||
String vehicle_type = task.getVehicle_type();
|
|
||||||
String vehicle_code = task.getVehicle_code();
|
|
||||||
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;
|
SchBasePoint schBasePoint = null;
|
||||||
switch (vehicle_type) {
|
switch (vehicle_type) {
|
||||||
case "R01":
|
case "R01":
|
||||||
//RO1空料容
|
schBasePoint = schBasePointService.selectStackPoint(RegionEnum.DDLK.getRegion_code(),
|
||||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R01.getVehicleCode(), IS_VEHICLE.get("vehicles"), POINT_TYPE.get("空托盘"));
|
||||||
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R01.getVehicleCode(), 2,1);
|
|
||||||
break;
|
break;
|
||||||
case "R02":
|
case "R02":
|
||||||
//RO2空料容
|
schBasePoint = schBasePointService.selectStackPoint(RegionEnum.DDLK.getRegion_code(),
|
||||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), IS_VEHICLE.get("vehicles"), POINT_TYPE.get("空托盘"));
|
||||||
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), 2,1);
|
|
||||||
break;
|
break;
|
||||||
case "S04":
|
case "S04":
|
||||||
//RO2空料容
|
schBasePoint = schBasePointService.selectStackPoint(RegionEnum.DDLK.getRegion_code(),
|
||||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S04.getVehicleCode(), IS_VEHICLE.get("vehicle_code"), POINT_TYPE.get("空托盘"));
|
||||||
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S04.getVehicleCode(), 2,1);
|
|
||||||
break;
|
break;
|
||||||
case "S06":
|
case "S06":
|
||||||
//RO2空料容
|
schBasePoint = schBasePointService.selectStackPoint(RegionEnum.DDLK.getRegion_code(),
|
||||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S06.getVehicleCode(), IS_VEHICLE.get("vehicle_code"), POINT_TYPE.get("空托盘"));
|
||||||
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S06.getVehicleCode(), 2,1);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -103,25 +96,35 @@ public class EmptyCageTask extends AbstractTask {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 设置终点并修改创建成功状态
|
// 设置终点并修改创建成功状态
|
||||||
|
TaskUtils.setUpdateByAcs(task);
|
||||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
task.setVehicle_type(vehicle_type);
|
||||||
task.setRemark("");
|
task.setRemark("");
|
||||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||||
taskService.updateById(task);
|
taskService.updateById(task);
|
||||||
|
|
||||||
if (vehicle_type.equals(VehicleTypeEnum.FRAME_R01.getVehicleCode()) || vehicle_type.equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
|
|
||||||
schBasePoint.setVehicles(task.getVehicle_code());
|
|
||||||
} else {
|
|
||||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
|
||||||
}
|
|
||||||
schBasePoint.setVehicle_qty(task.getVehicle_qty());
|
|
||||||
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
|
||||||
schBasePoint.setIs_lock(true);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
pointService.updateById(schBasePoint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取托盘类型
|
||||||
|
* @param task 任务对象
|
||||||
|
* @return 托盘类型
|
||||||
|
*/
|
||||||
|
private String getVehicleType(SchBaseTask task) {
|
||||||
|
String vehicle_type = task.getVehicle_type();
|
||||||
|
String vehicle_code = task.getVehicle_code();
|
||||||
|
if (StrUtil.isNotEmpty(vehicle_code)) {
|
||||||
|
String vehicleCode = vehicle_code;
|
||||||
|
if(vehicle_code.contains(",")){
|
||||||
|
String[] split = vehicle_code.split(",");
|
||||||
|
vehicleCode = split[0];
|
||||||
|
}
|
||||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicleCode);
|
||||||
|
vehicle_type = mdBaseVehicle.getVehicle_type();
|
||||||
|
}
|
||||||
|
return vehicle_type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateStatus(String task_code, TaskStatus status) {
|
protected void updateStatus(String task_code, TaskStatus status) {
|
||||||
//TODO:完成任务的时候将int_task_code的清除
|
//TODO:完成任务的时候将int_task_code的清除
|
||||||
@@ -141,50 +144,42 @@ public class EmptyCageTask extends AbstractTask {
|
|||||||
public void cancel(String task_code) {
|
public void cancel(String task_code) {
|
||||||
//TODO:取消任务的时候将int_task_code的清除
|
//TODO:取消任务的时候将int_task_code的清除
|
||||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
cancelPoint(taskObj.getPoint_code1());
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint1)) {
|
cancelPoint(taskObj.getPoint_code2());
|
||||||
schBasePoint1.setVehicle_code(null);
|
|
||||||
schBasePoint1.setPoint_status(GoodsEnum.OUT_OF_STOCK.getValue());
|
|
||||||
schBasePoint1.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint1);
|
|
||||||
schBasePointService.updateById(schBasePoint1);
|
|
||||||
}
|
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
|
||||||
schBasePoint.setVehicle_code(taskObj.getVehicle_code());
|
|
||||||
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
|
||||||
schBasePoint.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
schBasePointService.updateById(schBasePoint);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(taskObj)) {
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
throw new BadRequestException("该任务不存在");
|
throw new BadRequestException("该任务不存在");
|
||||||
}
|
}
|
||||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消任务还原点位状态
|
||||||
|
*
|
||||||
|
* @param pointCode 点位名称
|
||||||
|
*/
|
||||||
|
private void cancelPoint(String pointCode) {
|
||||||
|
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(pointCode);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
schBasePoint.setIs_lock(false);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
schBasePointService.updateById(schBasePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新任务状态
|
||||||
|
*
|
||||||
|
* @param taskObj
|
||||||
|
* @param taskFinishedType
|
||||||
|
*/
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
updateStartPointStatus(taskObj);
|
||||||
String startPoint = taskObj.getPoint_code1();
|
updateEndPointStatus(taskObj);
|
||||||
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.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
@@ -193,24 +188,46 @@ public class EmptyCageTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
/**
|
||||||
// 获取参数
|
* 更新起点点位状态
|
||||||
|
*
|
||||||
|
* @param taskObj 任务对象
|
||||||
|
*/
|
||||||
|
private void updateStartPointStatus(SchBaseTask taskObj) {
|
||||||
String startPoint = taskObj.getPoint_code1();
|
String startPoint = taskObj.getPoint_code1();
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
// 起点清空
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新终点点位状态
|
||||||
|
*
|
||||||
|
* @param taskObj 任务对象
|
||||||
|
*/
|
||||||
|
private void updateEndPointStatus(SchBaseTask taskObj) {
|
||||||
String point_code2 = taskObj.getPoint_code2();
|
String point_code2 = taskObj.getPoint_code2();
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
String vehicle_type = taskObj.getVehicle_type();
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
if (vehicle_type.equals(VehicleTypeEnum.FRAME_R01.getVehicleCode()) || vehicle_type.equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
schBasePoint2.setVehicles(taskObj.getVehicle_code());
|
||||||
|
schBasePoint2.setVehicle_qty(taskObj.getVehicle_qty());
|
||||||
|
} else {
|
||||||
|
schBasePoint2.setVehicle_code(taskObj.getVehicle_code());
|
||||||
|
}
|
||||||
|
schBasePoint2.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
||||||
|
schBasePoint2.setIs_lock(false);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint2);
|
||||||
|
pointService.updateById(schBasePoint2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class PcOperationSMTTask extends AbstractTask {
|
|||||||
updatePointStatus(schBasePoint, null, GoodsEnum.OUT_OF_STOCK.getValue());
|
updatePointStatus(schBasePoint, null, GoodsEnum.OUT_OF_STOCK.getValue());
|
||||||
String endPoint = taskObj.getPoint_code2();
|
String endPoint = taskObj.getPoint_code2();
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
||||||
updatePointStatus(schBasePoint, taskObj.getVehicle_code(), GoodsEnum.IN_STOCK.getValue());
|
updatePointStatus(schBasePoint2, taskObj.getVehicle_code(), GoodsEnum.IN_STOCK.getValue());
|
||||||
SendMaterVo sendMaterVo = JSONObject.parseObject(taskObj.getRequest_param(),SendMaterVo.class);
|
SendMaterVo sendMaterVo = JSONObject.parseObject(taskObj.getRequest_param(),SendMaterVo.class);
|
||||||
List<SendMaterVo> sendMaterVos = new ArrayList<>();
|
List<SendMaterVo> sendMaterVos = new ArrayList<>();
|
||||||
sendMaterVo.getMaterial_info().forEach(materVo -> {
|
sendMaterVo.getMaterial_info().forEach(materVo -> {
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
|
|
||||||
for (SchBaseTask task : tasks) {
|
for (SchBaseTask task : tasks) {
|
||||||
|
|
||||||
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||||
//判断是否指定到外协区
|
//判断是否指定到外协区
|
||||||
String targetRegionCode = sendMaterVo.getRegion_code();
|
String targetRegionCode = sendMaterVo.getRegion_code();
|
||||||
@@ -158,8 +157,11 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成任务
|
* 完成任务
|
||||||
|
*
|
||||||
|
* @param taskObj
|
||||||
|
* @param taskFinishedType
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
log.info("开始完成任务:{},", taskObj.getTask_code());
|
log.info("开始完成任务:{},", taskObj.getTask_code());
|
||||||
updateStartPointStatus(taskObj);
|
updateStartPointStatus(taskObj);
|
||||||
@@ -170,27 +172,57 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
if (CollUtil.isEmpty(materials)) {
|
if (CollUtil.isEmpty(materials)) {
|
||||||
materials = jsonObject2.getJSONArray("mater");
|
materials = jsonObject2.getJSONArray("mater");
|
||||||
}
|
}
|
||||||
List<SendVehicleVo> sendVehicleVos = BeanUtil.copyToList(materials, SendVehicleVo.class);
|
if (CollUtil.isNotEmpty(materials)) {
|
||||||
sendVehicleVos.forEach(sendVehicleVo -> {
|
List<SendVehicleVo> sendVehicleVos = BeanUtil.copyToList(materials, SendVehicleVo.class);
|
||||||
String dueDate = schBaseVehiclematerialgroupService.selectDueDateByVehicleCode(sendVehicleVo);
|
|
||||||
sendVehicleVo.setDue_date(dueDate);
|
|
||||||
});
|
|
||||||
if (region_code.equals(RegionEnum.NBJG.getRegion_code())) {
|
|
||||||
JSONObject jsonObject3 = new JSONObject();
|
|
||||||
jsonObject3.put("vehicle_code", taskObj.getVehicle_code());
|
|
||||||
jsonObject3.put("id", taskObj.getTask_code());
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
|
||||||
sendVehicleVos.forEach(sendVehicleVo -> {
|
sendVehicleVos.forEach(sendVehicleVo -> {
|
||||||
JSONObject jsonObject4 = new JSONObject();
|
String dueDate = schBaseVehiclematerialgroupService.selectDueDateByVehicleCode(sendVehicleVo);
|
||||||
jsonObject4.put("product_id", sendVehicleVo.getMaterial_code());
|
sendVehicleVo.setDue_date(dueDate);
|
||||||
jsonObject4.put("current_qty", sendVehicleVo.getMaterial_qty());
|
|
||||||
jsonObject4.put("production_order", sendVehicleVo.getOrder_code());
|
|
||||||
jsonObject4.put("due_date", sendVehicleVo.getDue_date());
|
|
||||||
jsonArray.add(jsonObject4);
|
|
||||||
});
|
});
|
||||||
jsonObject3.put("materials", jsonArray);
|
if (region_code.equals(RegionEnum.NBJG.getRegion_code())) {
|
||||||
lmsToWmsService.feedbackMaterialStatus(jsonObject3);
|
interiorTemplate(taskObj, sendVehicleVos);
|
||||||
} else if (region_code.equals(RegionEnum.WXJG.getRegion_code())) {
|
} else if (region_code.equals(RegionEnum.WXJG.getRegion_code())) {
|
||||||
|
outsourcingTemplate(taskObj, sendVehicleVos);
|
||||||
|
}
|
||||||
|
updateVehicleData(taskObj, sendVehicleVos);
|
||||||
|
}
|
||||||
|
// 任务完成
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新托盘数据
|
||||||
|
*
|
||||||
|
* @param taskObj
|
||||||
|
* @param sendVehicleVos
|
||||||
|
*/
|
||||||
|
private void updateVehicleData(SchBaseTask taskObj, List<SendVehicleVo> sendVehicleVos) {
|
||||||
|
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code", taskObj.getVehicle_code()));
|
||||||
|
sendVehicleVos.forEach(sendVehicleVo -> {
|
||||||
|
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||||
|
schBaseVehiclematerialgroup.setVehicle_code(taskObj.getVehicle_code());
|
||||||
|
schBaseVehiclematerialgroup.setMaterial_qty(sendVehicleVo.getMaterial_qty());
|
||||||
|
schBaseVehiclematerialgroup.setMaterial_id(sendVehicleVo.getMaterial_code());
|
||||||
|
schBaseVehiclematerialgroup.setOrder_code(sendVehicleVo.getOrder_code());
|
||||||
|
schBaseVehiclematerialgroup.setDue_date(sendVehicleVo.getDue_date());
|
||||||
|
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外协数据打印
|
||||||
|
*
|
||||||
|
* @param taskObj
|
||||||
|
* @param sendVehicleVos
|
||||||
|
*/
|
||||||
|
private void outsourcingTemplate(SchBaseTask taskObj, List<SendVehicleVo> sendVehicleVos) {
|
||||||
|
Param isPrint = sysParamService.findByCode(GeneralDefinition.IS_PRINT);
|
||||||
|
if (ObjectUtil.isNotEmpty(isPrint) && "1".equals(isPrint.getValue())) {
|
||||||
|
} else {
|
||||||
Param byCode = sysParamService.findByCode(GeneralDefinition.TEMPLATE_URL);
|
Param byCode = sysParamService.findByCode(GeneralDefinition.TEMPLATE_URL);
|
||||||
Param filePath = sysParamService.findByCode(GeneralDefinition.FILE_URL);
|
Param filePath = sysParamService.findByCode(GeneralDefinition.FILE_URL);
|
||||||
Param printerName = sysParamService.findByCode(GeneralDefinition.PRINTER_NAME);
|
Param printerName = sysParamService.findByCode(GeneralDefinition.PRINTER_NAME);
|
||||||
@@ -212,23 +244,29 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
json.put("data", jsonArray);
|
json.put("data", jsonArray);
|
||||||
PrintUtil.printWord(byCode.getValue(), json, filePath.getValue(), printerName.getValue());
|
PrintUtil.printWord(byCode.getValue(), json, filePath.getValue(), printerName.getValue());
|
||||||
}
|
}
|
||||||
schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().eq("vehicle_code", taskObj.getVehicle_code()));
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部数据反馈
|
||||||
|
*
|
||||||
|
* @param taskObj
|
||||||
|
* @param sendVehicleVos
|
||||||
|
*/
|
||||||
|
private void interiorTemplate(SchBaseTask taskObj, List<SendVehicleVo> sendVehicleVos) {
|
||||||
|
JSONObject jsonObject3 = new JSONObject();
|
||||||
|
jsonObject3.put("vehicle_code", taskObj.getVehicle_code());
|
||||||
|
jsonObject3.put("id", taskObj.getTask_code());
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
sendVehicleVos.forEach(sendVehicleVo -> {
|
sendVehicleVos.forEach(sendVehicleVo -> {
|
||||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
JSONObject jsonObject4 = new JSONObject();
|
||||||
schBaseVehiclematerialgroup.setVehicle_code(taskObj.getVehicle_code());
|
jsonObject4.put("product_id", sendVehicleVo.getMaterial_code());
|
||||||
schBaseVehiclematerialgroup.setMaterial_qty(sendVehicleVo.getMaterial_qty());
|
jsonObject4.put("current_qty", sendVehicleVo.getMaterial_qty());
|
||||||
schBaseVehiclematerialgroup.setMaterial_id(sendVehicleVo.getMaterial_code());
|
jsonObject4.put("production_order", sendVehicleVo.getOrder_code());
|
||||||
schBaseVehiclematerialgroup.setOrder_code(sendVehicleVo.getOrder_code());
|
jsonObject4.put("due_date", sendVehicleVo.getDue_date());
|
||||||
schBaseVehiclematerialgroup.setDue_date(sendVehicleVo.getDue_date());
|
jsonArray.add(jsonObject4);
|
||||||
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
|
||||||
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
|
||||||
});
|
});
|
||||||
// 任务完成
|
jsonObject3.put("materials", jsonArray);
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
lmsToWmsService.feedbackMaterialStatus(jsonObject3);
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
|
||||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
|
||||||
taskService.updateById(taskObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,9 +292,9 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
.set(SchBasePoint::getPoint_status, pointStatus)
|
.set(SchBasePoint::getPoint_status, pointStatus)
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error("修改终点点位状态失败",e);
|
log.error("修改终点点位状态失败", e);
|
||||||
throw new BadRequestException("修改" + taskObj.getPoint_code2()+ "终点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
throw new BadRequestException("修改" + taskObj.getPoint_code2() + "终点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,9 +312,9 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error("修改起点点位状态失败",e);
|
log.error("修改起点点位状态失败", e);
|
||||||
throw new BadRequestException("修改" + taskObj.getPoint_code1()+ "起点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
throw new BadRequestException("修改" + taskObj.getPoint_code1() + "起点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -184,16 +185,16 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
|||||||
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||||
// 循环获取的数据
|
// 循环获取的数据
|
||||||
|
List<BmVehicleInfo> bmVehicleInfos = new ArrayList<>();
|
||||||
for (int i = 0; i < read.size(); i++) {
|
for (int i = 0; i < read.size(); i++) {
|
||||||
List list = read.get(i);
|
List list = read.get(i);
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
String vehicleCode = list.get(0).toString();
|
String vehicleCode = list.get(0).toString();
|
||||||
String vehicleType = list.get(1).toString();
|
String vehicleType = list.get(1).toString();
|
||||||
if (StrUtil.isEmpty(vehicleCode) || StrUtil.isEmpty(vehicleType)) {
|
if (StrUtil.isEmpty(vehicleCode) || StrUtil.isEmpty(vehicleType)) {
|
||||||
throw new BadRequestException("载具号或载具类型为空!");
|
throw new BadRequestException("载具号或载具类型为空!");
|
||||||
}
|
}
|
||||||
BmVehicleInfo one = getOne(Wrappers.lambdaQuery(BmVehicleInfo.class).eq(BmVehicleInfo::getVehicle_code, vehicleCode));
|
BmVehicleInfo one = getOne(Wrappers.lambdaQuery(BmVehicleInfo.class).eq(BmVehicleInfo::getVehicle_code, vehicleCode));
|
||||||
if(ObjectUtil.isNotEmpty(one)){
|
if (ObjectUtil.isNotEmpty(one)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("code", "can_vehicle_type").eq("value", vehicleType));
|
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("code", "can_vehicle_type").eq("value", vehicleType));
|
||||||
@@ -206,8 +207,9 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
|||||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||||
entity.setUpdate_time(DateUtil.now());
|
entity.setUpdate_time(DateUtil.now());
|
||||||
entity.setVehicle_type(dict.getValue());
|
entity.setVehicle_type(dict.getValue());
|
||||||
this.save(entity);
|
bmVehicleInfos.add(entity);
|
||||||
}
|
}
|
||||||
|
this.saveBatch(bmVehicleInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 91 KiB |
@@ -299,7 +299,7 @@ export default {
|
|||||||
value: '',
|
value: '',
|
||||||
options: [{ value: 'G01', label: 'G01' }, { value: 'R01', label: 'R01' }, { value: 'R02', label: 'R02' }, { value: 'R03', label: 'R03' }, { value: 'S04', label: 'S04' }, { value: 'S06', label: 'S06' }],
|
options: [{ value: 'G01', label: 'G01' }, { value: 'R01', label: 'R01' }, { value: 'R02', label: 'R02' }, { value: 'R03', label: 'R03' }, { value: 'S04', label: 'S04' }, { value: 'S06', label: 'S06' }],
|
||||||
value1: '',
|
value1: '',
|
||||||
options1: [{ value: '1', label: '货架' }, { value: '2', label: '内部' }, { value: '3', label: '外协' }, { value: '4', label: '内部过道' }],
|
options1: [{ value: '1', label: '货架' }, { value: '2', label: '内部' }, { value: '3', label: '外协' }, { value: '4', label: '内部过道' }, { value: '5', label: '其他加工' }],
|
||||||
value2: '',
|
value2: '',
|
||||||
options2: [],
|
options2: [],
|
||||||
vcode: '',
|
vcode: '',
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
@change="hand"
|
@change="hand"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in pointTypesList"
|
v-for="item in dict.storagevehicle_type"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
@@ -418,7 +418,7 @@ const defaultForm = {
|
|||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'SchBasePoint',
|
name: 'SchBasePoint',
|
||||||
dicts: ['vehicle_type', 'TrueOrFalse', 'can_vehicle_type'],
|
dicts: ['vehicle_type', 'TrueOrFalse', 'can_vehicle_type', 'storagevehicle_type'],
|
||||||
components: { PointDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
|
components: { PointDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
|
|||||||
Reference in New Issue
Block a user