11 changed files with 251 additions and 10 deletions
@ -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(); |
|||
} |
|||
} |
Loading…
Reference in new issue