opt:优化单据多物料校验
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
"author": "Zheng Jie",
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"dev1": "vue-cli-service serve",
|
||||
"dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
"preview": "node build/index.js --preview",
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -14,7 +15,10 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -70,4 +74,13 @@ public class MaterialbaseController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/importExcel")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
RedissonUtils.lock(() -> {
|
||||
iMdMeMaterialbaseService.excelImport(file, request, response);
|
||||
}, "信息导入", null);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -58,4 +61,12 @@ public interface IMdMeMaterialbaseService extends IService<MdMeMaterialbase> {
|
||||
* @return 返回结果
|
||||
*/
|
||||
MdMeMaterialbase getByCode(String material_code);
|
||||
|
||||
/**
|
||||
* 导入物料
|
||||
* @param file
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class MdPbStoragevehicletype {
|
||||
private String storagevehicle_btype;
|
||||
private String storagevehicle_size;
|
||||
/**
|
||||
* 1.RT16(3层) 2.PS20(四层) 3.RT16和PS20
|
||||
* 1.RT16(4层) 2.PS20(1-3层) 3.RT16和PS20
|
||||
*/
|
||||
private String suitable_car;
|
||||
private String storagevehicle_name;
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.basedata_manage.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -17,11 +19,17 @@ import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.wbwms.service.IWmsToWmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -47,6 +55,8 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
@Autowired
|
||||
private IWmsToWmsService iWmsToWmsService;
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Override
|
||||
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
||||
// 查询条件
|
||||
@@ -163,4 +173,63 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
}
|
||||
return one;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点位
|
||||
*/
|
||||
|
||||
@Transactional
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
List<List<Object>> read = excelReader.read();
|
||||
if (read.size() > 1) {
|
||||
List<SchBasePoint> insertList = new ArrayList<>();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
//仓位
|
||||
String m1 = String.valueOf(list.get(0));
|
||||
// String m2 = String.valueOf(list.get(1));
|
||||
// String m3 = String.valueOf(list.get(2));
|
||||
// String m4 = String.valueOf(list.get(3));
|
||||
// String m5 = String.valueOf(list.get(4));
|
||||
SchBasePoint dao = new SchBasePoint();
|
||||
dao.setPoint_code(m1);
|
||||
dao.setPoint_name(m1);
|
||||
dao.setRegion_code("RKQ");
|
||||
dao.setRegion_name("入库区域");
|
||||
// dao.setPoint_type("1");
|
||||
//dao.setPoint_status("0");
|
||||
// dao.setVehicle_type(m5);
|
||||
dao.setVehicle_max_qty(0);
|
||||
dao.setIs_has_workder(false);
|
||||
dao.setIs_used(true);
|
||||
dao.setIs_auto(true);
|
||||
dao.setBlock_num(0);
|
||||
dao.setRow_num(0);
|
||||
dao.setCol_num(0);
|
||||
dao.setLayer_num(0);
|
||||
dao.setIn_order_seq(0);
|
||||
dao.setOut_order_seq(0);
|
||||
dao.setIn_empty_seq(0);
|
||||
dao.setOut_empty_seq(0);
|
||||
dao.setParent_point_code(m1);
|
||||
dao.setWorkshop_code("A1");
|
||||
dao.setCreate_id("1");
|
||||
dao.setCreate_name("admin");
|
||||
dao.setCreate_time(DateUtil.now());
|
||||
dao.setUpdate_id("1");
|
||||
dao.setUpdate_name("admin");
|
||||
dao.setUpdate_time(DateUtil.now());
|
||||
dao.setLock_up(false);
|
||||
insertList.add(dao);
|
||||
}
|
||||
iSchBasePointService.saveBatch(insertList);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException("导入失败" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -185,14 +185,13 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
||||
dto.setSect_code(sectattr.getSect_code());
|
||||
dto.setSect_name(sectattr.getSect_name());
|
||||
dto.setStor_id(bsrealStorattr.getStor_id());
|
||||
dto.setStor_code(bsrealStorattr.getStor_code());
|
||||
dto.setStor_name(bsrealStorattr.getStor_name());
|
||||
|
||||
// Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
||||
// BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
||||
// dto.setSect_code(sectattr.getSect_code());
|
||||
// dto.setSect_name(sectattr.getSect_name());
|
||||
// dto.setStor_id(bsrealStorattr.getStor_id());
|
||||
// dto.setStor_code(bsrealStorattr.getStor_code());
|
||||
// dto.setStor_name(bsrealStorattr.getStor_name());
|
||||
structattrMapper.updateById(dto);
|
||||
}
|
||||
|
||||
@@ -364,7 +363,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq("sect_code", param.getSect_code())
|
||||
.isNull("width")
|
||||
.ne("stor_type",1)
|
||||
.isNull("stor_type")
|
||||
.and(wrapper -> wrapper.isNull("storagevehicle_code")
|
||||
.or()
|
||||
.eq("storagevehicle_code", " "));
|
||||
@@ -374,7 +373,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.eq("sect_code", param.getSect_code())
|
||||
.eq("width",1)
|
||||
.ne("layer_num",4)
|
||||
.ne("stor_type",1)
|
||||
.isNull("stor_type")
|
||||
.and(wrapper -> wrapper.isNull("storagevehicle_code")
|
||||
.or()
|
||||
.eq("storagevehicle_code", " "));
|
||||
@@ -383,7 +382,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.eq("lock_type",IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq("sect_code", param.getSect_code())
|
||||
.eq("layer_num",4)
|
||||
.ne("stor_type",1)
|
||||
.isNull("stor_type")
|
||||
.and(wrapper -> wrapper.isNull("storagevehicle_code")
|
||||
.or()
|
||||
.eq("storagevehicle_code", " "));
|
||||
|
||||
@@ -236,21 +236,55 @@ public class WmsToIWmsServiceImpl implements WmsToIWmsService {
|
||||
@Override
|
||||
@Transactional
|
||||
public WmstoIWmsResponse outBillTask(JSONObject parm) {
|
||||
// log.info("WMS出库请求参数参数为:-------------------" + parm.toString());
|
||||
// WmstoIWmsResponse result = new WmstoIWmsResponse();
|
||||
// JSONArray tableData = parm.getJSONArray("tableData");
|
||||
// String storage_code=tableData.getJSONObject(0).getString("storage_code");
|
||||
// String turnout_struct_code=tableData.getJSONObject(0).getString("turnout_struct_code");
|
||||
// Structattr structattr=iStructattrService.getByCode(turnout_struct_code);
|
||||
// if(ObjectUtil.isEmpty(structattr)){
|
||||
// throw new BadRequestException("wms上不存在该点位");
|
||||
// }
|
||||
// if(!storage_code.equals(structattr.getStoragevehicle_code())){
|
||||
// throw new BadRequestException("该点位存放托盘与所传托盘的编码不对");
|
||||
// }
|
||||
// if(!structattr.getLock_type().equals("0")){
|
||||
// throw new BadRequestException("传入点位有任务");
|
||||
// }
|
||||
log.info("WMS 出库请求参数参数为:-------------------" + parm.toString());
|
||||
WmstoIWmsResponse result = new WmstoIWmsResponse();
|
||||
JSONArray tableData = parm.getJSONArray("tableData");
|
||||
String storage_code=tableData.getJSONObject(0).getString("storage_code");
|
||||
String turnout_struct_code=tableData.getJSONObject(0).getString("turnout_struct_code");
|
||||
Structattr structattr=iStructattrService.getByCode(turnout_struct_code);
|
||||
if (CollectionUtils.isEmpty(tableData)) {
|
||||
throw new BadRequestException("tableData 不能为空");
|
||||
}
|
||||
List<String> turnoutStructCodes = new ArrayList<>();
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject item = tableData.getJSONObject(i);
|
||||
turnoutStructCodes.add(item.getString("turnout_struct_code"));
|
||||
}
|
||||
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.in(Structattr::getStruct_code, turnoutStructCodes));
|
||||
if (CollectionUtils.isEmpty(structattrList)) {
|
||||
throw new BadRequestException("wms 上不存在这些点位");
|
||||
}
|
||||
java.util.Map<String, Structattr> structattrMap = structattrList.stream()
|
||||
.collect(java.util.stream.Collectors.toMap(Structattr::getStruct_code, s -> s));
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject jsonObject = tableData.getJSONObject(i);
|
||||
String storage_code = jsonObject.getString("storage_code");
|
||||
String turnout_struct_code = jsonObject.getString("turnout_struct_code");
|
||||
Structattr structattr = structattrMap.get(turnout_struct_code);
|
||||
if (ObjectUtil.isEmpty(structattr)) {
|
||||
throw new BadRequestException("wms上不存在该点位");
|
||||
throw new BadRequestException("wms上不存在该点位:" + turnout_struct_code);
|
||||
}
|
||||
if (!storage_code.equals(structattr.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("该点位存放托盘与所传托盘的编码不对");
|
||||
throw new BadRequestException("该点位存放托盘与所传托盘的编码不对:" + turnout_struct_code);
|
||||
}
|
||||
if(!structattr.getLock_type().equals("0")){
|
||||
throw new BadRequestException("传入点位有任务");
|
||||
if (!"0".equals(structattr.getLock_type())) {
|
||||
throw new BadRequestException("传入点位有任务:" + turnout_struct_code);
|
||||
}
|
||||
}
|
||||
Structattr structattr = structattrList.get(0);
|
||||
parm.put("sect_id",structattr.getSect_id());
|
||||
parm.put("stor_id",structattr.getStor_id());
|
||||
// parm.put("turnout_struct_code",turnout_struct_code);
|
||||
|
||||
@@ -9,10 +9,10 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${DB_HOST:192.168.81.251}:${DB_PORT:3306}/${DB_NAME:hyjm_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lms_huayu}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms_oulun}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:P@ssw0rd.}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 15
|
||||
# 最小连接数
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"dev1": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"dev_mac": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
|
||||
@@ -286,6 +286,8 @@
|
||||
<el-table-column prop="task_code" label="锁定任务编码" width="150" />
|
||||
<el-table-column prop="inv_code" label="锁定单据编码" width="150" />
|
||||
<el-table-column prop="inv_type" label="锁定单据类型" width="150" :formatter="invtypeFormat" />
|
||||
<el-table-column prop="width" label="宽度(1为专放蝴蝶龙)" width="150" />
|
||||
<el-table-column prop="stor_type" label="类型(1为专放超托)" width="150" />
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
v-permission="['admin','structattr:edit','structattr:del']"
|
||||
|
||||
Reference in New Issue
Block a user