fix:托盘混料入库优化
This commit is contained in:
@@ -2,9 +2,11 @@ package org.nl.config.mybatis;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.github.pagehelper.PageInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -37,13 +39,18 @@ public class MybatisPlusConfig {
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 分页插件
|
||||
// // 分页插件
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
//乐观锁插件
|
||||
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
ConfigurationCustomizer mybatisConfigurationCustomizer() {
|
||||
return configuration -> configuration.addInterceptor(new PageInterceptor());
|
||||
}
|
||||
@PostConstruct
|
||||
public void datainnit() {
|
||||
String url = ((DruidDataSource) dataSource).getUrl();
|
||||
|
||||
@@ -65,6 +65,12 @@ public class SectattrController {
|
||||
return new ResponseEntity<>(iSectattrService.getSect(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getSectCode")
|
||||
@Log("查询库区下拉框")
|
||||
public ResponseEntity<Object> querySectCode(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iSectattrService.getSectCode(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/changeActive")
|
||||
@Log("修改库区状态")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject json) {
|
||||
|
||||
@@ -35,6 +35,7 @@ public interface ISectattrService extends IService<Sectattr> {
|
||||
* @return Sectattr
|
||||
*/
|
||||
Sectattr findById(String sect_id);
|
||||
Sectattr findByCode(String sect_code);
|
||||
|
||||
|
||||
/**
|
||||
@@ -59,6 +60,7 @@ public interface ISectattrService extends IService<Sectattr> {
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
JSONObject getSect(Map whereJson);
|
||||
JSONObject getSectCode(Map whereJson);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
|
||||
@@ -69,6 +69,21 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
return sectattr;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Sectattr findByCode(String code) {
|
||||
|
||||
LambdaQueryWrapper<Sectattr> queryWrapper = new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.eq(Sectattr::getSect_code, code)
|
||||
.eq(Sectattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
Sectattr sectattr = sectattrMapper.selectOne(queryWrapper);
|
||||
|
||||
if (ObjectUtil.isEmpty(sectattr)) {
|
||||
return null;
|
||||
}
|
||||
return sectattr;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Sectattr dto) {
|
||||
@@ -179,7 +194,68 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
stor_cas.put("label", stor_jo.getStor_name());
|
||||
|
||||
List<Sectattr> sectattrList = sectattrMapper.selectList(new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.select(Sectattr::getSect_code,Sectattr::getSect_name)
|
||||
.select(Sectattr::getSect_code,Sectattr::getSect_id,Sectattr::getSect_name)
|
||||
.eq(StrUtil.isNotEmpty(stor_jo.getStor_id()),Sectattr::getStor_id,stor_jo.getStor_id())
|
||||
.eq(StrUtil.isNotEmpty(sect_type_attr),Sectattr::getSect_type_attr,sect_type_attr)
|
||||
.eq(Sectattr::getIs_delete,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(Sectattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
);
|
||||
|
||||
if (!sectattrList.isEmpty()) {
|
||||
JSONArray sect_ja = new JSONArray();
|
||||
for (int j = 0; j < sectattrList.size(); j++) {
|
||||
Sectattr sect_jo = sectattrList.get(j);
|
||||
JSONObject sect_cas = new JSONObject();
|
||||
sect_cas.put("value", sect_jo.getSect_id());
|
||||
sect_cas.put("label", sect_jo.getSect_name());
|
||||
sect_ja.add(sect_cas);
|
||||
}
|
||||
stor_cas.put("children", sect_ja);
|
||||
}
|
||||
new_ja.add(stor_cas);
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", new_ja);
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getSectCode(Map whereJson) {
|
||||
JSONArray new_ja = new JSONArray();
|
||||
|
||||
String is_materialstore = (String) whereJson.get("is_materialstore");
|
||||
String is_virtualstore = (String) whereJson.get("is_virtualstore");
|
||||
String is_semi_finished = (String) whereJson.get("is_semi_finished");
|
||||
String is_productstore = (String) whereJson.get("is_productstore");
|
||||
String is_attachment = (String) whereJson.get("is_attachment");
|
||||
String is_reversed = (String) whereJson.get("is_reversed");
|
||||
String sect_type_attr = (String) whereJson.get("sect_type_attr");
|
||||
String stor_code = (String) whereJson.get("stor_code");
|
||||
|
||||
LambdaQueryWrapper<BsrealStorattr> queryWrapper = new LambdaQueryWrapper<>(BsrealStorattr.class)
|
||||
.select(BsrealStorattr::getStor_id, BsrealStorattr::getStor_code, BsrealStorattr::getStor_name)
|
||||
.eq(StrUtil.isNotEmpty(is_materialstore),BsrealStorattr::getIs_materialstore,is_materialstore)
|
||||
.eq(StrUtil.isNotEmpty(is_virtualstore),BsrealStorattr::getIs_virtualstore,is_virtualstore)
|
||||
.eq(StrUtil.isNotEmpty(is_semi_finished),BsrealStorattr::getIs_materialstore,is_semi_finished)
|
||||
.eq(StrUtil.isNotEmpty(is_productstore),BsrealStorattr::getIs_materialstore,is_productstore)
|
||||
.eq(StrUtil.isNotEmpty(is_attachment),BsrealStorattr::getIs_materialstore,is_attachment)
|
||||
.eq(StrUtil.isNotEmpty(is_reversed),BsrealStorattr::getIs_materialstore,is_reversed)
|
||||
.eq(StrUtil.isNotEmpty(stor_code),BsrealStorattr::getStor_code,stor_code)
|
||||
.eq(BsrealStorattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(BsrealStorattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是")
|
||||
);
|
||||
|
||||
List<BsrealStorattr> bsrealStorattrList = iBsrealStorattrService.list(queryWrapper);
|
||||
|
||||
for (int i = 0; i < bsrealStorattrList.size(); i++) {
|
||||
BsrealStorattr stor_jo = bsrealStorattrList.get(i);
|
||||
JSONObject stor_cas = new JSONObject();
|
||||
stor_cas.put("value", stor_jo.getStor_code());
|
||||
stor_cas.put("label", stor_jo.getStor_name());
|
||||
|
||||
List<Sectattr> sectattrList = sectattrMapper.selectList(new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.select(Sectattr::getSect_code,Sectattr::getSect_id,Sectattr::getSect_name)
|
||||
.eq(StrUtil.isNotEmpty(stor_jo.getStor_id()),Sectattr::getStor_id,stor_jo.getStor_id())
|
||||
.eq(StrUtil.isNotEmpty(sect_type_attr),Sectattr::getSect_type_attr,sect_type_attr)
|
||||
.eq(Sectattr::getIs_delete,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
|
||||
@@ -148,29 +148,18 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
||||
Sectattr sectattr = iSectattrService.findByCode(dto.getSect_code());
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
||||
dto.setSect_code(sectattr.getSect_code());
|
||||
dto.setSect_id(sectattr.getSect_id());
|
||||
dto.setSect_name(sectattr.getSect_name());
|
||||
dto.setStor_id(bsrealStorattr.getStor_id());
|
||||
dto.setStor_code(bsrealStorattr.getStor_code());
|
||||
dto.setStor_name(bsrealStorattr.getStor_name());
|
||||
|
||||
String storagevehicle_code = dto.getStoragevehicle_code();
|
||||
if (ObjectUtil.isNotEmpty(storagevehicle_code)) {
|
||||
// 暂时搁置后续添加
|
||||
// WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
// JSONObject obj = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "'").uniqueResult(0);
|
||||
|
||||
// if (ObjectUtil.isEmpty(obj)) {
|
||||
// throw new BadRequestException("未发现载具号为【" + storagevehicle_code + "】的载具信息");
|
||||
// }
|
||||
//
|
||||
// dto.setStoragevehicle_id(obj.getLong
|
||||
// ("storagevehicle_id"));
|
||||
// dto.setStoragevehicle_type(obj.getString("storagevehicle_type"));
|
||||
dto.setStoragevehicle_code(storagevehicle_code);
|
||||
}
|
||||
|
||||
structattrMapper.insert(dto);
|
||||
}
|
||||
|
||||
@@ -425,7 +414,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
record.setMaterial_id(vehicleMater.getMaterial_id());
|
||||
record.setPcsn(vehicleMater.getPcsn());
|
||||
record.setQty(vehicleMater.getQty());
|
||||
record.setChange_qty(subtract);
|
||||
record.setChange_qty(vehicleMater.getFrozen_qty());
|
||||
record.setTask_type(changeDto.getTaskType());
|
||||
record.setFrozen_qty(vehicleMater.getFrozen_qty());
|
||||
record.setSource_form_id(changeDto.getInv());
|
||||
|
||||
@@ -29,7 +29,7 @@ public class StIvtStructivtflowServiceImpl extends ServiceImpl<StIvtStructivtflo
|
||||
@Override
|
||||
public Object pageQuery(StructIvtFlowQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("update_time DESC");
|
||||
page.setOrderBy("id DESC");
|
||||
List<Map> mst_detail = this.baseMapper.getPageQuery(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
|
||||
@@ -12,7 +12,7 @@ spring:
|
||||
url: jdbc:mysql://${DB_HOST:192.168.81.251}:${DB_PORT:3306}/${DB_NAME:wms_standardv2}?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:123456}
|
||||
password: ${DB_PWD:P@ssw0rd.}
|
||||
# 初始连接数
|
||||
initial-size: 15
|
||||
# 最小连接数
|
||||
|
||||
Reference in New Issue
Block a user