| | |
| | | package com.ruoyi.inventory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.excel.StockInExcelDto; |
| | | import com.ruoyi.inventory.service.StockInService; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | 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.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/stockin") |
| | | public class StockInController extends BaseController { |
| | | public class StockInController{ |
| | | @Autowired |
| | | private StockInService stockInService; |
| | | |
| | | @PostMapping("/add")// æ°å¢å
¥åºè®°å½ |
| | | public AjaxResult addStockIn(@RequestBody StockIn stockIn) { |
| | | int i = stockInService.addStockIn(stockIn); |
| | | if(i>0){ |
| | | return success(); |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, StockinDto stockinDto) { |
| | | return AjaxResult.success(stockInService.selectStockInPage(page,stockinDto)); |
| | | } |
| | | return error(); |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody StockIn stockIn) { |
| | | stockInService.saveStockin(stockIn); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/list")// ååºææå
¥åºè®°å½ |
| | | public AjaxResult listStockIns() { |
| | | List<StockIn> stockIns = stockInService.listStockIns(); |
| | | return success(stockIns); |
| | | } |
| | | |
| | | @GetMapping("/{id}")// æ ¹æ®IDè·åå
¥åºè®°å½ |
| | | public AjaxResult getStockInById(@PathVariable Long id) { |
| | | StockIn stockIn = stockInService.getStockInById(id); |
| | | return success(stockIn); |
| | | return AjaxResult.success(stockIn); |
| | | } |
| | | @PutMapping("/update")// æ´æ°å
¥åºè®°å½ |
| | | public AjaxResult updateStockIn(@RequestBody StockIn stockIn) { |
| | | int i = stockInService.updateStockIn(stockIn); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | @DeleteMapping("/delete/{id}")// å é¤å
¥åºè®°å½ |
| | | public AjaxResult deleteStockIn(@PathVariable Long id) { |
| | | int i = stockInService.deleteStockIn(id); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | // @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.EXPORT) |
| | | // @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @GetMapping("/export")// 导åºå
¥åºæ°æ® |
| | | public AjaxResult exportStockInData() { |
| | | List<StockIn> stockIns = stockInService.listStockIns(); |
| | | ExcelUtil<StockIn> util = new ExcelUtil<StockIn>(StockIn.class); |
| | | util.exportExcel(stockIns, "åºåå
¥åºä¿¡æ¯"); |
| | | return success(); |
| | | stockInService.updateStockIn(stockIn); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStockin(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | stockInService.delStockin(ids); |
| | | return AjaxResult.success(); |
| | | } |
| | | //å¯¼åº |
| | | @Log(title = "å
¥åºæ¡£æ¡", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, StockinDto stockinDto) { |
| | | stockInService.stockinExport(response, stockinDto); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.inventory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import com.ruoyi.inventory.service.StockManagementService; |
| | | 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; |
| | | |
| | | import static com.ruoyi.framework.web.domain.AjaxResult.error; |
| | |
| | | public class StockManagementController { |
| | | @Autowired |
| | | private StockManagementService stockManagementService; |
| | | @RequestMapping("/list")// ååºææåºåºè®°å½ |
| | | public AjaxResult listStockOuts() { |
| | | List<StockManagement> stockManagements = stockManagementService.getStockManagements(); |
| | | return success(stockManagements); |
| | | } |
| | | @GetMapping("/{id}")// æ ¹æ®IDè·ååºåºè®°å½ |
| | | public AjaxResult getStockOutById(@PathVariable Long id) { |
| | | StockManagement stockManagement = stockManagementService.getStockManagementById(id); |
| | | return success(stockManagement); |
| | | } |
| | | @PostMapping("add")// æ°å¢åºåºè®°å½ |
| | | public AjaxResult addStockOut(@RequestBody StockManagement stockManagement) { |
| | | int i = stockManagementService.addStockManagement(stockManagement); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | @PutMapping("/update")// æ´æ°åºåºè®°å½ |
| | | public AjaxResult updateStockOut(@RequestBody StockManagement stockManagement) { |
| | | int i = stockManagementService.updateStockManagement(stockManagement); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | @DeleteMapping("/delete/{id}")// å é¤åºåºè®°å½ |
| | | public AjaxResult deleteStockOut(@PathVariable Long id) { |
| | | int i = stockManagementService.deleteStockManagement(id); |
| | | if(i>0){ |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | // æ´æ°åºå |
| | | @PutMapping("/update") |
| | | public AjaxResult updateStockManagement(@RequestBody StockManagement stockManagement) { |
| | | stockManagementService.updateStockManagement(stockManagement); |
| | | return AjaxResult.success(); |
| | | } |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStockManage(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | stockManagementService.delStockManage(ids); |
| | | return AjaxResult.success(); |
| | | } |
| | | // å页æ¥è¯¢ |
| | | @GetMapping("/page") |
| | | public AjaxResult getStockManagementPage(Page page, StockManagementDto stockManagementdto) { |
| | | return success(stockManagementService.selectStockManagePage(page, stockManagementdto)); |
| | | } |
| | | // å¯¼åº |
| | | @PostMapping("/export") |
| | | public void stockmanageExport(HttpServletResponse response, StockManagementDto stockManagementDto) { |
| | | stockManagementService.stockManageExport(response, stockManagementDto); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.inventory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | import com.ruoyi.inventory.service.StockOutService; |
| | | 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; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | |
| | | @RequestMapping("/add") |
| | | public AjaxResult addStockOut(StockOut stockOut) { |
| | | int i = stockOutService.addStockOut(stockOut); |
| | | if(i>0){ |
| | | return success(); |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody StockOut stockout) { |
| | | stockOutService.saveStockout(stockout); |
| | | return AjaxResult.success(); |
| | | } |
| | | return error(); |
| | | } |
| | | @RequestMapping("/list") |
| | | public AjaxResult listStockOuts() { |
| | | List<StockOut> stockOuts = stockOutService.getStockOuts(); |
| | | return success(stockOuts); |
| | | } |
| | | |
| | | @RequestMapping("/{id}") |
| | | public AjaxResult getStockOutById(@PathVariable Long id) { |
| | | StockOut stockOut = stockOutService.getStockOutById(id); |
| | | return success(stockOut); |
| | | return success(stockOutService.getStockOutById(id)); |
| | | } |
| | | @RequestMapping("/update") |
| | | public AjaxResult updateStockOut(@RequestBody StockOut stockOut) { |
| | | int i = stockOutService.updateStockOut(stockOut); |
| | | if(i>0){ |
| | | return success(); |
| | | @PutMapping("/update")// æ´æ°å
¥åºè®°å½ |
| | | public AjaxResult updateStockout(@RequestBody StockOut stockOut) { |
| | | stockOutService.updateStockOut(stockOut); |
| | | return AjaxResult.success(); |
| | | } |
| | | return error(); |
| | | @RequestMapping("/page") |
| | | public AjaxResult getStockOutPage(Page page, StockoutDto stockOutdto) { |
| | | IPage<StockoutDto> stockOutPage = stockOutService.selectStockOutPage(page, stockOutdto); |
| | | return success(stockOutPage); |
| | | } |
| | | @RequestMapping("/delete/{id}") |
| | | public AjaxResult deleteStockOut(Long id) { |
| | | int i = stockOutService.deleteStockOut(id); |
| | | if(i>0){ |
| | | return success(); |
| | | // å¯¼åº |
| | | @PostMapping("/export") |
| | | public void stockoutExport(HttpServletResponse response, StockoutDto stockoutDto) { |
| | | stockOutService.stockoutExport(response, stockoutDto); |
| | | } |
| | | return error(); |
| | | |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStockOut(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | stockOutService.delStockOut(ids); |
| | | return AjaxResult.success(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.dto; |
| | | |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | @Data |
| | | public class StockManagementDto extends StockManagement { |
| | | |
| | | private String supplierName; |
| | | private String productCategory; |
| | | private String unit; |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotalPrice; |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | private String specificationModel; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | @Data |
| | | public class StockinDto extends StockIn{ |
| | | |
| | | @ApiModelProperty(value = "产å大类") |
| | | private String productCategory; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotalPrice; |
| | | @ApiModelProperty(value = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | @TableField(exist = false) |
| | | private Date startTime; |
| | | @TableField(exist = false) |
| | | private Date endTime; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.dto; |
| | | |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | @Data |
| | | public class StockoutDto extends StockOut { |
| | | |
| | | private String supplierName; |
| | | private String unit; |
| | | private String productCategory; |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotalPrice; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | private String specificationModel; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.excel; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class StockInExcelDto { |
| | | @Excel(name = "å
¥åºæ¶é´") |
| | | private String inboundTime; |
| | | @Excel(name = "å
¥åºæ¹æ¬¡") |
| | | private String inboundBatch; |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | @Excel(name = "产å大类") |
| | | private String productCategory; |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | @Excel(name = "å
¥åºæ°é") |
| | | private Integer inboundQuantity; |
| | | @Excel(name = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | @Excel(name = "å«ç¨æ»ä»·") |
| | | private BigDecimal taxInclusiveTotal; |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·") |
| | | private BigDecimal taxExclusiveTotal; |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | @Excel(name = "å
¥åºäºº") |
| | | private String inboundPerson; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.excel; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | @Data |
| | | public class StockManagementExcelDto { |
| | | @Excel(name = "åºåæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date boundTime; |
| | | @Excel(name = "å
¥åºæ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inboundTime; |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | @Excel(name = "产å大类") |
| | | private String productCategory; |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | @Excel(name = "åºåæ°é") |
| | | private Integer stockQuantity; |
| | | @Excel(name = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | @Excel(name = "å«ç¨æ»ä»·") |
| | | private BigDecimal taxInclusiveTotal; |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·") |
| | | private BigDecimal taxExclusiveTotal; |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | @Excel(name = "å
¥åºäºº") |
| | | private String inboundPerson; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.inventory.excel; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class StockOutExcelDto { |
| | | @Excel(name = "åºåºæ¶é´") |
| | | private String inboundTime; |
| | | @Excel(name = "åºåºæ¹æ¬¡") |
| | | private String inboundBatch; |
| | | @Excel(name = "产å大类") |
| | | private String productCategory; |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | @Excel(name = "åºåºæ°é") |
| | | private Integer inboundQuantity; |
| | | @Excel(name = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | @Excel(name = "å«ç¨æ»ä»·") |
| | | private BigDecimal taxInclusiveTotal; |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·") |
| | | private BigDecimal taxExclusiveTotal; |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | @Excel(name = "åºåºäºº") |
| | | private String outboundPerson; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.excel.StockInExcelDto; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @createDate 2025-06-23 18:11:59 |
| | | * @Entity inventory.domain.StockIn |
| | | */ |
| | | public interface StockInMapper { |
| | | @Mapper |
| | | public interface StockInMapper extends BaseMapper<StockIn> { |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insertSelective(StockIn record); |
| | | |
| | | StockIn selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(StockIn record); |
| | | |
| | | List<StockIn> selectList(); |
| | | IPage<StockIn> selectStockInWithProductInfo(Page page, @Param("stockinDto") StockinDto stockinDto); |
| | | List<StockInExcelDto> stockinExportList(@Param("stockinDto") StockinDto stockinDto); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.excel.StockManagementExcelDto; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @createDate 2025-06-23 18:11:59 |
| | | * @Entity inventory.domain.StockManagement |
| | | */ |
| | | public interface StockManagementMapper { |
| | | List<StockManagement> selectAll(); |
| | | int deleteByPrimaryKey(Long id); |
| | | @Mapper |
| | | public interface StockManagementMapper extends BaseMapper<StockManagement> { |
| | | |
| | | int insertSelective(StockManagement record); |
| | | |
| | | StockManagement selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(StockManagement record); |
| | | |
| | | IPage<StockManagement> selectStockManagementBypage(Page page, @Param("stockManagementDto") StockManagementDto stockManagementDto); |
| | | List<StockManagementExcelDto> stockManageExportList(@Param("stockManagementDto") StockManagementDto stockManagementDto); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.excel.StockOutExcelDto; |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @createDate 2025-06-23 18:11:59 |
| | | * @Entity inventory.domain.StockOut |
| | | */ |
| | | public interface StockOutMapper { |
| | | @Mapper |
| | | public interface StockOutMapper extends BaseMapper<StockOut> { |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | List<StockOut> selectAll(); |
| | | int insertSelective(StockOut record); |
| | | |
| | | StockOut selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(StockOut record); |
| | | IPage<StockoutDto> selectStockOutBypage(Page page,@Param("stockOutdto") StockoutDto stockOutdto); |
| | | List<StockOutExcelDto> stockoutExportList(@Param("stockOutdto") StockoutDto stockOutdto); |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.pojo; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * |
| | | * @TableName stock_in |
| | | */ |
| | | @Data |
| | | public class StockIn implements Serializable { |
| | | @TableName("stock_in") |
| | | public class StockIn{ |
| | | /** |
| | | * å
¥åºè®°å½ID |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 产åid |
| | | */ |
| | | private Integer productId; |
| | | private Long productId; |
| | | |
| | | /** |
| | | * å
¥åºæ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inboundTime; |
| | | |
| | | /** |
| | |
| | | private String inboundBatch; |
| | | |
| | | /** |
| | | * ä¾åºååç§° |
| | | * ä¾åºåid |
| | | */ |
| | | private String supplierName; |
| | | |
| | | private Long supplierId; |
| | | /** |
| | | * å
¥åºæ°é |
| | | */ |
| | | private Integer inboundQuantity; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusivePrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotal; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotal; |
| | | |
| | | /** |
| | | * å
¥åºäºº |
| | | */ |
| | | private String inboundPerson; |
| | | // tenant_id |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | private List<StockProduct> stockProducts; |
| | | // private List<StockProduct> stockProducts; |
| | | |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | 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 lombok.Data; |
| | | |
| | | /** |
| | |
| | | * @TableName stock_management |
| | | */ |
| | | @Data |
| | | public class StockManagement implements Serializable { |
| | | @TableName("stock_management") |
| | | public class StockManagement{ |
| | | /** |
| | | * åºåè®°å½ID |
| | | */ |
| | |
| | | /** |
| | | * 产åid |
| | | */ |
| | | private Integer productId; |
| | | private Long productId; |
| | | |
| | | /** |
| | | * å½ååºåé |
| | | */ |
| | | private Integer stockQuantity; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusivePrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotal; |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotal; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date boundTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date inboundTime; |
| | | |
| | | /** |
| | | * å
¥åºäºº |
| | | */ |
| | | private String inboundPerson; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | * @TableName stock_out |
| | | */ |
| | | @Data |
| | | @TableName("stock_out") |
| | | public class StockOut implements Serializable { |
| | | /** |
| | | * åºåºè®°å½ID |
| | |
| | | /** |
| | | * 产åid |
| | | */ |
| | | private Integer productId; |
| | | private Long productId; |
| | | |
| | | /** |
| | | * åºåºæ¶é´ |
| | |
| | | /** |
| | | * ä¾åºååç§° |
| | | */ |
| | | private String supplierName; |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * å
¥åºæ°é |
| | | */ |
| | | private Integer inboundQuantity; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | private BigDecimal taxInclusivePrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxInclusiveTotal; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | private BigDecimal taxExclusiveTotal; |
| | | |
| | | /** |
| | | * åºåºäºº |
| | | */ |
| | | private String inboundPerson; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface StockInService { |
| | | int addStockIn(StockIn stockIn); |
| | | |
| | | List<StockIn> listStockIns(); |
| | | public interface StockInService extends IService<StockIn> { |
| | | void saveStockin(StockIn stockIn); |
| | | |
| | | StockIn getStockInById(Long id); |
| | | |
| | | int updateStockIn(StockIn stockIn); |
| | | |
| | | int deleteStockIn(Long id); |
| | | |
| | | |
| | | int delStockin(List<Integer> ids); |
| | | // PageInfo<StockinProcuct> getStockInPage(Integer pageNum, Integer pageSize, StockInQueryDTO query); |
| | | IPage<StockIn> selectStockInPage(Page page, StockinDto stockinDto); |
| | | void stockinExport(HttpServletResponse response, StockinDto stockinDto); |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface StockManagementService { |
| | | List<StockManagement> getStockManagements(); |
| | | StockManagement getStockManagementById(Long id); |
| | | int addStockManagement(StockManagement stockManagement); |
| | | public interface StockManagementService extends IService<StockManagement> { |
| | | |
| | | int updateStockManagement(StockManagement stockManagement); |
| | | int deleteStockManagement(Long id); |
| | | int delStockManage(List<Integer> ids); |
| | | IPage<StockManagement> selectStockManagePage(Page page, StockManagementDto stockManagementdto); |
| | | void stockManageExport(HttpServletResponse response, StockManagementDto stockManagementdto); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface StockOutService { |
| | | List<StockOut> getStockOuts(); |
| | | int delStockOut(List<Integer> ids); |
| | | |
| | | StockOut getStockOutById(Long id); |
| | | int addStockOut(StockOut stockOut); |
| | | void saveStockout(StockOut stockout); |
| | | int updateStockOut(StockOut stockOut); |
| | | int deleteStockOut(Long id); |
| | | IPage<StockoutDto> selectStockOutPage(Page page, StockoutDto stockoutDto); |
| | | void stockoutExport(HttpServletResponse response, StockoutDto stockoutDto); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.utils.poi.ExcelUtil; |
| | | import com.ruoyi.inventory.dto.StockinDto; |
| | | import com.ruoyi.inventory.excel.StockInExcelDto; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.pojo.StockIn; |
| | | import com.ruoyi.inventory.mapper.StockInMapper; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import com.ruoyi.inventory.service.StockInService; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class StockInServiceImpl implements StockInService { |
| | | public class StockInServiceImpl extends ServiceImpl<StockInMapper,StockIn> implements StockInService { |
| | | @Autowired |
| | | private StockInMapper stockInMapper; |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | |
| | | @Override//æ·»å åºåå
¥åºä¿¡æ¯ |
| | | public int addStockIn(StockIn stockIn) { |
| | | int i = stockInMapper.insertSelective(stockIn); |
| | | return i; |
| | | |
| | | // æ°å¢æ¹æ³ |
| | | /** |
| | | * æ°å¢åºåå
¥åºä¿¡æ¯ |
| | | * @param stockIn |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStockin(StockIn stockIn) { |
| | | stockInMapper.insert(stockIn); |
| | | StockManagement stockManagement = new StockManagement(); |
| | | // è¿è¡å¤ææ¯å¦åå¨ç¸åç产åidåä¾åºåid |
| | | LambdaQueryWrapper<StockManagement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StockManagement::getProductId, stockIn.getProductId()); |
| | | queryWrapper.eq(StockManagement::getSupplierId, stockIn.getSupplierId()); |
| | | StockManagement stockManagement1 = stockManagementMapper.selectOne(queryWrapper); |
| | | if (stockManagement1!= null) { |
| | | stockManagement1.setStockQuantity(stockManagement1.getStockQuantity() + stockIn.getInboundQuantity()); |
| | | stockManagement1.setInboundTime(stockIn.getInboundTime()); |
| | | stockManagement1.setBoundTime(new Date()); |
| | | stockManagement1.setInboundPerson(stockIn.getInboundPerson()); |
| | | System.out.println(stockManagement1+"22"); |
| | | stockManagementMapper.updateById(stockManagement1); |
| | | } |
| | | |
| | | @Override//ååºææåºåå
¥åºä¿¡æ¯ |
| | | public List<StockIn> listStockIns() { |
| | | List<StockIn> stockIns = stockInMapper.selectList(); |
| | | return stockIns; |
| | | else { |
| | | stockManagement.setProductId(stockIn.getProductId()); |
| | | stockManagement.setStockQuantity(stockIn.getInboundQuantity()); |
| | | stockManagement.setBoundTime(stockIn.getInboundTime()); |
| | | stockManagement.setStockQuantity(stockIn.getInboundQuantity()); |
| | | stockManagement.setInboundPerson(stockIn.getInboundPerson()); |
| | | stockManagement.setSupplierId(stockIn.getSupplierId()); |
| | | stockManagement.setTenantId(stockIn.getTenantId()); |
| | | stockManagement.setBoundTime(new Date()); |
| | | stockManagementMapper.insert(stockManagement); |
| | | } |
| | | } |
| | | |
| | | @Override//æ ¹æ®idè·ååºåå
¥åºä¿¡æ¯ |
| | | public StockIn getStockInById(Long id) { |
| | | StockIn stockIn = stockInMapper.selectByPrimaryKey(id); |
| | | StockIn stockIn = stockInMapper.selectById(id); |
| | | return stockIn; |
| | | } |
| | | |
| | | @Override//æ´æ°åºåå
¥åºä¿¡æ¯ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateStockIn(StockIn stockIn) { |
| | | int i = stockInMapper.updateByPrimaryKeySelective(stockIn); |
| | | return i; |
| | | StockIn stockIn1 = stockInMapper.selectById(stockIn.getId()); |
| | | // è¿è¡å¤ææ¯å¦åå¨ç¸åç产åidåä¾åºåid |
| | | LambdaQueryWrapper<StockManagement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StockManagement::getProductId, stockIn.getProductId()); |
| | | queryWrapper.eq(StockManagement::getSupplierId, stockIn.getSupplierId()); |
| | | StockManagement stockManagement1 = stockManagementMapper.selectOne(queryWrapper); |
| | | if (stockManagement1!= null) { |
| | | stockManagement1.setStockQuantity(stockManagement1.getStockQuantity() - stockIn1.getInboundQuantity() + stockIn.getInboundQuantity()); |
| | | stockManagement1.setInboundTime(stockIn.getInboundTime()); |
| | | stockManagement1.setBoundTime(new Date()); |
| | | stockManagement1.setInboundPerson(stockIn.getInboundPerson()); |
| | | System.out.println(stockManagement1 + "22"); |
| | | stockManagementMapper.updateById(stockManagement1); |
| | | } else { |
| | | StockManagement stockManagement = new StockManagement(); |
| | | stockManagement.setProductId(stockIn.getProductId()); |
| | | stockManagement.setStockQuantity(stockIn.getInboundQuantity()); |
| | | stockManagement.setBoundTime(stockIn.getInboundTime()); |
| | | stockManagement.setStockQuantity(stockIn.getInboundQuantity()); |
| | | stockManagement.setInboundPerson(stockIn.getInboundPerson()); |
| | | stockManagement.setSupplierId(stockIn.getSupplierId()); |
| | | stockManagement.setTenantId(stockIn.getTenantId()); |
| | | stockManagement.setBoundTime(new Date()); |
| | | System.out.println(stockManagement + "33"); |
| | | stockManagementMapper.insert(stockManagement); |
| | | } |
| | | return stockInMapper.updateById(stockIn); |
| | | } |
| | | |
| | | @Override//å é¤åºåå
¥åºä¿¡æ¯ |
| | | public int deleteStockIn(Long id) { |
| | | int i = stockInMapper.deleteByPrimaryKey(id); |
| | | return i; |
| | | @Override |
| | | public int delStockin(List<Integer> ids) { |
| | | LambdaQueryWrapper<StockIn> delWrapper = new LambdaQueryWrapper<>(); |
| | | delWrapper.in(StockIn::getId, ids); |
| | | return stockInMapper.delete(delWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StockIn> selectStockInPage(Page page, StockinDto stockinDto) { |
| | | System.out.println(stockinDto); |
| | | IPage<StockIn> stockinDtoIPage = stockInMapper.selectStockInWithProductInfo(page, stockinDto); |
| | | System.out.println(stockinDtoIPage.getRecords()); |
| | | return stockInMapper.selectStockInWithProductInfo(page, stockinDto); |
| | | } |
| | | |
| | | @Override |
| | | public void stockinExport(HttpServletResponse response, StockinDto stockinDto) { |
| | | List<StockInExcelDto> stockInExcelDtoList = stockInMapper.stockinExportList(stockinDto); |
| | | ExcelUtil<StockInExcelDto> util = new ExcelUtil<StockInExcelDto>(StockInExcelDto.class); |
| | | util.exportExcel(response, stockInExcelDtoList, "ä¾åºå导åº"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.inventory.service.impl; |
| | | |
| | | 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.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.inventory.dto.StockManagementDto; |
| | | import com.ruoyi.inventory.excel.StockManagementExcelDto; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import com.ruoyi.inventory.service.StockManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class StockManagementServiceImpl implements StockManagementService { |
| | | public class StockManagementServiceImpl extends ServiceImpl<StockManagementMapper,StockManagement> implements StockManagementService { |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | |
| | | @Override |
| | | public List<StockManagement> getStockManagements() { |
| | | List<StockManagement> stockManagements = stockManagementMapper.selectAll(); |
| | | return stockManagements; |
| | | } |
| | | |
| | | @Override |
| | | public StockManagement getStockManagementById(Long id) { |
| | | StockManagement stockManagement = stockManagementMapper.selectByPrimaryKey(id); |
| | | return stockManagement; |
| | | } |
| | | |
| | | @Override |
| | | public int addStockManagement(StockManagement stockManagement) { |
| | | int i = stockManagementMapper.insertSelective(stockManagement); |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | public int updateStockManagement(StockManagement stockManagement) { |
| | | int i = stockManagementMapper.updateByPrimaryKeySelective(stockManagement); |
| | | return i; |
| | | return stockManagementMapper.updateById(stockManagement); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStockManagement(Long id) { |
| | | int i = stockManagementMapper.deleteByPrimaryKey(id); |
| | | return i; |
| | | public int delStockManage(List<Integer> ids) { |
| | | return stockManagementMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<StockManagement> selectStockManagePage(Page page, StockManagementDto stockManagementdto) { |
| | | return stockManagementMapper.selectStockManagementBypage(page, stockManagementdto); |
| | | } |
| | | |
| | | @Override |
| | | public void stockManageExport(HttpServletResponse response, StockManagementDto stockManagementdto) { |
| | | List<StockManagementExcelDto> stockManageList = stockManagementMapper.stockManageExportList(stockManagementdto); |
| | | ExcelUtil<StockManagementExcelDto> util = new ExcelUtil<StockManagementExcelDto>(StockManagementExcelDto.class); |
| | | util.exportExcel(response, stockManageList, "åºå导åº"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.inventory.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.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.inventory.dto.StockoutDto; |
| | | import com.ruoyi.inventory.excel.StockOutExcelDto; |
| | | import com.ruoyi.inventory.mapper.StockManagementMapper; |
| | | import com.ruoyi.inventory.mapper.StockOutMapper; |
| | | import com.ruoyi.inventory.pojo.StockManagement; |
| | | import com.ruoyi.inventory.pojo.StockOut; |
| | | import com.ruoyi.inventory.service.StockOutService; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class StockOutServiceImpl implements StockOutService { |
| | | @Autowired |
| | | private StockOutMapper stockOutMapper; |
| | | @Autowired |
| | | private StockManagementMapper stockManagementMapper; |
| | | |
| | | |
| | | @Override |
| | | public List<StockOut> getStockOuts() { |
| | | List<StockOut> stockOuts = stockOutMapper.selectAll(); |
| | | return stockOuts; |
| | | public int delStockOut(List<Integer> ids) { |
| | | return stockOutMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public StockOut getStockOutById(Long id) { |
| | | StockOut stockOut = stockOutMapper.selectByPrimaryKey(id); |
| | | StockOut stockOut = stockOutMapper.selectById(id); |
| | | return stockOut; |
| | | } |
| | | |
| | | @Override |
| | | public int addStockOut(StockOut stockOut) { |
| | | int i = stockOutMapper.insertSelective(stockOut); |
| | | return i; |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStockout(StockOut stockOut) { |
| | | // è¿è¡å¤ææ¯å¦åå¨ç¸åç产åidåä¾åºåid |
| | | LambdaQueryWrapper<StockManagement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StockManagement::getProductId, stockOut.getProductId()); |
| | | queryWrapper.eq(StockManagement::getSupplierId, stockOut.getSupplierId()); |
| | | StockManagement stockManagement1 = stockManagementMapper.selectOne(queryWrapper); |
| | | if (stockManagement1!= null) { |
| | | // 夿åºåæ°éæ¯å¦å¤§äºåºåºæ°é |
| | | if (stockManagement1.getStockQuantity() < stockOut.getInboundQuantity()) { |
| | | throw new RuntimeException("åºåæ°éä¸è¶³"); |
| | | } |
| | | stockOutMapper.insert(stockOut); |
| | | stockManagement1.setStockQuantity(stockManagement1.getStockQuantity() - stockOut.getInboundQuantity()); |
| | | stockManagement1.setInboundTime(new Date()); |
| | | stockManagementMapper.updateById(stockManagement1); |
| | | } |
| | | else { |
| | | throw new RuntimeException("åºåä¸åå¨"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int updateStockOut(StockOut stockOut) { |
| | | int i = stockOutMapper.updateByPrimaryKeySelective(stockOut); |
| | | return i; |
| | | // éè¦è¿è¡å¤æå¨åºå䏿¯å¦åå¨è¯¥äº§åï¼å¦æåå¨ï¼å°±è¿è¡ä¿®æ¹ï¼å¦åå°±æåºå¼å¸¸ |
| | | StockOut stockOut1 = stockOutMapper.selectById(stockOut.getId()); |
| | | LambdaQueryWrapper<StockManagement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StockManagement::getProductId, stockOut.getProductId()); |
| | | StockManagement stockManagement1 = stockManagementMapper.selectOne(queryWrapper); |
| | | if (stockManagement1!= null) { |
| | | // 夿åºåæ°éæ¯å¦å¤§äºåºåºæ°é |
| | | if (stockManagement1.getStockQuantity()+stockOut1.getInboundQuantity() < stockOut.getInboundQuantity()) { |
| | | throw new RuntimeException("åºåæ°éä¸è¶³"); |
| | | } |
| | | stockManagement1.setStockQuantity(stockManagement1.getStockQuantity() + stockOut1.getInboundQuantity() - stockOut.getInboundQuantity()); |
| | | stockManagement1.setInboundTime(stockOut.getInboundTime()); |
| | | stockManagement1.setBoundTime(new Date()); |
| | | System.out.println(stockManagement1 + "22"); |
| | | stockManagementMapper.updateById(stockManagement1); |
| | | } else { |
| | | throw new RuntimeException("åºåä¸åå¨"); |
| | | } |
| | | return stockOutMapper.updateById(stockOut); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteStockOut(Long id) { |
| | | int i = stockOutMapper.deleteByPrimaryKey(id); |
| | | return i; |
| | | public IPage<StockoutDto> selectStockOutPage(Page page, StockoutDto stockoutDto) { |
| | | return stockOutMapper.selectStockOutBypage(page, stockoutDto); |
| | | } |
| | | |
| | | @Override |
| | | public void stockoutExport(HttpServletResponse response, StockoutDto stockoutDto) { |
| | | List<StockOutExcelDto> stockoutList = stockOutMapper.stockoutExportList(stockoutDto); |
| | | ExcelUtil<StockOutExcelDto> util = new ExcelUtil<StockOutExcelDto>(StockOutExcelDto.class); |
| | | util.exportExcel(response, stockoutList, "ä¾åºå导åº"); |
| | | } |
| | | } |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inventory.mapper.StockInMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.inventory.pojo.StockIn"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="productId" column="product_id" jdbcType="INTEGER"/> |
| | | <result property="inboundTime" column="inbound_time" jdbcType="TIMESTAMP"/> |
| | | <result property="inboundBatch" column="inbound_batch" jdbcType="VARCHAR"/> |
| | | <result property="supplierName" column="supplier_name" jdbcType="VARCHAR"/> |
| | | <result property="inboundQuantity" column="inbound_quantity" jdbcType="INTEGER"/> |
| | | <result property="taxInclusivePrice" column="tax_inclusive_price" jdbcType="DECIMAL"/> |
| | | <result property="taxInclusiveTotal" column="tax_inclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="taxRate" column="tax_rate" jdbcType="DECIMAL"/> |
| | | <result property="taxExclusiveTotal" column="tax_exclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="inboundPerson" column="inbound_person" jdbcType="VARCHAR"/> |
| | | <collection property="stockProducts" ofType="com.ruoyi.inventory.pojo.StockProduct" |
| | | select="com.ruoyi.inventory.mapper.StockProductMapper.selectByPrimaryKey" column="productId"> |
| | | <id property="id" column="productId" jdbcType="INTEGER"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,product_id,inbound_time, |
| | | inbound_batch,supplier_name,inbound_quantity, |
| | | tax_inclusive_price,tax_inclusive_total,tax_rate, |
| | | tax_exclusive_total,inbound_person |
| | | </sql> |
| | | <!-- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultType="com.ruoyi.inventory.dto.StockinDto">--> |
| | | <!-- SELECT--> |
| | | <!-- T1.id,--> |
| | | <!-- T1.product_id,--> |
| | | <!-- T1.inbound_time,--> |
| | | <!-- T1.inbound_batch,--> |
| | | <!-- T1.supplier_id,--> |
| | | <!-- T1.inbound_quantity,--> |
| | | <!-- T1.tax_inclusive_price,--> |
| | | <!-- T1.tax_inclusive_total,--> |
| | | <!-- T1.tax_rate,--> |
| | | <!-- T1.tax_exclusive_total,--> |
| | | <!-- T1.inbound_person,--> |
| | | <!-- T1.tenant_id,--> |
| | | <!-- T2.product_category,--> |
| | | <!-- T2.specification_model,--> |
| | | <!-- T3.supplier_name--> |
| | | <!-- FROM--> |
| | | <!-- stock_in T1--> |
| | | <!-- INNER JOIN--> |
| | | <!-- product_record T2--> |
| | | <!-- ON--> |
| | | <!-- T1.product_id = T2.product_id--> |
| | | <!-- INNER JOIN--> |
| | | <!-- supplier_manage T3--> |
| | | <!-- ON--> |
| | | <!-- T1.supplier_id = T3.id--> |
| | | <!-- where T1.id = #{id,jdbcType=INTEGER}--> |
| | | <!-- </select>--> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_in |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </select> |
| | | <select id="selectList" resultType="com.ruoyi.inventory.pojo.StockIn"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_in |
| | | </select> |
| | | <select id="selectListByPage" resultType="com.ruoyi.inventory.pojo.StockIn"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_in |
| | | limit #{pageNum},#{pageSize} |
| | | |
| | | <select id="selectStockInWithProductInfo" resultType="com.ruoyi.inventory.dto.StockinDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.inbound_time, |
| | | T1.inbound_batch, |
| | | T1.supplier_id, |
| | | T1.inbound_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.tenant_id, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T2.unit, |
| | | T3.supplier_name |
| | | FROM |
| | | stock_in T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockinDto.supplierName != null and stockinDto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockinDto.supplierName}, '%') |
| | | </if> |
| | | <if test="stockinDto.startTime != null and stockinDto.startTime != ''"> |
| | | AND T1.inbound_time >= #{stockinDto.startTime} |
| | | </if> |
| | | <if test="stockinDto.endTime != null and stockinDto.endTime != ''"> |
| | | AND T1.inbound_time <= #{stockinDto.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY T1.inbound_time DESC |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from stock_in |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | <select id="stockinExportList" resultType="com.ruoyi.inventory.excel.StockInExcelDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.inbound_time, |
| | | T1.inbound_batch, |
| | | T1.supplier_id, |
| | | T1.inbound_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.tenant_id, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T2.unit, |
| | | T3.supplier_name |
| | | FROM |
| | | stock_in T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockinDto.supplierName != null and stockinDto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockinDto.supplierName}, '%') |
| | | </if> |
| | | <if test="stockinDto.startTime != null and stockinDto.startTime != ''"> |
| | | AND T1.inbound_time >= #{stockinDto.startTime} |
| | | </if> |
| | | <if test="stockinDto.endTime != null and stockinDto.endTime != ''"> |
| | | AND T1.inbound_time <= #{stockinDto.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY T1.inbound_time DESC |
| | | </select> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.inventory.pojo.StockIn" useGeneratedKeys="true"> |
| | | insert into stock_in |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="productId != null">product_id,</if> |
| | | <if test="inboundTime != null">inbound_time,</if> |
| | | <if test="inboundBatch != null">inbound_batch,</if> |
| | | <if test="supplierName != null">supplier_name,</if> |
| | | <if test="inboundQuantity != null">inbound_quantity,</if> |
| | | <if test="taxInclusivePrice != null">tax_inclusive_price,</if> |
| | | <if test="taxInclusiveTotal != null">tax_inclusive_total,</if> |
| | | <if test="taxRate != null">tax_rate,</if> |
| | | <if test="taxExclusiveTotal != null">tax_exclusive_total,</if> |
| | | <if test="inboundPerson != null">inbound_person,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=INTEGER},</if> |
| | | <if test="productId != null">#{productId,jdbcType=INTEGER},</if> |
| | | <if test="inboundTime != null">#{inboundTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inboundBatch != null">#{inboundBatch,jdbcType=VARCHAR},</if> |
| | | <if test="supplierName != null">#{supplierName,jdbcType=VARCHAR},</if> |
| | | <if test="inboundQuantity != null">#{inboundQuantity,jdbcType=INTEGER},</if> |
| | | <if test="taxInclusivePrice != null">#{taxInclusivePrice,jdbcType=DECIMAL},</if> |
| | | <if test="taxInclusiveTotal != null">#{taxInclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="taxRate != null">#{taxRate,jdbcType=DECIMAL},</if> |
| | | <if test="taxExclusiveTotal != null">#{taxExclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.inventory.pojo.StockIn"> |
| | | update stock_in |
| | | <set> |
| | | <if test="productId != null"> |
| | | product_id = #{productId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="inboundTime != null"> |
| | | inbound_time = #{inboundTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="inboundBatch != null"> |
| | | inbound_batch = #{inboundBatch,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="supplierName != null"> |
| | | supplier_name = #{supplierName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="inboundQuantity != null"> |
| | | inbound_quantity = #{inboundQuantity,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="taxInclusivePrice != null"> |
| | | tax_inclusive_price = #{taxInclusivePrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxInclusiveTotal != null"> |
| | | tax_inclusive_total = #{taxInclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxRate != null"> |
| | | tax_rate = #{taxRate,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxExclusiveTotal != null"> |
| | | tax_exclusive_total = #{taxExclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="inboundPerson != null"> |
| | | inbound_person = #{inboundPerson,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inventory.mapper.StockManagementMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.inventory.pojo.StockManagement"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="productId" column="product_id" jdbcType="INTEGER"/> |
| | | <result property="stockQuantity" column="stock_quantity" jdbcType="INTEGER"/> |
| | | <result property="taxInclusivePrice" column="tax_inclusive_price" jdbcType="DECIMAL"/> |
| | | <result property="taxInclusiveTotal" column="tax_inclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="taxRate" column="tax_rate" jdbcType="DECIMAL"/> |
| | | <result property="taxExclusiveTotal" column="tax_exclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="inboundPerson" column="inbound_person" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,product_id,stock_quantity, |
| | | tax_inclusive_price,tax_inclusive_total,tax_rate, |
| | | tax_exclusive_total,inbound_person |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_management |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </select> |
| | | <select id="selectAll" resultType="com.ruoyi.inventory.pojo.StockManagement"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_management |
| | | <!-- æ ¹æ®ä¾åºåæ¨¡ç³æç´¢--> |
| | | <select id="selectStockManagementBypage" resultType="com.ruoyi.inventory.dto.StockManagementDto"> |
| | | SELECT |
| | | T2.unit, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T3.supplier_name, |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.stock_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.supplier_id, |
| | | T1.tenant_id, |
| | | T1.bound_time, |
| | | T1.inbound_time |
| | | FROM |
| | | stock_management T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockManagementDto.supplierName != null and stockManagementDto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockManagementDto.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from stock_management |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | <select id="stockManageExportList" resultType="com.ruoyi.inventory.excel.StockManagementExcelDto"> |
| | | SELECT |
| | | T2.unit, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T3.supplier_name, |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.stock_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.supplier_id, |
| | | T1.tenant_id, |
| | | T1.bound_time, |
| | | T1.inbound_time |
| | | FROM |
| | | stock_management T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockManagementDto.supplierName != null and stockManagementDto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockManagementDto.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.inventory.pojo.StockManagement" useGeneratedKeys="true"> |
| | | insert into stock_management |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="productId != null">product_id,</if> |
| | | <if test="stockQuantity != null">stock_quantity,</if> |
| | | <if test="taxInclusivePrice != null">tax_inclusive_price,</if> |
| | | <if test="taxInclusiveTotal != null">tax_inclusive_total,</if> |
| | | <if test="taxRate != null">tax_rate,</if> |
| | | <if test="taxExclusiveTotal != null">tax_exclusive_total,</if> |
| | | <if test="inboundPerson != null">inbound_person,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=INTEGER},</if> |
| | | <if test="productId != null">#{productId,jdbcType=INTEGER},</if> |
| | | <if test="stockQuantity != null">#{stockQuantity,jdbcType=INTEGER},</if> |
| | | <if test="taxInclusivePrice != null">#{taxInclusivePrice,jdbcType=DECIMAL},</if> |
| | | <if test="taxInclusiveTotal != null">#{taxInclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="taxRate != null">#{taxRate,jdbcType=DECIMAL},</if> |
| | | <if test="taxExclusiveTotal != null">#{taxExclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.inventory.pojo.StockManagement"> |
| | | update stock_management |
| | | <set> |
| | | <if test="productId != null"> |
| | | product_id = #{productId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="stockQuantity != null"> |
| | | stock_quantity = #{stockQuantity,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="taxInclusivePrice != null"> |
| | | tax_inclusive_price = #{taxInclusivePrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxInclusiveTotal != null"> |
| | | tax_inclusive_total = #{taxInclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxRate != null"> |
| | | tax_rate = #{taxRate,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxExclusiveTotal != null"> |
| | | tax_exclusive_total = #{taxExclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="inboundPerson != null"> |
| | | inbound_person = #{inboundPerson,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.inventory.mapper.StockOutMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.inventory.pojo.StockOut"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="productId" column="product_id" jdbcType="INTEGER"/> |
| | | <result property="inboundTime" column="inbound_time" jdbcType="TIMESTAMP"/> |
| | | <result property="inboundBatch" column="inbound_batch" jdbcType="VARCHAR"/> |
| | | <result property="supplierName" column="supplier_name" jdbcType="VARCHAR"/> |
| | | <result property="inboundQuantity" column="inbound_quantity" jdbcType="INTEGER"/> |
| | | <result property="taxInclusivePrice" column="tax_inclusive_price" jdbcType="DECIMAL"/> |
| | | <result property="taxInclusiveTotal" column="tax_inclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="taxRate" column="tax_rate" jdbcType="DECIMAL"/> |
| | | <result property="taxExclusiveTotal" column="tax_exclusive_total" jdbcType="DECIMAL"/> |
| | | <result property="inboundPerson" column="inbound_person" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,product_id,inbound_time, |
| | | inbound_batch,supplier_name,inbound_quantity, |
| | | tax_inclusive_price,tax_inclusive_total,tax_rate, |
| | | tax_exclusive_total,inbound_person |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_out |
| | | where id = #{id,jdbcType=INTEGER} |
| | | <select id="selectStockOutBypage" resultType="com.ruoyi.inventory.dto.StockoutDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.inbound_time, |
| | | T1.inbound_batch, |
| | | T1.supplier_id, |
| | | T1.inbound_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.tenant_id, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T2.unit, |
| | | T3.supplier_name |
| | | FROM |
| | | stock_out T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockOutdto.supplierName != null and stockOutdto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockOutdto.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY T1.inbound_time DESC |
| | | </select> |
| | | <select id="selectAll" resultType="com.ruoyi.inventory.pojo.StockOut"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from stock_out |
| | | <select id="stockoutExportList" resultType="com.ruoyi.inventory.excel.StockOutExcelDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.product_id, |
| | | T1.inbound_time, |
| | | T1.inbound_batch, |
| | | T1.supplier_id, |
| | | T1.inbound_quantity, |
| | | T2.tax_inclusive_unit_price, |
| | | T2.tax_inclusive_total_price, |
| | | T2.tax_rate, |
| | | T2.tax_exclusive_total_price, |
| | | T1.inbound_person, |
| | | T1.tenant_id, |
| | | T2.product_category, |
| | | T2.specification_model, |
| | | T2.unit, |
| | | T3.supplier_name |
| | | FROM |
| | | stock_out T1 |
| | | INNER JOIN |
| | | product_record T2 |
| | | ON |
| | | T1.product_id = T2.product_id |
| | | INNER JOIN |
| | | supplier_manage T3 |
| | | ON |
| | | T1.supplier_id = T3.id |
| | | <where> |
| | | <if test="stockOutdto.supplierName != null and stockOutdto.supplierName != ''"> |
| | | AND T3.supplier_name LIKE CONCAT('%', #{stockOutdto.supplierName}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY T1.inbound_time DESC |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete from stock_out |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.inventory.pojo.StockOut" useGeneratedKeys="true"> |
| | | insert into stock_out |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="productId != null">product_id,</if> |
| | | <if test="inboundTime != null">inbound_time,</if> |
| | | <if test="inboundBatch != null">inbound_batch,</if> |
| | | <if test="supplierName != null">supplier_name,</if> |
| | | <if test="inboundQuantity != null">inbound_quantity,</if> |
| | | <if test="taxInclusivePrice != null">tax_inclusive_price,</if> |
| | | <if test="taxInclusiveTotal != null">tax_inclusive_total,</if> |
| | | <if test="taxRate != null">tax_rate,</if> |
| | | <if test="taxExclusiveTotal != null">tax_exclusive_total,</if> |
| | | <if test="inboundPerson != null">inbound_person,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=INTEGER},</if> |
| | | <if test="productId != null">#{productId,jdbcType=INTEGER},</if> |
| | | <if test="inboundTime != null">#{inboundTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="inboundBatch != null">#{inboundBatch,jdbcType=VARCHAR},</if> |
| | | <if test="supplierName != null">#{supplierName,jdbcType=VARCHAR},</if> |
| | | <if test="inboundQuantity != null">#{inboundQuantity,jdbcType=INTEGER},</if> |
| | | <if test="taxInclusivePrice != null">#{taxInclusivePrice,jdbcType=DECIMAL},</if> |
| | | <if test="taxInclusiveTotal != null">#{taxInclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="taxRate != null">#{taxRate,jdbcType=DECIMAL},</if> |
| | | <if test="taxExclusiveTotal != null">#{taxExclusiveTotal,jdbcType=DECIMAL},</if> |
| | | <if test="inboundPerson != null">#{inboundPerson,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.inventory.pojo.StockOut"> |
| | | update stock_out |
| | | <set> |
| | | <if test="productId != null"> |
| | | product_id = #{productId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="inboundTime != null"> |
| | | inbound_time = #{inboundTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="inboundBatch != null"> |
| | | inbound_batch = #{inboundBatch,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="supplierName != null"> |
| | | supplier_name = #{supplierName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="inboundQuantity != null"> |
| | | inbound_quantity = #{inboundQuantity,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="taxInclusivePrice != null"> |
| | | tax_inclusive_price = #{taxInclusivePrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxInclusiveTotal != null"> |
| | | tax_inclusive_total = #{taxInclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxRate != null"> |
| | | tax_rate = #{taxRate,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="taxExclusiveTotal != null"> |
| | | tax_exclusive_total = #{taxExclusiveTotal,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="inboundPerson != null"> |
| | | inbound_person = #{inboundPerson,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | | </mapper> |