Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://localhost:3306/product-inventory-management-new-pro"; |
| | | public static String database_url = "jdbc:mysql://localhost:3300/product-inventory-management-new-pro"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "123456"; |
| | | public static String database_password= "root"; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "technology"; // 模å |
| | | public static String model = "sales"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.approve.bean.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ApproveNodeDto extends ApproveNode { |
| | | |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOS; |
| | | } |
| | |
| | | |
| | | |
| | | CUSTOMIZATION_STOCK_IN("0", "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT("1", "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN("2", "ç产æ¥å·¥-å
¥åº"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT("3", "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_SCRAP("4", "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | PRODUCTION_SCRAP("5", "ç产æ¥å·¥-æ¥åº"), |
| | | QUALITYINSPECT_STOCK_IN("6", "è´¨æ£-åæ ¼å
¥åº"), |
| | | PURCHASE_STOCK_IN("7", "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT("8", "éå®-åºåº"), |
| | | CUSTOMIZATION_UNSTOCK_IN("9", "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT("10", "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | DEFECTIVE_PASS("11", "ä¸åæ ¼-è®©æ¥æ¾è¡"), |
| | | QUALITYINSPECT_UNSTOCK_IN("12", "è´¨æ£-ä¸åæ ¼å
¥åº"), |
| | | SALE_SHIP_STOCK_OUT("13", "éå®-åè´§åºåº"), |
| | | RETURN_HE_IN("14", "éå®éè´§-åæ ¼å
¥åº"), |
| | | PICK_RETURN_IN("20", "éå®éè´§-åæ ¼å
¥åº"); |
| | | RETURN_UNSTOCK_IN("15", "éå®éè´§-ä¸åæ ¼å
¥åº"), |
| | | PICK_RETURN_IN("20", "éå®éè´§-åæ ¼å
¥åº"), |
| | | PURCHASE_RETURN_STOCK_OUT("21", "éè´éè´§"); |
| | | |
| | | |
| | | |
| | | |
| | | private final String code; |
| | |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | } |
| | | |
| | | public void substractStock(Long productModelId, BigDecimal quantity, String recordType, Long recordId, String batchNo) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryDto.setBatchNo(batchNo); |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | } |
| | | |
| | | //ä¸åæ ¼åºåå é¤ |
| | | public void deleteStockInRecord(Long recordId, String recordType) { |
| | | StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>() |
| | |
| | | // æ·»å åè´§æ¶æ¯ |
| | | req.setShippingNo(sh); |
| | | req.setStatus("å¾
å®¡æ ¸"); |
| | | boolean save = shippingInfoService.save(req); |
| | | boolean save = shippingInfoService.add(req); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * åè´§å°è´¦è¯¦æ
表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-06 10:02:10 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/shippingProductDetail") |
| | | public class ShippingProductDetailController { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | |
| | | private List<Long> batchNo; |
| | | private List<ShippingProductDetail> batchNoDetailList; |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * åè´§å°è´¦è¯¦æ
表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-06 10:02:10 |
| | | */ |
| | | @Mapper |
| | | public interface ShippingProductDetailMapper extends BaseMapper<ShippingProductDetail> { |
| | | |
| | | } |
| | |
| | | //é对éå®å°è´¦ï¼æ¯å¦ç产 |
| | | private Boolean isProduction; |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal noQuantity; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | | * åè´§å°è´¦è¯¦æ
表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-06 10:02:10 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("shipping_product_detail") |
| | | @ApiModel(value = "ShippingProductDetail对象", description = "åè´§å°è´¦è¯¦æ
表") |
| | | public class ShippingProductDetail implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®id |
| | | */ |
| | | @ApiModelProperty("主é®id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * åºå表id |
| | | */ |
| | | @ApiModelProperty("åºå表id") |
| | | private Long stockInventoryId; |
| | | |
| | | /** |
| | | * æ¹æ¬¡å· |
| | | */ |
| | | @ApiModelProperty("æ¹æ¬¡å·") |
| | | private String batchNo; |
| | | |
| | | /** |
| | | * åè´§çæ°é |
| | | */ |
| | | @ApiModelProperty("åè´§çæ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * åè´§å°è´¦id |
| | | */ |
| | | @ApiModelProperty("åè´§å°è´¦id") |
| | | private Long shippingInfoId; |
| | | |
| | | @ApiModelProperty("产ååå·id") |
| | | private Long productModelId; |
| | | } |
| | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById( Long shippingId); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | boolean add(ShippingInfoDto req); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.service; |
| | | |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * åè´§å°è´¦è¯¦æ
表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-06 10:02:10 |
| | | */ |
| | | public interface ShippingProductDetailService extends IService<ShippingProductDetail> { |
| | | |
| | | } |
| | |
| | | import com.ruoyi.technology.mapper.TechnologyBomStructureMapper; |
| | | import com.ruoyi.technology.mapper.TechnologyRoutingMapper; |
| | | import com.ruoyi.technology.pojo.TechnologyRouting; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | if(shippingInfo != null){ |
| | | item.setShippingDate(shippingInfo.getShippingDate()); |
| | | item.setShippingCarNumber(shippingInfo.getShippingCarNumber()); |
| | | item.setShippingStatus(shippingInfo.getStatus()); |
| | | item.setExpressCompany(shippingInfo.getExpressCompany()); |
| | | item.setExpressNumber(shippingInfo.getExpressNumber()); |
| | | } |
| | |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.mapper.ShippingProductDetailMapper; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final ApproveProcessServiceImpl approveProcessService; |
| | | private final FileUtil fileUtil; |
| | | private final ShippingProductDetailMapper shippingProductDetailMapper; |
| | | |
| | | @Override |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | |
| | | } |
| | | //æ£ååºå |
| | | if(!"å·²åè´§".equals(byId.getStatus())){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | // SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | List<ShippingProductDetail> shippingProductDetails = shippingProductDetailMapper.selectList(new LambdaQueryWrapper<ShippingProductDetail>().eq(ShippingProductDetail::getShippingInfoId, req.getId())); |
| | | if (CollectionUtils.isEmpty(shippingProductDetails)) { |
| | | throw new RuntimeException("åè´§ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | for (ShippingProductDetail shippingProductDetail : shippingProductDetails) { |
| | | stockUtils.substractStock(shippingProductDetail.getProductModelId(), shippingProductDetail.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId(), shippingProductDetail.getBatchNo()); |
| | | } |
| | | } |
| | | byId.setExpressNumber(req.getExpressNumber()); |
| | | byId.setExpressCompany(req.getExpressCompany()); |
| | |
| | | // å é¤åè´§å®¡æ¹ |
| | | if(CollectionUtils.isNotEmpty(shippingInfos)){ |
| | | for (ShippingInfo shippingInfo : shippingInfos){ |
| | | ApproveProcess one = approveProcessService.getOne(new LambdaQueryWrapper<ApproveProcess>() |
| | | List<ApproveProcess> one = approveProcessService.list(new LambdaQueryWrapper<ApproveProcess>() |
| | | .like(ApproveProcess::getApproveReason, shippingInfo.getShippingNo())); |
| | | if(one != null){ |
| | | approveProcessService.delByIds(Collections.singletonList(one.getId())); |
| | | List<Long> list = one.stream().map(ApproveProcess::getId).toList(); |
| | | approveProcessService.delByIds(list); |
| | | } |
| | | } |
| | | } |
| | | //å é¤åè´§æç» |
| | | shippingProductDetailMapper.delete(new LambdaQueryWrapper<ShippingProductDetail>().in(ShippingProductDetail::getShippingInfoId, ids)); |
| | | |
| | | return this.removeBatchByIds(ids); |
| | | return this.removeByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public List<ShippingInfo> getShippingInfoByCustomerName(String customerName) { |
| | | return shippingInfoMapper.getShippingInfoByCustomerName(customerName); |
| | | } |
| | | |
| | | @Override |
| | | public boolean add(ShippingInfoDto req) { |
| | | this.save( req); |
| | | req.getBatchNoDetailList().forEach(item -> item.setShippingInfoId(req.getId())); |
| | | shippingProductDetailMapper.insert(req.getBatchNoDetailList()); |
| | | return true; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.service.impl; |
| | | |
| | | import com.ruoyi.sales.pojo.ShippingProductDetail; |
| | | import com.ruoyi.sales.mapper.ShippingProductDetailMapper; |
| | | import com.ruoyi.sales.service.ShippingProductDetailService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * åè´§å°è´¦è¯¦æ
表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-06 10:02:10 |
| | | */ |
| | | @Service |
| | | public class ShippingProductDetailServiceImpl extends ServiceImpl<ShippingProductDetailMapper, ShippingProductDetail> implements ShippingProductDetailService { |
| | | |
| | | } |
| | |
| | | public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) { |
| | | return R.ok(stockInventoryService.thawStock(stockInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getByModelId") |
| | | @Operation(summary = "æ ¹æ®äº§åè§æ ¼IDè·åå
¥åºè®°å½") |
| | | public R getByModelId(Long productModelId) { |
| | | return R.ok(stockInventoryService.getByModelId(productModelId)); |
| | | } |
| | | } |
| | |
| | | BigDecimal selectPendingOutQuantity(@Param("productModelId") Long productModelId, @Param("batchNo") String batchNo, @Param("type") String type); |
| | | |
| | | List<StockInventory> listSelectableBatchNoByProductModelIds(@Param("productModelIds") List<Long> productModelIds); |
| | | |
| | | List<StockInventory> getByModelId(@Param("productModelId") Long productModelId); |
| | | } |
| | |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | Boolean frozenStock(StockInventoryDto stockInventoryDto); |
| | | |
| | | Boolean thawStock(StockInventoryDto stockInventoryDto); |
| | | |
| | | List<StockInventory> getByModelId(Long modelId); |
| | | } |
| | |
| | | stockInventory.setLockedQuantity(stockInventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity())); |
| | | return this.updateById(stockInventory); |
| | | } |
| | | |
| | | @Override |
| | | public List<StockInventory> getByModelId(Long modelId) { |
| | | return stockInventoryMapper.getByModelId(modelId); |
| | | } |
| | | } |
| | |
| | | SELECT |
| | | T1.*, |
| | | CASE |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1 |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1 |
| | | ELSE 0 |
| | | END as has_sufficient_stock |
| | | END as has_sufficient_stock, |
| | | (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) as no_quantity, |
| | | CASE |
| | | WHEN (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN 'å¾
åè´§' |
| | | ELSE 'å·²åè´§' |
| | | END as shippingStatus |
| | | FROM |
| | | sales_ledger_product T1 |
| | | LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id |
| | | LEFT JOIN ( |
| | | SELECT product_model_id, SUM(qualitity) as qualitity, SUM(locked_quantity) as locked_quantity |
| | | FROM stock_inventory |
| | | GROUP BY product_model_id |
| | | ) t2 ON T1.product_model_id = t2.product_model_id |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_product_id, IFNULL(SUM(spd.quantity), 0) as shipped_quantity |
| | | FROM shipping_info si |
| | | LEFT JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id |
| | | GROUP BY sales_ledger_product_id |
| | | ) t3 ON t3.sales_ledger_product_id = T1.id |
| | | <where> |
| | | <if test="salesLedgerProduct.salesLedgerId != null"> |
| | | AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId} |
| | |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | SELECT |
| | | slp.*, |
| | | si.shipping_no, |
| | | GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM shipping_info si |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.sales.mapper.ShippingProductDetailMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.sales.pojo.ShippingProductDetail"> |
| | | <id column="id" property="id" /> |
| | | <result column="stock_inventory_id" property="stockInventoryId" /> |
| | | <result column="batch_no" property="batchNo" /> |
| | | <result column="quantity" property="quantity" /> |
| | | <result column="shipping_info_id" property="shippingInfoId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | and (si.qualitity - ifnull(si.locked_quantity, 0)) > 0 |
| | | order by si.product_model_id, si.batch_no |
| | | </select> |
| | | <select id="getByModelId" resultType="com.ruoyi.stock.pojo.StockInventory"> |
| | | select spd.id, spd.batch_no, spd.locked_quantity, (spd.qualitity - IFNULL(sd.qualitity, 0)) as qualitity |
| | | from stock_inventory spd |
| | | left join (select stock_inventory_id, sum(quantity) as qualitity |
| | | from shipping_product_detail |
| | | group by stock_inventory_id) as sd on sd.stock_inventory_id = spd.id |
| | | where product_model_id = #{productModelId} |
| | | </select> |
| | | |
| | | </mapper> |