| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.IsptOrderParam; |
| | | import com.vincent.rsf.server.manager.controller.params.QlyInspectAndItem; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.QlyIsptItem; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.QlyIsptStatus; |
| | | import com.vincent.rsf.server.manager.mapper.QlyInspectMapper; |
| | | import com.vincent.rsf.server.manager.entity.QlyInspect; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.manager.service.QlyInspectService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.QlyIsptItemService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | @Autowired |
| | | private QlyIsptItemService qlyIsptItemService; |
| | | |
| | | @Autowired |
| | | private WarehouseAreasItemService warehouseAreasItemService; |
| | | |
| | | @Override |
| | | public List<AsnOrderItem> listByAsn(Map<String, Object> map) { |
| | |
| | | * @return |
| | | * @time 2025/3/31 10:12 |
| | | */ |
| | | |
| | | @Override |
| | | public List<AsnOrder> getUnInspect(Map<String, Object> params) { |
| | | List<AsnOrder> asnOrders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>() |
| | | .eq(AsnOrder::getStatus, 1) |
| | | .eq(!Objects.isNull(params.get("asnCode")), AsnOrder::getCode, !Objects.isNull(params.get("asnCode")) ? params.get("asnCode").toString() : "") |
| | | .eq(AsnOrder::getNtyStatus, 0)); |
| | | return asnOrders; |
| | | public List<WarehouseAreasItem> getUnInspect(Map<String, String> params) { |
| | | String code = params.get("asnCode"); |
| | | List<WarehouseAreasItem> warehouseAreasItems = warehouseAreasItemService |
| | | .list(new QueryWrapper<WarehouseAreasItem>() |
| | | .select("asn_id as id, SUM(anfme) anfme, SUM(qty) qty, area_id, area_name, asn_code, asn_id") |
| | | .eq(StringUtils.isNotBlank(code), "asn_code", code) |
| | | .lambda() |
| | | .groupBy(WarehouseAreasItem::getAsnCode)); |
| | | return warehouseAreasItems; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 保存 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/31 14:54 |
| | | */ |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | } |
| | | if (!asnOrderService.update(new LambdaUpdateWrapper<AsnOrder>().in(AsnOrder::getId, param.getIds()).set(AsnOrder::getNtyStatus, 1))) { |
| | | throw new CoolException("报检状态修改失败!!"); |
| | | } |
| | | return R.ok("保存成功!!"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean qlySave(QlyInspect qlyInspect) { |
| | | String code = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_INSPECT_CODE, qlyInspect); |
| | | if (Objects.isNull(code) || StringUtils.isBlank(code)) { |
| | | throw new CoolException("编码规则错误:" + "请检查编码:" + "「SYS_INSPECT_CODE」" + "是否设置成功!!"); |
| | | } |
| | | qlyInspect.setCode(code); |
| | | if (Objects.isNull(qlyInspect.getAsnCode()) || StringUtils.isBlank(qlyInspect.getAsnCode())) { |
| | | throw new CoolException("收货单号不能为空!!"); |
| | | } |
| | | AsnOrder asnOrder = asnOrderService.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getId, qlyInspect.getAsnCode())); |
| | | if (Objects.isNull(asnOrder)) { |
| | | throw new CoolException("收货单不存在!!"); |
| | | } |
| | | qlyInspect.setAsnCode(asnOrder.getCode()).setAsnId(asnOrder.getId()); |
| | | |
| | | return this.save(qlyInspect); |
| | | } |
| | | } |