1.耗材迁移
2.仓储物流新增字段(毛重,皮重,净重)
3.设备保养多选(多条定时任务)
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.service.ConsumablesInRecordService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "èæå
¥åº") |
| | | @RequestMapping("/consumablesInRecord") |
| | | public class ConsumablesInRecordController { |
| | | @Autowired |
| | | private ConsumablesInRecordService consumablesInRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-å表", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "å
¥åºç®¡çå表") |
| | | public AjaxResult listPage(Page page, ConsumablesInRecordDto ConsumablesInRecordDto) { |
| | | IPage<ConsumablesInRecordDto> result = consumablesInRecordService.listPage(page, ConsumablesInRecordDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "å
¥åºç®¡ç-å é¤å
¥åº", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(consumablesInRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportConsumablesInRecord") |
| | | @ApiOperation("导åºå
¥åºè®°å½") |
| | | public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto ConsumablesInRecordDto) { |
| | | consumablesInRecordService.exportConsumablesInRecord(response,ConsumablesInRecordDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesInventoryExportData; |
| | | import com.ruoyi.consumables.service.ConsumablesInventoryService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | 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> |
| | | * èæåºå表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/consumablesInventory") |
| | | @Api(tags = "èæåºå表") |
| | | public class ConsumablesInventoryController { |
| | | |
| | | @Autowired |
| | | private ConsumablesInventoryService ConsumablesInventoryService; |
| | | |
| | | @GetMapping("/pageConsumablesInventory") |
| | | @ApiOperation("å页æ¥è¯¢åºå") |
| | | public R pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = ConsumablesInventoryService.pageConsumablesInventory(page, ConsumablesInventoryDto); |
| | | return R.ok(ConsumablesInventoryDtoIPage); |
| | | } |
| | | |
| | | @PostMapping("/addConsumablesInventory") |
| | | @ApiOperation("æ°å¢åºå") |
| | | public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode())); |
| | | ConsumablesInventoryDto.setRecordId(0L); |
| | | return R.ok(ConsumablesInventoryService.addConsumablesInventory(ConsumablesInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/subtractConsumablesInventory") |
| | | @ApiOperation("æ£ååºå") |
| | | public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode())); |
| | | ConsumablesInventoryDto.setRecordId(0L); |
| | | return R.ok(ConsumablesInventoryService.subtractConsumablesInventory(ConsumablesInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("importConsumablesInventory") |
| | | @ApiOperation("导å
¥åºå") |
| | | public R importConsumablesInventory(MultipartFile file) { |
| | | return ConsumablesInventoryService.importConsumablesInventory(file); |
| | | } |
| | | |
| | | @Log(title = "ä¸è½½åºå导å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/downloadConsumablesInventory") |
| | | public void downloadConsumablesInventory(HttpServletResponse response) { |
| | | List<ConsumablesInventoryExportData> list = new ArrayList<>(); |
| | | ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class); |
| | | util.exportExcel(response, list, "åºå模æ¿"); |
| | | } |
| | | |
| | | @PostMapping("/exportConsumablesInventory") |
| | | @ApiOperation("导åºåºå") |
| | | public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesInventoryService.exportConsumablesInventory(response, ConsumablesInventoryDto); |
| | | } |
| | | |
| | | @GetMapping("ConsumablesInventoryPage") |
| | | @ApiOperation("åºåæ¥è¡¨æ¥è¯¢") |
| | | public R ConsumablesInventoryPage(Page page, ConsumablesInventoryDto consumablesInventoryDto) { |
| | | return R.ok(ConsumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page)); |
| | | } |
| | | |
| | | @GetMapping("ConsumablesInAndOutRecord") |
| | | @ApiOperation("ç»è®¡å个产åçå
¥åºååºåºè®°å½") |
| | | public R ConsumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) { |
| | | return R.ok(ConsumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page)); |
| | | } |
| | | |
| | | @PostMapping("/frozenConsumables") |
| | | @ApiOperation("å»ç»åºå") |
| | | public R frozenConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | return R.ok(ConsumablesInventoryService.frozenConsumables(ConsumablesInventoryDto)); |
| | | } |
| | | |
| | | @PostMapping("/thawConsumables") |
| | | @ApiOperation("è§£å»åºå") |
| | | public R thawConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | return R.ok(ConsumablesInventoryService.thawConsumables(ConsumablesInventoryDto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.service.ConsumablesOutRecordService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * èæåºåºè®°å½è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Api(tags = "èæåºåº") |
| | | @RestController |
| | | @RequestMapping("/consumablesOutRecord") |
| | | public class ConsumablesOutRecordController { |
| | | @Autowired |
| | | private ConsumablesOutRecordService consumablesUnInventoryDto; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产åºåº-åºåºç®¡ç-å表", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "åºåºç®¡çå表") |
| | | public AjaxResult listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | IPage<ConsumablesOutRecordDto> result = consumablesUnInventoryDto.listPage(page, ConsumablesOutRecordDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("") |
| | | @Log(title = "åºåºç®¡ç-æ°å¢åºåº", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | return AjaxResult.success(consumablesUnInventoryDto.add(ConsumablesOutRecordDto)); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @Log(title = "åºåºç®¡ç-æ´æ°åºåº", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | return AjaxResult.success(consumablesUnInventoryDto.update(id, ConsumablesOutRecordDto)); |
| | | } |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "åºåºç®¡ç-å é¤åºåº", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(consumablesUnInventoryDto.batchDelete(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportConsumablesOutRecord") |
| | | @ApiOperation("导åºåºåºè®°å½") |
| | | public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | consumablesUnInventoryDto.exportConsumablesOutRecord(response,ConsumablesOutRecordDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.service.ConsumablesUnInventoryService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * èæä¸åæ ¼åºå表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Api(tags = "èæä¸åæ ¼") |
| | | @RestController |
| | | @RequestMapping("/consumablesUnInventory") |
| | | public class ConsumablesUnInventoryController { |
| | | @Autowired |
| | | private ConsumablesUnInventoryService consumablesUnInventoryService; |
| | | |
| | | @GetMapping("/pageConsumablesUnInventory") |
| | | @ApiOperation("å页æ¥è¯¢åºå") |
| | | public R pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) { |
| | | IPage<ConsumablesUnInventoryDto> ConsumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto); |
| | | return R.ok(ConsumablesUnInventoryDtoIPage); |
| | | } |
| | | |
| | | @PostMapping("/addConsumablesUnInventory") |
| | | @ApiOperation("æ°å¢åºå") |
| | | public R addConsumablesUnInventory(@RequestBody ConsumablesUnInventoryDto consumablesUnInventoryDto) { |
| | | consumablesUnInventoryDto.setRecordType(String.valueOf(StockInUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | consumablesUnInventoryDto.setRecordId(0L); |
| | | return R.ok(consumablesUnInventoryService.addConsumablesUnInventory(consumablesUnInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/subtractConsumablesUnInventory") |
| | | @ApiOperation("æ£ååºå") |
| | | public R subtractConsumablesUnInventory(@RequestBody ConsumablesUnInventoryDto consumablesUnInventoryDto) { |
| | | consumablesUnInventoryDto.setRecordType(String.valueOf(StockOutUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | consumablesUnInventoryDto.setRecordId(0L); |
| | | return R.ok(consumablesUnInventoryService.subtractConsumablesUnInventory(consumablesUnInventoryDto)); |
| | | } |
| | | |
| | | @PostMapping("/exportConsumablesUnInventory") |
| | | @ApiOperation("导åºåºå") |
| | | public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto) { |
| | | consumablesUnInventoryService.exportConsumablesUnInventory(response,consumablesUnInventoryDto); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/frozenConsumables") |
| | | @ApiOperation("å»ç»åºå") |
| | | public R frozenConsumables(@RequestBody ConsumablesInventoryDto consumablesUnInventoryDto) { |
| | | return R.ok(consumablesUnInventoryService.frozenConsumables(consumablesUnInventoryDto)); |
| | | } |
| | | |
| | | @PostMapping("/thawConsumables") |
| | | @ApiOperation("è§£å»åºå") |
| | | public R thawConsumables(@RequestBody ConsumablesInventoryDto consumablesUnInventoryDto) { |
| | | return R.ok(consumablesUnInventoryService.thawConsumables(consumablesUnInventoryDto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.dto; |
| | | |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class ConsumablesInRecordDto extends ConsumablesInRecord { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 产åè§æ ¼ |
| | | */ |
| | | private String model; |
| | | /** |
| | | * 产ååä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | private String timeStr; |
| | | |
| | | private String createBy; |
| | | |
| | | //ç°åé |
| | | private String currentconsumables; |
| | | |
| | | //ç°åé |
| | | private BigDecimal currentWeight; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class ConsumablesInventoryDto extends ConsumablesInventory { |
| | | |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | | |
| | | |
| | | //å
¥åºç±»å |
| | | private String recordType; |
| | | |
| | | //å
¥åºç±»å对åºçid |
| | | private Long recordId; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate reportDate; |
| | | |
| | | //åºåææ¥æ¥è¯¢å段 |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate startMonth; |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endMonth; |
| | | |
| | | private BigDecimal totalconsumablesIn; |
| | | private BigDecimal totalconsumablesOut; |
| | | private BigDecimal currentconsumables; |
| | | |
| | | private BigDecimal unLockedQuantity; |
| | | |
| | | private Long parentId; |
| | | |
| | | @ApiModelProperty("è¿ç£
æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime weighingDate; |
| | | |
| | | private String parentName; |
| | | |
| | | @ApiModelProperty("åé(æ»æ°)") |
| | | private BigDecimal netWeight; |
| | | |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("ç£
åæä»¶è·¯å¾") |
| | | private String weighbridgeDocPath; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.dto; |
| | | |
| | | import com.ruoyi.consumables.pojo.ConsumablesOutRecord; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ConsumablesOutRecordDto extends ConsumablesOutRecord { |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 产åè§æ ¼ |
| | | */ |
| | | private String model; |
| | | /** |
| | | * 产ååä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | private String timeStr; |
| | | |
| | | private String createBy; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.dto; |
| | | |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ConsumablesUnInventoryDto extends ConsumablesUnInventory { |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | | |
| | | |
| | | //å
¥åºç±»å |
| | | private String recordType; |
| | | |
| | | //å
¥åºç±»å对åºçid |
| | | private Long recordId; |
| | | |
| | | private BigDecimal unLockedQuantity; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.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 ConsumablesInRecordExportData { |
| | | |
| | | @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 ConsumablesInNum; |
| | | @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.consumables.execl; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ConsumablesInventoryExportData { |
| | | |
| | | |
| | | |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Excel(name = "è§æ ¼") |
| | | private String model; |
| | | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | @Excel(name = "åºåæ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @Excel(name = "é¢è¦æ°é") |
| | | private BigDecimal warnNum; |
| | | |
| | | @Excel(name = "å»ç»æ°é") |
| | | private BigDecimal lockedQuantity; |
| | | |
| | | @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.consumables.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 ConsumablesOutRecordExportData { |
| | | @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 ConsumablesInNum; |
| | | @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.consumables.execl; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ConsumablesUnInventoryExportData { |
| | | |
| | | |
| | | |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | | |
| | | @Excel(name = "è§æ ¼") |
| | | private String model; |
| | | |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | @Excel(name = "åºåæ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @Excel(name = "å»ç»æ°é") |
| | | private BigDecimal lockedQuantity; |
| | | |
| | | @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.consumables.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesInRecordExportData; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ConsumablesInRecordMapper extends BaseMapper<ConsumablesInRecord> { |
| | | IPage<ConsumablesInRecordDto> listPage(Page page, @Param("params") ConsumablesInRecordDto ConsumablesInRecordDto); |
| | | |
| | | List<ConsumablesInRecordExportData> listConsumablesInRecordExportData(@Param("params") ConsumablesInRecordDto ConsumablesInRecordDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesInventoryExportData; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Mapper |
| | | public interface ConsumablesInventoryMapper extends BaseMapper<ConsumablesInventory> { |
| | | |
| | | IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, @Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | |
| | | |
| | | int updateAddConsumablesInventory(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | |
| | | int updateSubtractConsumablesInventory(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | |
| | | List<ConsumablesInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | |
| | | IPage<ConsumablesInRecordDto> ConsumablesInventoryPage(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); |
| | | |
| | | IPage<ConsumablesInventoryDto> ConsumablesInAndOutRecord(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page); |
| | | |
| | | BigDecimal selectTotal(); |
| | | |
| | | int selectStorageProductCountByDate(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | | |
| | | List<Map<String, Object>> selectDailyConsumablesInCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<Map<String, Object>> selectDailyConsumablesOutCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | BigDecimal selectTotalByDate(@Param("now") LocalDate now); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesOutRecordExportData; |
| | | import com.ruoyi.consumables.pojo.ConsumablesOutRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Mapper |
| | | public interface ConsumablesOutRecordMapper extends BaseMapper<ConsumablesOutRecord> { |
| | | IPage<ConsumablesOutRecordDto> listPage(Page page, @Param("params") ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | |
| | | List<ConsumablesOutRecordExportData> listConsumablesOutRecordExportData(@Param("params") ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesUnInventoryExportData; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Mapper |
| | | public interface ConsumablesUnInventoryMapper extends BaseMapper<ConsumablesUnInventory> { |
| | | |
| | | IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, @Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | int updateSubtractConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | int updateAddConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | List<ConsumablesUnInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("consumables_in_record") |
| | | @ApiModel("å
¥åºç®¡ç") |
| | | public class ConsumablesInRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "å
¥åºæ¹æ¬¡") |
| | | private String inboundBatches; |
| | | |
| | | @ApiModelProperty(value = "å
¥åºæ°é") |
| | | private BigDecimal consumablesInNum; |
| | | |
| | | @ApiModelProperty(value = "è®°å½ç±»å æä¸¾") |
| | | private String recordType; |
| | | |
| | | @ApiModelProperty(value = "è®°å½ID ") |
| | | private Long recordId; |
| | | |
| | | @ApiModelProperty(value = "产åè§æ ¼ID") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0åæ ¼å
¥åº 1ä¸åæ ¼å
¥åº") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("è¿ç£
æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime weighingDate; |
| | | |
| | | @ApiModelProperty("åé") |
| | | private BigDecimal netWeight; |
| | | /** |
| | | * æ¯éï¼åä½ï¼å¨ï¼ |
| | | */ |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | /** |
| | | * ç®éï¼åä½ï¼å¨ï¼ |
| | | */ |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | /** |
| | | * 车çå· |
| | | */ |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | /** |
| | | * è¿ç£
å |
| | | */ |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("ç£
åæä»¶è·¯å¾") |
| | | private String weighbridgeDocPath; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("consumables_inventory") |
| | | @ApiModel(value = "consumablesInventory对象", description = "åºå表") |
| | | public class ConsumablesInventory implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("è§æ ¼id") |
| | | @NotBlank(message = "ä¸è½ä¸ºç©º") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("æ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty("被订åé宿°é") |
| | | private BigDecimal lockedQuantity; |
| | | |
| | | @ApiModelProperty("é¢è¦æ°é") |
| | | private BigDecimal warnNum; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("consumables_out_record") |
| | | @ApiModel(value = "consumablesOutRecord对象", description = "åºåºè®°å½è¡¨") |
| | | public class ConsumablesOutRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("å
¥åºæ¹æ¬¡") |
| | | private String outboundBatches; |
| | | |
| | | @ApiModelProperty("å
¥åºæ°é") |
| | | private BigDecimal consumablesOutNum; |
| | | |
| | | @ApiModelProperty("å
¥åºæ¥æºid") |
| | | private Long recordId; |
| | | |
| | | @ApiModelProperty("å
¥åºç±»å") |
| | | private String recordType; |
| | | |
| | | @ApiModelProperty("产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0åæ ¼å
¥åº 1ä¸åæ ¼å
¥åº") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("è¿ç£
æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime weighingDate; |
| | | |
| | | @ApiModelProperty("åé") |
| | | private BigDecimal netWeight; |
| | | |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("consumables_UnInventory") |
| | | @ApiModel(value = "consumablesUnInventory对象", description = "ä¸åæ ¼åºå表") |
| | | public class ConsumablesUnInventory implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("è§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("æ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("被订åé宿°é") |
| | | private BigDecimal lockedQuantity; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface ConsumablesInRecordService extends IService<ConsumablesInRecord> { |
| | | IPage<ConsumablesInRecordDto> listPage(Page page, ConsumablesInRecordDto consumablesInRecordDto); |
| | | |
| | | int add(ConsumablesInRecordDto consumablesInRecordDto); |
| | | |
| | | int update(Long id, ConsumablesInRecordDto consumablesInRecordDto); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto consumablesInRecordDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | public interface ConsumablesInventoryService extends IService<ConsumablesInventory> { |
| | | |
| | | IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto consumablesInventoryDto); |
| | | |
| | | Boolean addConsumablesInventory(ConsumablesInventoryDto consumablesInventoryDto); |
| | | |
| | | Boolean subtractConsumablesInventory(ConsumablesInventoryDto consumablesInventoryDto); |
| | | |
| | | R importConsumablesInventory(MultipartFile file); |
| | | |
| | | void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto consumablesInventoryDto); |
| | | |
| | | IPage<ConsumablesInRecordDto> consumablesInventoryPage(ConsumablesInventoryDto consumablesInventoryDto, Page page); |
| | | |
| | | IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page); |
| | | |
| | | Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto); |
| | | |
| | | Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.pojo.ConsumablesOutRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | public interface ConsumablesOutRecordService extends IService<ConsumablesOutRecord> { |
| | | IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | |
| | | int add(ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | |
| | | int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | public interface ConsumablesUnInventoryService extends IService<ConsumablesUnInventory> { |
| | | |
| | | IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto); |
| | | |
| | | Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | |
| | | Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | 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.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesInRecordExportData; |
| | | import com.ruoyi.consumables.mapper.ConsumablesInRecordMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | import com.ruoyi.consumables.service.ConsumablesInRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ConsumablesInRecordServiceImpl extends ServiceImpl<ConsumablesInRecordMapper, ConsumablesInRecord> implements ConsumablesInRecordService { |
| | | |
| | | private ConsumablesInRecordMapper consumablesInRecordMapper; |
| | | private ConsumablesInventoryMapper consumablesInventoryMapper; |
| | | private ConsumablesUnInventoryMapper consumablesUnInventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<ConsumablesInRecordDto> listPage(Page page, ConsumablesInRecordDto consumablesInRecordDto) { |
| | | return consumablesInRecordMapper.listPage(page, consumablesInRecordDto); |
| | | } |
| | | |
| | | // æ°å¢å
¥åº |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int add(ConsumablesInRecordDto consumablesInRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(consumablesInRecordMapper, "RK"); |
| | | consumablesInRecordDto.setInboundBatches(no); |
| | | ConsumablesInRecord consumablesInRecord = new ConsumablesInRecord(); |
| | | BeanUtils.copyProperties(consumablesInRecordDto, consumablesInRecord); |
| | | return consumablesInRecordMapper.insert(consumablesInRecord); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int update(Long id, ConsumablesInRecordDto consumablesInRecordDto) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | ConsumablesInRecord consumablesInRecord = consumablesInRecordMapper.selectById(id); |
| | | if (consumablesInRecord == null){ |
| | | throw new BaseException("该å
¥åºè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id", "inbound_batches"};//æé¤id屿§ |
| | | BeanUtils.copyProperties(consumablesInRecordDto, consumablesInRecord, ignoreProperties); |
| | | return consumablesInRecordMapper.updateById(consumablesInRecord); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int batchDelete(List<Long> ids) { |
| | | for (Long id : ids) { |
| | | ConsumablesInRecord consumablesInRecord = consumablesInRecordMapper.selectById(id); |
| | | if (consumablesInRecord.getType().equals("0")) { |
| | | ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectOne(new LambdaQueryWrapper<ConsumablesInventory>().eq(ConsumablesInventory::getProductModelId, consumablesInRecord.getProductModelId())); |
| | | if (consumablesInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto(); |
| | | consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId()); |
| | | consumablesInRecordDto.setQualitity(consumablesInRecord.getConsumablesInNum()); |
| | | consumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInRecordDto); |
| | | } |
| | | }else if (consumablesInRecord.getType().equals("1")) { |
| | | ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectOne(new LambdaQueryWrapper<ConsumablesUnInventory>().eq(ConsumablesUnInventory::getProductModelId, consumablesInRecord.getProductModelId())); |
| | | if (consumablesUnInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto(); |
| | | consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId()); |
| | | consumablesUnInventoryDto.setQualitity(consumablesInRecord.getConsumablesInNum()); |
| | | consumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(consumablesUnInventoryDto); |
| | | } |
| | | } |
| | | } |
| | | return consumablesInRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto consumablesInRecordDto) { |
| | | List<ConsumablesInRecordExportData> list = consumablesInRecordMapper.listConsumablesInRecordExportData(consumablesInRecordDto); |
| | | for (ConsumablesInRecordExportData consumablesInRecordExportData : list) { |
| | | if (consumablesInRecordExportData.getType().equals("0")) { |
| | | consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<ConsumablesInRecordExportData> util = new ExcelUtil<>(ConsumablesInRecordExportData.class); |
| | | util.exportExcel(response,list, "å
¥åºè®°å½ä¿¡æ¯"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesInventoryExportData; |
| | | import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import com.ruoyi.consumables.service.ConsumablesInRecordService; |
| | | import com.ruoyi.consumables.service.ConsumablesInventoryService; |
| | | import com.ruoyi.consumables.service.ConsumablesOutRecordService; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.stock.word.WeighbridgeDocGenerator; |
| | | import lombok.RequiredArgsConstructor; |
| | | 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 javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | public class ConsumablesInventoryServiceImpl extends ServiceImpl<ConsumablesInventoryMapper, ConsumablesInventory> implements ConsumablesInventoryService { |
| | | |
| | | private final ConsumablesInventoryMapper ConsumablesInventoryMapper; |
| | | private final ConsumablesInRecordService ConsumablesInRecordService; |
| | | private final ConsumablesOutRecordService ConsumablesOutRecordService; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | @Override |
| | | public IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | return ConsumablesInventoryMapper.pageConsumablesInventory(page, ConsumablesInventoryDto); |
| | | } |
| | | |
| | | //å
¥åºè°ç¨ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addConsumablesInventory(ConsumablesInventoryDto consumablesInventoryDto) { |
| | | //æ°å¢å
¥åºè®°å½åæ·»å åºå |
| | | ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto(); |
| | | consumablesInRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); |
| | | consumablesInRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); |
| | | consumablesInRecordDto.setConsumablesInNum(consumablesInventoryDto.getNetWeight()); |
| | | 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.setType("0"); |
| | | ConsumablesInRecordService.add(consumablesInRecordDto); |
| | | //åè¿è¡æ°å¢åºåæ°éåºå |
| | | //å
æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° |
| | | ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldConsumablesInventory)) { |
| | | ConsumablesInventory newConsumablesInventory = new ConsumablesInventory(); |
| | | newConsumablesInventory.setProductModelId(consumablesInventoryDto.getProductModelId()); |
| | | newConsumablesInventory.setQualitity(consumablesInventoryDto.getNetWeight()); |
| | | newConsumablesInventory.setVersion(1); |
| | | newConsumablesInventory.setRemark(consumablesInventoryDto.getRemark()); |
| | | newConsumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity()); |
| | | newConsumablesInventory.setWarnNum(consumablesInventoryDto.getWarnNum()); |
| | | ConsumablesInventoryMapper.insert(newConsumablesInventory); |
| | | } else { |
| | | consumablesInventoryDto.setQualitity(consumablesInventoryDto.getNetWeight()); |
| | | ConsumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //åºåºè°ç¨ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean subtractConsumablesInventory(ConsumablesInventoryDto consumablesInventoryDto) { |
| | | // æ°å¢åºåºè®°å½ |
| | | ConsumablesOutRecordDto consumablesOutRecordDto = new ConsumablesOutRecordDto(); |
| | | consumablesOutRecordDto.setRecordId(consumablesInventoryDto.getRecordId()); |
| | | consumablesOutRecordDto.setRecordType(consumablesInventoryDto.getRecordType()); |
| | | consumablesOutRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate()); |
| | | consumablesOutRecordDto.setConsumablesOutNum(consumablesInventoryDto.getNetWeight()); |
| | | consumablesOutRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight()); |
| | | consumablesOutRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight()); |
| | | consumablesOutRecordDto.setTareWeight(consumablesInventoryDto.getTareWeight()); |
| | | consumablesOutRecordDto.setWeighingOperator(consumablesInventoryDto.getWeighingOperator()); |
| | | consumablesOutRecordDto.setProductModelId(consumablesInventoryDto.getProductModelId()); |
| | | consumablesOutRecordDto.setLicensePlateNo(consumablesInventoryDto.getLicensePlateNo()); |
| | | consumablesOutRecordDto.setProductId(consumablesInventoryDto.getProductId()); |
| | | consumablesOutRecordDto.setType("0"); |
| | | ConsumablesOutRecordService.add(consumablesOutRecordDto); |
| | | ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldConsumablesInventory)) { |
| | | throw new RuntimeException("产ååºåä¸åå¨"); |
| | | } |
| | | BigDecimal lockedQty = oldConsumablesInventory.getLockedQuantity(); |
| | | if (lockedQty == null) { |
| | | lockedQty = BigDecimal.ZERO; |
| | | } |
| | | if (consumablesInventoryDto.getQualitity().compareTo(oldConsumablesInventory.getQualitity().subtract(lockedQty)) > 0) { |
| | | throw new RuntimeException("åºåä¸è¶³æ æ³åºåº"); |
| | | } |
| | | |
| | | ConsumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInventoryDto); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public R importConsumablesInventory(MultipartFile file) { |
| | | try { |
| | | // æ¥è¯¢ææç产å |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectProduct(); |
| | | |
| | | ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<ConsumablesInventoryExportData>(ConsumablesInventoryExportData.class); |
| | | List<ConsumablesInventoryExportData> list = util.importExcel(file.getInputStream()); |
| | | |
| | | // è®°å½æªæ¾å°å¹é
é¡¹çæ°æ® |
| | | List<String> unmatchedRecords = new ArrayList<>(); |
| | | |
| | | list.forEach(dto -> { |
| | | boolean matched = false; |
| | | for (SalesLedgerProduct item : salesLedgerProducts) { |
| | | if (item.getProductCategory().equals(dto.getProductName()) && |
| | | item.getSpecificationModel().equals(dto.getModel())) { |
| | | ConsumablesInventoryDto ConsumablesInventoryDto = new ConsumablesInventoryDto(); |
| | | ConsumablesInventoryDto.setRecordId(0L); |
| | | ConsumablesInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()); |
| | | ConsumablesInventoryDto.setQualitity(dto.getQualitity()); |
| | | ConsumablesInventoryDto.setRemark(dto.getRemark()); |
| | | ConsumablesInventoryDto.setWarnNum(dto.getWarnNum()); |
| | | if (ObjectUtils.isNotEmpty(dto.getLockedQuantity()) && dto.getLockedQuantity().compareTo(dto.getQualitity()) > 0) { |
| | | throw new RuntimeException("å»ç»æ°éä¸è½è¶
è¿æ¬æ¬¡å¯¼å
¥çåºåæ°é"); |
| | | } |
| | | ConsumablesInventoryDto.setLockedQuantity(dto.getLockedQuantity()); |
| | | ConsumablesInventoryDto.setProductModelId(item.getProductModelId()); |
| | | this.addConsumablesInventory(ConsumablesInventoryDto); |
| | | matched = true; |
| | | break; // æ¾å°å¹é
项åè·³åºå¾ªç¯ |
| | | } |
| | | } |
| | | if (!matched) { |
| | | // è®°å½æªå¹é
çæ°æ® |
| | | String unmatchedInfo = String.format("产ååç§°ï¼%sï¼è§æ ¼åå·ï¼%s", |
| | | dto.getProductName(), dto.getModel()); |
| | | unmatchedRecords.add(unmatchedInfo); |
| | | } |
| | | }); |
| | | // æå»ºè¿åä¿¡æ¯ |
| | | StringBuilder message = new StringBuilder(); |
| | | if (!unmatchedRecords.isEmpty()) { |
| | | message.append("以ä¸äº§åæªæ¾å°å¹é
项ï¼\n"); |
| | | for (String record : unmatchedRecords) { |
| | | message.append(record).append("\n"); |
| | | } |
| | | throw new RuntimeException(message.toString()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("导å
¥å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | return R.ok("导å
¥æå"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | |
| | | List<ConsumablesInventoryExportData> list = ConsumablesInventoryMapper.listConsumablesInventoryExportData(ConsumablesInventoryDto); |
| | | ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class); |
| | | util.exportExcel(response, list, "åºåä¿¡æ¯"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ConsumablesInRecordDto> consumablesInventoryPage(ConsumablesInventoryDto consumablesInventoryDto, Page page) { |
| | | return ConsumablesInventoryMapper.ConsumablesInventoryPage(consumablesInventoryDto, page); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) { |
| | | return ConsumablesInventoryMapper.ConsumablesInAndOutRecord(consumablesInventoryDto, page); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId()); |
| | | if (ConsumablesInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) { |
| | | throw new RuntimeException("å»ç»æ°éä¸è½è¶
è¿åºåæ°é"); |
| | | } |
| | | if (ObjectUtils.isEmpty(ConsumablesInventory.getLockedQuantity())) { |
| | | ConsumablesInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity()); |
| | | } else { |
| | | ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity())); |
| | | } |
| | | return this.updateById(ConsumablesInventory); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId()); |
| | | if (ConsumablesInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) { |
| | | throw new RuntimeException("è§£å»æ°éä¸è½è¶
è¿å»ç»æ°é"); |
| | | } |
| | | ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity())); |
| | | return this.updateById(ConsumablesInventory); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | 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.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesOutRecordExportData; |
| | | import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesOutRecordMapper; |
| | | import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInRecord; |
| | | import com.ruoyi.consumables.pojo.ConsumablesInventory; |
| | | import com.ruoyi.consumables.pojo.ConsumablesOutRecord; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | import com.ruoyi.consumables.service.ConsumablesOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ConsumablesOutRecordServiceImpl extends ServiceImpl<ConsumablesOutRecordMapper, ConsumablesOutRecord> implements ConsumablesOutRecordService { |
| | | private ConsumablesOutRecordMapper consumablesOutRecordMapper; |
| | | private ConsumablesInventoryMapper consumablesInventoryMapper; |
| | | private ConsumablesUnInventoryMapper consumablesUnInventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | return consumablesOutRecordMapper.listPage(page, ConsumablesOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int add(ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(consumablesOutRecordMapper, "CK"); |
| | | ConsumablesOutRecordDto.setOutboundBatches(no); |
| | | ConsumablesInRecord ConsumablesInRecord = new ConsumablesInRecord(); |
| | | BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesInRecord); |
| | | return consumablesOutRecordMapper.insert(ConsumablesOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | ConsumablesOutRecord ConsumablesOutRecord = consumablesOutRecordMapper.selectById(id); |
| | | if (ConsumablesOutRecord == null){ |
| | | throw new BaseException("该åºåºè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id", "outbound_batches"};//æé¤id屿§ |
| | | BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesOutRecord, ignoreProperties); |
| | | return consumablesOutRecordMapper.updateById(ConsumablesOutRecord); |
| | | } |
| | | |
| | | @Override |
| | | public int batchDelete(List<Long> ids) { |
| | | for (Long id : ids) { |
| | | ConsumablesOutRecord consumablesOutRecord = consumablesOutRecordMapper.selectById(id); |
| | | if (consumablesOutRecord.getType().equals("0")) { |
| | | ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectOne(new LambdaQueryWrapper<ConsumablesInventory>().eq(ConsumablesInventory::getProductModelId, consumablesOutRecord.getProductModelId())); |
| | | if (consumablesInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto(); |
| | | consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId()); |
| | | consumablesInRecordDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); |
| | | consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInRecordDto); |
| | | } |
| | | }else if (consumablesOutRecord.getType().equals("1")) { |
| | | ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectOne(new LambdaQueryWrapper<ConsumablesUnInventory>().eq(ConsumablesUnInventory::getProductModelId, consumablesOutRecord.getProductModelId())); |
| | | if (consumablesUnInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto(); |
| | | consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId()); |
| | | consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getConsumablesOutNum()); |
| | | consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto); |
| | | } |
| | | } |
| | | } |
| | | return consumablesOutRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) { |
| | | List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(ConsumablesOutRecordDto); |
| | | for (ConsumablesOutRecordExportData consumablesInRecordExportData : list) { |
| | | if (consumablesInRecordExportData.getType().equals("0")) { |
| | | consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); |
| | | }else { |
| | | consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue()); |
| | | } |
| | | } |
| | | ExcelUtil<ConsumablesOutRecordExportData> util = new ExcelUtil<>(ConsumablesOutRecordExportData.class); |
| | | util.exportExcel(response,list, "åºåºè®°å½ä¿¡æ¯"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.consumables.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.consumables.dto.ConsumablesInRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesInventoryDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesOutRecordDto; |
| | | import com.ruoyi.consumables.dto.ConsumablesUnInventoryDto; |
| | | import com.ruoyi.consumables.execl.ConsumablesUnInventoryExportData; |
| | | import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper; |
| | | import com.ruoyi.consumables.pojo.ConsumablesUnInventory; |
| | | import com.ruoyi.consumables.service.ConsumablesInRecordService; |
| | | import com.ruoyi.consumables.service.ConsumablesOutRecordService; |
| | | import com.ruoyi.consumables.service.ConsumablesUnInventoryService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ConsumablesUnInventoryServiceImpl extends ServiceImpl<ConsumablesUnInventoryMapper, ConsumablesUnInventory> implements ConsumablesUnInventoryService { |
| | | |
| | | private ConsumablesUnInventoryMapper ConsumablesUnInventoryMapper; |
| | | private ConsumablesOutRecordService ConsumablesOutRecordService; |
| | | private ConsumablesInRecordService ConsumablesInRecordService; |
| | | |
| | | @Override |
| | | public IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { |
| | | return ConsumablesUnInventoryMapper.pageConsumablesUnInventory(page, ConsumablesUnInventoryDto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { |
| | | //æ°å¢å
¥åºè®°å½åæ·»å åºå |
| | | ConsumablesInRecordDto ConsumablesInRecordDto = new ConsumablesInRecordDto(); |
| | | ConsumablesInRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId()); |
| | | ConsumablesInRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType()); |
| | | ConsumablesInRecordDto.setConsumablesInNum(ConsumablesUnInventoryDto.getQualitity()); |
| | | ConsumablesInRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); |
| | | ConsumablesInRecordDto.setType("1"); |
| | | ConsumablesInRecordService.add(ConsumablesInRecordDto); |
| | | //åè¿è¡æ°å¢åºåæ°éåºå |
| | | //å
æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° |
| | | ConsumablesUnInventory oldConsumablesUnInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldConsumablesUnInventory)) { |
| | | ConsumablesUnInventory newConsumablesUnInventory = new ConsumablesUnInventory(); |
| | | newConsumablesUnInventory.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); |
| | | newConsumablesUnInventory.setQualitity(ConsumablesUnInventoryDto.getQualitity()); |
| | | newConsumablesUnInventory.setVersion(1); |
| | | newConsumablesUnInventory.setRemark(ConsumablesUnInventoryDto.getRemark()); |
| | | ConsumablesUnInventoryMapper.insert(newConsumablesUnInventory); |
| | | }else { |
| | | ConsumablesUnInventoryMapper.updateAddConsumablesUnInventory(ConsumablesUnInventoryDto); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { |
| | | |
| | | // æ°å¢åºåºè®°å½ |
| | | ConsumablesOutRecordDto ConsumablesOutRecordDto = new ConsumablesOutRecordDto(); |
| | | ConsumablesOutRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId()); |
| | | ConsumablesOutRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType()); |
| | | ConsumablesOutRecordDto.setConsumablesOutNum(ConsumablesUnInventoryDto.getQualitity()); |
| | | ConsumablesOutRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId()); |
| | | ConsumablesOutRecordDto.setType("1"); |
| | | ConsumablesOutRecordService.add(ConsumablesOutRecordDto); |
| | | ConsumablesUnInventory oldConsumablesInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldConsumablesInventory)) { |
| | | throw new RuntimeException("产ååºåä¸åå¨"); |
| | | }else { |
| | | ConsumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(ConsumablesUnInventoryDto); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) { |
| | | List<ConsumablesUnInventoryExportData> list = ConsumablesUnInventoryMapper.listConsumablesInventoryExportData(ConsumablesUnInventoryDto); |
| | | ExcelUtil<ConsumablesUnInventoryExportData> util = new ExcelUtil<>(ConsumablesUnInventoryExportData.class); |
| | | util.exportExcel(response,list, "ä¸åæ ¼åºåä¿¡æ¯"); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId()); |
| | | if (ConsumablesUnInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) { |
| | | throw new RuntimeException("å»ç»æ°éä¸è½è¶
è¿åºåæ°é"); |
| | | } |
| | | if (ObjectUtils.isEmpty(ConsumablesUnInventory.getLockedQuantity())) { |
| | | ConsumablesUnInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity()); |
| | | }else { |
| | | ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity())); |
| | | } |
| | | return this.updateById(ConsumablesUnInventory); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) { |
| | | ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId()); |
| | | if (ConsumablesUnInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) { |
| | | throw new RuntimeException("è§£å»æ°éä¸è½è¶
è¿å»ç»æ°é"); |
| | | } |
| | | ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity())); |
| | | return this.updateById(ConsumablesUnInventory); |
| | | } |
| | | } |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "设å¤ä¿å
»å®æ¶ä»»å¡å表") |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public AjaxResult listPage(Page<MaintenanceTask> page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.List; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class MaintenanceTaskDto extends MaintenanceTask { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private List<Long> taskIds; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @Data |
| | | @ApiModel |
| | | @TableName("maintenance_task") |
| | | public class MaintenanceTask { |
| | | public class MaintenanceTask implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | @ApiModelProperty(value = "ä»»å¡åç§°") |
| | | @Excel(name = "ä¿å
»ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private Long taskId; |
| | | |
| | | @ApiModelProperty(value = "å¤ä¸ªè®¾å¤id") |
| | | private String deviceIds; |
| | | |
| | | @ApiModelProperty(value = "颿¬¡") |
| | | @Excel(name = "颿¬¡") |
| | |
| | | @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(exist = false) |
| | | private String deviceName; |
| | | } |
| | |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskService extends IService<MaintenanceTask> { |
| | | AjaxResult listPage(Page page, MaintenanceTask maintenanceTask); |
| | | AjaxResult listPage(Page<MaintenanceTask> page, MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult add(MaintenanceTask maintenanceTask); |
| | | |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class DeviceLedgerServiceImpl extends ServiceImpl<DeviceLedgerMapper, DeviceLedger> implements IDeviceLedgerService { |
| | | |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import org.quartz.*; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | @DisallowConcurrentExecution // ç¦æ¢å¹¶åæ§è¡åä¸ä¸ªJob |
| | |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) throws JobExecutionException { |
| | |
| | | throw new JobExecutionException("MaintenanceTaskJobæ¾ä¸å°å®æ¶ä»»å¡: " + taskId); |
| | | } |
| | | |
| | | // 2. å建并ä¿åå·¡æ£ä»»å¡è®°å½ - è¿å°±æ¯æ¨æä¾ç代ç åºè¯¥æ¾çä½ç½® |
| | | DeviceMaintenance deviceMaintenance = createInspectionTask(timingTask); |
| | | deviceMaintenanceService.save(deviceMaintenance); |
| | | // 2. å建并ä¿åå·¡æ£ä»»å¡è®°å½ |
| | | createInspectionTask(timingTask); |
| | | |
| | | // 3. æ´æ°å®æ¶ä»»å¡çæ§è¡æ¶é´ |
| | | if (!tasks.isEmpty()) { |
| | |
| | | } |
| | | } |
| | | |
| | | // è¿å°±æ¯æ¨æä¾ç代ç å°è£
æçæ¹æ³ |
| | | private DeviceMaintenance createInspectionTask(MaintenanceTask timingTask) { |
| | | // å®ä½ç±»å°è£
|
| | | private void createInspectionTask(MaintenanceTask timingTask) { |
| | | // 1. åæ°æ ¡éª |
| | | if (timingTask == null || StringUtils.isEmpty(timingTask.getDeviceIds())) { |
| | | return; |
| | | } |
| | | |
| | | // 2. è§£æè®¾å¤IDå表 |
| | | List<Long> deviceIds; |
| | | try { |
| | | deviceIds = JSON.parseArray(timingTask.getDeviceIds(), Long.class); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("设å¤IDæ ¼å¼é误"); |
| | | } |
| | | |
| | | if (CollectionUtils.isEmpty(deviceIds)) { |
| | | return; |
| | | } |
| | | |
| | | // 3. æ¹éæ¥è¯¢è®¾å¤ä¿¡æ¯ |
| | | List<DeviceLedger> deviceLedgers = deviceLedgerMapper.selectBatchIds(deviceIds); |
| | | if (CollectionUtils.isEmpty(deviceLedgers)) { |
| | | return; |
| | | } |
| | | |
| | | // 4. 转æ¢ä¸ºMap |
| | | Map<Long, DeviceLedger> deviceLedgerMap = deviceLedgers.stream() |
| | | .collect(Collectors.toMap(DeviceLedger::getId, Function.identity())); |
| | | |
| | | // 5. æ¹éæå»ºå·¡æ£ä»»å¡ |
| | | List<DeviceMaintenance> inspectionTaskList = new ArrayList<>(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | Integer createUser = null; |
| | | if (timingTask.getRegistrantId() != null) { |
| | | try { |
| | | createUser = Math.toIntExact(timingTask.getRegistrantId()); |
| | | } catch (ArithmeticException e) { |
| | | throw new RuntimeException("ç¨æ·IDè¶
åºææèå´"); |
| | | } |
| | | } |
| | | |
| | | for (Long deviceId : deviceIds) { |
| | | DeviceLedger deviceLedger = deviceLedgerMap.get(deviceId); |
| | | if (deviceLedger == null) { |
| | | continue; |
| | | } |
| | | |
| | | DeviceMaintenance inspectionTask = new DeviceMaintenance(); |
| | | |
| | | // å¤å¶åºæ¬å±æ§ |
| | | inspectionTask.setDeviceName(timingTask.getTaskName()); |
| | | // 设置设å¤ç¸å
³ä¿¡æ¯ |
| | | inspectionTask.setDeviceLedgerId(deviceId); |
| | | inspectionTask.setDeviceName(deviceLedger.getDeviceName()); |
| | | inspectionTask.setDeviceModel(deviceLedger.getDeviceModel()); |
| | | |
| | | // 设置任å¡ç¸å
³ä¿¡æ¯ |
| | | inspectionTask.setMaintenanceTaskId(timingTask.getId()); |
| | | inspectionTask.setDeviceLedgerId(timingTask.getTaskId()); |
| | | inspectionTask.setMaintenancePlanTime(LocalDateTime.now()); |
| | | inspectionTask.setMaintenancePlanTime(now); |
| | | inspectionTask.setFrequencyType(timingTask.getFrequencyType()); |
| | | inspectionTask.setFrequencyDetail(timingTask.getFrequencyDetail()); |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | |
| | | // è®¾ç½®ç¶æåæ¶é´ |
| | | inspectionTask.setStatus(0); |
| | | inspectionTask.setDeviceModel(timingTask.getDeviceModel()); |
| | | inspectionTask.setCreateUser(Integer.parseInt(timingTask.getRegistrantId().toString())); |
| | | inspectionTask.setUpdateTime(LocalDateTime.now()); |
| | | inspectionTask.setCreateTime(LocalDateTime.now()); |
| | | inspectionTask.setUpdateUser(Integer.parseInt(timingTask.getRegistrantId().toString())); |
| | | return inspectionTask; |
| | | inspectionTask.setCreateTime(now); |
| | | inspectionTask.setUpdateTime(now); |
| | | |
| | | // è®¾ç½®ç¨æ·ä¿¡æ¯ |
| | | inspectionTask.setTenantId(timingTask.getTenantId()); |
| | | inspectionTask.setCreateUser(createUser); |
| | | inspectionTask.setUpdateUser(createUser); |
| | | |
| | | inspectionTaskList.add(inspectionTask); |
| | | } |
| | | |
| | | if (!inspectionTaskList.isEmpty()) { |
| | | try { |
| | | deviceMaintenanceService.saveBatch(inspectionTaskList); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("å建巡æ£ä»»å¡å¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.device.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.mapper.MaintenanceTaskMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Autowired |
| | | private MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | |
| | | @Autowired |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null); |
| | | // 2. å¦ææ²¡ææ°æ®ï¼ç´æ¥è¿å空å页 |
| | | public AjaxResult listPage(Page<MaintenanceTask> page, MaintenanceTask maintenanceTask) { |
| | | // æ¥è¯¢ |
| | | LambdaQueryWrapper<MaintenanceTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (maintenanceTask.getTaskName() != null) { |
| | | queryWrapper.like(MaintenanceTask::getTaskName, maintenanceTask.getTaskName()); |
| | | } |
| | | |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, queryWrapper); |
| | | |
| | | if (taskPage.getRecords().isEmpty()) { |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | | // 3. æ¶éææéè¦æ¥è¯¢çç¨æ·ID |
| | | //æ¶éææéè¦æ¥è¯¢çID |
| | | Set<Long> userIds = new HashSet<>(); |
| | | Set<Long> allDeviceIds = new HashSet<>(); |
| | | //设å¤IDå表 |
| | | Map<Long, List<Long>> taskDeviceIdMap = new HashMap<>(); |
| | | |
| | | // éåä»»å¡ï¼æ¶éç»è®°äººIDå设å¤ID |
| | | for (MaintenanceTask task : taskPage.getRecords()) { |
| | | // æ¶éç»è®°äººID |
| | | taskPage.getRecords().forEach(task -> { |
| | | if (task.getRegistrantId() != null) { |
| | | userIds.add(task.getRegistrantId()); |
| | | } |
| | | }); |
| | | |
| | | // æ¶é设å¤IDå¹¶è§£æ |
| | | if (StringUtils.isNotEmpty(task.getDeviceIds())) { |
| | | try { |
| | | List<Long> deviceIds = JSON.parseArray(task.getDeviceIds(), Long.class); |
| | | if (CollectionUtils.isNotEmpty(deviceIds)) { |
| | | allDeviceIds.addAll(deviceIds); |
| | | taskDeviceIdMap.put(task.getId(), deviceIds); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("è§£æè®¾å¤IDå表失败: taskId={}, deviceIds={}", task.getId(), task.getDeviceIds(), e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 4. æ¹éæ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | Map<Long, String> userNickNameMap = new HashMap<>(); |
| | | if (!userIds.isEmpty()) { |
| | | List<SysUser> users = sysUserMapper.selectUserByIds((new ArrayList<>(userIds))); |
| | | List<SysUser> users = sysUserMapper.selectUserByIds(new ArrayList<>(userIds)); |
| | | if (CollectionUtils.isNotEmpty(users)) { |
| | | users.forEach(user -> userNickNameMap.put(user.getUserId(), user.getNickName())); |
| | | } |
| | | taskPage.getRecords().forEach(task -> { |
| | | } |
| | | |
| | | // 5. æ¹éæ¥è¯¢è®¾å¤ä¿¡æ¯ |
| | | Map<Long, String> deviceNameMap = new HashMap<>(); |
| | | if (!allDeviceIds.isEmpty()) { |
| | | List<DeviceLedger> devices = deviceLedgerMapper.selectBatchIds(new ArrayList<>(allDeviceIds)); |
| | | if (CollectionUtils.isNotEmpty(devices)) { |
| | | devices.forEach(device -> deviceNameMap.put(device.getId(), device.getDeviceName())); |
| | | } |
| | | } |
| | | |
| | | // 6. 设置è¿åç»æ |
| | | for (MaintenanceTask task : taskPage.getRecords()) { |
| | | // 设置ç»è®°äººæµç§° |
| | | if (task.getRegistrantId() != null) { |
| | | task.setRegistrant(userNickNameMap.getOrDefault(task.getRegistrantId(), "æªç¥ç¨æ·")); |
| | | } |
| | | }); |
| | | |
| | | // 设置设å¤åç§° |
| | | List<Long> deviceIds = taskDeviceIdMap.get(task.getId()); |
| | | if (CollectionUtils.isNotEmpty(deviceIds)) { |
| | | List<String> deviceNames = deviceIds.stream() |
| | | .map(id -> deviceNameMap.getOrDefault(id, "æªç¥è®¾å¤")) |
| | | .collect(Collectors.toList()); |
| | | task.setDeviceName(String.join(", ", deviceNames)); |
| | | } else { |
| | | task.setDeviceName("æ 设å¤"); |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(taskPage); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("ç£
åæä»¶è·¯å¾") |
| | | private String weighbridgeDocPath; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("åé") |
| | | private BigDecimal netWeight; |
| | | /** |
| | | * æ¯éï¼åä½ï¼å¨ï¼ |
| | | */ |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | /** |
| | | * ç®éï¼åä½ï¼å¨ï¼ |
| | | */ |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | /** |
| | | * 车çå· |
| | | */ |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | /** |
| | | * è¿ç£
å |
| | | */ |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("ç£
åæä»¶è·¯å¾") |
| | | private String weighbridgeDocPath; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("车çå·") |
| | | private String licensePlateNo; |
| | | |
| | | @ApiModelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @ApiModelProperty("ç®é") |
| | | private BigDecimal tareWeight; |
| | | |
| | | @ApiModelProperty("è¿ç£
å") |
| | | private String weighingOperator; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productId; |
| | | } |
| | |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import com.ruoyi.stock.word.WeighbridgeDocGenerator; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | public class StockInventoryServiceImpl extends ServiceImpl<StockInventoryMapper, StockInventory> implements StockInventoryService { |
| | | |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockInRecordService stockInRecordService; |
| | | private StockOutRecordService stockOutRecordService; |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | private final StockInRecordService stockInRecordService; |
| | | private final StockOutRecordService stockOutRecordService; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final WeighbridgeDocGenerator weighbridgeDocGenerator; |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pagestockInventory(page, stockInventoryDto); |
| | |
| | | StockInRecordDto stockInRecordDto = new StockInRecordDto(); |
| | | stockInRecordDto.setRecordId(stockInventoryDto.getRecordId()); |
| | | stockInRecordDto.setRecordType(stockInventoryDto.getRecordType()); |
| | | stockInRecordDto.setStockInNum(stockInventoryDto.getQualitity()); |
| | | stockInRecordDto.setStockInNum(stockInventoryDto.getNetWeight()); |
| | | stockInRecordDto.setWeighingDate(stockInventoryDto.getWeighingDate()); |
| | | stockInRecordDto.setNetWeight(stockInventoryDto.getNetWeight()); |
| | | stockInRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight()); |
| | | stockInRecordDto.setTareWeight(stockInventoryDto.getTareWeight()); |
| | | stockInRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo()); |
| | | stockInRecordDto.setWeighingOperator(stockInventoryDto.getWeighingOperator()); |
| | | stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | stockInRecordDto.setProductId(stockInventoryDto.getProductId()); |
| | | stockInRecordDto.setType("0"); |
| | | //çæç£
å |
| | | String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto); |
| | | stockInRecordDto.setWeighbridgeDocPath(absoluteDocPath); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //åè¿è¡æ°å¢åºåæ°éåºå |
| | | //å
æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° |
| | |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | StockInventory newStockInventory = new StockInventory(); |
| | | newStockInventory.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | newStockInventory.setQualitity(stockInventoryDto.getQualitity()); |
| | | newStockInventory.setQualitity(stockInventoryDto.getNetWeight()); |
| | | newStockInventory.setVersion(1); |
| | | newStockInventory.setRemark(stockInventoryDto.getRemark()); |
| | | newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity()); |
| | | newStockInventory.setWarnNum(stockInventoryDto.getWarnNum()); |
| | | stockInventoryMapper.insert(newStockInventory); |
| | | }else { |
| | | stockInventoryDto.setQualitity(stockInventoryDto.getNetWeight()); |
| | | stockInventoryMapper.updateAddStockInventory(stockInventoryDto); |
| | | } |
| | | return true; |
| | |
| | | stockOutRecordDto.setRecordId(stockInventoryDto.getRecordId()); |
| | | stockOutRecordDto.setRecordType(stockInventoryDto.getRecordType()); |
| | | stockInventoryDto.setWeighingDate(stockInventoryDto.getWeighingDate()); |
| | | stockOutRecordDto.setStockOutNum(stockInventoryDto.getQualitity()); |
| | | stockOutRecordDto.setStockOutNum(stockInventoryDto.getNetWeight()); |
| | | stockOutRecordDto.setNetWeight(stockInventoryDto.getNetWeight()); |
| | | stockOutRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight()); |
| | | stockOutRecordDto.setTareWeight(stockInventoryDto.getTareWeight()); |
| | | stockOutRecordDto.setWeighingOperator(stockInventoryDto.getWeighingOperator()); |
| | | stockOutRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | stockOutRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo()); |
| | | stockOutRecordDto.setProductId(stockInventoryDto.getProductId()); |
| | | stockOutRecordDto.setType("0"); |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.word; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * é颿°å转大åå·¥å
·ç±» |
| | | */ |
| | | public class ChineseNumberUtil { |
| | | |
| | | private static final String[] CN_UPPER_NUMBER = {"é¶", "壹", "è´°", "å", "è", "ä¼", "é", "æ", "æ", "ç"}; |
| | | private static final String[] CN_UPPER_UNIT = {"", "æ¾", "ä½°", "ä»", "ä¸", "æ¾", "ä½°", "ä»", "亿", "æ¾", "ä½°", "ä»"}; |
| | | private static final String CN_DOLLAR = ""; |
| | | private static final String CN_TEN_CENT = "ç¹"; |
| | | private static final String CN_CENT = ""; |
| | | private static final String CN_INTEGER = "æ´"; |
| | | |
| | | /** |
| | | * å°æ°å转æ¢ä¸ºå¤§åéé¢ |
| | | * @param number æ°åï¼åä½ï¼å¨ï¼ |
| | | * @return 大åéé¢å符串 |
| | | */ |
| | | public static String numberToChinese(BigDecimal number) { |
| | | if (number == null) { |
| | | return "é¶"; |
| | | } |
| | | |
| | | // å¤çè´æ° |
| | | boolean isNegative = false; |
| | | if (number.compareTo(BigDecimal.ZERO) < 0) { |
| | | isNegative = true; |
| | | number = number.abs(); |
| | | } |
| | | |
| | | StringBuilder result = new StringBuilder(); |
| | | |
| | | // åç¦»æ´æ°åå°æ°é¨å |
| | | String[] parts = number.toString().split("\\."); |
| | | String integerPart = parts[0]; |
| | | String decimalPart = parts.length > 1 ? parts[1] : ""; |
| | | |
| | | // è½¬æ¢æ´æ°é¨å |
| | | if (!"0".equals(integerPart)) { |
| | | result.append(convertIntegerPart(integerPart)); |
| | | } else { |
| | | result.append("é¶"); |
| | | } |
| | | |
| | | // 转æ¢å°æ°é¨å |
| | | if (decimalPart.length() > 0 && !"00".equals(decimalPart) && !"0".equals(decimalPart)) { |
| | | result.append(CN_TEN_CENT); |
| | | char[] decimals = decimalPart.toCharArray(); |
| | | for (int i = 0; i < decimals.length; i++) { |
| | | if (decimals[i] != '0') { |
| | | result.append(CN_UPPER_NUMBER[Integer.parseInt(String.valueOf(decimals[i]))]); |
| | | } else { |
| | | if (i < decimals.length - 1 && decimals[i + 1] != '0') { |
| | | result.append(CN_UPPER_NUMBER[0]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return isNegative ? "è´" + result.toString() : result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * è½¬æ¢æ´æ°é¨å |
| | | */ |
| | | private static String convertIntegerPart(String integerPart) { |
| | | StringBuilder result = new StringBuilder(); |
| | | int length = integerPart.length(); |
| | | |
| | | for (int i = 0; i < length; i++) { |
| | | int digit = Integer.parseInt(String.valueOf(integerPart.charAt(i))); |
| | | int unitIndex = length - i - 1; |
| | | |
| | | if (digit != 0) { |
| | | result.append(CN_UPPER_NUMBER[digit]).append(CN_UPPER_UNIT[unitIndex]); |
| | | } else { |
| | | // å¤çè¿ç»çé¶ |
| | | if (i > 0 && integerPart.charAt(i - 1) != '0') { |
| | | result.append(CN_UPPER_NUMBER[0]); |
| | | } |
| | | // å¤çä¸ä½åäº¿ä½ |
| | | if (unitIndex == 4 || unitIndex == 8) { |
| | | if (result.length() > 0 && !result.toString().endsWith(CN_UPPER_NUMBER[0])) { |
| | | result.append(CN_UPPER_UNIT[unitIndex]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String resultStr = result.toString(); |
| | | // å»é¤æ«å°¾çé¶ |
| | | while (resultStr.endsWith(CN_UPPER_NUMBER[0])) { |
| | | resultStr = resultStr.substring(0, resultStr.length() - 1); |
| | | } |
| | | |
| | | return resultStr; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.word; |
| | | |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * ç£
åWordææ¡£çæå¨ |
| | | */ |
| | | @Component |
| | | public class WeighbridgeDocGenerator { |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Autowired |
| | | private IProductService productService; |
| | | |
| | | /** |
| | | * çæç£
åWordææ¡£ |
| | | * @param dto å
¥åºè®°å½DTO |
| | | * @return æä»¶ä¿åçç»å¯¹è·¯å¾ï¼çæå¤±è´¥è¿ånull |
| | | */ |
| | | public String generateWeighbridgeDoc(StockInRecordDto dto) { |
| | | // åæ°æ ¡éª |
| | | if (dto == null) { |
| | | return null; |
| | | } |
| | | |
| | | FileOutputStream out = null; |
| | | XWPFDocument document = null; |
| | | |
| | | try { |
| | | // åå»ºæ°ææ¡£ |
| | | document = new XWPFDocument(); |
| | | |
| | | // æå»ºææ¡£å
容 |
| | | buildDocumentContent(document, dto); |
| | | |
| | | // æå»ºæä»¶ä¿åè·¯å¾ï¼ç»å¯¹è·¯å¾ï¼ |
| | | String absolutePath = buildAbsoluteFilePath(dto); |
| | | File file = new File(absolutePath); |
| | | |
| | | // ç¡®ä¿ç®å½åå¨ |
| | | file.getParentFile().mkdirs(); |
| | | |
| | | // åå
¥æä»¶ |
| | | out = new FileOutputStream(file); |
| | | document.write(out); |
| | | out.flush(); |
| | | |
| | | // è¿åç»å¯¹è·¯å¾ï¼ç¨äºæ°æ®åºåå¨ï¼ |
| | | return absolutePath; |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } finally { |
| | | // å
³éèµæº |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | if (document != null) { |
| | | document.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå»ºææ¡£å
容 |
| | | */ |
| | | private void buildDocumentContent(XWPFDocument document, StockInRecordDto dto) { |
| | | // 1. æ·»å æ é¢ "ç£
ç å" - 使ç¨é»ä½ |
| | | XWPFParagraph titlePara = document.createParagraph(); |
| | | titlePara.setAlignment(ParagraphAlignment.CENTER); |
| | | titlePara.setSpacingAfter(200); |
| | | |
| | | XWPFRun titleRun = titlePara.createRun(); |
| | | titleRun.setText("ç£
ç å"); |
| | | titleRun.setBold(true); |
| | | titleRun.setFontSize(28); |
| | | titleRun.setFontFamily("é»ä½"); |
| | | |
| | | // 2. 空ä¸è¡ |
| | | document.createParagraph(); |
| | | |
| | | // 3. 头é¨ä¿¡æ¯ï¼å¹´ææ¥å计éåä½åå¹¶å¨ä¸è¡ï¼- 使ç¨å®ä½ |
| | | XWPFParagraph headerPara = document.createParagraph(); |
| | | headerPara.setSpacingAfter(200); |
| | | XWPFRun headerRun = headerPara.createRun(); |
| | | |
| | | // æ ¼å¼åæ¥æä¸º yyyy-MM-dd |
| | | String weighDate = ""; |
| | | if (dto.getWeighingDate() != null) { |
| | | try { |
| | | // å设 weighingDate æ¯ LocalDateTime ç±»å |
| | | weighDate = dto.getWeighingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } catch (Exception e) { |
| | | // 妿æ¯å符串类åï¼å°è¯è½¬æ¢ |
| | | weighDate = dto.getWeighingDate().toString(); |
| | | if (weighDate.length() > 10) { |
| | | weighDate = weighDate.substring(0, 10); |
| | | } |
| | | } |
| | | } |
| | | |
| | | headerRun.setText("å¹´ææ¥ï¼" + weighDate + " 计éåä½ï¼ï¼å¨ï¼"); |
| | | headerRun.setFontSize(12); |
| | | headerRun.setFontFamily("å®ä½"); |
| | | |
| | | // 4. åå»ºä¸»è¡¨æ ¼ - 4è¡6åï¼è¡¨å¤´1è¡+æ°æ®1è¡+å计1è¡+空è¡1è¡ï¼ |
| | | XWPFTable table = document.createTable(4, 6); |
| | | |
| | | // è®¾ç½®è¡¨æ ¼å®½åº¦ |
| | | table.setWidth("100%"); |
| | | |
| | | // è®¾ç½®è¡¨æ ¼è¾¹æ¡å ç²ï¼è¾¹æ¡å®½åº¦è®¾ä¸º2ï¼ |
| | | table.setInsideHBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | table.setInsideVBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | table.setTopBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | table.setBottomBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | table.setLeftBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | table.setRightBorder(XWPFBorderType.SINGLE, 2, 0, "000000"); |
| | | |
| | | // 设置è¡é« |
| | | table.getRow(0).setHeight(400); |
| | | table.getRow(1).setHeight(400); |
| | | table.getRow(2).setHeight(400); |
| | | table.getRow(3).setHeight(400); |
| | | |
| | | // 设置表头 - 使ç¨é»ä½å ç² |
| | | String[] headers = {"车å·", "åå", "æ¯é", "ç®é", "åé", "夿³¨"}; |
| | | XWPFTableRow headerRow = table.getRow(0); |
| | | for (int i = 0; i < headers.length; i++) { |
| | | XWPFTableCell cell = headerRow.getCell(i); |
| | | cell.setText(headers[i]); |
| | | cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); |
| | | |
| | | XWPFParagraph cellPara = cell.getParagraphs().get(0); |
| | | cellPara.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun cellRun = cellPara.getRuns().get(0); |
| | | cellRun.setBold(true); |
| | | cellRun.setFontSize(12); |
| | | cellRun.setFontFamily("é»ä½"); |
| | | } |
| | | |
| | | // è®¾ç½®æ°æ®è¡ - 使ç¨å®ä½ |
| | | XWPFTableRow dataRow = table.getRow(1); |
| | | String netWeight = dto.getNetWeight() != null ? dto.getNetWeight().toString() : ""; |
| | | String grossWeight = dto.getGrossWeight() != null ? dto.getGrossWeight().toString() : ""; |
| | | String tareWeight = dto.getTareWeight() != null ? dto.getTareWeight().toString() : ""; |
| | | |
| | | String[] data = { |
| | | dto.getLicensePlateNo() != null ? dto.getLicensePlateNo() : "", |
| | | getProductModelName(dto.getProductId()), |
| | | grossWeight + "t", |
| | | tareWeight + "t", |
| | | netWeight + "t", |
| | | dto.getRemark() != null ? dto.getRemark() : "" |
| | | }; |
| | | |
| | | for (int i = 0; i < data.length; i++) { |
| | | XWPFTableCell cell = dataRow.getCell(i); |
| | | cell.setText(data[i]); |
| | | cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); |
| | | |
| | | XWPFParagraph cellPara = cell.getParagraphs().get(0); |
| | | cellPara.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun cellRun = cellPara.getRuns().get(0); |
| | | cellRun.setFontSize(12); |
| | | cellRun.setFontFamily("å®ä½"); |
| | | } |
| | | |
| | | // åè®¡è¡ - 第3è¡ |
| | | XWPFTableRow totalRow = table.getRow(2); |
| | | |
| | | // 第1åæ¾ç¤º"å计ï¼å¤§åï¼" |
| | | XWPFTableCell totalLabelCell = totalRow.getCell(0); |
| | | totalLabelCell.setText("å计ï¼å¤§åï¼"); |
| | | totalLabelCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); |
| | | XWPFParagraph totalLabelPara = totalLabelCell.getParagraphs().get(0); |
| | | totalLabelPara.setAlignment(ParagraphAlignment.CENTER); |
| | | XWPFRun totalLabelRun = totalLabelPara.getRuns().get(0); |
| | | totalLabelRun.setBold(true); |
| | | totalLabelRun.setFontSize(12); |
| | | totalLabelRun.setFontFamily("å®ä½"); |
| | | |
| | | |
| | | XWPFTableCell contentCell = totalRow.getCell(1); |
| | | String netWeightChinese = ChineseNumberUtil.numberToChinese( |
| | | dto.getNetWeight() != null ? dto.getNetWeight() : BigDecimal.ZERO |
| | | ); |
| | | contentCell.setText(netWeightChinese + "å¨"); |
| | | contentCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); |
| | | XWPFParagraph contentPara = contentCell.getParagraphs().get(0); |
| | | contentPara.setAlignment(ParagraphAlignment.LEFT); |
| | | XWPFRun contentRun = contentPara.getRuns().get(0); |
| | | contentRun.setFontSize(12); |
| | | contentRun.setFontFamily("å®ä½"); |
| | | |
| | | // å并第3-6åå°ç¬¬2å |
| | | for (int i = 2; i < 6; i++) { |
| | | XWPFTableCell cell = totalRow.getCell(i); |
| | | // 设置è¿äºåå
æ ¼ä¸ºåå¹¶ç¶æï¼ç»§æ¿èªç¬¬2åï¼ |
| | | cell.getCTTc().addNewTcPr().addNewHMerge().setVal(org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge.CONTINUE); |
| | | } |
| | | |
| | | // 6. å建è¿ç£
åè¡ï¼åç¬ä¸è¡ï¼å·¦å¯¹é½ï¼ |
| | | XWPFParagraph operatorPara = document.createParagraph(); |
| | | operatorPara.setSpacingAfter(100); |
| | | operatorPara.setAlignment(ParagraphAlignment.LEFT); |
| | | XWPFRun operatorRun = operatorPara.createRun(); |
| | | String operator = dto.getWeighingOperator() != null ? dto.getWeighingOperator() : ""; |
| | | operatorRun.setText("è¿ç£
åï¼" + operator); |
| | | operatorRun.setFontSize(8); |
| | | operatorRun.setFontFamily("å®ä½"); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æå»ºæä»¶ä¿åçç»å¯¹è·¯å¾ |
| | | */ |
| | | private String buildAbsoluteFilePath(StockInRecordDto dto) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String year = String.valueOf(now.getYear()); |
| | | String month = String.format("%02d", now.getMonthValue()); |
| | | String day = String.format("%02d", now.getDayOfMonth()); |
| | | |
| | | // æä»¶åæ ¼å¼ï¼ç£
å_车çå·_å¹´ææ¥æ¶åç§.docx |
| | | String fileName = String.format("ç£
å_%s_%s.docx", |
| | | dto.getLicensePlateNo() != null ? dto.getLicensePlateNo() : "æªç¥è½¦ç", |
| | | now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | |
| | | return uploadDir + File.separator + year + File.separator + month + File.separator + day + File.separator + fileName; |
| | | } |
| | | |
| | | /** |
| | | * è·å产ååå·åç§° |
| | | */ |
| | | private String getProductModelName(Long productModelId) { |
| | | if (productModelId == null) { |
| | | return "æªç¥äº§å"; |
| | | } |
| | | try { |
| | | Product product = productService.getById(productModelId); |
| | | return product != null ? product.getProductName() : "æªç¥äº§å"; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return "æªç¥äº§å"; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.consumables.mapper.ConsumablesInRecordMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> |
| | | SELECT |
| | | sir.*, |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM consumables_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="listConsumablesInRecordExportData" resultType="com.ruoyi.consumables.execl.ConsumablesInRecordExportData"> |
| | | SELECT |
| | | sir.*, |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM consumables_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> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.consumables.mapper.ConsumablesInventoryMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.consumables.pojo.ConsumablesInventory"> |
| | | <result column="id" property="id"/> |
| | | <result column="product_model_id" property="productModelId"/> |
| | | <result column="qualitity" property="qualitity"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="version" property="version"/> |
| | | <result column="locked_quantity" property="lockedQuantity"/> |
| | | <result column="warn_num" property="warnNum"/> |
| | | </resultMap> |
| | | <update id="updateAddConsumablesInventory"> |
| | | update Consumables_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | <if test="ew.warnNum != null and ew.warnNum !=''"> |
| | | warn_num = #{ew.warnNum}, |
| | | </if> |
| | | <if test="ew.lockedQuantity != null and ew.lockedQuantity !=''"> |
| | | locked_quantity = locked_quantity + #{ew.lockedQuantity}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | | </update> |
| | | <update id="updateSubtractConsumablesInventory"> |
| | | update Consumables_inventory |
| | | <set> |
| | | <if test="ew.netWeight != null"> |
| | | qualitity = qualitity - #{ew.netWeight}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | |
| | | <select id="pageConsumablesInventory" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> |
| | | select |
| | | si.id, |
| | | -- å½ååé = å
¥åºåé - åºåºåé |
| | | (COALESCE(sir.total_net_weight,0) - COALESCE(sor.total_net_weight,0)) as net_weight, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) as locked_quantity, |
| | | si.product_model_id, |
| | | si.create_time, |
| | | si.update_time, |
| | | COALESCE(si.warn_num, 0) as warn_num, |
| | | si.version, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity, |
| | | pm.model, |
| | | si.remark, |
| | | pm.unit, |
| | | p.product_name, |
| | | p1.product_name as parent_name, |
| | | p1.id as parent_id |
| | | |
| | | from Consumables_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product p1 on p.parent_id = p1.id |
| | | -- å
¥åºåé |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_net_weight |
| | | from Consumables_in_record |
| | | group by product_model_id |
| | | ) sir on si.product_model_id = sir.product_model_id |
| | | -- åºåºåé |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_net_weight |
| | | from Consumables_out_record |
| | | group by product_model_id |
| | | ) sor on si.product_model_id = sor.product_model_id |
| | | |
| | | <where> |
| | | 1=1 |
| | | <if test="ew.parentId != null and ew.parentId !=''"> |
| | | and p.parent_id = #{ew.parentId} |
| | | </if> |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="listConsumablesInventoryExportData" resultType="com.ruoyi.consumables.execl.ConsumablesInventoryExportData"> |
| | | select si.qualitity, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | coalesce(si.warn_num, 0) as warn_num, |
| | | coalesce(si.locked_quantity, 0) as locked_quantity, |
| | | si.remark, |
| | | si.update_time |
| | | from Consumables_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> |
| | | |
| | | <select id="ConsumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto"> |
| | | select |
| | | sir.*, |
| | | si.qualitity as current_Consumables, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | su.nick_name as create_by, |
| | | |
| | | -- å½ååé = å
¥åºåé - åºåºåé |
| | | IFNULL(inWeight.total_in_weight,0) - IFNULL(outWeight.total_out_weight,0) as current_weight |
| | | |
| | | from Consumables_in_record sir |
| | | |
| | | left join Consumables_inventory si |
| | | on sir.product_model_id = si.product_model_id |
| | | |
| | | left join product_model pm |
| | | on sir.product_model_id = pm.id |
| | | |
| | | left join product p |
| | | on pm.product_id = p.id |
| | | |
| | | left join sys_user su |
| | | on sir.create_user = su.user_id |
| | | |
| | | -- å
¥åºåéç»è®¡ |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_in_weight |
| | | from Consumables_in_record |
| | | group by product_model_id |
| | | ) inWeight |
| | | on sir.product_model_id = inWeight.product_model_id |
| | | |
| | | -- åºåºåéç»è®¡ |
| | | left join ( |
| | | select |
| | | product_model_id, |
| | | sum(net_weight) as total_out_weight |
| | | from Consumables_out_record |
| | | group by product_model_id |
| | | ) outWeight |
| | | on sir.product_model_id = outWeight.product_model_id |
| | | |
| | | <where> |
| | | <if test="ew.reportDate != null"> |
| | | and sir.create_time >= #{ew.reportDate} |
| | | and sir.create_time < DATE_ADD(#{ew.reportDate}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="ew.startMonth != null"> |
| | | and sir.create_time >= #{ew.startMonth} |
| | | </if> |
| | | <if test="ew.endMonth != null"> |
| | | and sir.create_time <= #{ew.endMonth} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="ConsumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto"> |
| | | SELECT |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | MAX(current_inventory) as current_Consumables, |
| | | SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_Consumables_in, |
| | | SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_Consumables_out |
| | | FROM ( |
| | | SELECT |
| | | product_model_id, |
| | | SUM(qualitity) as current_inventory, |
| | | 0 as amount, |
| | | '' as record_type |
| | | FROM Consumables_inventory |
| | | GROUP BY product_model_id |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | product_model_id, |
| | | 0 as current_inventory, |
| | | SUM(Consumables_in_num) as amount, |
| | | 'in' as record_type |
| | | FROM Consumables_in_record |
| | | <where> |
| | | type = 0 |
| | | <if test="ew.startMonth != null"> |
| | | and Consumables_in_record.create_time >= #{ew.startMonth} |
| | | </if> |
| | | <if test="ew.endMonth != null"> |
| | | and Consumables_in_record.create_time <= #{ew.endMonth} |
| | | </if> |
| | | </where> |
| | | GROUP BY product_model_id |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | product_model_id, |
| | | 0 as current_inventory, |
| | | SUM(Consumables_out_num) as amount, |
| | | 'out' as record_type |
| | | FROM Consumables_out_record |
| | | <where> |
| | | type = 0 |
| | | <if test="ew.startMonth != null"> |
| | | and Consumables_out_record.create_time >= #{ew.startMonth} |
| | | </if> |
| | | <if test="ew.endMonth != null"> |
| | | and Consumables_out_record.create_time <= #{ew.endMonth} |
| | | </if> |
| | | </where> |
| | | GROUP BY product_model_id |
| | | ) combined_data |
| | | LEFT JOIN product_model pm ON pm.id = combined_data.product_model_id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | <where> |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | <if test="ew.model != null and ew.model !=''"> |
| | | and pm.model like concat('%',#{ew.model},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | </select> |
| | | <select id="selectTotal" resultType="java.math.BigDecimal"> |
| | | select ifnull(sum(qualitity), 0) |
| | | from consumables_inventory |
| | | </select> |
| | | |
| | | <select id="selectTotalByDate" resultType="java.math.BigDecimal"> |
| | | select IFNULL(sum(qualitity), 0) |
| | | from consumables_inventory |
| | | where create_time >= #{now} |
| | | and create_time < DATE_ADD(#{now}, INTERVAL 1 DAY) |
| | | </select> |
| | | |
| | | <select id="selectStorageProductCountByDate" resultType="int"> |
| | | SELECT SUM(total_count) |
| | | FROM (SELECT COUNT(*) as total_count |
| | | FROM consumables_inventory |
| | | WHERE create_time >= #{startDate} |
| | | AND create_time <= #{endDate} |
| | | UNION ALL |
| | | SELECT COUNT(*) as total_count |
| | | FROM consumables_uninventory |
| | | WHERE create_time >= #{startDate} |
| | | AND create_time <= #{endDate}) AS combined_counts |
| | | </select> |
| | | |
| | | <select id="selectDailyConsumablesInCounts" resultType="java.util.Map"> |
| | | SELECT DATE(sir.create_time) AS date, |
| | | SUM(sir.Consumables_in_num) AS count |
| | | FROM consumables_in_record sir |
| | | JOIN product_model pm ON sir.product_model_id = pm.id |
| | | JOIN product p ON pm.product_id = p.id |
| | | WHERE (p.parent_id = #{rootCategoryId} OR p.id = #{rootCategoryId}) |
| | | AND sir.create_time >= #{startDate} |
| | | AND sir.create_time <= #{endDate} |
| | | GROUP BY DATE(sir.create_time) |
| | | ORDER BY DATE(sir.create_time) ASC |
| | | </select> |
| | | |
| | | <select id="selectDailyConsumablesOutCounts" resultType="java.util.Map"> |
| | | SELECT DATE(sor.create_time) AS date, |
| | | SUM(sor.Consumables_out_num) AS count |
| | | FROM consumables_out_record sor |
| | | JOIN product_model pm ON sor.product_model_id = pm.id |
| | | JOIN product p ON pm.product_id = p.id |
| | | WHERE (p.parent_id = #{rootCategoryId} OR p.id = #{rootCategoryId}) |
| | | AND sor.create_time >= #{startDate} |
| | | AND sor.create_time <= #{endDate} |
| | | GROUP BY DATE(sor.create_time) |
| | | ORDER BY DATE(sor.create_time) ASC |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.consumables.mapper.ConsumablesOutRecordMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.consumables.pojo.ConsumablesOutRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="outbound_batches" property="outboundBatches" /> |
| | | <result column="Consumables_out_num" property="consumablesOutNum" /> |
| | | <result column="record_id" property="recordId" /> |
| | | <result column="record_type" property="recordType" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="license_plate_no" property="licensePlateNo" /> |
| | | </resultMap> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.consumables.dto.ConsumablesOutRecordDto"> |
| | | SELECT |
| | | sor.*, |
| | | p.product_name as productName, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM Consumables_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> |
| | | <select id="listConsumablesOutRecordExportData" resultType="com.ruoyi.consumables.execl.ConsumablesOutRecordExportData"> |
| | | SELECT |
| | | sor.*, |
| | | p.product_name as productName, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM Consumables_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> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.consumables.pojo.ConsumablesUnInventory"> |
| | | <result column="id" property="id" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="qualitity" property="qualitity" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="version" property="version" /> |
| | | </resultMap> |
| | | <update id="updateSubtractConsumablesUnInventory"> |
| | | update consumables_uninventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity - #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <update id="updateAddConsumablesUnInventory"> |
| | | update consumables_uninventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | | </update> |
| | | <select id="pageConsumablesUninventory" resultType="com.ruoyi.consumables.dto.ConsumablesUnInventoryDto"> |
| | | select su.id, |
| | | su.qualitity, |
| | | COALESCE(su.locked_quantity, 0) as locked_quantity, |
| | | su.product_model_id, |
| | | su.create_time, |
| | | su.update_time, |
| | | su.version, |
| | | su.update_time, |
| | | (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from consumables_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> |
| | | <select id="listConsumablesInventoryExportData" resultType="com.ruoyi.consumables.execl.ConsumablesUnInventoryExportData"> |
| | | select su.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from consumables_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> |
| | |
| | | <update id="updateSubtractStockInventory"> |
| | | update stock_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity - #{ew.qualitity}, |
| | | <if test="ew.netWeight != null"> |
| | | qualitity = qualitity - #{ew.netWeight}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |