add:退料管理
This commit is contained in:
@@ -81,4 +81,11 @@ public class GroupController {
|
||||
iMdPbGroupplateService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/copySave")
|
||||
@Log("查询供应商")
|
||||
public ResponseEntity<Object> copySave(@RequestBody GroupPlate dto) {
|
||||
iMdPbGroupplateService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.nl.wms.pdm_manage.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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_manage.service.IPdmBomCallMaterialDtlService;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料明细 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-19
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/bomCallMaterialDtl")
|
||||
@Slf4j
|
||||
public class BomCallMaterialDtlController {
|
||||
|
||||
@Autowired
|
||||
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iPdmBomCallMaterialDtlService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@Log("查询明细")
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iPdmBomCallMaterialDtlService.getDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getWeigh")
|
||||
@Log("获取称重信息")
|
||||
public ResponseEntity<Object> getWeigh(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iPdmBomCallMaterialDtlService.getWeigh(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveWeigh")
|
||||
@Log("保存称重信息")
|
||||
public ResponseEntity<Object> saveWeigh(@RequestBody PdmBomCallMaterialDtlDto dto) {
|
||||
iPdmBomCallMaterialDtlService.saveWeigh(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("退料确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody PdmBomCallMaterialDtlDto dto) {
|
||||
iPdmBomCallMaterialDtlService.confirm(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,11 +20,14 @@ import java.util.Map;
|
||||
@Getter
|
||||
public enum BomEnum {
|
||||
|
||||
// 叫料单状态
|
||||
// 叫料单主表状态
|
||||
CALL_BOM_STATUS(MapOf.of("生成", "1", "叫料中", "2", "叫料完成", "3"
|
||||
, "退料中", "4", "完成", "5"
|
||||
)),
|
||||
|
||||
// 叫料单明细状态
|
||||
CALL_BOM_DTL_STATUS(MapOf.of("生成", "1", "完成", "2")),
|
||||
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.nl.wms.pdm_manage.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_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单明细 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-19
|
||||
*/
|
||||
public interface IPdmBomCallMaterialDtlService extends IService<PdmBomCallMaterialDtl> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<PdmBomCallMaterialDtlDto> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询明细
|
||||
*
|
||||
* @param whereJson {
|
||||
* bom_id
|
||||
* }
|
||||
* @return List<PdmBomCallMaterialDtlDto>
|
||||
*/
|
||||
List<PdmBomCallMaterialDtlDto> getDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取称重信息
|
||||
*
|
||||
* @param whereJson {
|
||||
* vehicle_code: 载具编码
|
||||
* }
|
||||
* @return JSONObject {
|
||||
* weigh_qty: 称重重量
|
||||
* }
|
||||
*/
|
||||
JSONObject getWeigh(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 保存称重信息
|
||||
*
|
||||
* @param dto {
|
||||
* 叫料明细
|
||||
* }
|
||||
*/
|
||||
void saveWeigh(PdmBomCallMaterialDtlDto dto);
|
||||
|
||||
/**
|
||||
* 退料确认
|
||||
*
|
||||
* @param dto {
|
||||
* 叫料明细
|
||||
* }
|
||||
*/
|
||||
void confirm(PdmBomCallMaterialDtlDto dto);
|
||||
}
|
||||
@@ -54,4 +54,10 @@ public interface IPdmBomCallMaterialService extends IService<PdmBomCallMaterial>
|
||||
* @return PdmBomCallMaterial 实体类
|
||||
*/
|
||||
PdmBomCallMaterial findByCode (String bom_code);
|
||||
|
||||
/**
|
||||
* 更新叫料单状态
|
||||
* @param bom_id 叫料单标识
|
||||
*/
|
||||
void updateStatus(String bom_id);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class PdmBomCallMaterial implements Serializable {
|
||||
private BigDecimal real_qty;
|
||||
|
||||
/**
|
||||
* 实际用料总量
|
||||
* 实际用料重量
|
||||
*/
|
||||
private BigDecimal real_weigh_qty;
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package org.nl.wms.pdm_manage.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-08-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pdm_bom_callmaterialdtl")
|
||||
public class PdmBomCallMaterialDtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 标识
|
||||
*/
|
||||
@TableId(value = "bomdtl_id")
|
||||
private String bomdtl_id;
|
||||
|
||||
/**
|
||||
* 工单标识
|
||||
*/
|
||||
private String bom_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 出库仓位
|
||||
*/
|
||||
private String struct_code;
|
||||
|
||||
/**
|
||||
* 工单状态
|
||||
*/
|
||||
private String bom_status;
|
||||
|
||||
/**
|
||||
* 出库分配标识
|
||||
*/
|
||||
private String out_dis_id;
|
||||
|
||||
/**
|
||||
* 出库数量
|
||||
*/
|
||||
private BigDecimal out_qty;
|
||||
|
||||
/**
|
||||
* 称重重量
|
||||
*/
|
||||
private BigDecimal weigh_qty;
|
||||
|
||||
/**
|
||||
* 创建人标识
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.wms.pdm_manage.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_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单明细 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-19
|
||||
*/
|
||||
public interface PdmBomCallMaterialDtlMapper extends BaseMapper<PdmBomCallMaterialDtl> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<PdmBomCallMaterialDtlDto>
|
||||
*/
|
||||
IPage<PdmBomCallMaterialDtlDto> queryAllByPage(Page<PdmBomCallMaterialDtlDto> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 查询明细
|
||||
*
|
||||
* @param whereJson {
|
||||
* bom_id
|
||||
* }
|
||||
* @return List<PdmBomCallMaterialDtlDto>
|
||||
*/
|
||||
List<PdmBomCallMaterialDtlDto> getDtl(@Param("param") JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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_manage.service.dao.mapper.PdmBomCallMaterialDtlMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto">
|
||||
SELECT
|
||||
dtl.*,
|
||||
mst.bom_code,
|
||||
mst.device_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
attr.sect_name,
|
||||
attr.stor_name
|
||||
FROM
|
||||
pdm_bom_callmaterialdtl dtl
|
||||
INNER JOIN pdm_bom_callmaterial mst ON mst.bom_id = dtl.bom_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
LEFT JOIN st_ivt_structattr attr ON attr.struct_code = dtl.struct_code
|
||||
<where>
|
||||
mst.bom_status IN ('3','4')
|
||||
<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.device_code != null and param.device_code != ''">
|
||||
AND
|
||||
mst.device_code LIKE #{param.device_code}
|
||||
</if>
|
||||
|
||||
<if test="param.bom_code != null and param.bom_code != ''">
|
||||
AND
|
||||
mst.bom_code LIKE #{param.bom_code}
|
||||
</if>
|
||||
|
||||
<if test="param.bom_status != null and param.bom_status != ''">
|
||||
AND
|
||||
dtl.bom_status = #{param.bom_status}
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
dtl.pcsn = #{param.pcsn}
|
||||
</if>
|
||||
|
||||
<if test="param.vehicle_code != null and param.vehicle_code != ''">
|
||||
AND
|
||||
dtl.vehicle_code = #{param.vehicle_code}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY dtl.create_time Desc
|
||||
</select>
|
||||
|
||||
<select id="getDtl" resultType="org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto">
|
||||
SELECT
|
||||
dtl.*,
|
||||
mst.bom_code,
|
||||
mst.device_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
attr.sect_name,
|
||||
attr.stor_name
|
||||
FROM
|
||||
pdm_bom_callmaterialdtl dtl
|
||||
INNER JOIN pdm_bom_callmaterial mst ON mst.bom_id = dtl.bom_id
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
|
||||
LEFT JOIN st_ivt_structattr attr ON attr.struct_code = dtl.struct_code
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.bom_id != null and param.bom_id != ''">
|
||||
AND
|
||||
dtl.bom_id = #{param.bom_id}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY dtl.create_time Desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.nl.wms.pdm_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单明细dto
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-19
|
||||
*/
|
||||
@Data
|
||||
public class PdmBomCallMaterialDtlDto extends PdmBomCallMaterialDtl {
|
||||
|
||||
/**
|
||||
* 物料标规格
|
||||
*/
|
||||
private String material_spec;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 工单编码
|
||||
*/
|
||||
private String bom_code;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
private String sect_name;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String stor_name;
|
||||
|
||||
/**
|
||||
* 机台编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package org.nl.wms.pdm_manage.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.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.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.ext.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.pdm_manage.enums.BomEnum;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.pdm_manage.service.dao.mapper.PdmBomCallMaterialDtlMapper;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDtlDto;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产线叫料单明细 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-19
|
||||
*/
|
||||
@Service
|
||||
public class PdmBomCallMaterialDtlServiceImpl extends ServiceImpl<PdmBomCallMaterialDtlMapper, PdmBomCallMaterialDtl> implements IPdmBomCallMaterialDtlService {
|
||||
|
||||
/**
|
||||
* 叫料工单服务
|
||||
*/
|
||||
@Autowired
|
||||
private IPdmBomCallMaterialService iPdmBomCallMaterialService;
|
||||
|
||||
/**
|
||||
* 点位信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 载具信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
|
||||
/**
|
||||
* wms调用acs服务
|
||||
*/
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBomCallMaterialDtlDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PdmBomCallMaterialDtlDto> getDtl(JSONObject whereJson) {
|
||||
return this.baseMapper.getDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public JSONObject getWeigh(JSONObject whereJson) {
|
||||
// 判断当前载具是否是称重位上的载具
|
||||
SchBasePoint pointDao = iSchBasePointService.getById(IOSConstant.CZW_POINT);
|
||||
if (!pointDao.getVehicle_code().equals(whereJson.getString("vehicle_code"))) {
|
||||
throw new BadRequestException("当前称重位载具与退料载具不符,当前称重位载具为【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
// 获取载具信息
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(pointDao.getVehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleDao.getWeigth())) {
|
||||
throw new BadRequestException("请维护当前载具重量【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
|
||||
// TODO 调用ACS接口获取称重信息
|
||||
AcsResponse weighAcs = wmsToAcsService.getWeighAcs(new JSONObject());
|
||||
JSONObject jsonResult = weighAcs.getResultData();
|
||||
|
||||
// 称重重量
|
||||
double weigh_qty = NumberUtil.round(jsonResult.getDoubleValue("weigh_qty"), 2).doubleValue();
|
||||
// 扣除载具重量
|
||||
double sub_qty = NumberUtil.sub(weigh_qty, vehicleDao.getWeigth().doubleValue());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("weigh_qty", NumberUtil.round(sub_qty, 2));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveWeigh(PdmBomCallMaterialDtlDto dto) {
|
||||
// 更新称重信息
|
||||
PdmBomCallMaterialDtl bomdtlDao = this.getById(dto.getBomdtl_id());
|
||||
bomdtlDao.setWeigh_qty(dto.getWeigh_qty());
|
||||
this.updateById(bomdtlDao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirm(PdmBomCallMaterialDtlDto dto) {
|
||||
// 更新明细状态完成
|
||||
PdmBomCallMaterialDtl bomdtlDao = this.getById(dto.getBomdtl_id());
|
||||
bomdtlDao.setBom_status(BomEnum.CALL_BOM_DTL_STATUS.code("完成"));
|
||||
bomdtlDao.setConfirm_time(DateUtil.now());
|
||||
this.updateById(bomdtlDao);
|
||||
|
||||
// 查询叫料工单
|
||||
PdmBomCallMaterial bomDao = iPdmBomCallMaterialService.getById(dto.getBom_id());
|
||||
|
||||
// 增加叫料工单实际用料重量: 叫料单实际用料 + (叫料明细出库重量 - 叫料明细称重重量)
|
||||
double qty = NumberUtil.sub(dto.getOut_qty(), dto.getWeigh_qty()).doubleValue();
|
||||
double real_weigh_qty = NumberUtil.add(bomDao.getReal_weigh_qty(), qty).doubleValue();
|
||||
|
||||
bomDao.setReal_weigh_qty(NumberUtil.round(real_weigh_qty, 2));
|
||||
iPdmBomCallMaterialService.updateById(bomDao);
|
||||
|
||||
// 更新叫料单状态
|
||||
iPdmBomCallMaterialService.updateStatus(bomDao.getBom_id());
|
||||
}
|
||||
}
|
||||
@@ -12,14 +12,17 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
||||
import org.nl.wms.pdm_manage.enums.BomEnum;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.pdm_manage.service.dao.mapper.PdmBomCallMaterialMapper;
|
||||
import org.nl.wms.pdm_manage.service.dto.PdmBomCallMaterialDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,6 +43,12 @@ public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMateria
|
||||
@Autowired
|
||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||
|
||||
/**
|
||||
* 叫料单明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBomCallMaterialDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
@@ -78,7 +87,29 @@ public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMateria
|
||||
public PdmBomCallMaterial findByCode(String bom_code) {
|
||||
return this.baseMapper.selectOne(
|
||||
new QueryWrapper<PdmBomCallMaterial>().lambda()
|
||||
.eq(PdmBomCallMaterial::getBom_code, bom_code)
|
||||
.eq(PdmBomCallMaterial::getBom_code, bom_code)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(String bom_id) {
|
||||
PdmBomCallMaterial bomDao = this.getById(bom_id);
|
||||
|
||||
// 查询叫料单明细
|
||||
List<PdmBomCallMaterialDtl> bomDtlList = iPdmBomCallMaterialDtlService.list(
|
||||
new QueryWrapper<PdmBomCallMaterialDtl>().lambda()
|
||||
.eq(PdmBomCallMaterialDtl::getBom_id, bom_id)
|
||||
);
|
||||
|
||||
// 全部为完成则更新叫料单状态为完成,否则为退料中
|
||||
boolean is_confirm = bomDtlList.stream()
|
||||
.allMatch(row -> row.getBom_status().equals(BomEnum.CALL_BOM_DTL_STATUS.code("完成")));
|
||||
|
||||
if (is_confirm) {
|
||||
bomDao.setConfirm_time(DateUtil.now());
|
||||
}
|
||||
bomDao.setBom_status(is_confirm ? BomEnum.CALL_BOM_STATUS.code("完成") : BomEnum.CALL_BOM_STATUS.code("退料中"));
|
||||
this.updateById(bomDao);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,16 @@ package org.nl.wms.sch_manage.service.util.tasks;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.pdm_manage.enums.BomEnum;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
@@ -21,7 +25,9 @@ import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -58,12 +64,24 @@ public class ReceiveOutTask extends AbstractTask {
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 明细mapper
|
||||
*/
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Resource
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 退料单服务
|
||||
*/
|
||||
@Resource
|
||||
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -152,10 +170,6 @@ public class ReceiveOutTask extends AbstractTask {
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 更新终点
|
||||
@@ -170,6 +184,7 @@ public class ReceiveOutTask extends AbstractTask {
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
outBillService.taskFinish(taskObj);
|
||||
this.taskConfirm(taskObj.getTask_code());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -197,4 +212,30 @@ public class ReceiveOutTask extends AbstractTask {
|
||||
taskObj.setRemark("已取消");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
IOStorInvDis disDao = ioStorInvDisMapper.selectOne(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
IOStorInvDtl stDtlDao = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
|
||||
|
||||
// 创建退料明细
|
||||
PdmBomCallMaterialDtl materDtlDao = new PdmBomCallMaterialDtl();
|
||||
materDtlDao.setBomdtl_id(IdUtil.getStringId());
|
||||
materDtlDao.setBom_id(stDtlDao.getSource_billdtl_id());
|
||||
materDtlDao.setMaterial_id(disDao.getMaterial_id());
|
||||
materDtlDao.setPcsn(disDao.getPcsn());
|
||||
materDtlDao.setVehicle_code(disDao.getStoragevehicle_code());
|
||||
materDtlDao.setStruct_code(disDao.getStruct_code());
|
||||
materDtlDao.setBom_status(BomEnum.CALL_BOM_DTL_STATUS.code("生成"));
|
||||
materDtlDao.setOut_dis_id(disDao.getIostorinvdis_id());
|
||||
materDtlDao.setOut_qty(disDao.getReal_qty());
|
||||
materDtlDao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
materDtlDao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
materDtlDao.setCreate_time(DateUtil.now());
|
||||
iPdmBomCallMaterialDtlService.save(materDtlDao);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,5 +80,4 @@ public interface IMdPbGroupplateService extends IService<GroupPlate> {
|
||||
* @param ids 标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dto.GroupPlateDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
md_pb_groupplate late
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||
<where>
|
||||
late.status = '01'
|
||||
late.status = '1'
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
AND
|
||||
late.storagevehicle_code = #{param.storagevehicle_code}
|
||||
|
||||
@@ -23,6 +23,11 @@ public class GroupPlateDto extends GroupPlate{
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
/**
|
||||
* 物料批次
|
||||
*/
|
||||
private String material_spec;
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ 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.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.service.IMdCsSupplierbaseService;
|
||||
@@ -24,6 +25,7 @@ import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.GroupPlateDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -76,6 +78,12 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(GroupPlate dto) {
|
||||
// 校验载具信息
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(dto.getStoragevehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleDao.getWeigth())) {
|
||||
throw new BadRequestException("请先维护载具重量信息!");
|
||||
}
|
||||
|
||||
// 校验此载具是否已经组盘
|
||||
List<GroupPlate> groupList = this.list(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
@@ -88,6 +96,7 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
|
||||
}
|
||||
|
||||
dto.setGroup_id(IdUtil.getStringId());
|
||||
dto.setPcsn(CodeUtil.getNewCode("GROUP_PCSN_CODE"));
|
||||
// 计量单位默认重量KG
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode("KG");
|
||||
dto.setQty_unit_id(unitDao.getMeasure_unit_id());
|
||||
|
||||
@@ -349,6 +349,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
ioStorInvDtl.put("remark", row.getString("remark"));
|
||||
ioStorInvDtl.put("assign_qty", "0");
|
||||
ioStorInvDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
ioStorInvDtl.put("source_billdtl_id", row.get("source_billdtl_id"));
|
||||
ioStorInvDtl.put("source_bill_code", row.get("source_bill_code"));
|
||||
|
||||
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class));
|
||||
|
||||
@@ -19,6 +19,8 @@ import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.ext.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService;
|
||||
import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
@@ -97,6 +99,12 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
|
||||
@Autowired
|
||||
private ISectattrService iSectattrService;
|
||||
|
||||
/**
|
||||
* 叫料明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
|
||||
|
||||
@Override
|
||||
public IPage<SelectOutDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
@@ -116,7 +124,7 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
|
||||
throw new BadRequestException("当前称重位载具与拣选载具不符,当前称重位载具为【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
// 获取载具信息
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString(pointDao.getVehicle_code()));
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(pointDao.getVehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleDao.getWeigth())) {
|
||||
throw new BadRequestException("请维护当前载具重量【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
@@ -161,8 +169,8 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
|
||||
// 更新明细是否拣选为否
|
||||
this.update(
|
||||
new UpdateWrapper<IOStorInvDtl>().lambda()
|
||||
.set(IOStorInvDtl::getIs_check, IOSConstant.IS_DELETE_NO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id, dto.getIostorinvdtl_id())
|
||||
.set(IOStorInvDtl::getIs_check, IOSConstant.IS_DELETE_NO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id, dto.getIostorinvdtl_id())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -214,6 +222,21 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
|
||||
jsonMst.put("tableData", tableData);
|
||||
String iostorinv_id = iRawAssistIStorService.insertDtl(jsonMst);
|
||||
|
||||
// 更新原出库明细实际出库数量: 计划重量 - 称重重量
|
||||
double real_qty = NumberUtil.sub(disDao.getPlan_qty(), dtlDao.getWeigh_qty()).doubleValue();
|
||||
if (real_qty <= 0) {
|
||||
throw new BadRequestException("实际出库重量不能为负数或为0!");
|
||||
}
|
||||
disDao.setReal_qty(NumberUtil.round(real_qty, 3));
|
||||
ioStorInvDisMapper.updateById(disDao);
|
||||
|
||||
// 更新叫料明细实际出库重量
|
||||
iPdmBomCallMaterialDtlService.update(
|
||||
new UpdateWrapper<PdmBomCallMaterialDtl>().lambda()
|
||||
.set(PdmBomCallMaterialDtl::getOut_qty, disDao.getReal_qty())
|
||||
.eq(PdmBomCallMaterialDtl::getOut_dis_id, disDao.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("sect_id", disDao.getSect_id());
|
||||
result.put("iostorinv_id", iostorinv_id);
|
||||
|
||||
Reference in New Issue
Block a user