| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.params.CheckObjParams; |
| | | import com.vincent.rsf.server.api.controller.params.OpStockParams; |
| | | import com.vincent.rsf.server.api.controller.params.OtherReceiptParams; |
| | | import com.vincent.rsf.server.api.controller.params.ReceiptParams; |
| | | import com.vincent.rsf.server.api.entity.dto.CheckObjDto; |
| | | import com.vincent.rsf.server.api.entity.dto.InspectDetlDto; |
| | | import com.vincent.rsf.server.api.entity.dto.InspectItemDto; |
| | | import com.vincent.rsf.server.api.entity.dto.ReceiptDetlsDto; |
| | |
| | | import com.vincent.rsf.server.common.security.JwtSubject; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.JwtUtil; |
| | | import com.vincent.rsf.server.manager.controller.params.IsptItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.WaitPakinParam; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.mapper.*; |
| | |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.tika.utils.StringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | private MatnrMapper matnrMapper; |
| | | @Resource |
| | | private QlyInspectMapper qlyInspectMapper; |
| | | @Autowired |
| | | private QlyIsptItemService qlyIsptItemService; |
| | | @Resource |
| | | private StockItemMapper stockItemMapper; |
| | | @Resource |
| | |
| | | |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public R getOrderByCode(String barcode) { |
| | | if (StringUtils.isEmpty(barcode)) { |
| | | if (StringUtils.isBlank(barcode)) { |
| | | return R.error("标签码不能为空!!"); |
| | | } |
| | | List<AsnOrderItem> asnOrderItem = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getTrackCode, barcode)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过物料,质检单获取需要质检单据 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R checkObjs(CheckObjParams params) { |
| | | if (Objects.isNull(params.getIsptCode())) { |
| | | throw new CoolException("质检单不能为空"); |
| | | } |
| | | if (Objects.isNull(params.getMatnrCode())) { |
| | | throw new CoolException("物料编码不能为空!"); |
| | | } |
| | | QlyInspect inspect = qlyInspectMapper.selectOne(new LambdaQueryWrapper<QlyInspect>().eq(QlyInspect::getCode, params.getIsptCode())); |
| | | if (Objects.isNull(inspect)) { |
| | | throw new CoolException("质检单据不存在!!"); |
| | | } |
| | | QlyIsptItem isptItem = qlyIsptItemService.getOne(new LambdaQueryWrapper<QlyIsptItem>() |
| | | .eq(QlyIsptItem::getMatnrCode, params.getMatnrCode()) |
| | | .eq(QlyIsptItem::getIspectId, inspect.getId())); |
| | | if (Objects.isNull(isptItem)) { |
| | | throw new CoolException("质检单明细不存在!!"); |
| | | } |
| | | |
| | | CheckObjDto objDto = new CheckObjDto(); |
| | | objDto.setIsptCode(inspect.getCode()) |
| | | .setAsnCode(inspect.getAsnCode()) |
| | | .setId(isptItem.getId()) |
| | | .setMatnrCode(isptItem.getMatnrCode()) |
| | | .setMaktx(isptItem.getMaktx()) |
| | | .setDisQty(isptItem.getDisQty()) |
| | | .setDlyQty(isptItem.getDlyQty()) |
| | | .setRcptQty(isptItem.getRcptQty()) |
| | | .setIsptResult(isptItem.getIsptResult()) |
| | | .setSplrBatch(isptItem.getSplrBatch()) |
| | | .setSplrName(isptItem.getSplrName()) |
| | | .setPicPath(isptItem.getPicPath()) |
| | | .setMemo(isptItem.getMemo()) |
| | | .setSafeQty(isptItem.getSafeQty()); |
| | | return R.ok(objDto); |
| | | } |
| | | |
| | | /** |
| | | * 快速质检 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R checkUpdate(QlyIsptItem params) { |
| | | if (Objects.isNull(params.getId())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | IsptItemsParams itemsParams = new IsptItemsParams(); |
| | | List<QlyIsptItem> items = new ArrayList<>(); |
| | | items.add(params); |
| | | itemsParams.setIsptItem(items).setType("0"); |
| | | if (qlyIsptItemService.batchUpdate(itemsParams)) { |
| | | return R.ok(); |
| | | } else { |
| | | return R.error("保存失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 人工上架 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/2 16:33 |
| | | */ |
| | | @Override |
| | | public R operateToStock(OpStockParams params) { |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(params.getBarcode())) { |
| | | throw new CoolException("拖盘码不能为空!!"); |
| | | } |
| | | if (StringUtils.isBlank(params.getAsnCode())) { |
| | | throw new CoolException("单据不能为空!!"); |
| | | } |
| | | if (StringUtils.isBlank(params.getMatnrCode())) { |
| | | throw new CoolException("物料编码不能为空!!"); |
| | | } |
| | | AsnOrder asnOrders = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, params.getAsnCode())); |
| | | if (Objects.isNull(asnOrders)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.getBarcode())); |
| | | if (!locs.isEmpty()) { |
| | | throw new CoolException("拖盘已使用"); |
| | | } |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, params.getBarcode())); |
| | | if (!waitPakins.isEmpty()) { |
| | | throw new CoolException("拖盘已使用!!"); |
| | | } |
| | | List<AsnOrderItem> orderItems = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnId, asnOrders.getId()) |
| | | .eq(AsnOrderItem::getMatnrCode, params.getMatnrCode())); |
| | | if (orderItems.isEmpty()) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | List<AsnOrderItem> stocks = new ArrayList<>(); |
| | | orderItems.forEach(item -> { |
| | | item.setBarcode(params.getBarcode()); |
| | | stocks.add(item); |
| | | }); |
| | | return R.ok(stocks); |
| | | } |
| | | |
| | | /** |
| | | * 获取ReceiptDetlsDtos |
| | | */ |
| | | private R getAsnOrderItem(List<AsnOrderItem> items) { |