Merge remote-tracking branch 'origin/dev_New' into dev_New
# Conflicts:
# src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
# src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
| | |
| | | |
| | | |
| | | @Getter |
| | | public enum StockQualifiedRecordTypeEnum implements BaseEnum<Integer> { |
| | | CUSTOMIZATION_STOCK_IN(0, "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT(1, "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN(2, "ç产æ¥å·¥-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT(3, "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_PASS(6, "ä¸åæ ¼å¤ç-è®©æ¥æ¾è¡"), |
| | | PURCHASE_STOCK_IN(7, "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT(8, "éå®-åºåº"), |
| | | QUALITYINSPECT_STOCK_IN(11, "è´¨æ£-åæ ¼å
¥åº"); |
| | | public enum StockQualifiedRecordTypeEnum implements BaseEnum<String> { |
| | | CUSTOMIZATION_STOCK_IN("0", "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT("1", "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN("2", "ç产æ¥å·¥-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_PASS("6", "ä¸åæ ¼å¤ç-è®©æ¥æ¾è¡"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | QUALITYINSPECT_STOCK_IN("11", "è´¨æ£-åæ ¼å
¥åº"); |
| | | |
| | | |
| | | |
| | | private final Integer code; |
| | | private final String code; |
| | | private final String value; |
| | | |
| | | StockQualifiedRecordTypeEnum(Integer code, String value) { |
| | | StockQualifiedRecordTypeEnum(String code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | |
| | | |
| | | |
| | | @Getter |
| | | public enum StockUnQualifiedRecordTypeEnum implements BaseEnum<Integer> { |
| | | public enum StockUnQualifiedRecordTypeEnum implements BaseEnum<String> { |
| | | |
| | | |
| | | PRODUCTION_SCRAP(4, "ç产æ¥å·¥-æ¥åº"), |
| | | DEFECTIVE_SCRAP(5, "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_IN(9, "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT(10, "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | QUALITYINSPECT_UNSTOCK_IN(12, "è´¨æ£-ä¸åæ ¼å
¥åº"); |
| | | PRODUCTION_SCRAP("4", "ç产æ¥å·¥-æ¥åº"), |
| | | DEFECTIVE_SCRAP("5", "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_IN("9", "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | QUALITYINSPECT_UNSTOCK_IN("12", "è´¨æ£-ä¸åæ ¼å
¥åº"); |
| | | |
| | | |
| | | private final Integer code; |
| | | private final String code; |
| | | private final String value; |
| | | |
| | | StockUnQualifiedRecordTypeEnum(Integer code, String value) { |
| | | StockUnQualifiedRecordTypeEnum(String code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | |
| | | */ |
| | | public static <E extends Enum<E> & BaseEnum> E fromCode(Class<E> enumClass, int code) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | if (Integer.parseInt(String.valueOf(e.getCode())) == code) { |
| | | return e; |
| | | } |
| | | } |
| | |
| | | |
| | | public static <E extends Enum<E> & BaseEnum> E fromCodeHasNull(Class<E> enumClass, int code) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | if (Integer.parseInt(String.valueOf(e.getCode())) == code) { |
| | | return e; |
| | | } |
| | | } |
| | |
| | | |
| | | public static <E extends Enum<E> & BaseEnum> E fromCodeHasDefault(Class<E> enumClass, int code,E defaultE) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | if (Integer.parseInt(String.valueOf(e.getCode())) == code) { |
| | | return e; |
| | | } |
| | | } |
| | |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | public void addUnStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setRecordId(recordId); |
| | | stockUninventoryDto.setRecordType(String.valueOf(recordType)); |
| | |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | public void addStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void substractStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType,Long recordId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | |
| | | } |
| | | |
| | | //ä¸åæ ¼åºåå é¤ |
| | | public void deleteStockRecord(Long recordId, Integer recordType) { |
| | | public void deleteStockRecord(Long recordId, String recordType) { |
| | | StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>() |
| | | .lambda().eq(StockInRecord::getRecordId, recordId) |
| | | .eq(StockInRecord::getRecordType, recordType)); |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class ProductStructureDto extends ProductStructure { |
| | | |
| | | @ApiModelProperty(value = "å·¥èºåç§°") |
| | | private String processName; |
| | | |
| | | @ApiModelProperty(value = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productId; |
| | | |
| | | private String model; |
| | | |
| | | private List<ProductStructure> productStructureList; |
| | | @TableField(exist = false) |
| | | private String tempId; |
| | | |
| | | @TableField(exist = false) |
| | | private String parentTempId; |
| | | |
| | | @TableField(exist = false) |
| | | private List<ProductStructureDto> children; |
| | | } |
| | |
| | | */ |
| | | private Long bomId; |
| | | |
| | | |
| | | /** |
| | | * ç¶èç¹ID |
| | | */ |
| | | private Long parentId; |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.service.IProductModelService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.mapper.ProductBomMapper; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.mapper.ProductStructureMapper; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Autowired |
| | | private ProductBomMapper productBomMapper; |
| | | |
| | | @Autowired |
| | | private IProductModelService productModelService; |
| | | |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductBomDto> listPage(Page page, ProductBomDto productBomDto) { |
| | | return productBomMapper.listPage(page,productBomDto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(ProductBom productBom) { |
| | | boolean save = productBomMapper.insert(productBom) > 0; |
| | | if (save) { |
| | |
| | | String no = "BM." + String.format("%05d", productBom.getId()); |
| | | productBom.setBomNo(no); |
| | | productBomMapper.updateById(productBom); |
| | | |
| | | // æ¥è¯¢åºäº§å模åä¿¡æ¯ |
| | | if (productBom.getProductModelId() == null) { |
| | | throw new ServiceException("è¯·éæ©äº§åæ¨¡å"); |
| | | } |
| | | |
| | | ProductModel productModel = productModelService.getById(productBom.getProductModelId()); |
| | | if (productModel == null) { |
| | | throw new ServiceException("éæ©çäº§åæ¨¡åä¸åå¨"); |
| | | } |
| | | |
| | | // æ·»å åå§ç产åç»æ |
| | | ProductStructure productStructure = new ProductStructure(); |
| | | productStructure.setProductModelId(productBom.getProductModelId()); |
| | | productStructure.setUnit(productModel.getUnit()); |
| | | productStructure.setUnitQuantity(BigDecimal.valueOf(1)); |
| | | productStructure.setBomId(Long.valueOf(productBom.getId())); |
| | | |
| | | productStructureMapper.insert(productStructure); |
| | | |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.ProductModelDto; |
| | | import com.ruoyi.basic.dto.ProductTreeDto; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.ProductBomMapper; |
| | | import com.ruoyi.production.mapper.ProductStructureMapper; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | | import com.ruoyi.production.service.ProductStructureService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | 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.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Slf4j |
| | | @Service |
| | | public class ProductStructureServiceImpl extends ServiceImpl<ProductStructureMapper, ProductStructure> implements ProductStructureService { |
| | | |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Boolean addProductStructureDto(ProductStructureDto productStructureDto) { |
| | | this.remove(new QueryWrapper<ProductStructure>().lambda().eq(ProductStructure::getBomId, productStructureDto.getBomId())); |
| | | productStructureDto.getProductStructureList().forEach(productStructure -> { |
| | | productStructure.setBomId(productStructureDto.getBomId()); |
| | | }); |
| | | return this.saveBatch(productStructureDto.getProductStructureList()); |
| | | @Transactional |
| | | public Boolean addProductStructureDto(ProductStructureDto dto) { |
| | | |
| | | Long bomId = dto.getBomId(); |
| | | |
| | | // å°æ æå¹³å |
| | | List<ProductStructureDto> flatDtoList = new ArrayList<>(); |
| | | flattenTree(dto.getChildren(), flatDtoList); |
| | | |
| | | // æ¥è¯¢æ°æ®åºä¸å·²æç BOM æ°æ® |
| | | List<ProductStructure> dbList = this.list(new LambdaQueryWrapper<ProductStructure>().eq(ProductStructure::getBomId, bomId)); |
| | | |
| | | // æ¥æ¾å·²åå¨çèç¹ - ID |
| | | Set<Long> frontendIds = flatDtoList.stream() |
| | | .map(ProductStructureDto::getId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | // éè¦å é¤çèç¹ - ID |
| | | Set<Long> deleteIds = dbList.stream() |
| | | .map(ProductStructure::getId) |
| | | .filter(id -> !frontendIds.contains(id)) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | if (!deleteIds.isEmpty()) { |
| | | this.removeByIds(deleteIds); |
| | | } |
| | | |
| | | // æ°å¢ / æ´æ° |
| | | List<ProductStructure> insertList = new ArrayList<>(); |
| | | List<ProductStructure> updateList = new ArrayList<>(); |
| | | |
| | | // ç¨äºåå parentId |
| | | Map<String, ProductStructure> tempEntityMap = new HashMap<>(); |
| | | |
| | | for (ProductStructureDto psDto : flatDtoList) { |
| | | ProductStructure entity = new ProductStructure(); |
| | | BeanUtils.copyProperties(psDto, entity); |
| | | entity.setBomId(bomId); |
| | | |
| | | if (psDto.getId() == null) { |
| | | // æ°å¢ |
| | | entity.setId(null); |
| | | entity.setParentId(null); |
| | | insertList.add(entity); |
| | | tempEntityMap.put(psDto.getTempId(), entity); |
| | | } else { |
| | | // æ´æ° |
| | | updateList.add(entity); |
| | | } |
| | | } |
| | | |
| | | // æå
¥æ°èç¹ |
| | | if (!insertList.isEmpty()) { |
| | | this.saveBatch(insertList); |
| | | } |
| | | |
| | | // ååæ°å¢èç¹ parentId |
| | | List<ProductStructure> parentFixList = new ArrayList<>(); |
| | | // çå®çç¶èç¹ ID |
| | | Long realParentId; |
| | | for (ProductStructureDto psDto : flatDtoList) { |
| | | if (psDto.getId() == null && psDto.getParentTempId() != null) { |
| | | ProductStructure child = tempEntityMap.get(psDto.getTempId()); |
| | | if (tempEntityMap.containsKey(psDto.getParentTempId())) { |
| | | // ç¶èç¹æ¯æ°èç¹ |
| | | realParentId = tempEntityMap.get(psDto.getParentTempId()).getId(); |
| | | } else { |
| | | // ç¶èç¹æ¯èèç¹ |
| | | realParentId = Long.valueOf(psDto.getParentTempId()); |
| | | } |
| | | |
| | | child.setParentId(realParentId); |
| | | parentFixList.add(child); |
| | | } |
| | | } |
| | | |
| | | if (!parentFixList.isEmpty()) { |
| | | this.updateBatchById(parentFixList); |
| | | } |
| | | |
| | | if (!updateList.isEmpty()) { |
| | | this.updateBatchById(updateList); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * å°åç«¯ä¼ å
¥çæ è¿è¡æå¹³å |
| | | * |
| | | * @param source æ°æ®æ |
| | | * @param result æå¹³åæ°æ® |
| | | */ |
| | | private void flattenTree(List<ProductStructureDto> source, List<ProductStructureDto> result) { |
| | | if (source == null) { |
| | | return; |
| | | } |
| | | for (ProductStructureDto node : source) { |
| | | result.add(node); |
| | | flattenTree(node.getChildren(), result); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listBybomId(Long bomId) { |
| | | List<ProductStructureDto> tree = productStructureMapper.listBybomId(bomId); |
| | | return tree; |
| | | List<ProductStructureDto> list = productStructureMapper.listBybomId(bomId); |
| | | |
| | | Map<Long, ProductStructureDto> map = new HashMap<>(); |
| | | for (ProductStructureDto node : list) { |
| | | node.setChildren(new ArrayList<>()); |
| | | map.put(node.getId(), node); |
| | | } |
| | | |
| | | List<ProductStructureDto> tree = new ArrayList<>(); |
| | | for (ProductStructureDto node : list) { |
| | | Long parentId = node.getParentId(); |
| | | if (parentId == null || parentId == 0) { |
| | | tree.add(node); |
| | | } else { |
| | | ProductStructureDto parent = map.get(parentId); |
| | | if (parent != null) { |
| | | parent.getChildren().add(node); |
| | | } |
| | | } |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | } |
| | |
| | | // procurementDto.setSalesLedgerProductId(item.getId()); |
| | | // procurementDto.setProductCategory(item.getProductCategory()); |
| | | // IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(new Page<>(1,-1), procurementDto); |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity"); |
| | | if(stockQuantity != null) { |
| | | // BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity"); |
| | | |
| | | // ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getQuantity().compareTo(stockQuantity) <= 0 && item.getApproveStatus() == 0) { |
| | | if (item.getApproveStatus() != 2) { |
| | | if (item.getHasSufficientStock() == 0) { |
| | | item.setApproveStatus(0); |
| | | }else { |
| | | item.setApproveStatus(1); |
| | | salesLedgerProductService.addOrUpdateSalesLedgerProduct(item); |
| | | } |
| | | } |
| | | }); |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> { |
| | | List<SalesLedgerProduct> selectProduct() ; |
| | | |
| | | List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct); |
| | | |
| | | SalesLedgerProduct selectSalesLedgerProductByMainId(@Param("productMainId") Long productMainId); |
| | |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦è´¨æ£") |
| | | private Boolean isChecked; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer hasSufficientStock; |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | return AjaxResult.success(stockInRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockInRecord") |
| | | @ApiOperation("导åºå
¥åºè®°å½") |
| | | public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) { |
| | | stockInRecordService.exportStockInRecord(response,stockInRecordDto); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @GetMapping("importStockInventory") |
| | | @ApiOperation("导å
¥åºå") |
| | | public R importStockInventory(MultipartFile file) { |
| | | return R.ok(stockInventoryService.importStockInventory(file)); |
| | | return stockInventoryService.importStockInventory(file); |
| | | } |
| | | |
| | | @Log(title = "ä¸è½½åºå导å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/downloadStockInventory") |
| | | public void downloadStockInventory(HttpServletResponse response) { |
| | | List<StockInventoryExportData> list = new ArrayList<>(); |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | util.exportExcel(response, list, "åºå模æ¿"); |
| | | } |
| | | |
| | | @PostMapping("/exportStockInventory") |
| | | @ApiOperation("导åºåºå") |
| | | public void exportStockInventory(HttpServletResponse response,StockInventoryDto stockInventoryDto) { |
| | | stockInventoryService.exportStockInventory(response,stockInventoryDto); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | return AjaxResult.success(stockOutRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockOutRecord") |
| | | @ApiOperation("导åºåºåºè®°å½") |
| | | public void exportStockOutRecord(HttpServletResponse response, StockOutRecordDto stockOutRecordDto) { |
| | | stockOutRecordService.exportStockOutRecord(response,stockOutRecordDto); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 å端æ§å¶å¨ |
| | |
| | | return R.ok(stockUninventoryService.subtractStockUninventory(stockUninventoryDto)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockUninventory") |
| | | @ApiOperation("导åºåºå") |
| | | public void exportStockUninventory(HttpServletResponse response, StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryService.exportStockUninventory(response,stockUninventoryDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class StockInRecordExportData { |
| | | |
| | | @Excel(name = "å
¥åºæ¹æ¬¡") |
| | | private String inboundBatches; |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String model; |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | @Excel(name = "å
¥åºæ¥æº") |
| | | private String recordType; |
| | | @Excel(name = "å
¥åºæ°é") |
| | | private String stockInNum; |
| | | @Excel(name = "å
¥åºæ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Excel(isExport = false) |
| | | private String type; |
| | | } |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class StockInventoryExportData { |
| | | |
| | | |
| | | |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Excel(name = "è§æ ¼") |
| | | private String model; |
| | | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | @Excel(name = "åºåæ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Excel(name = "ææ°æ´æ°æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class StockOutRecordExportData { |
| | | @Excel(name = "åºåºæ¹æ¬¡") |
| | | private String outboundBatches; |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String model; |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | @Excel(name = "åºåºæ¥æº") |
| | | private String recordType; |
| | | @Excel(name = "åºåºæ°é") |
| | | private String stockInNum; |
| | | @Excel(name = "åºåºæ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Excel(isExport = false) |
| | | private String type; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.execl.StockInRecordExportData; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface StockInRecordMapper extends BaseMapper<StockInRecord> { |
| | | IPage<StockInRecordDto> listPage(Page page, @Param("params") StockInRecordDto stockInRecordDto); |
| | | |
| | | List<StockInRecordExportData> listStockInRecordExportData(@Param("params") StockInRecordDto stockInRecordDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | int updateAddStockInventory(@Param("ew") StockInventoryDto stockInventoryDto); |
| | | |
| | | int updateSubtractStockInventory(@Param("ew") StockInventoryDto stockInventoryDto); |
| | | |
| | | List<StockInventoryExportData> listStockInventoryExportData(@Param("ew") StockInventoryDto stockInventoryDto); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.execl.StockOutRecordExportData; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public interface StockOutRecordMapper extends BaseMapper<StockOutRecord> { |
| | | IPage<StockOutRecordDto> listPage(Page page, @Param("params") StockOutRecordDto stockOutRecordDto); |
| | | |
| | | List<StockOutRecordExportData> listStockOutRecordExportData(@Param("params") StockOutRecordDto stockOutRecordDto); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | int updateSubtractStockUnInventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | int updateAddStockUnInventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | List<StockInventoryExportData> listStockInventoryExportData(@Param("ew") StockUninventoryDto stockUninventoryDto); |
| | | } |
| | |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface StockInRecordService extends IService<StockInRecord> { |
| | |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 æå¡ç±» |
| | |
| | | |
| | | Boolean subtractStockInventory(StockInventoryDto stockInventoryDto); |
| | | |
| | | Boolean importStockInventory(MultipartFile file); |
| | | R importStockInventory(MultipartFile file); |
| | | |
| | | void exportStockInventory(HttpServletResponse response, StockInventoryDto stockInventoryDto); |
| | | } |
| | |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | int update(Long id, StockOutRecordDto stockOutRecordDto); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | void exportStockOutRecord(HttpServletResponse response, StockOutRecordDto stockOutRecordDto); |
| | | } |
| | |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 æå¡ç±» |
| | |
| | | Integer addStockUninventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | Integer subtractStockUninventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | void exportStockUninventory(HttpServletResponse response, StockUninventoryDto stockUninventoryDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInRecordExportData; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | } |
| | | return stockInRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockInRecord(HttpServletResponse response, StockInRecordDto stockInRecordDto) { |
| | | List<StockInRecordExportData> list = stockInRecordMapper.listStockInRecordExportData(stockInRecordDto); |
| | | for (StockInRecordExportData stockInRecordExportData : list) { |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<StockInRecordExportData> util = new ExcelUtil<>(StockInRecordExportData.class); |
| | | util.exportExcel(response,list, "å
¥åºè®°å½ä¿¡æ¯"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockInRecordService stockInRecordService; |
| | | private StockOutRecordService stockOutRecordService; |
| | | |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | @Override |
| | | public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pagestockInventory(page, stockInventoryDto); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean importStockInventory(MultipartFile file) { |
| | | public R importStockInventory(MultipartFile file) { |
| | | try { |
| | | final StringBuffer[] errorMsg = {new StringBuffer()}; |
| | | //æ¥è¯¢ææç产å |
| | | List<SalesLedgerProduct> salesLedgerProducts =salesLedgerProductMapper.selectProduct(); |
| | | |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<StockInventoryExportData>(StockInventoryExportData.class); |
| | | List<StockInventoryExportData> list = util.importExcel(file.getInputStream()); |
| | | ArrayList<StockInventory> stockInventories = new ArrayList<>(); |
| | | list.stream().forEach(dto -> { |
| | | // TODO: 2026/1/21 æ·»å å
¥åºè®°å½ |
| | | salesLedgerProducts.stream().forEach(item->{ |
| | | if (item.getProductCategory().equals(dto.getProductName())&&item.getSpecificationModel().equals(dto.getModel())) { |
| | | //æ´æ°åºå |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(0L); |
| | | stockInventoryDto.setRecordType(StockQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()); |
| | | stockInventoryDto.setQualitity(dto.getQualitity()); |
| | | stockInventoryDto.setProductModelId(item.getProductModelId()); |
| | | this.addstockInventory(stockInventoryDto); }else { |
| | | errorMsg[0] = errorMsg[0].append("产ååç§°ï¼"+dto.getProductName()+"è§æ ¼ï¼"+dto.getModel()+"ä¸åå¨").append("\n"); |
| | | } |
| | | }); |
| | | |
| | | this.saveOrUpdateBatch(stockInventories); |
| | | return true; |
| | | }); |
| | | return R.ok(errorMsg[0]); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockInventory(HttpServletResponse response, StockInventoryDto stockInventoryDto) { |
| | | |
| | | List<StockInventoryExportData> list = stockInventoryMapper.listStockInventoryExportData(stockInventoryDto); |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | util.exportExcel(response,list, "åºåä¿¡æ¯"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInRecordExportData; |
| | | import com.ruoyi.stock.execl.StockOutRecordExportData; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | return stockOutRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockOutRecord(HttpServletResponse response, StockOutRecordDto stockOutRecordDto) { |
| | | List<StockOutRecordExportData> list = stockOutRecordMapper.listStockOutRecordExportData(stockOutRecordDto); |
| | | for (StockOutRecordExportData stockInRecordExportData : list) { |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<StockOutRecordExportData> util = new ExcelUtil<>(StockOutRecordExportData.class); |
| | | util.exportExcel(response,list, "åºåºè®°å½ä¿¡æ¯"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockUninventory(HttpServletResponse response, StockUninventoryDto stockUninventoryDto) { |
| | | List<StockInventoryExportData> list = stockUninventoryMapper.listStockInventoryExportData(stockUninventoryDto); |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | util.exportExcel(response,list, "ä¸åæ ¼åºåä¿¡æ¯"); |
| | | } |
| | | } |
| | |
| | | t3.shipping_car_number, |
| | | t3.shipping_date, |
| | | t3.status as shippingStatus |
| | | t3.shipping_date, |
| | | CASE |
| | | WHEN t2.qualitity > T1.quantity THEN 1 |
| | | ELSE 0 |
| | | END as has_sufficient_stock |
| | | FROM |
| | | sales_ledger_product T1 |
| | | left join shipping_info t3 on T1.id = t3.sales_ledger_product_id |
| | | LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id |
| | | LEFT JOIN shipping_info t3 ON T1.id = t3.sales_ledger_product_id |
| | | <where> |
| | | 1=1 |
| | | <if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' "> |
| | |
| | | WHERE sl.id = #{salesLedegerId}) A |
| | | group by a.model, a.product_name, a.unit |
| | | </select> |
| | | <select id="selectProduct" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | | select |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.id |
| | | from product_model pm |
| | | left join product p on pm.product_id = p.id |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="listPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | SELECT |
| | | sir.*, |
| | | p.product_name as productName, |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM stock_in_record as sir |
| | | LEFT JOIN product_model as pm on sir.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sir.create_user = u.user_id |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sir.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | | <if test="params.productName != null and params.productName != ''"> |
| | | and p.product_name like concat('%',#{params.productName},'%') |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and sir.type = #{params.type} |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sir.record_type = #{params.recordType} |
| | | </if> |
| | | </where> |
| | | order by sir.id desc |
| | | </select> |
| | | <select id="listStockInRecordExportData" resultType="com.ruoyi.stock.execl.StockInRecordExportData"> |
| | | SELECT |
| | | sir.*, |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | | select si.qualitity, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | si.remark, |
| | | si.update_time |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </where> |
| | | order by sor.id desc |
| | | </select> |
| | | <select id="listStockOutRecordExportData" resultType="com.ruoyi.stock.execl.StockOutRecordExportData"> |
| | | SELECT |
| | | sor.*, |
| | | p.product_name as productName, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM stock_out_record as sor |
| | | LEFT JOIN product_model as pm on sor.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sor.create_user = u.user_id |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sor.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | | <if test="params.productName != null and params.productName != ''"> |
| | | and p.product_name like concat('%',#{params.productName},'%') |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and sor.type = #{params.type} |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sor.record_type = #{params.recordType} |
| | | </if> |
| | | </where> |
| | | order by sor.id desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData"> |
| | | select su.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |