init:合并基础版本
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ public class TableDataInfo<T> implements Serializable {
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private List<T> content;
|
||||
private List<T> content = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 消息状态码
|
||||
@@ -56,7 +57,7 @@ public class TableDataInfo<T> implements Serializable {
|
||||
public static <T> TableDataInfo<T> build(IPage<T> page) {
|
||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setMsg("操作成功");
|
||||
rspData.setContent(page.getRecords());
|
||||
rspData.setTotalElements(page.getTotal());
|
||||
return rspData;
|
||||
@@ -65,7 +66,7 @@ public class TableDataInfo<T> implements Serializable {
|
||||
public static <T> TableDataInfo<T> build(List<T> list) {
|
||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setMsg("操作成功");
|
||||
rspData.setContent(list);
|
||||
rspData.setTotalElements(list.size());
|
||||
return rspData;
|
||||
@@ -74,7 +75,7 @@ public class TableDataInfo<T> implements Serializable {
|
||||
public static <T> TableDataInfo<T> build() {
|
||||
TableDataInfo<T> rspData = new TableDataInfo<>();
|
||||
rspData.setCode(String.valueOf(HttpStatus.HTTP_OK));
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setMsg("操作成功");
|
||||
return rspData;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.nl.common.utils.MapOf;
|
||||
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2,7 +2,9 @@ package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -17,6 +19,7 @@ import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -24,8 +27,11 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -46,6 +52,8 @@ public class GroupController {
|
||||
private final IMdPbGroupplateService iMdPbGroupplateService;
|
||||
@Autowired
|
||||
private final IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
@Autowired
|
||||
private final MdPbGroupplateMapper mdPbGroupplateMapper;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询")
|
||||
@@ -56,25 +64,31 @@ public class GroupController {
|
||||
|
||||
@PostMapping
|
||||
@Log("新增组盘组盘")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject group) {
|
||||
Assert.noNullElements(new Object[]{group,group.get("material_id"),group.get("storagevehicle_code"),group.get("qty")},"请求参数不能为空");
|
||||
GroupPlate groupPlate = group.toJavaObject(GroupPlate.class);
|
||||
String storagevehicleCode = groupPlate.getStoragevehicle_code();
|
||||
public ResponseEntity<Object> createSingle(@RequestBody JSONObject group) {
|
||||
Assert.noNullElements(new Object[]{group, group.get("tableData"), group.get("storagevehicle_code")}, "请求参数不能为空");
|
||||
String storagevehicleCode = group.getString("storagevehicle_code");
|
||||
{
|
||||
iMdPbStoragevehicleinfoService.getByCode(storagevehicleCode);
|
||||
int has = iMdPbGroupplateService.count(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, groupPlate.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getStoragevehicle_code, storagevehicleCode)
|
||||
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
if (has>0){
|
||||
if (has > 0) {
|
||||
throw new BadRequestException("当前载具组盘信息已存在");
|
||||
}
|
||||
}
|
||||
groupPlate.setGroup_id(IdUtil.getStringId());
|
||||
groupPlate.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setCreate_name(SecurityUtils.getCurrentUsername());
|
||||
groupPlate.setCreate_time(DateUtil.now());
|
||||
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||
iMdPbGroupplateService.save(groupPlate);
|
||||
JSONArray rows = group.getJSONArray("tableData");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
GroupPlate groupPlate = row.toJavaObject(GroupPlate.class);
|
||||
groupPlate.setStoragevehicle_code(storagevehicleCode);
|
||||
groupPlate.setGroup_id(IdUtil.getStringId());
|
||||
groupPlate.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setCreate_name(SecurityUtils.getCurrentUsername());
|
||||
groupPlate.setCreate_time(DateUtil.now());
|
||||
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||
iMdPbGroupplateService.save(groupPlate);
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -84,4 +98,18 @@ public class GroupController {
|
||||
iMdPbGroupplateService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/getAllGroupInfo")
|
||||
@Log("通过载具号获取全部组盘信息")
|
||||
public ResponseEntity<Object> getAllGroupInfo(@RequestBody JSONArray rows) {
|
||||
List<String> vehicle_list = rows.stream()
|
||||
.map(obj -> (HashMap<String, String>) obj)
|
||||
.map(json -> json.get("storagevehicle_code"))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<JSONObject> list = mdPbGroupplateMapper.getVehicleMaterial(new JSONObject() {{
|
||||
put("vehicle_codes", vehicle_list);
|
||||
}});
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class MaterialbaseController {
|
||||
@Log("新增物料")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdMeMaterialbase dto) {
|
||||
iMdMeMaterialbaseService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
|
||||
@@ -35,6 +35,7 @@ public interface ISectattrService extends IService<Sectattr> {
|
||||
* @return Sectattr
|
||||
*/
|
||||
Sectattr findById(String sect_id);
|
||||
Sectattr findByCode(String sect_code);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,6 +113,8 @@ public interface IStructattrService extends IService<Structattr> {
|
||||
|
||||
/**
|
||||
* 生成库存变动记录表,更新载具冻结数量
|
||||
* 如果是拣选出库,则库存数为0的变成出库状态
|
||||
* 拣选的,扣减冻结数之后变成组盘状态,如果需要回库则通过余料回库回去
|
||||
* @param changeDto
|
||||
*/
|
||||
void changeStruct(StructattrChangeDto changeDto);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MdMeMaterialbase implements Serializable {
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
@@ -60,7 +60,12 @@ public class MdMeMaterialbase implements Serializable {
|
||||
/**
|
||||
* 基本计量单位
|
||||
*/
|
||||
private String base_unit_id;
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 基本计量单位名称
|
||||
*/
|
||||
private String qty_unit_name;
|
||||
|
||||
/**
|
||||
* 辅助计量单位
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
|
||||
<select id="queryAvailableInv" resultType="org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto">
|
||||
SELECT
|
||||
ext.group_id as storagevehicleext_id,
|
||||
ext.group_id,
|
||||
ext.storagevehicle_code,
|
||||
ext.pcsn,
|
||||
ext.qty_unit_name,
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.basedata_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -10,7 +11,7 @@ import java.math.BigDecimal;
|
||||
* 2025/6/5
|
||||
*/
|
||||
@Data
|
||||
public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
public class MdPbStoragevehicleextDto extends GroupPlate {
|
||||
|
||||
/**
|
||||
* 库区标识
|
||||
@@ -51,6 +52,7 @@ public class MdPbStoragevehicleextDto extends MdPbStoragevehicleext{
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@@ -20,33 +20,14 @@ public class StrategyStructParam {
|
||||
* 仓位编码
|
||||
*/
|
||||
private String stor_code;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_code;
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 组盘数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 同步单号
|
||||
*/
|
||||
private String ext_code;
|
||||
|
||||
/**
|
||||
* 分配的单号
|
||||
*/
|
||||
private String inv_code;
|
||||
/**
|
||||
* 来源单据类型
|
||||
*/
|
||||
@@ -56,4 +37,15 @@ public class StrategyStructParam {
|
||||
* 出入库类型
|
||||
*/
|
||||
private String ioType;
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 载具明细:混料的话则是数组
|
||||
*/
|
||||
private List<StrategyMater> strategyMaters;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -87,12 +87,13 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(MdMeMaterialbase dto) {
|
||||
MdMeMaterialbase mdMeMaterialbase = this.baseMapper.selectById(dto.getMaterial_id());
|
||||
MdMeMaterialbase mdMeMaterialbase = this.baseMapper.selectOne(new QueryWrapper<MdMeMaterialbase>()
|
||||
.select("material_code",dto.getMaterial_code()));
|
||||
if (ObjectUtil.isEmpty(mdMeMaterialbase)) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
throw new BadRequestException("物料信息不存在");
|
||||
}
|
||||
|
||||
// 修改
|
||||
dto.setMaterial_id(mdMeMaterialbase.getMaterial_id());
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
|
||||
@@ -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) {
|
||||
@@ -216,7 +231,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
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_id = (String) whereJson.get("stor_id");
|
||||
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)
|
||||
@@ -226,7 +241,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
.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_id),BsrealStorattr::getStor_id,stor_id)
|
||||
.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("是")
|
||||
);
|
||||
|
||||
@@ -88,6 +88,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
String search = (String) whereJson.get("search");
|
||||
String stor_id = (String) whereJson.get("stor_id");
|
||||
String sect_id = (String) whereJson.get("sect_id");
|
||||
String sect_code = (String) whereJson.get("sect_code");
|
||||
String lock_type = (String) whereJson.get("lock_type");
|
||||
String layer_num = (String) whereJson.get("layer_num");
|
||||
String is_used = (String) whereJson.get("is_used");
|
||||
@@ -98,6 +99,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_name, search)
|
||||
.eq(StrUtil.isNotEmpty(stor_id),Structattr::getStor_id, stor_id)
|
||||
.eq(StrUtil.isNotEmpty(sect_id),Structattr::getSect_id, sect_id)
|
||||
.eq(StrUtil.isNotEmpty(sect_code),Structattr::getSect_code, sect_code)
|
||||
.eq(StrUtil.isNotEmpty(lock_type),Structattr::getLock_type, lock_type)
|
||||
.eq(StrUtil.isNotEmpty(layer_num),Structattr::getLayer_num, layer_num)
|
||||
.eq(StrUtil.isNotEmpty(is_used),Structattr::getIs_used, is_used)
|
||||
@@ -146,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);
|
||||
}
|
||||
|
||||
@@ -322,6 +313,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
* @param param:根据库区,需要物料及数量,单据,批次分配具体货位
|
||||
* @return 返回结果为仓位--对应--货物组盘物料信息及出库冻结数量
|
||||
* 当前分配不会自动锁定货位及冻结出库数量,分配完成后需要手动锁定货位并冻结出库数量
|
||||
* 混料模式下,同一个出库单允许分配到同一个托盘上
|
||||
*/
|
||||
@Override
|
||||
public List<StrategyStructMaterialVO> outBoundSectDiv(StrategyStructParam param) {
|
||||
@@ -356,7 +348,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
@Override
|
||||
public List<Structattr> inBoundSectDiv(StrategyStructParam param) {
|
||||
//批号,单据暂时不校验,具体业务具体校验
|
||||
Assert.noNullElements(new Object[]{param.getQty(),param.getMaterial_code(),param.getSect_code()},"请求参数不能为空");
|
||||
Assert.noNullElements(new Object[]{param.getStrategyMaters(),param.getStor_code(),param.getSect_code()},"请求参数不能为空");
|
||||
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
|
||||
.eq(StSectStrategy::getSect_code, param.getSect_code())
|
||||
.eq(StSectStrategy::getStrategy_type, StatusEnum.STRATEGY_TYPE.code("入库")));
|
||||
@@ -412,8 +404,11 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.set("frozen_qty", 0)
|
||||
.set("qty", subtract)
|
||||
.set("update_time", now)
|
||||
.set("status", GROUP_PLATE_STATUS.code("组盘"))
|
||||
.set("status", GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq("group_id", vehicleMater.getGroup_id());
|
||||
if (subtract.intValue()<=0){
|
||||
update.set("status", GROUP_PLATE_STATUS.code("出库"));
|
||||
}
|
||||
iMdPbGroupplateService.update(update);
|
||||
}
|
||||
StIvtStructivtflow record = new StIvtStructivtflow();
|
||||
@@ -423,7 +418,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());
|
||||
|
||||
@@ -71,29 +71,29 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
item.put("pointUse", pointUse(storCode));
|
||||
// //2.【实时库存分析】数据
|
||||
item.put("ivtAnalyse", ivtAnalyse(storCode));
|
||||
//3.【出入库趋势】数据
|
||||
//3.【出入库趋势】数据
|
||||
item.put("inAndOutTrend", inAndOutTrend(storCode));
|
||||
// //4.【今日出入库】数据
|
||||
item.put("toDayInAndOut", toDayInAndOut(storCode));
|
||||
// //5.【今日出入库】数据
|
||||
item.put("realTask", realTask(storCode));
|
||||
//6.【未完成单据】数据
|
||||
//6.【未完成单据】数据
|
||||
item.put("unIos", unIos(storCode));
|
||||
result.add(item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
//
|
||||
// * 货位使用
|
||||
// *
|
||||
// * @return JSONObject {
|
||||
// * total_qty: 总货位数
|
||||
// * use_qty: 已用货位
|
||||
// * emp_qty: 空余货位
|
||||
// * use_percentage: 百分比(使用货位百分比)
|
||||
// * }
|
||||
// */
|
||||
//
|
||||
// * 货位使用
|
||||
// *
|
||||
// * @return JSONObject {
|
||||
// * total_qty: 总货位数
|
||||
// * use_qty: 已用货位
|
||||
// * emp_qty: 空余货位
|
||||
// * use_percentage: 百分比(使用货位百分比)
|
||||
// * }
|
||||
// */
|
||||
private JSONObject pointUse(String storCode) {
|
||||
// 返回数据
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
|
||||
@@ -38,16 +39,18 @@ public class FIFORuleHandler extends Decisioner<StrategyStructMaterialVO, Strate
|
||||
//分配数量
|
||||
//当前条件只有id,批次
|
||||
log.info("---------执行fifo出库分配规则---------");
|
||||
BigDecimal planQty = param.getQty();
|
||||
List<StrategyMater> maters = param.getStrategyMaters();
|
||||
StrategyMater strategyMater = maters.get(0);
|
||||
BigDecimal planQty = strategyMater.getQty();
|
||||
List<StructattrVechielDto> vechielDtos =
|
||||
iStructattrService.collectVechicle(MapOf.of("material_id", param.getMaterial_id()
|
||||
, "pcsn", param.getPcsn()
|
||||
, "stor_code", param.getStor_code()
|
||||
, "sect_code", param.getSect_code()
|
||||
, "plan_qty", planQty
|
||||
, "is_lock", "false"
|
||||
, "order_by", "gro.update_time asc")
|
||||
);
|
||||
iStructattrService.collectVechicle(MapOf.of("material_id", strategyMater.getMaterial_id()
|
||||
, "pcsn", strategyMater.getPcsn()
|
||||
, "stor_code", param.getStor_code()
|
||||
, "sect_code", param.getSect_code()
|
||||
, "plan_qty", planQty
|
||||
, "is_lock", "false"
|
||||
, "order_by", "gro.update_time asc")
|
||||
);
|
||||
if (ObjectUtils.isEmpty(vechielDtos)) {
|
||||
throw new BadRequestException("当前出库策略:先进先出,库存分配失败,失败原因:库存不足!");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2025/2/1 16:18
|
||||
* 相同巷道,自下而上分配,左右相邻
|
||||
*/
|
||||
@Service("sameBlockNum")
|
||||
//@Service("sameBlockNum")
|
||||
@Slf4j
|
||||
public class SameBlockNumRuleHandler extends Decisioner<Structattr, JSONObject> {
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dto.MaterialQuery;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosInService;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
@@ -146,7 +148,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
String qty = whereJson.getString("qty");
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(materialId);
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getBase_unit_id());
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getQty_unit_id());
|
||||
// 校验
|
||||
if (ObjectUtil.isEmpty(vehicleDao) || ObjectUtil.isEmpty(materDao) || ObjectUtil.isEmpty(materDao)) {
|
||||
throw new BadRequestException("载具,物料或单位信息有误!");
|
||||
@@ -317,15 +319,25 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
throw new BadRequestException("该库区未找到对应仓库信息,请检查");
|
||||
}
|
||||
//分配仓位
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("ioType", StatusEnum.STRATEGY_TYPE.code("入库"));
|
||||
params.put("storagevehicle_code", vehicleDao.getStoragevehicle_code());
|
||||
params.put("stor_code", storeDao.getStor_code());
|
||||
params.put("sect_code", whereJson.getString("sect_code"));
|
||||
params.put("material_code", whereJson.getString("material_code"));
|
||||
params.put("qty", whereJson.getString("qty"));
|
||||
params.put("pcsn", whereJson.getString("pcsn"));
|
||||
Structattr attrDao = iRawAssistIStorService.getStructattr(whereJson);
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setMaterial_code(whereJson.getString("material_code"));
|
||||
mater.setMaterial_id(whereJson.getString("material_id"));
|
||||
mater.setQty(whereJson.getBigDecimal("qty"));
|
||||
mater.setPcsn(whereJson.getString("pcsn"));
|
||||
List<StrategyMater> materss = new ArrayList<>();
|
||||
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(StatusEnum.STRATEGY_TYPE.code("入库"))
|
||||
.sect_code(whereJson.getString("sect_code"))
|
||||
.stor_code(storeDao.getStor_code())
|
||||
.storagevehicle_code(vehicleDao.getStoragevehicle_code())
|
||||
.strategyMaters(materss)
|
||||
.build());
|
||||
if (CollectionUtils.isEmpty(structattrs)) {
|
||||
throw new BadRequestException("无可用货位");
|
||||
}
|
||||
Structattr attrDao = structattrs.get(0);
|
||||
//确定起点
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, whereJson.getString("site_code")));
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -268,13 +270,18 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
BsrealStorattr storeDao = iSrealStorattrService.getById(sectattr.getStor_id());
|
||||
whereJson.put("stor_code", storeDao.getStor_code());
|
||||
whereJson.put("sect_code", sectattr.getSect_code());
|
||||
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(BigDecimal.valueOf(qty));
|
||||
mater.setMaterial_id(whereJson.getString("material_id"));
|
||||
mater.setMaterial_code(whereJson.getString("material_code"));
|
||||
List<StrategyMater> maters = new ArrayList<>();
|
||||
maters.add(mater);
|
||||
StrategyStructParam strategyStructParam = StrategyStructParam.builder()
|
||||
.ioType(whereJson.getString(StatusEnum.STRATEGY_TYPE.code("出库")))
|
||||
.sect_code(whereJson.getString("sect_code"))
|
||||
.stor_code(whereJson.getString("stor_code"))
|
||||
.material_code(whereJson.getString("material_id"))
|
||||
.material_code(whereJson.getString("material_code"))
|
||||
.qty(BigDecimal.valueOf(qty))
|
||||
.strategyMaters(maters)
|
||||
.build();
|
||||
List<StrategyStructMaterialVO> structList = iStructattrService.outBoundSectDiv(strategyStructParam);
|
||||
if (CollectionUtils.isEmpty(structList)) {
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
package org.nl.wms.sch_manage.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.MapOf;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch_manage.service.dto.SchBasePointQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -28,6 +37,8 @@ public class SchBasePointController {
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseRegionService iSchBaseRegionService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询点位管理")
|
||||
@@ -69,6 +80,28 @@ public class SchBasePointController {
|
||||
return new ResponseEntity<>(schBasePointService.getPointList(region), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getRegionPoints")
|
||||
@Log("获取区域下拉点")
|
||||
public ResponseEntity<Object> getRegionPoints(String region_code) {
|
||||
SchBaseRegion region = iSchBaseRegionService.getOne(new LambdaUpdateWrapper<SchBaseRegion>().eq(SchBaseRegion::getRegion_code, region_code));
|
||||
|
||||
HashMap parent = MapOf.of("value", region.getRegion_code(), "label", region.getRegion_name());
|
||||
List<SchBasePoint> points = schBasePointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, region_code));
|
||||
List<Object> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(points)){
|
||||
for (SchBasePoint point : points) {
|
||||
HashMap item = MapOf.of("value", point.getPoint_code(), "label", point.getPoint_name());
|
||||
list.add(item);
|
||||
}
|
||||
}
|
||||
parent.put("children",list);
|
||||
List<Object> result = new ArrayList<>();
|
||||
result.add(parent);
|
||||
return new ResponseEntity<>(TableDataInfo.build(result), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("锁定与解锁")
|
||||
@PostMapping("/changeLock")
|
||||
public ResponseEntity<Object> changeLock(@RequestBody JSONObject points) {
|
||||
|
||||
@@ -54,6 +54,7 @@ public class ForewarningTask {
|
||||
|
||||
//定时任务
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run() {
|
||||
RLock lock = redissonClient.getLock(this.getClass().getName());
|
||||
boolean tryLock = lock.tryLock(2, TimeUnit.SECONDS);
|
||||
@@ -81,8 +82,8 @@ public class ForewarningTask {
|
||||
*/
|
||||
private void runTask() {
|
||||
// 1. 删除st_ivt_overdueforewarning、st_ivt_safetyforewarning表中的全部数据
|
||||
// stIvtOverdueforewarningService.deleteAllNoParam();
|
||||
// stIvtSafetyforewarningService.deleteAllNoParam();
|
||||
// stIvtOverdueforewarningService.deleteAllNoParam();
|
||||
// stIvtSafetyforewarningService.deleteAllNoParam();
|
||||
|
||||
// 2. 查询st_ivt_forewarningconfig,获取正在启用的、未删除的配置
|
||||
List<StIvtForewarningconfig> configList = forewarningconfigService.list(new LambdaQueryWrapper<StIvtForewarningconfig>()
|
||||
|
||||
@@ -94,13 +94,15 @@ public class UserController {
|
||||
@PostMapping(value = "/updatePass")
|
||||
public ResponseEntity<Object> updatePass(@RequestBody JSONObject passVo) throws Exception {
|
||||
// 解密,得到字符密码
|
||||
String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("oldPass"));
|
||||
String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("newPass"));
|
||||
// String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("oldPass"));
|
||||
// String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("newPass"));
|
||||
String oldPass = passVo.getString("oldPass");
|
||||
String newPass = passVo.getString("newPass");
|
||||
SysUser user = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, SecurityUtils.getCurrentUsername()));
|
||||
if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) {
|
||||
if (!user.getPassword().equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) {
|
||||
throw new BadRequestException(LangProcess.msg("login_pwd_1"));
|
||||
}
|
||||
if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(newPass, "salt"))) {
|
||||
if (user.getPassword().equals(SaSecureUtil.md5BySalt(newPass, "salt"))) {
|
||||
throw new BadRequestException(LangProcess.msg("login_pwd_2"));
|
||||
}
|
||||
user.setPassword(SaSecureUtil.md5BySalt(newPass, "salt"));
|
||||
|
||||
@@ -81,7 +81,7 @@ public class InBillController {
|
||||
|
||||
@PostMapping("/unDivStruct")
|
||||
@Log("取消分配货位")
|
||||
public ResponseEntity<Object> unDivStruct(@RequestBody Map whereJson) {
|
||||
public ResponseEntity<Object> unDivStruct(@RequestBody JSONObject whereJson) {
|
||||
iRawAssistIStorService.unDivStruct(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface IInBillService extends IService<IOStorInv> {
|
||||
|
||||
|
||||
|
||||
void unDivStruct(Map whereJson);
|
||||
void unDivStruct(JSONObject whereJson);
|
||||
|
||||
void divPoint(Map whereJson);
|
||||
|
||||
@@ -56,5 +56,4 @@ public interface IInBillService extends IService<IOStorInv> {
|
||||
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson);
|
||||
|
||||
Structattr getStructattr(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -20,17 +20,17 @@
|
||||
|
||||
<select id="getBillTaskDtl" resultType="org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto">
|
||||
SELECT
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code,
|
||||
task.task_status
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code,
|
||||
task.task_status
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
|
||||
where
|
||||
dis.iostorinvdtl_id = #{iostorinvdtl_id}
|
||||
dis.iostorinvdtl_id = #{iostorinvdtl_id}
|
||||
</select>
|
||||
|
||||
<select id="queryOutBillDisDtl" resultType="org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto">
|
||||
@@ -39,12 +39,15 @@
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code,
|
||||
ext.create_time as insert_time
|
||||
ext.create_time as insert_time,
|
||||
ext.qty
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id
|
||||
LEFT JOIN md_pb_groupplate ext ON ext.storagevehicle_code = dis.storagevehicle_code
|
||||
LEFT JOIN md_pb_groupplate ext
|
||||
ON ext.storagevehicle_code = dis.storagevehicle_code
|
||||
and ext.material_id = dis.material_id and ext.pcsn = dis.pcsn
|
||||
where
|
||||
1=1
|
||||
<if test="params.iostorinvdtl_id != null">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper">
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv">
|
||||
SELECT DISTINCT ios.* FROM st_ivt_iostorinv ios
|
||||
LEFT JOIN st_ivt_iostorinvdtl dtl ON ios.iostorinv_id = dtl.iostorinv_id
|
||||
LEFT JOIN st_ivt_iostorinvdtl dtl ON ios.iostorinv_id = dtl.iostorinv_id
|
||||
LEFT JOIN st_ivt_iostorinvdis dis ON dtl.iostorinvdtl_id = dis.iostorinvdtl_id
|
||||
<where>
|
||||
ios.is_delete = '0' AND ios.io_type = '0'
|
||||
@@ -49,12 +49,16 @@
|
||||
|
||||
<select id="getGroupPlate" resultType="org.nl.wms.warehouse_manage.service.dto.GroupPlateDto">
|
||||
SELECT group_id,
|
||||
storagevehicle_code,
|
||||
gp.material_id,pcsn,
|
||||
qty_unit_id,
|
||||
qty_unit_name,qty,frozen_qty,remark,
|
||||
status,ext_code,ext_type,
|
||||
mater.material_name,mater.material_spec,mater.material_code
|
||||
storagevehicle_code,
|
||||
gp.material_id,
|
||||
pcsn,
|
||||
gp.qty_unit_id,
|
||||
gp.qty_unit_name,
|
||||
qty,
|
||||
frozen_qty,
|
||||
remark,
|
||||
status,ext_code,ext_type,
|
||||
mater.material_name,mater.material_spec,mater.material_code
|
||||
FROM md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = gp.material_id
|
||||
<where>
|
||||
@@ -65,11 +69,11 @@
|
||||
</if>
|
||||
<if test="params.pcsn != null">
|
||||
AND
|
||||
gp.pcsn LIKE CONCAT('%', #{params.pcsn}, '%')
|
||||
gp.pcsn LIKE CONCAT('%', #{params.pcsn}, '%')
|
||||
</if>
|
||||
<if test="params.storagevehicle_code != null">
|
||||
AND
|
||||
gp.storagevehicle_code LIKE CONCAT('%', #{params.storagevehicle_code}, '%')
|
||||
gp.storagevehicle_code LIKE CONCAT('%', #{params.storagevehicle_code}, '%')
|
||||
</if>
|
||||
<if test="params.begin_time != null">
|
||||
AND
|
||||
@@ -83,17 +87,17 @@
|
||||
</select>
|
||||
|
||||
<select id="getIODtl" resultType="org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto">
|
||||
SELECT DISTINCT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mst.bill_code
|
||||
SELECT
|
||||
dtl.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
mst.bill_code
|
||||
FROM
|
||||
st_ivt_iostorinvdtl dtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
||||
st_ivt_iostorinvdtl dtl
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
|
||||
where
|
||||
1=1
|
||||
1=1
|
||||
<if test="params.bill_code != null and params.bill_code != ''">
|
||||
AND
|
||||
mst.bill_code = #{params.bill_code}
|
||||
|
||||
@@ -19,6 +19,10 @@ public class IOStorInvDisDto extends IOStorInvDis {
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
/**
|
||||
* 物料总数量
|
||||
*/
|
||||
private String qty;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
|
||||
@@ -25,9 +25,9 @@ import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleinfoMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
@@ -53,6 +53,9 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.ToIntFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
@@ -109,7 +112,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
String[] s = pcsn.split(" ");
|
||||
String pcsn_in = String.join("','", Arrays.asList(s));
|
||||
|
||||
map.put("pcsn_in", "('"+pcsn_in+"')");
|
||||
map.put("pcsn_in", "('" + pcsn_in + "')");
|
||||
} else {
|
||||
map.put("pcsn", "%" + pcsn + "%");
|
||||
}
|
||||
@@ -124,12 +127,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
if (!StrUtil.isEmpty(end_time)) {
|
||||
map.put("end_time", end_time);
|
||||
}
|
||||
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage()+1, page.getSize()), map);
|
||||
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()), map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<GroupPlateDto> getBillDtl(Map whereJson, PageQuery page) {
|
||||
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage()+1,page.getSize()),whereJson);
|
||||
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage() + 1, page.getSize()), whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,6 +142,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
BigDecimal total_qty = new BigDecimal(BigInteger.ZERO);
|
||||
int row_size = 0;
|
||||
JSONObject io_mst = new JSONObject();
|
||||
String iostorinv_id = IdUtil.getStringId();
|
||||
String bill_code = CodeUtil.getNewCode("IN_STORE_CODE");
|
||||
@@ -153,7 +157,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
io_mst.put("stor_id", whereJson.get("stor_id"));
|
||||
io_mst.put("stor_code", stor_code);
|
||||
io_mst.put("stor_name", stor_name);
|
||||
io_mst.put("detail_count", rows.size());
|
||||
io_mst.put("remark", whereJson.get("remark"));
|
||||
io_mst.put("bill_status", whereJson.get("bill_status"));
|
||||
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
||||
@@ -171,35 +174,51 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> row = rows.get(i);
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.putAll(row);
|
||||
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("material_code",row.get("material_code"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("source_bill_type",row.get("ext_type"));
|
||||
ioStorInvDtl.put("source_bill_code",row.get("ext_code"));
|
||||
ioStorInvDtl.put("assign_qty","0");
|
||||
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("plan_qty",row.get("qty"));
|
||||
Double qty = new Double(String.valueOf(row.get("qty")));
|
||||
total_qty = total_qty.add(new BigDecimal(qty));
|
||||
//判断是否存在相同批次、相同物料的物料明细存在
|
||||
IOStorInvDtl dtl_dto = ioStorInvDtlMapper.selectOne(new LambdaQueryWrapper<IOStorInvDtl>()
|
||||
.eq(IOStorInvDtl::getMaterial_code, row.get("material_code"))
|
||||
.eq(IOStorInvDtl::getPcsn, row.get("pcsn"))
|
||||
.eq(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"))
|
||||
.eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
||||
if (ObjectUtil.isEmpty(dtl_dto)) {
|
||||
ioStorInvDtl.putAll(row);
|
||||
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.get("material_id"));
|
||||
ioStorInvDtl.put("material_code", row.get("material_code"));
|
||||
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("source_bill_type", row.get("ext_type"));
|
||||
ioStorInvDtl.put("source_bill_code", row.get("ext_code"));
|
||||
ioStorInvDtl.put("assign_qty", "0");
|
||||
ioStorInvDtl.put("unassign_qty", row.get("qty"));
|
||||
ioStorInvDtl.put("plan_qty", row.get("qty"));
|
||||
Double qty = new Double(String.valueOf(row.get("qty")));
|
||||
total_qty = total_qty.add(new BigDecimal(qty));
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
if (ObjectUtil.isNotEmpty(structattr)) {
|
||||
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
|
||||
if (ObjectUtil.isNotEmpty(structattr)) {
|
||||
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
||||
}
|
||||
IOStorInvDtl invDtl = ioStorInvDtl.toJavaObject(IOStorInvDtl.class);
|
||||
ioStorInvDtlMapper.insert(invDtl);
|
||||
row_size++;
|
||||
} else {
|
||||
Double qty = new Double(String.valueOf(row.get("qty")));
|
||||
dtl_dto.setUnassign_qty(dtl_dto.getUnassign_qty().add(new BigDecimal(qty)));
|
||||
dtl_dto.setPlan_qty(dtl_dto.getPlan_qty().add(new BigDecimal(qty)));
|
||||
total_qty = total_qty.add(new BigDecimal(qty));
|
||||
ioStorInvDtlMapper.updateById(dtl_dto);
|
||||
}
|
||||
IOStorInvDtl invDtl = ioStorInvDtl.toJavaObject(IOStorInvDtl.class);
|
||||
ioStorInvDtlMapper.insert(invDtl);
|
||||
|
||||
JSONObject dis = new JSONObject();
|
||||
dis.put("iostorinvdis_id", IdUtil.getStringId());
|
||||
dis.put("iostorinv_id", iostorinv_id);
|
||||
dis.put("iostorinvdtl_id", ioStorInvDtl.getString("iostorinvdtl_id"));
|
||||
dis.put("iostorinvdtl_id", ObjectUtil.isEmpty(dtl_dto) ? ioStorInvDtl.getString("iostorinvdtl_id") : dtl_dto.getIostorinvdtl_id());
|
||||
dis.put("seq_no", 1);
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("material_code", row.get("material_code"));
|
||||
@@ -213,6 +232,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
ioStorInvDisMapper.insert(dis.toJavaObject(IOStorInvDis.class));
|
||||
}
|
||||
io_mst.put("total_qty", total_qty);
|
||||
io_mst.put("detail_count", row_size);
|
||||
ioStorInvMapper.insert(io_mst.toJavaObject(IOStorInv.class));
|
||||
return iostorinv_id;
|
||||
}
|
||||
@@ -252,45 +272,45 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject iostorinv_json = new JSONObject();
|
||||
iostorinv_json.put("iostorinv_id",iostorinv_id);
|
||||
iostorinv_json.put("stor_id",whereJson.get("stor_id"));
|
||||
iostorinv_json.put("stor_code",whereJson.get("stor_code"));
|
||||
iostorinv_json.put("stor_name",whereJson.get("stor_name"));
|
||||
iostorinv_json.put("total_qty",whereJson.get("total_qty"));
|
||||
iostorinv_json.put("detail_count",whereJson.get("detail_count"));
|
||||
iostorinv_json.put("biz_date",whereJson.get("biz_date"));
|
||||
iostorinv_json.put("bill_type",whereJson.get("bill_type"));
|
||||
iostorinv_json.put("remark",whereJson.get("remark"));
|
||||
iostorinv_json.put("update_optid",currentUserId);
|
||||
iostorinv_json.put("update_optname",nickName);
|
||||
iostorinv_json.put("update_time",now);
|
||||
iostorinv_json.put("iostorinv_id", iostorinv_id);
|
||||
iostorinv_json.put("stor_id", whereJson.get("stor_id"));
|
||||
iostorinv_json.put("stor_code", whereJson.get("stor_code"));
|
||||
iostorinv_json.put("stor_name", whereJson.get("stor_name"));
|
||||
iostorinv_json.put("total_qty", whereJson.get("total_qty"));
|
||||
iostorinv_json.put("detail_count", whereJson.get("detail_count"));
|
||||
iostorinv_json.put("biz_date", whereJson.get("biz_date"));
|
||||
iostorinv_json.put("bill_type", whereJson.get("bill_type"));
|
||||
iostorinv_json.put("remark", whereJson.get("remark"));
|
||||
iostorinv_json.put("update_optid", currentUserId);
|
||||
iostorinv_json.put("update_optname", nickName);
|
||||
iostorinv_json.put("update_time", now);
|
||||
|
||||
ioStorInvMapper.updateById(iostorinv_json.toJavaObject(IOStorInv.class));
|
||||
|
||||
//先删除该单据下的所有明细
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,iostorinv_id));
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,iostorinv_id));
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id, iostorinv_id));
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> row = rows.get(i);
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.putAll(row);
|
||||
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
||||
ioStorInvDtl.put("material_id",row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("assign_qty",0);
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
ioStorInvDtl.put("assign_qty", 0);
|
||||
ioStorInvDtl.put("plan_qty", row.get("plan_qty"));
|
||||
ioStorInvDtl.put("unassign_qty", row.get("qty"));
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
|
||||
if (ObjectUtil.isNotEmpty(structattr)) {
|
||||
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
||||
}
|
||||
@@ -323,15 +343,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void divStruct(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("stor_code"),param.getString("sect_code")},"参数异常");
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
|
||||
Assert.noNullElements(new Object[]{param.getString("stor_code"), param.getString("sect_code")}, "参数异常");
|
||||
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
|
||||
HashMap<String, String> map = rows.get(0);
|
||||
JSONObject map = param.getJSONObject("dis_row");
|
||||
String iostorinvId = map.getString("iostorinv_id");
|
||||
String storagevehicleCode = map.getString("storagevehicle_code");
|
||||
//判断该分配明细是否已经分配货位
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, storagevehicleCode)
|
||||
.isNull(IOStorInvDis::getStruct_code));
|
||||
if (ioStorInvDis ==null){
|
||||
if (CollectionUtils.isEmpty(disList)) {
|
||||
throw new BadRequestException("当前明细已经分配过库位");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -346,18 +368,23 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
//是否自动分配仓位
|
||||
Boolean checked = mst.getBoolean("checked");
|
||||
if (ObjectUtil.isNotEmpty(checked) && checked) {
|
||||
param.put("qty", map.get("plan_qty"));
|
||||
param.put("material_code", map.get("material_code"));
|
||||
param.put("pcsn", map.get("pcsn"));
|
||||
param.put("ioType", StatusEnum.STRATEGY_TYPE.code("入库"));
|
||||
//根据载具进行分配货位
|
||||
List<StrategyMater> maters = new ArrayList<>();
|
||||
for (IOStorInvDis dis : disList) {
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setPcsn(dis.getPcsn());
|
||||
mater.setMaterial_code(dis.getMaterial_code());
|
||||
mater.setMaterial_id(dis.getMaterial_id());
|
||||
mater.setQty(dis.getPlan_qty());
|
||||
maters.add(mater);
|
||||
}
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(param.getString("ioType"))
|
||||
.sect_code(param.getString("sect_code"))
|
||||
.stor_code(param.getString("stor_code"))
|
||||
.material_code(param.getString("material_code"))
|
||||
.qty(new BigDecimal(param.getString("qty")))
|
||||
.pcsn(param.getString("pcsn"))
|
||||
.storagevehicle_code(param.getString("storagevehicle_code"))
|
||||
.strategyMaters(maters)
|
||||
.build());
|
||||
Structattr struct = structattrs.get(0);
|
||||
sect_id = struct.getSect_id();
|
||||
@@ -367,16 +394,16 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
struct_code = struct.getStruct_code();
|
||||
struct_name = struct.getStruct_name();
|
||||
} else {
|
||||
Structattr structattr = iStructattrService.findById(map.get("struct_id"));
|
||||
Structattr structattr = iStructattrService.findById(map.getString("struct_id"));
|
||||
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
);
|
||||
sect_id = map.get("sect_id");
|
||||
sect_code = map.get("sect_code");
|
||||
sect_name = map.get("sect_name");
|
||||
struct_id = map.get("struct_id");
|
||||
struct_code = map.get("struct_code");
|
||||
struct_name = map.get("struct_name");
|
||||
sect_id = map.getString("sect_id");
|
||||
sect_code = map.getString("sect_code");
|
||||
sect_name = map.getString("sect_name");
|
||||
struct_id = map.getString("struct_id");
|
||||
struct_code = map.getString("struct_code");
|
||||
struct_name = map.getString("struct_name");
|
||||
}
|
||||
JSONObject dis_map = new JSONObject();
|
||||
dis_map.put("sect_id", sect_id);
|
||||
@@ -386,43 +413,47 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
dis_map.put("struct_code", struct_code);
|
||||
dis_map.put("struct_name", struct_name);
|
||||
//锁定货位
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(map.get("iostorinv_id"));
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId);
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", struct_code);
|
||||
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("入库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
//更新组盘表状态
|
||||
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
|
||||
// 更新分配明细表
|
||||
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getSect_id,dis_map.getString("sect_id"))
|
||||
.set(IOStorInvDis::getSect_code,dis_map.getString("sect_code"))
|
||||
.set(IOStorInvDis::getSect_name,dis_map.getString("sect_name"))
|
||||
.set(IOStorInvDis::getStruct_id,dis_map.getString("struct_id"))
|
||||
.set(IOStorInvDis::getStruct_code,dis_map.getString("struct_code"))
|
||||
.set(IOStorInvDis::getStruct_name,dis_map.getString("struct_name"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class), new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getSect_id, dis_map.getString("sect_id"))
|
||||
.set(IOStorInvDis::getSect_code, dis_map.getString("sect_code"))
|
||||
.set(IOStorInvDis::getSect_name, dis_map.getString("sect_name"))
|
||||
.set(IOStorInvDis::getStruct_id, dis_map.getString("struct_id"))
|
||||
.set(IOStorInvDis::getStruct_code, dis_map.getString("struct_code"))
|
||||
.set(IOStorInvDis::getStruct_name, dis_map.getString("struct_name"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, storagevehicleCode)
|
||||
);
|
||||
//维护单据明细表里 分配数量
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinvdtl_id",map.get("iostorinvdtl_id"));
|
||||
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("分配完"));
|
||||
jsonObject.put("assign_qty",map.get("plan_qty"));
|
||||
jsonObject.put("unassign_qty","0");
|
||||
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
||||
//维护单据明细表里分配数量
|
||||
List<String> dtlCollect = disList.stream().map(IOStorInvDis::getIostorinvdtl_id).collect(Collectors.toList());
|
||||
List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<IOStorInvDtl>().in(IOStorInvDtl::getIostorinvdtl_id, dtlCollect));
|
||||
for (IOStorInvDtl dtl : dtls) {
|
||||
int disQtySum = disList.stream().filter(dis -> dis.getIostorinvdtl_id().equals(dtl.getIostorinvdtl_id())).mapToInt(value -> value.getPlan_qty().intValue()).sum();
|
||||
dtl.setAssign_qty(dtl.getAssign_qty().add(BigDecimal.valueOf(disQtySum)));
|
||||
dtl.setUnassign_qty(dtl.getPlan_qty().subtract(dtl.getAssign_qty()));
|
||||
dtl.setBill_status(dtl.getUnassign_qty().compareTo(BigDecimal.valueOf(0)) > 0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完"));
|
||||
ioStorInvDtlMapper.updateById(dtl);
|
||||
}
|
||||
//根据单据标识判断分配明细是否都已经分配完成
|
||||
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
||||
.and(wrapper -> wrapper.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code, "")));
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(map.get("iostorinv_id"));
|
||||
ios.setIostorinv_id(iostorinvId);
|
||||
ios.setUpdate_optid(currentUserId);
|
||||
ios.setUpdate_optname(nickName);
|
||||
ios.setUpdate_time(now);
|
||||
@@ -431,43 +462,14 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据库区策略获取仓位
|
||||
* ioType 出入库类型
|
||||
* sect_code 库区编码
|
||||
* stor_code 仓库编码
|
||||
* material_code 物料编码
|
||||
* qty 计划数量
|
||||
* pcsn 批次号
|
||||
*/
|
||||
@Override
|
||||
public Structattr getStructattr(JSONObject param) {
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(param.getString("ioType"))
|
||||
.sect_code(param.getString("sect_code"))
|
||||
.stor_code(param.getString("stor_code"))
|
||||
.material_code(param.getString("material_code"))
|
||||
.qty(new BigDecimal(param.getString("qty")))
|
||||
.pcsn(param.getString("pcsn"))
|
||||
.build());
|
||||
if (CollectionUtils.isEmpty(structattrs)) {
|
||||
throw new BadRequestException("无可用货位");
|
||||
}
|
||||
return structattrs.get(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unDivStruct(Map whereJson) {
|
||||
public void unDivStruct(JSONObject whereJson) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
||||
HashMap<String, String> jo = rows.get(0);
|
||||
JSONObject jo = whereJson.getJSONObject("dis_row");
|
||||
|
||||
//解锁原货位点位
|
||||
JSONObject unlock_map = new JSONObject();
|
||||
@@ -475,39 +477,51 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
unlock_map.put("inv_type", null);
|
||||
unlock_map.put("inv_id", null);
|
||||
unlock_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2",unlock_map);
|
||||
iStructattrService.updateStatusByCode("2", unlock_map);
|
||||
|
||||
// 修改分配明细表
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getSect_id,null)
|
||||
.set(IOStorInvDis::getSect_code,null)
|
||||
.set(IOStorInvDis::getSect_name,null)
|
||||
.set(IOStorInvDis::getStruct_id,null)
|
||||
.set(IOStorInvDis::getStruct_code,null)
|
||||
.set(IOStorInvDis::getStruct_name,null)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,jo.get("iostorinvdis_id"))
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getSect_id, null)
|
||||
.set(IOStorInvDis::getSect_code, null)
|
||||
.set(IOStorInvDis::getSect_name, null)
|
||||
.set(IOStorInvDis::getStruct_id, null)
|
||||
.set(IOStorInvDis::getStruct_code, null)
|
||||
.set(IOStorInvDis::getStruct_name, null)
|
||||
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
||||
);
|
||||
|
||||
//维护单据明细表里 分配数量
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("iostorinvdtl_id",jo.get("iostorinvdtl_id"));
|
||||
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonObject.put("assign_qty","0");
|
||||
jsonObject.put("unassign_qty",jo.get("plan_qty"));
|
||||
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
||||
//更新组盘表状态
|
||||
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>().eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code")));
|
||||
//维护单据明细表里分配数量
|
||||
List<String> dtlCollect = disList.stream().map(IOStorInvDis::getIostorinvdtl_id).collect(Collectors.toList());
|
||||
List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<IOStorInvDtl>().in(IOStorInvDtl::getIostorinvdtl_id, dtlCollect));
|
||||
for (IOStorInvDtl dtl : dtls) {
|
||||
int disQtySum = disList.stream().filter(dis -> dis.getIostorinvdtl_id().equals(dtl.getIostorinvdtl_id())).mapToInt(value -> value.getPlan_qty().intValue()).sum();
|
||||
dtl.setAssign_qty(dtl.getAssign_qty().subtract(BigDecimal.valueOf(disQtySum)));
|
||||
dtl.setUnassign_qty(dtl.getPlan_qty().subtract(dtl.getAssign_qty()));
|
||||
dtl.setBill_status(dtl.getUnassign_qty().compareTo(dtl.getPlan_qty()) == 0 ? IOSEnum.BILL_STATUS.code("生成") : IOSEnum.BILL_STATUS.code("分配中"));
|
||||
ioStorInvDtlMapper.updateById(dtl);
|
||||
}
|
||||
|
||||
//根据单据标识判断分配明细是否都已经分配完成
|
||||
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
|
||||
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
|
||||
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(jo.get("iostorinv_id"));
|
||||
ios.setIostorinv_id(jo.getString("iostorinv_id"));
|
||||
ios.setUpdate_optid(currentUserId);
|
||||
ios.setUpdate_optname(nickName);
|
||||
ios.setUpdate_time(now);
|
||||
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
|
||||
ios.setBill_status(disCount > 0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvMapper.updateById(ios);
|
||||
}
|
||||
|
||||
@@ -519,24 +533,20 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
HashMap<String, String> map = rows.get(0);
|
||||
|
||||
//判断是否已经分配好货位
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
|
||||
if (CollectionUtils.isEmpty(ioStorInvDis)) {
|
||||
throw new BadRequestException("该明细还没分配货位,请先分配货位");
|
||||
}
|
||||
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STInTask");
|
||||
task_form.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("PickingLocation", point_code);
|
||||
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PlacedLocation", ioStorInvDis.get(0).getStruct_code());
|
||||
task_form.put("vehicle_code", map.get("storagevehicle_code"));
|
||||
// GroupPlate groupPlate = mdPbGroupplateMapper.selectOne(new LambdaQueryWrapper<>(GroupPlate.class)
|
||||
// .eq(GroupPlate::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
// );
|
||||
// task_form.put("group_id", groupPlate.getGroup_id());
|
||||
StInTask stInTask = SpringContextHolder.getBean("STInTask");
|
||||
|
||||
String task_id = stInTask.create(task_form);
|
||||
@@ -548,7 +558,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
//更新详情数据
|
||||
ioStorInvDisMapper.update(dis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.set(IOStorInvDis::getTask_id, task_id)
|
||||
.set(IOStorInvDis::getIs_issued, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(IOStorInvDis::getPoint_code, point_code)
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -560,27 +578,27 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<>(IOStorInv.class)
|
||||
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
|
||||
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())) {
|
||||
throw new BadRequestException("主表状态必须为分配完!");
|
||||
}
|
||||
|
||||
//解锁原货位点位
|
||||
List<IOStorInvDis> storInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
|
||||
for (IOStorInvDis ioStorInvDis : storInvDisList) {
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())) {
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
iStructattrService.updateStatusByCode("1", finish_map);
|
||||
|
||||
//修改库存
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
@@ -597,35 +615,35 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
|
||||
//更新详情数据
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
ioStorInvDisMapper.update(ioStorInvDis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty, ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, ioStorInvDis.getIostorinvdis_id())
|
||||
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(), new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty, ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
//更新组盘记录表
|
||||
mdPbGroupplateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
mdPbGroupplateService.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
}
|
||||
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(ioStorInv,new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid, currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname, nickName)
|
||||
.set(IOStorInv::getConfirm_time, now)
|
||||
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
}
|
||||
@@ -633,77 +651,66 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
||||
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id, task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
if (CollectionUtils.isEmpty(ioStorInvDis)) {
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 明细
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInv)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
String iostorinvId = ioStorInvDis.get(0).getIostorinv_id();
|
||||
String storagevehicleCode = ioStorInvDis.get(0).getStoragevehicle_code();
|
||||
String structCode = ioStorInvDis.get(0).getStruct_code();
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("struct_code", structCode);
|
||||
finish_map.put("storagevehicle_code", storagevehicleCode);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
iStructattrService.updateStatusByCode("1", finish_map);
|
||||
//库存变动
|
||||
StructattrChangeDto changeDto = StructattrChangeDto.builder()
|
||||
.inv(ioStorInv.getIostorinv_id())
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(true).build();
|
||||
.inv(iostorinvId)
|
||||
.storagevehicleCode(storagevehicleCode)
|
||||
.structCode(structCode).taskType(task.getConfig_code()).inBound(true).build();
|
||||
iStructattrService.changeStruct(changeDto);
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
if (countDis == 0){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
);
|
||||
}
|
||||
// 完成当前分配明细
|
||||
Map<String, BigDecimal> dtlMap = new HashMap<>();
|
||||
for (IOStorInvDis item : ioStorInvDis) {
|
||||
ioStorInvDisMapper.update(item, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty, item.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, item.getIostorinvdis_id()));
|
||||
dtlMap.put(item.getIostorinvdtl_id(), item.getPlan_qty());
|
||||
}
|
||||
//更新明细
|
||||
for (String dtl_id : dtlMap.keySet()) {
|
||||
IOStorInvDtl invDtl = new IOStorInvDtl();
|
||||
invDtl.setIostorinvdtl_id(dtl_id);
|
||||
invDtl.setReal_qty(dtlMap.get(dtl_id));
|
||||
invDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(invDtl);
|
||||
}
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id, iostorinvId)
|
||||
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0) {
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(), new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid, currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname, nickName)
|
||||
.set(IOStorInv::getConfirm_time, now)
|
||||
.eq(IOStorInv::getIostorinv_id, iostorinvId)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -719,17 +726,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
String storagevehicle_code = whereJson.getString("storagevehicle_code");
|
||||
// 查询没有任务的仓位号
|
||||
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
|
||||
.eq(Structattr::getSect_id,sect_id)
|
||||
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,""))
|
||||
.eq(Structattr::getSect_id, sect_id)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code, ""))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(structattrList)){
|
||||
if (ObjectUtil.isEmpty(structattrList)) {
|
||||
throw new BadRequestException("该库区没有仓位");
|
||||
}
|
||||
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicle_code)
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, storagevehicle_code)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)){
|
||||
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)) {
|
||||
throw new BadRequestException("没有该载具号信息");
|
||||
}
|
||||
// 过滤掉不满足载具长宽高的仓位
|
||||
@@ -739,7 +746,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
st.getZdepth() >= 0
|
||||
).findAny().get();
|
||||
|
||||
if (ObjectUtil.isEmpty(structattr)){
|
||||
if (ObjectUtil.isEmpty(structattr)) {
|
||||
throw new BadRequestException("未找到满足的仓位");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
@@ -23,10 +24,7 @@ import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.*;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
@@ -48,6 +46,7 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -369,13 +368,18 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String material_id = dtl.getMaterial_id();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
// 根据物料和批次号查询库存可用
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(unassign_qty);
|
||||
mater.setPcsn(pcsn);
|
||||
mater.setMaterial_code(material_code);
|
||||
mater.setMaterial_id(material_id);
|
||||
List<StrategyMater> list = new ArrayList<>();
|
||||
list.add(mater);
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.strategyMaters(list)
|
||||
.build()
|
||||
);
|
||||
int seq_no = 1;
|
||||
@@ -473,10 +477,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
Set<String> dtlSet = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
|
||||
//添加需要更新的明细标识
|
||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
@@ -489,7 +491,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
|
||||
//解锁库位
|
||||
JSONObject unlock_map = new JSONObject();
|
||||
unlock_map.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
@@ -497,7 +498,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
unlock_map.put("inv_id", null);
|
||||
unlock_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2",unlock_map);
|
||||
|
||||
//删除出入库单分配表
|
||||
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id());
|
||||
|
||||
@@ -553,14 +553,20 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
String pcsn = dtl.getPcsn();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(unassign_qty);
|
||||
mater.setPcsn(pcsn);
|
||||
mater.setMaterial_code(material_code);
|
||||
mater.setMaterial_id(dtl.getMaterial_id());
|
||||
List<StrategyMater> list = new ArrayList<>();
|
||||
list.add(mater);
|
||||
//调用分配规则获取分配的库位:如果库存不足则直接报错
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.inv_code(ioStorInv.getBill_code())
|
||||
.strategyMaters(list)
|
||||
.build()
|
||||
);
|
||||
int seq_no = 1;
|
||||
@@ -753,7 +759,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
double allocation_canuse_qty = 0;
|
||||
for (int i = 0; i < rows.size(); i++){
|
||||
JSONObject ivt = rows.getJSONObject(i);
|
||||
double canuse_qty = ivt.getDoubleValue("canuse_qty");
|
||||
double canuse_qty = ivt.getDoubleValue("qty");
|
||||
//分配明细
|
||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
||||
@@ -763,6 +769,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setSect_id(ivt.getString("sect_id"));
|
||||
ioStorInvDis.setPcsn(ivt.getString("pcsn"));
|
||||
ioStorInvDis.setMaterial_id(dtl.getMaterial_id());
|
||||
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
|
||||
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
|
||||
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
|
||||
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
|
||||
@@ -773,18 +780,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
// if (unassign_qty-canuse_qty>=0){
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
// }else {
|
||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
||||
// }
|
||||
// unassign_qty = unassign_qty-canuse_qty;
|
||||
// if (unassign_qty<0){
|
||||
// unassign_qty=0;
|
||||
// }
|
||||
if (unassign_qty <= 0){
|
||||
throw new BadRequestException("已全部分配完,未分配数量为0");
|
||||
}
|
||||
@@ -929,21 +924,31 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void allSetPoint(JSONObject whereJson) {
|
||||
//出库点
|
||||
String point_code = whereJson.getString("point_code");
|
||||
|
||||
if (StrUtil.isBlank(point_code)){
|
||||
throw new BadRequestException("未选择出库点");
|
||||
if (StrUtil.isBlank(whereJson.getString("region_code"))){
|
||||
throw new BadRequestException("未选择出库区");
|
||||
}
|
||||
String pointCode = whereJson.getString("point_code");
|
||||
//----根据区域找点,特殊业务比如找空点位在这边----
|
||||
if (StringUtils.isEmpty(pointCode)){
|
||||
List<SchBasePoint> regionCode = schBasePointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, whereJson.getString("region_code"))
|
||||
);
|
||||
if (CollectionUtils.isEmpty(regionCode)){
|
||||
throw new BadRequestException("当前库区"+regionCode+"无可用点位");
|
||||
}
|
||||
pointCode=regionCode.get(0).getPoint_code();
|
||||
}
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
//查询主表信息
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
}
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
@@ -952,28 +957,30 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(ioStorInvDisList)){
|
||||
throw new BadRequestException("当前没有可设置的分配明细");
|
||||
}
|
||||
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
//分配明细中同分配到同载具的进行合并
|
||||
Map<String, List<IOStorInvDis>> groupDis = ioStorInvDisList.stream().collect(Collectors.groupingBy(dis -> dis.getStoragevehicle_code()));
|
||||
for (String storageVehicleCode : groupDis.keySet()) {
|
||||
List<IOStorInvDis> disList = groupDis.get(storageVehicleCode);
|
||||
IOStorInvDis item = disList.get(0);
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STOutTask");
|
||||
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("PickingLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PlacedLocation", point_code);
|
||||
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
|
||||
task_form.put("PickingLocation", item.getStruct_code());
|
||||
task_form.put("PlacedLocation", pointCode);
|
||||
task_form.put("vehicle_code", item.getStoragevehicle_code());
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
|
||||
String task_id = stOutTask.create(task_form);
|
||||
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(ioStorInvDis.getIostorinvdis_id());
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
for (IOStorInvDis itemDis : disList) {
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(itemDis.getIostorinvdis_id());
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(pointCode);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1003,12 +1010,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
// 判断此单据下的所有任务有没有完成的
|
||||
boolean is_finish = iSchBaseTaskService.list(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.in(SchBaseTask::getTask_id, storInvDisList.stream()
|
||||
.map(IOStorInvDis::getTask_id)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
).stream()
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.in(SchBaseTask::getTask_id, storInvDisList.stream()
|
||||
.map(IOStorInvDis::getTask_id)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
).stream()
|
||||
.allMatch(row -> row.getTask_status().equals(TaskStatus.FINISHED.getCode()));
|
||||
if (!is_finish) {
|
||||
throw new BadRequestException("当前有未完成的任务不能强制确认!");
|
||||
@@ -1111,20 +1118,22 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id, task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)) {
|
||||
if (ObjectUtil.isEmpty(disList)) {
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
// 完成当前任务对应的所有分配明细
|
||||
for (IOStorInvDis ioStorInvDis : disList) {
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id()));
|
||||
}
|
||||
IOStorInvDis item = disList.get(0);
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("struct_code", item.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",null);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
@@ -1132,17 +1141,17 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
//库存变动:根据冻结数更新物料库存
|
||||
StructattrChangeDto changeDto = StructattrChangeDto.builder()
|
||||
.inv(ioStorInvDis.getIostorinv_id())
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(false).build();
|
||||
.inv(item.getIostorinv_id())
|
||||
.storagevehicleCode(item.getStoragevehicle_code())
|
||||
.structCode(item.getStruct_code()).taskType(task.getConfig_code()).inBound(false).build();
|
||||
iStructattrService.changeStruct(changeDto);
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,item.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(item.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
<select id="getDtl" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
late.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
late.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
md_pb_groupplate late
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
md_pb_groupplate late
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
<where>
|
||||
late.status = '01'
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
@@ -21,18 +21,18 @@
|
||||
|
||||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
late.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
late.*,
|
||||
mater.material_code,
|
||||
mater.material_name
|
||||
FROM
|
||||
md_pb_groupplate late
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
md_pb_groupplate late
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.material_code} or
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
@@ -76,6 +76,12 @@
|
||||
AND
|
||||
gro.qty>0
|
||||
</if>
|
||||
<if test="params.vehicle_codes != null and params.vehicle_codes.size > 0">
|
||||
AND gro.storagevehicle_code IN
|
||||
<foreach collection="params.vehicle_codes" item="storagevehicle_code" open="(" separator="," close=")">
|
||||
#{storagevehicle_code}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY gro.create_time Desc
|
||||
</select>
|
||||
|
||||
@@ -119,7 +119,7 @@ public class UpdateIvtUtils {
|
||||
* @param where 输入参数
|
||||
*/
|
||||
private void updateAddCanuseInsertIvt(JSONObject where) {
|
||||
// throw new BadRequestException("当前载具已存在库存物料,请检查数据!");
|
||||
throw new BadRequestException("当前载具已存在库存物料,请检查数据!");
|
||||
// 判断当前载具是否有物料
|
||||
// MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
// new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
@@ -197,7 +197,7 @@ public class UpdateIvtUtils {
|
||||
}
|
||||
// 如果可用数和冻结数都为零则删除数据
|
||||
if (frozen_qty == 0 && extDao.getQty().doubleValue() == 0) {
|
||||
// iMdPbStoragevehicleextService.removeById(extDao);
|
||||
iMdPbStoragevehicleextService.removeById(extDao);
|
||||
} else {
|
||||
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty));
|
||||
extDao.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
@@ -219,20 +219,16 @@ public class UpdateIvtUtils {
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||
.eq(GroupPlate::getPcsn, where.getString("pcsn")).eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
// 减冻结
|
||||
double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue();
|
||||
if (qty < 0) {
|
||||
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】");
|
||||
}
|
||||
// 加可用
|
||||
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
BigDecimal addQty = extDao.getQty().add(where.getBigDecimal("change_qty"));
|
||||
extDao.setFrozen_qty(BigDecimal.ZERO);
|
||||
extDao.setQty(BigDecimal.valueOf(qty));
|
||||
extDao.setQty(addQty);
|
||||
extDao.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
|
||||
Reference in New Issue
Block a user