add:入库混料
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package org.nl.wms.pdm_management.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.wms.pdm_management.service.IMdPdmPackagingService;
|
||||
import org.nl.wms.pdm_management.service.dao.MdPdmPackaging;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 外包材收货记录 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-11-26
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/packaging")
|
||||
@Slf4j
|
||||
public class PackagingController {
|
||||
|
||||
@Resource
|
||||
private final IMdPdmPackagingService iMdPdmPackagingService;
|
||||
|
||||
@GetMapping
|
||||
@Log("外包材收货分页查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
whereJson.put("is_transfer", IOSConstant.ZERO);
|
||||
return new ResponseEntity<>(TableDataInfo.build(iMdPdmPackagingService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryTransfer")
|
||||
@Log("外包材转运分页查询")
|
||||
public ResponseEntity<Object> queryTransfer(@RequestParam Map whereJson, PageQuery page) {
|
||||
whereJson.put("is_transfer", IOSConstant.ONE);
|
||||
return new ResponseEntity<>(TableDataInfo.build(iMdPdmPackagingService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增外包材收货记录")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdPdmPackaging dto) {
|
||||
iMdPdmPackagingService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改外包材收货记录")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MdPdmPackaging dto) {
|
||||
iMdPdmPackagingService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除外包材收货记录")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iMdPdmPackagingService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.nl.wms.pdm_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pdm_management.service.dao.MdPdmPackaging;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 外包材收货记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-11-26
|
||||
*/
|
||||
public interface IMdPdmPackagingService extends IService<MdPdmPackaging> {
|
||||
|
||||
/**
|
||||
* 外包材收货分页查询
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<JSONObject> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增外包材收货记录
|
||||
*
|
||||
* @param dto 外包材收货记录实体类
|
||||
*/
|
||||
void create(MdPdmPackaging dto);
|
||||
|
||||
/**
|
||||
* 修改外包材收货记录
|
||||
*
|
||||
* @param dto 外包材收货记录实体类
|
||||
*/
|
||||
void update(MdPdmPackaging dto);
|
||||
|
||||
/**
|
||||
* 删除外包材收货记录
|
||||
*
|
||||
* @param ids 标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 确认转运
|
||||
*
|
||||
* @param dto 外包材收货记录实体类
|
||||
*/
|
||||
void confirmTransfer(MdPdmPackaging dto);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.nl.wms.pdm_management.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 外包材收货记录表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("md_pdm_packaging")
|
||||
public class MdPdmPackaging implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 收货标识id
|
||||
*/
|
||||
@TableId(value = "packing_id")
|
||||
private String packing_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 收货人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 收货人名称
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 收货时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 转运点位
|
||||
*/
|
||||
private String point_code;
|
||||
|
||||
/**
|
||||
* 是否转运
|
||||
*/
|
||||
private String is_transfer;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.pdm_management.service.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.pdm_management.service.dao.MdPdmPackaging;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 外包材收货记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-11-26
|
||||
*/
|
||||
public interface MdPdmPackagingMapper extends BaseMapper<MdPdmPackaging> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<StIvtMoveinv>
|
||||
*/
|
||||
IPage<JSONObject> queryAllByPage(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.pdm_management.service.dao.mapper.MdPdmPackagingMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
pack.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
mater.material_model
|
||||
FROM
|
||||
md_pdm_packaging pack
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = pack.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} )
|
||||
</if>
|
||||
|
||||
<if test="param.create_name != null and param.create_name != ''">
|
||||
AND
|
||||
pack.create_name LIKE #{param.create_name}
|
||||
</if>
|
||||
|
||||
<if test="param.is_transfer != null and param.is_transfer != ''">
|
||||
AND
|
||||
pack.is_transfer = #{param.is_transfer}
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
pack.pcsn LIKE #{param.pcsn}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY pack.create_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,108 @@
|
||||
package org.nl.wms.pdm_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pdm_management.service.IMdPdmPackagingService;
|
||||
import org.nl.wms.pdm_management.service.dao.MdPdmPackaging;
|
||||
import org.nl.wms.pdm_management.service.dao.mapper.MdPdmPackagingMapper;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 外包材收货记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-11-26
|
||||
*/
|
||||
@Service
|
||||
public class MdPdmPackagingServiceImpl extends ServiceImpl<MdPdmPackagingMapper, MdPdmPackaging> implements IMdPdmPackagingService {
|
||||
|
||||
@Resource
|
||||
private IMdPdmPackagingService iMdPdmPackagingService;
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(MdPdmPackaging dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getPoint_code())) {
|
||||
// 外包材转运操作
|
||||
iMdPdmPackagingService.confirmTransfer(dto);
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询此物料此批次是否有收过货的
|
||||
MdPdmPackaging packDao = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdPdmPackaging>().lambda()
|
||||
.eq(MdPdmPackaging::getMaterial_id, dto.getMaterial_id())
|
||||
.eq(MdPdmPackaging::getPcsn, dto.getPcsn())
|
||||
.eq(MdPdmPackaging::getIs_transfer, IOSConstant.ZERO)
|
||||
);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(packDao)) {
|
||||
// 数量叠加
|
||||
packDao.setQty(NumberUtil.add(packDao.getQty(), dto.getQty()));
|
||||
packDao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
packDao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
packDao.setCreate_time(DateUtil.now());
|
||||
this.updateById(packDao);
|
||||
} else {
|
||||
// 新增
|
||||
dto.setPacking_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(MdPdmPackaging dto) {
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Set<String> ids) {
|
||||
this.baseMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirmTransfer(MdPdmPackaging dto) {
|
||||
MdPdmPackaging mdPdmPackaging = this.baseMapper.selectOne(
|
||||
new QueryWrapper<MdPdmPackaging>().lambda()
|
||||
.eq(MdPdmPackaging::getMaterial_id, dto.getMaterial_id())
|
||||
.eq(MdPdmPackaging::getPcsn, dto.getPcsn())
|
||||
);
|
||||
|
||||
mdPdmPackaging.setIs_transfer(IOSConstant.ONE);
|
||||
mdPdmPackaging.setPoint_code(dto.getPoint_code());
|
||||
mdPdmPackaging.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
mdPdmPackaging.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
mdPdmPackaging.setCreate_time(DateUtil.now());
|
||||
this.updateById(mdPdmPackaging);
|
||||
}
|
||||
}
|
||||
@@ -112,4 +112,10 @@ public class RawAssistIStorController {
|
||||
public ResponseEntity<Object> getInBillTaskDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iRawAssistIStorService.getInBillTaskDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehicleGroup")
|
||||
@Log("根据托盘查询此托盘下的所有已经组盘的记录")
|
||||
public ResponseEntity<Object> getVehicleGroup(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iRawAssistIStorService.getVehicleGroup(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public interface IRawAssistIStorService extends IService<IOStorInv> {
|
||||
void unDivStruct(Map whereJson);
|
||||
|
||||
/**
|
||||
* 设置站带你
|
||||
* 设置站点
|
||||
*
|
||||
* @param whereJson {
|
||||
* <p>
|
||||
@@ -151,4 +151,13 @@ public interface IRawAssistIStorService extends IService<IOStorInv> {
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson);
|
||||
|
||||
String insertPdaDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 根据托盘查询此托盘下的所有已经组盘的记录
|
||||
* @param whereJson {
|
||||
* rows: []
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getVehicleGroup(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,6 @@ public interface IOStorInvMapper extends BaseMapper<IOStorInv> {
|
||||
|
||||
IPage<IOStorInv> queryOutBillPage (IPage<IOStorInv> page,@Param("params") Map whereJson);
|
||||
|
||||
List<JSONObject> getVehicleGroup ( List<String> collect);
|
||||
|
||||
}
|
||||
|
||||
@@ -183,4 +183,32 @@
|
||||
</where>
|
||||
ORDER BY ios.iostorinv_id Desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getVehicleGroup" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
gp.*,
|
||||
gp.qty AS plan_qty,
|
||||
gp.vehicle_code AS storagevehicle_code,
|
||||
mtl.material_id,
|
||||
mtl.material_code,
|
||||
mtl.material_name,
|
||||
mtl.material_spec,
|
||||
supp.supp_name
|
||||
FROM
|
||||
md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mtl ON gp.material_id = mtl.material_id
|
||||
LEFT JOIN md_cs_supplierbase supp ON supp.supp_code = gp.supp_code
|
||||
|
||||
<where>
|
||||
gp.status = '1'
|
||||
<if test="collect != null and collect != ''">
|
||||
AND gp.vehicle_code IN
|
||||
<foreach collection="collect" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY gp.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -53,7 +53,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -413,7 +415,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
strategyDaoList.add(strategyDao);
|
||||
|
||||
jo_form.put("sect_code", sectDao.getSect_code());
|
||||
jo_form.put("stor_code",storDao.getStor_code());
|
||||
jo_form.put("stor_code", storDao.getStor_code());
|
||||
jo_form.put("storagevehicle_code", map.get("storagevehicle_code"));
|
||||
jo_form.put("strategyMaters", strategyDaoList);
|
||||
// 调用自动分配
|
||||
@@ -465,16 +467,34 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
.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"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
);
|
||||
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
);
|
||||
List<IOStorInvDtl> dtlList = ioStorInvDtlMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, disList.get(0).getIostorinv_id())
|
||||
.in(IOStorInvDtl::getPcsn, disList.stream()
|
||||
.map(IOStorInvDis::getPcsn)
|
||||
.collect(Collectors.toList()))
|
||||
);
|
||||
|
||||
//维护单据明细表里 分配数量
|
||||
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));
|
||||
dtlList.forEach(row -> {
|
||||
IOStorInvDis dis = disList.stream()
|
||||
.filter(item -> item.getPcsn().equals(row.getPcsn()))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
row.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
row.setAssign_qty(dis.getPlan_qty());
|
||||
row.setUnassign_qty(BigDecimal.ZERO);
|
||||
ioStorInvDtlMapper.updateById(row);
|
||||
});
|
||||
|
||||
//根据单据标识判断分配明细是否都已经分配完成
|
||||
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
@@ -518,16 +538,34 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
.set(IOStorInvDis::getStruct_id, null)
|
||||
.set(IOStorInvDis::getStruct_code, null)
|
||||
.set(IOStorInvDis::getStruct_name, null)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, jo.get("iostorinvdis_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
||||
);
|
||||
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
||||
);
|
||||
List<IOStorInvDtl> dtlList = ioStorInvDtlMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, disList.get(0).getIostorinv_id())
|
||||
.in(IOStorInvDtl::getPcsn, disList.stream()
|
||||
.map(IOStorInvDis::getPcsn)
|
||||
.collect(Collectors.toList()))
|
||||
);
|
||||
|
||||
//维护单据明细表里 分配数量
|
||||
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));
|
||||
dtlList.forEach(row -> {
|
||||
IOStorInvDis dis = disList.stream()
|
||||
.filter(item -> item.getPcsn().equals(row.getPcsn()))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
row.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
row.setAssign_qty(BigDecimal.ZERO);
|
||||
row.setUnassign_qty(dis.getPlan_qty());
|
||||
ioStorInvDtlMapper.updateById(row);
|
||||
});
|
||||
|
||||
//根据单据标识判断分配明细是否都已经分配完成
|
||||
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
@@ -574,13 +612,19 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
String task_id = task.create(task_form);
|
||||
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(map.get("iostorinvdis_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);
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
disList.forEach(row -> {
|
||||
row.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
row.setTask_id(task_id);
|
||||
row.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
row.setPoint_code(point_code);
|
||||
ioStorInvDisMapper.updateById(row);
|
||||
});
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@@ -679,87 +723,90 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
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> disList = ioStorInvDisMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.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("完成"))
|
||||
.set(IOStorInvDis::getReal_qty, ioStorInvDis.getPlan_qty())
|
||||
.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("完成"))
|
||||
.set(IOStorInvDis::getReal_qty, ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
//修改库存
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
//更新组盘记录表
|
||||
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getVehicle_code, ioStorInvDis.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
);
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
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())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//解锁库位
|
||||
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", disList.get(0).getStruct_code());
|
||||
finish_map.put("storagevehicle_code", disList.get(0).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);
|
||||
|
||||
//修改库存
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
//更新组盘记录表
|
||||
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getVehicle_code, ioStorInvDis.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
);
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
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())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -851,7 +898,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
io_mst.put("syscompanyid", deptId + "");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> row = rows.get(i);
|
||||
Object qty = ObjectUtil.isEmpty(whereJson.getBigDecimal("material_qty")) ? row.get("qty") :whereJson.getBigDecimal("material_qty");
|
||||
Object qty = ObjectUtil.isEmpty(whereJson.getBigDecimal("material_qty")) ? row.get("qty") : whereJson.getBigDecimal("material_qty");
|
||||
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.putAll(row);
|
||||
@@ -901,4 +948,18 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvMapper.insert(io_mst.toJavaObject(IOStorInv.class));
|
||||
return iostorinv_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getVehicleGroup(JSONObject whereJson) {
|
||||
if (ObjectUtil.isEmpty(whereJson.getJSONArray("rows"))) {
|
||||
return null;
|
||||
}
|
||||
List<JSONObject> rows = whereJson.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
List<String> vehicleList = rows.stream()
|
||||
.map(row -> row.getString("vehicle_code"))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return ioStorInvMapper.getVehicleGroup(vehicleList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user