| | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.word.WeighbridgeDocGenerator; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto(); |
| | | consumablesInRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); |
| | | consumablesInRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); |
| | | consumablesInRecordDto.setStockInNum(consumablesInventoryDto.getNetWeight()); |
| | | consumablesInRecordDto.setStockInNum(consumablesInventoryDto.getQualitity()); |
| | | consumablesInRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate()); |
| | | consumablesInRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight()); |
| | | consumablesInRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight()); |
| | | consumablesInRecordDto.setTareWeight(consumablesInventoryDto.getTareWeight()); |
| | | consumablesInRecordDto.setLicensePlateNo(consumablesInventoryDto.getLicensePlateNo()); |
| | | consumablesInRecordDto.setWeighingOperator(consumablesInventoryDto.getWeighingOperator()); |
| | | consumablesInRecordDto.setProductModelId(consumablesInventoryDto.getProductModelId()); |
| | | consumablesInRecordDto.setProductId(consumablesInventoryDto.getProductId()); |
| | | consumablesInRecordDto.setPurchaser(consumablesInventoryDto.getPurchaser()); |
| | | consumablesInRecordDto.setType("0"); |
| | | //生成磅单 |
| | | StockInRecordDto stockInRecordDto = new StockInRecordDto(); |
| | | BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto); |
| | | String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); |
| | | consumablesInRecordDto.setWeighbridgeDocPath(absoluteDocPath); |
| | | consumablesInRecordService.add(consumablesInRecordDto); |
| | | //再进行新增库存数量库存 |
| | | //先查询库存表中的产品是否存在,不存在新增,存在更新 |
| | |
| | | if (ObjectUtils.isEmpty(oldConsumablesInventory)) { |
| | | ConsumablesInventory newConsumablesInventory = new ConsumablesInventory(); |
| | | newConsumablesInventory.setProductModelId(consumablesInventoryDto.getProductModelId()); |
| | | newConsumablesInventory.setQualitity(consumablesInventoryDto.getNetWeight()); |
| | | newConsumablesInventory.setQualitity(consumablesInventoryDto.getQualitity()); |
| | | newConsumablesInventory.setVersion(1); |
| | | newConsumablesInventory.setRemark(consumablesInventoryDto.getRemark()); |
| | | newConsumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity()); |
| | | newConsumablesInventory.setWarnNum(consumablesInventoryDto.getWarnNum()); |
| | | newConsumablesInventory.setProductId(consumablesInventoryDto.getProductId()); |
| | | newConsumablesInventory.setPurchaser(consumablesInventoryDto.getPurchaser()); |
| | | consumablesInventoryMapper.insert(newConsumablesInventory); |
| | | } else { |
| | | consumablesInventoryDto.setQualitity(consumablesInventoryDto.getNetWeight()); |
| | | consumablesInventoryDto.setQualitity(consumablesInventoryDto.getQualitity()); |
| | | consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto); |
| | | } |
| | | return true; |
| | |
| | | consumablesOutRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); |
| | | consumablesOutRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); |
| | | consumablesOutRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate()); |
| | | consumablesOutRecordDto.setStockOutNum(consumablesInventoryDto.getNetWeight()); |
| | | consumablesOutRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight()); |
| | | consumablesOutRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight()); |
| | | consumablesOutRecordDto.setTareWeight(consumablesInventoryDto.getTareWeight()); |
| | | consumablesOutRecordDto.setStockOutNum(consumablesInventoryDto.getQualitity()); |
| | | consumablesOutRecordDto.setWeighingOperator(consumablesInventoryDto.getWeighingOperator()); |
| | | consumablesOutRecordDto.setProductModelId(consumablesInventoryDto.getProductModelId()); |
| | | consumablesOutRecordDto.setLicensePlateNo(consumablesInventoryDto.getLicensePlateNo()); |
| | | consumablesOutRecordDto.setProductId(consumablesInventoryDto.getProductId()); |
| | | consumablesOutRecordDto.setPurchaser(consumablesInventoryDto.getPurchaser()); |
| | | consumablesOutRecordDto.setType("0"); |
| | | //生成磅单 |
| | | StockInRecordDto stockInRecordDto = new StockInRecordDto(); |
| | | BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto); |
| | | String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); |
| | | consumablesOutRecordDto.setWeighbridgeDocPath(absoluteDocPath); |
| | | consumablesOutRecordService.add(consumablesOutRecordDto); |
| | | ConsumablesInventory oldConsumablesInventory = consumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldConsumablesInventory)) { |