add:手持盘点确认
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package org.nl.wms.pda.ios_manage.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosCheckService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 手持盘点确认 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-06-06
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/pda/iosCheck")
|
||||
@Slf4j
|
||||
public class PdaIosCheckController {
|
||||
|
||||
@Autowired
|
||||
private PdaIosCheckService pdaIosCheckService;
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@Log("获取盘点明细")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaIosCheckService.getDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("确认")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pdaIosCheckService.confirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.pda.ios_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 手持盘点确认 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-06-06
|
||||
*/
|
||||
public interface PdaIosCheckService extends IService<StIvtCheckdtl> {
|
||||
|
||||
/**
|
||||
* 获取盘点明细
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具编码
|
||||
* struct_code: 仓位
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse getDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 确认
|
||||
* @param whereJson {
|
||||
* storagevehicle_code: 载具编码
|
||||
* struct_code:仓位编码
|
||||
* data: [
|
||||
* checkdtl_id: 明细标识
|
||||
* bill_code: 单据编码
|
||||
* bill_code: 单据编码
|
||||
* pcsn: 批次
|
||||
* base_qty: 库存数量
|
||||
* fac_qty: 盘点数量
|
||||
* qty_unit_name: 单位
|
||||
* ]
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse confirm(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.nl.wms.pda.ios_manage.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.pda.ios_manage.service.PdaIosCheckService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckdtlService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckmstService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckdtlMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 手持盘点确认 实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-06-06
|
||||
*/
|
||||
@Service
|
||||
public class PdaIosCheckServiceImpl extends ServiceImpl<StIvtCheckdtlMapper, StIvtCheckdtl> implements PdaIosCheckService {
|
||||
|
||||
/**
|
||||
* 盘点单主表服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtCheckmstService iStIvtCheckmstService;
|
||||
|
||||
/**
|
||||
* 盘点单明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtCheckdtlService iStIvtCheckdtlService;
|
||||
|
||||
@Override
|
||||
public PdaResponse getDtl(JSONObject whereJson) {
|
||||
return PdaResponse.requestParamOk(this.baseMapper.getPdaDtl(whereJson));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse confirm(JSONObject whereJson) {
|
||||
List<JSONObject> dataList = whereJson.getJSONArray("data").toJavaList(JSONObject.class);
|
||||
// 查询明细
|
||||
List<StIvtCheckdtl> dtlDaoList = this.list(
|
||||
new QueryWrapper<StIvtCheckdtl>().lambda()
|
||||
.in(StIvtCheckdtl::getCheckdtl_id, dataList.stream()
|
||||
.map(row -> row.getString("checkdtl_id"))
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
// 需要更新的明细集合
|
||||
List<StIvtCheckdtl> needUpdateList = new ArrayList<>();
|
||||
for (JSONObject json : dataList) {
|
||||
StIvtCheckdtl dtlDao = dtlDaoList.stream()
|
||||
.filter(row -> row.getCheckdtl_id().equals(json.getString("checkdtl_id")))
|
||||
.findFirst().orElse(null);
|
||||
dtlDao.setStatus(IOSEnum.CHECK_DTL_STATUS.code("完成"));
|
||||
dtlDao.setFac_qty(json.getBigDecimal("fac_qty"));
|
||||
needUpdateList.add(dtlDao);
|
||||
}
|
||||
// 更新明细
|
||||
this.updateBatchById(needUpdateList);
|
||||
// 更新主表状态
|
||||
iStIvtCheckmstService.updateMst(dtlDaoList.get(0).getCheck_id());
|
||||
// 创建损益单
|
||||
iStIvtCheckdtlService.createMore(needUpdateList,dtlDaoList.get(0).getCheck_id());
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.pda.ios_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
@@ -94,10 +96,21 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
public PdaResponse confirm(JSONObject whereJson) {
|
||||
// 获取点位信息
|
||||
SchBasePoint pointDao = iSchBasePointService.getById(whereJson.getString("point_code"));
|
||||
if (ObjectUtil.isEmpty(pointDao)) {
|
||||
throw new BadRequestException("当前点位不存在!!");
|
||||
}
|
||||
// 获取出入库单明细信息
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectById(pointDao.getIos_id());
|
||||
IOStorInvDis disDao = ioStorInvDisMapper.selectById(pointDao.getIos_id());
|
||||
if(ObjectUtil.isEmpty(disDao)) {
|
||||
throw new BadRequestException("未查询到出库单分配明细!");
|
||||
}
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
|
||||
|
||||
// 获取点位库存信息
|
||||
JSONObject jsonIvt = mdPbStoragevehicleextMapper.getIosDtl(whereJson).get(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
throw new BadRequestException("当前点位没有库存信息!");
|
||||
}
|
||||
// 判断是否整出
|
||||
double plan_qty = dtlDao.getPlan_qty().doubleValue();
|
||||
double real_qty = NumberUtil.add(dtlDao.getReal_qty(), jsonIvt.getDoubleValue("qty")).doubleValue();
|
||||
@@ -112,7 +125,6 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
dtlDao.setReal_qty(BigDecimal.valueOf(real_qty));
|
||||
ioStorInvDtlMapper.updateById(dtlDao);
|
||||
// 更新分配明细实际出库数量
|
||||
IOStorInvDis disDao = ioStorInvDisMapper.selectById(pointDao.getIos_id());
|
||||
disDao.setReal_qty(jsonIvt.getBigDecimal("qty"));
|
||||
ioStorInvDisMapper.updateById(disDao);
|
||||
} else {
|
||||
@@ -127,8 +139,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
dtlDao.setReal_qty(BigDecimal.valueOf(plan_qty));
|
||||
ioStorInvDtlMapper.updateById(dtlDao);
|
||||
// 更新分配明细实际出库重量 = 变动数量
|
||||
IOStorInvDis disDao = ioStorInvDisMapper.selectById(pointDao.getIos_id());
|
||||
disDao.setReal_qty(change_qty);
|
||||
ioStorInvDisMapper.updateById(disDao);
|
||||
|
||||
// 查找入库货位
|
||||
JSONObject paramPoint = new JSONObject();
|
||||
|
||||
@@ -38,4 +38,13 @@ public interface IStIvtCheckdtlService extends IService<StIvtCheckdtl> {
|
||||
* @param list 明细实体类集合
|
||||
*/
|
||||
void createMore(List<StIvtCheckdtl> list, String check_id);
|
||||
|
||||
/**
|
||||
* 手持盘点获取明细
|
||||
* @param whereJson {
|
||||
* storagevehicle_code:载具号
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getPdaDtl(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,10 @@ public interface IStIvtCheckmstService extends IService<StIvtCheckmst> {
|
||||
* @param dto 新增修改dto实体类
|
||||
*/
|
||||
void confirm(CheckInsertDto dto);
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param check_id 主表id
|
||||
*/
|
||||
void updateMst(String check_id);
|
||||
}
|
||||
|
||||
@@ -26,4 +26,14 @@ public interface StIvtCheckdtlMapper extends BaseMapper<StIvtCheckdtl> {
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getDtl(@Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 手持获取盘点明细
|
||||
* @param whereJson {
|
||||
* storagevehicle_code:载具编码
|
||||
* struct_code: 仓位
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getPdaDtl(@Param("param") JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -24,4 +24,33 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getPdaDtl" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
dtl.checkdtl_id,
|
||||
ios.check_code,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
dtl.pcsn,
|
||||
dtl.base_qty,
|
||||
dtl.fac_qty,
|
||||
dtl.qty_unit_name
|
||||
FROM
|
||||
st_ivt_checkdtl dtl
|
||||
LEFT JOIN st_ivt_checkmst ios ON ios.check_id = dtl.check_id
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = dtl.material_id
|
||||
<where>
|
||||
dtl.status IN ('10','20')
|
||||
AND ios.status IN ('10','20')
|
||||
AND ios.is_delete = '0'
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
AND
|
||||
dtl.storagevehicle_code = #{param.storagevehicle_code}
|
||||
</if>
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
dtl.struct_code = #{param.struct_code}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.nl.wms.warehouse_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.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
@@ -132,4 +131,9 @@ public class StIvtCheckdtlServiceImpl extends ServiceImpl<StIvtCheckdtlMapper, S
|
||||
iStIvtMoreorlessmstService.confirm(iStIvtMoreorlessmstService.getById(mol_id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getPdaDtl(JSONObject whereJson) {
|
||||
return this.baseMapper.getPdaDtl(whereJson);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,11 +169,8 @@ public class StIvtCheckmstServiceImpl extends ServiceImpl<StIvtCheckmstMapper, S
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param check_id 主表标识
|
||||
*/
|
||||
private void updateMst(String check_id) {
|
||||
@Override
|
||||
public void updateMst(String check_id) {
|
||||
StIvtCheckmst mstDao = this.getById(check_id);
|
||||
List<StIvtCheckdtl> dtlDaoList = iStIvtCheckdtlService.list(
|
||||
new QueryWrapper<StIvtCheckdtl>().lambda()
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
<el-table-column type="index" label="序号" align="center" :min-width="flexWidth('index',crud.data,'序号')" />
|
||||
<el-table-column prop="status" label="状态" align="center" :formatter="bill_statusFormat" :min-width="flexWidth('status',crud.data,'状态')" />
|
||||
<el-table-column prop="sect_name" label="盘点库区" align="center" :min-width="flexWidth('sect_name',crud.data,'盘点库区')" />
|
||||
<el-table-column prop="struct_name" label="盘点货位" align="center" :min-width="flexWidth('struct_name',crud.data,'盘点货位')" />
|
||||
<el-table-column prop="struct_code" label="盘点货位" align="center" :min-width="flexWidth('struct_code',crud.data,'盘点货位')" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
|
||||
<el-table-column prop="material_code" label="物料编码" align="center" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
|
||||
|
||||
Reference in New Issue
Block a user