| | |
| | | public static String database_username = "root"; |
| | | public static String database_password= "123456"; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "sales"; // 模å |
| | | public static String model = "production"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | */ |
| | | @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProductModel") |
| | | public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) throws IOException { |
| | | return toAjax(productModelService.addOrEditProductModel(productModelDto)); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Data |
| | | public class ProductAndModelDto { |
| | | |
| | | private List<CommonFile> SalesLedgerFiles; |
| | | |
| | | private Long routeId; |
| | | |
| | | private String routeName; |
| | | |
| | | /** |
| | | * è§æ ¼id |
| | | */ |
| | |
| | | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | private List<ProductStructureDto> productStructureList; |
| | | |
| | | private String productName; |
| | | |
| | | private List<String> tempFileIds; |
| | | private List<CommonFile> SalesLedgerFiles; |
| | | } |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿id") |
| | | private Long routeId; |
| | | |
| | | /** |
| | | * å
³è产åid |
| | | */ |
| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | */ |
| | | public interface IProductModelService extends IService<ProductModel> { |
| | | |
| | | int addOrEditProductModel(ProductModelDto productModelDto); |
| | | int addOrEditProductModel(ProductModelDto productModelDto) throws IOException; |
| | | |
| | | int delProductModel(Long[] ids); |
| | | |
| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.AbstractMap; |
| | |
| | | private final ProductMapper productMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private ProductModelMapper productModelMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | |
| | | private final TempFileServiceImpl tempFileService; |
| | | |
| | | @Override |
| | | public int addOrEditProductModel(ProductModelDto productModelDto) { |
| | | public int addOrEditProductModel(ProductModelDto productModelDto) throws IOException { |
| | | if(StringUtils.isEmpty(productModelDto.getProductName())){ |
| | | throw new RuntimeException("产ååç§°ä¸è½ä¸ºç©º"); |
| | | } |
| | |
| | | ProductModel productModel = new ProductModel(); |
| | | BeanUtils.copyProperties(productModelDto,productModel); |
| | | productModel.setProductId(product.getId()); |
| | | return productModelMapper.insert(productModel); |
| | | productModelMapper.insert(productModel); |
| | | if(CollectionUtils.isNotEmpty(productModelDto.getTempFileIds())){ |
| | | commonFileService.migrateTempFilesToFormal(productModel.getId(), productModelDto.getTempFileIds()); |
| | | } |
| | | return 1; |
| | | } else { |
| | | Product product1 = productMapper.selectById(productModelDto.getProductId()); |
| | | if(product1 != null){ |
| | | product1.setProductName(productModelDto.getProductName()); |
| | | productMapper.updateById(product1); |
| | | } |
| | | |
| | | if(CollectionUtils.isNotEmpty(productModelDto.getTempFileIds())){ |
| | | commonFileService.migrateTempFilesToFormal(productModelDto.getId(), productModelDto.getTempFileIds()); |
| | | } |
| | | return productModelMapper.updateById(productModelDto); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | try { |
| | | ExcelUtil<ProductModelExcelCopyDto> productModelExcelUtil = new ExcelUtil<>(ProductModelExcelCopyDto.class); |
| | | List<ProductModelExcelCopyDto> productModelList = productModelExcelUtil.importExcel(file.getInputStream()); |
| | | // List<Product> productList = productMapper.selectList(new LambdaQueryWrapper<Product>() |
| | | // .isNull(Product::getParentId)); |
| | | // if(CollectionUtils.isEmpty(productList)) { |
| | | // throw new RuntimeException("请å
æ·»å ç¶çº§äº§å"); |
| | | // } |
| | | if(CollectionUtils.isNotEmpty(productModelList)){ |
| | | // 2. æäº§ååç§°,å¾çº¸ç¼å·åç» |
| | | Map<Map.Entry<String, String>, List<ProductModelExcelCopyDto>> groupedByProductNameAndDrawingNumber = |
| | |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | private ProductMapper productMapper; |
| | | |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | private final CommonFileServiceImpl commonFileService; |
| | | |
| | | @Override |
| | | public List<ProductTreeDto> selectProductList(ProductDto productDto) { |
| | |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, ProductAndModelDto productDto) { |
| | | return AjaxResult.success(productModelMapper.listPage(page, productDto)); |
| | | IPage<ProductAndModelDto> productAndModelDtoIPage = productModelMapper.listPage(page, productDto); |
| | | productAndModelDtoIPage.getRecords().forEach(item -> { |
| | | item.setSalesLedgerFiles(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.PRODUCT_MODEL.getValue())); |
| | | }); |
| | | return AjaxResult.success(productAndModelDtoIPage); |
| | | } |
| | | |
| | | |
| | |
| | | SHIP(9),//åè´§å°è´¦ |
| | | INSPECTION_PRODUCTION_BEFORE(10), |
| | | INSPECTION_PRODUCTION_AFTER(11), |
| | | INSPECTION(12);//å·¡æ£ ç产å |
| | | INSPECTION(12),//å·¡æ£ ç产å |
| | | PRODUCT_MODEL(13),// 产ååå·å¾çº¸ |
| | | PRODUCT_ORDER(14); //ç产订å |
| | | |
| | | private final int value; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FileDto { |
| | | |
| | | @TableField(exist = false) |
| | | private List<String> tempFileIds; |
| | | @TableField(exist = false) |
| | | private List<CommonFile> SalesLedgerFiles; |
| | | |
| | | } |
| | |
| | | @ApiOperation("ä¿®æ¹å·¥èºè·¯çº¿") |
| | | @PutMapping () |
| | | public R update(@RequestBody ProcessRoute processRoute) { |
| | | return R.ok(processRouteService.updateById(processRoute)); |
| | | return R.ok(processRouteService.updateProcessRoute(processRoute)); |
| | | } |
| | | @ApiOperation("å é¤å·¥èºè·¯çº¿") |
| | | @DeleteMapping("/{ids}") |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | |
| | | @GetMapping("page") |
| | | public R page(ProductOrderDto productOrder, Page page) { |
| | | return R.ok(productOrderService.pageProductOrder(page, productOrder)); |
| | | } |
| | | |
| | | @ApiOperation("å·¥åå¼å§åæå") |
| | | @PostMapping("/startOrPause") |
| | | public R startOrPause(@RequestBody ProductOrderDto productOrder) { |
| | | return R.ok(productOrderService.startOrPause(productOrder)); |
| | | } |
| | | |
| | | @ApiOperation("ç»å®å·¥èºè·¯çº¿") |
| | |
| | | |
| | | @ApiOperation("æ°å¢ç产订å") |
| | | @PostMapping("/addProductOrder") |
| | | public R addProductOrder(@RequestBody ProductOrder productOrder) { |
| | | public R addProductOrder(@RequestBody ProductOrder productOrder) throws IOException { |
| | | return R.ok(productOrderService.addProductOrder(productOrder)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.oA.pojo.OaProject; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.dto.SysDeptAndUserDto; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.service.impl.ProductProcessServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | private ProductProcessServiceImpl productProcessService; |
| | | |
| | | /** |
| | | * è·åé¨é¨ç¨æ·æ |
| | | */ |
| | | @GetMapping("/listDeptUserTree") |
| | | @ApiOperation("è·åé¨é¨ç¨æ·æ ") |
| | | public AjaxResult listDeptUserTree() { |
| | | List<SysDeptAndUserDto> list = productProcessService.listDeptUserTree(); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return AjaxResult.warn("ææ æ°æ®"); |
| | | } |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢å·¥åº |
| | | * @param page |
| | | * @param productProcessDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Log(title = "å·¥åº-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("å·¥åº-å页æ¥è¯¢") |
| | |
| | | private ProductStructureService productStructureService; |
| | | |
| | | |
| | | @ApiOperation("BOMåéå表(æ ç¶çº§)") |
| | | @GetMapping("/listBybomIdIsParent/{bomId}") |
| | | public R listBybomIdIsParent(@PathVariable("bomId") Integer bomId){ |
| | | return R.ok(productStructureService.listBybomIdIsParent(bomId)); |
| | | } |
| | | |
| | | @ApiOperation("æ°å¢BOMåé") |
| | | @PostMapping() |
| | | public R addOrUpdate(@RequestBody ProductStructureDto productStructureDto){ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产订å-ç©ææ¸
å表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-26 10:34:23 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productStructureRecord") |
| | | public class ProductStructureRecordController { |
| | | |
| | | } |
| | |
| | | private String drawingNumber; |
| | | |
| | | private String bomNo; |
| | | |
| | | @ApiModelProperty("å·¥åºåç§°") |
| | | private String processName; |
| | | } |
| | |
| | | |
| | | private Long productId; |
| | | |
| | | private String userPower; |
| | | |
| | | |
| | | private String model; |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | |
| | | @ApiModelProperty(value = "åºåæ°é") |
| | | @Excel(name = "åºåæ°é") |
| | | private BigDecimal inventoryQuantity; |
| | | |
| | | @ApiModelProperty(value = "æä½ 1-å¼å§ 2-æå") |
| | | private Integer operation; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SysDeptAndUserDto{ |
| | | |
| | | /** é¨é¨ID */ |
| | | private Long deptId; |
| | | |
| | | /** ç¶é¨é¨ID */ |
| | | private Long parentId; |
| | | |
| | | /** ç¥çº§å表 */ |
| | | private String ancestors; |
| | | |
| | | /** é¨é¨åç§° */ |
| | | private String deptName; |
| | | |
| | | /** æ¾ç¤ºé¡ºåº */ |
| | | private Integer orderNum; |
| | | |
| | | /** è´è´£äºº */ |
| | | private String leader; |
| | | |
| | | /** èç³»çµè¯ */ |
| | | private String phone; |
| | | |
| | | /** é®ç®± */ |
| | | private String email; |
| | | |
| | | /** é¨é¨ç¶æ:0æ£å¸¸,1åç¨ */ |
| | | private String status; |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** ç¶é¨é¨åç§° */ |
| | | private String parentName; |
| | | |
| | | /** é¨é¨ç¼å· */ |
| | | private String deptNick; |
| | | |
| | | /** åå·¥æ°é */ |
| | | private Integer staffCount; |
| | | |
| | | /** é¨é¨ä¸çç¨æ·å表 */ |
| | | private List<SysUser> userList; |
| | | |
| | | /** åé¨é¨å表 */ |
| | | private List<SysDeptAndUserDto> childrenList; |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | |
| | | @Mapper |
| | | public interface ProductProcessRouteMapper extends BaseMapper<ProductProcessRoute> { |
| | | |
| | | ProcessRouteDto listMain(@Param("orderId") Long orderId); |
| | | List<ProcessRouteDto> listMain(@Param("orderId") Long orderId); |
| | | } |
| | |
| | | @Mapper |
| | | public interface ProductStructureMapper extends BaseMapper<ProductStructure> { |
| | | |
| | | List<ProductStructureDto> listBybomId(@Param("bomId") Integer bomId); |
| | | /** |
| | | * æ¥è¯¢BOMåé |
| | | * @param bomId |
| | | * @param isParent æ¯å¦éè¦ç¶çº§ true è¿åå级 false è¿ååç¶çº§ |
| | | * @return |
| | | */ |
| | | List<ProductStructureDto> listBybomId(@Param("bomId") Integer bomId,@Param("isParent") boolean isParent); |
| | | |
| | | List<ProductStructureDto> listBybomAndProcess(@Param("bomId") Integer bomId, @Param("processId") Long processId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.ruoyi.production.pojo.ProductStructureRecord; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产订å-ç©ææ¸
å表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-26 10:34:23 |
| | | */ |
| | | @Mapper |
| | | public interface ProductStructureRecordMapper extends BaseMapper<ProductStructureRecord> { |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @TableName("process_route") |
| | | @Data |
| | | @ApiModel(value = "processRoute", description = "å·¥èºè·¯çº¿ä¸»è¡¨") |
| | | public class ProcessRoute { |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿æç»") |
| | | private List<ProcessRouteItem> processRouteItems; |
| | | |
| | | @ApiModelProperty(value = "åºå·") |
| | | private Long id; |
| | |
| | | |
| | | @ApiModelProperty(value = "æè¿°") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿ç¼ç ") |
| | | private String processRouteCode; |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿åç§°") |
| | | private String processRouteName; |
| | | |
| | | @ApiModelProperty(value = "BOMçID") |
| | | private Integer bomId; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.FileDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("product_order") |
| | | public class ProductOrder implements Serializable { |
| | | public class ProductOrder extends FileDto implements Serializable { |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "ç产任å¡") |
| | | private List<ProductProcessRouteItem> processRouteItems; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "ç©ææ¸
å") |
| | | private List<ProductStructureRecord> productStructureRecords; |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty("äº¤ä»æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd",shape = JsonFormat.Shape.STRING,timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "äº¤ä»æ¥æ") |
| | | private LocalDate deliveryDate; |
| | | |
| | | @ApiModelProperty("ç¶æ å¾
ç产 çäº§ä¸ å·²å®æ") |
| | | @Excel(name = "ç¶æ") |
| | | private String status; |
| | | |
| | | } |
| | |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Excel(name = "ç¨æ·æé(,éå¼)") |
| | | private String userPower; |
| | | |
| | | /** |
| | | * å·¥èµå®é¢ |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 计åå¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åå¼å§æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planStartTime; |
| | | |
| | | /** |
| | | * 计åç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åç»ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate planEndTime; |
| | | |
| | | @ApiModelProperty(value = "ç产订åid(product_order_id)") |
| | | private Long productOrderId; |
| | |
| | | private Integer dragSort; |
| | | |
| | | @ApiModelProperty(value ="æ¯å¦è´¨æ£") |
| | | private Boolean isQuality; |
| | | private Boolean isQuality = false; |
| | | |
| | | /** |
| | | * ç¨æ·æé |
| | | */ |
| | | @ApiModelProperty(value = "ç¨æ·æ¥å·¥æé") |
| | | private String userPower; |
| | | |
| | | @ApiModelProperty(value = "è®¡åæ°") |
| | | private Integer planNum; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | 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.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产订å-ç©ææ¸
å表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-26 10:34:23 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("product_structure_record") |
| | | @ApiModel(value = "ProductStructureRecord对象", description = "ç产订å-ç©ææ¸
å表") |
| | | public class ProductStructureRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("ç¶èç¹ID") |
| | | private Long parentId; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("ç产订åid") |
| | | private Long productOrderId; |
| | | |
| | | @ApiModelProperty("å·¥åºid") |
| | | private Long processId; |
| | | |
| | | @ApiModelProperty("åä½äº§åºéè¦æ°é") |
| | | private BigDecimal unitQuantity; |
| | | |
| | | @ApiModelProperty("éæ±æ°é") |
| | | private BigDecimal demandedQuantity; |
| | | |
| | | @ApiModelProperty("åä½") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("bomçid") |
| | | private Long bomId; |
| | | } |
| | |
| | | private String workOrderNo; |
| | | |
| | | /** |
| | | * ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4已宿 |
| | | * ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ |
| | | */ |
| | | @ApiModelProperty(value = "ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4已宿") |
| | | @ApiModelProperty(value = "ç¶æ 1 å¾
确认 2 å¾
ç产 3已宿") |
| | | private Integer status; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "宿æ°é") |
| | | private BigDecimal completeQuantity; |
| | | |
| | | /** |
| | | * ç¨æ·æé |
| | | */ |
| | | @ApiModelProperty(value = "ç¨æ·æ¥å·¥æé") |
| | | private String userPower; |
| | | |
| | | @ApiModelProperty(value = "è®¡åæ°") |
| | | private Integer planNum; |
| | | |
| | | |
| | | } |
| | |
| | | Integer saveProcessRoute(ProcessRoute processRoute); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | int updateProcessRoute(ProcessRoute processRoute); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | |
| | | List<ProductStructureDto> listProcessBom(Long orderId); |
| | | |
| | | Boolean addProductOrder(ProductOrder productOrder); |
| | | Boolean addProductOrder(ProductOrder productOrder) throws IOException; |
| | | |
| | | Boolean delete(Long[] id); |
| | | |
| | | Object startOrPause(ProductOrderDto productOrder); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | |
| | | */ |
| | | public interface ProductProcessRouteService extends IService<ProductProcessRoute> { |
| | | |
| | | ProcessRouteDto listMain(Long orderId); |
| | | List<ProcessRouteDto> listMain(Long orderId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.ruoyi.production.pojo.ProductStructureRecord; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产订å-ç©ææ¸
å表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-26 10:34:23 |
| | | */ |
| | | public interface ProductStructureRecordService extends IService<ProductStructureRecord> { |
| | | |
| | | } |
| | |
| | | |
| | | List<ProductStructureDto> listBybomId(Integer bomId); |
| | | |
| | | List<ProductStructureDto> listBybomIdIsParent(Integer bomId); |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProcessRouteMapper; |
| | |
| | | |
| | | @Override |
| | | public Integer saveProcessRoute(ProcessRoute processRoute) { |
| | | String nickName = SecurityUtils.getLoginUser().getNickName(); |
| | | processRoute.setCreateBy(nickName); |
| | | this.save(processRoute); |
| | | String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String idStr = String.format("%06d", processRoute.getId()); |
| | | String newProductCode = "GYLX" + dateStr + idStr; |
| | | // æ´æ°æ°æ®åºä¸çproductCode |
| | | processRoute.setProcessRouteCode(newProductCode); |
| | | // æ°å¢åè¡¨æ°æ® |
| | | if(CollectionUtils.isNotEmpty(processRoute.getProcessRouteItems())){ |
| | | for (ProcessRouteItem processRouteItem : processRoute.getProcessRouteItems()) { |
| | | processRouteItem.setRouteId(processRoute.getId()); |
| | | processRouteItemMapper.insert(processRouteItem); |
| | | } |
| | | } |
| | | if(StringUtils.isEmpty(processRoute.getProcessRouteCode())){ |
| | | String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String idStr = String.format("%06d", processRoute.getId()); |
| | | String newProductCode = "GYLX" + dateStr + idStr; |
| | | // æ´æ°æ°æ®åºä¸çproductCode |
| | | processRoute.setProcessRouteCode(newProductCode); |
| | | } |
| | | return processRouteMapper.updateById(processRoute); |
| | | } |
| | | |
| | |
| | | public int batchDelete(List<Long> ids) { |
| | | //å
夿æ¯å¦å·²ç»å¼ç¨äº |
| | | List<ProductOrder> productOrders = productOrderMapper.selectList(Wrappers.<ProductOrder>lambdaQuery().in(ProductOrder::getRouteId, ids)); |
| | | if (productOrders.size()>0){ |
| | | if (CollectionUtils.isNotEmpty(productOrders)){ |
| | | throw new RuntimeException("该工èºè·¯çº¿ç产已å¼ç¨ï¼ä¸è½å é¤"); |
| | | } |
| | | //å é¤å·¥èºè·¯çº¿è¯¦æ
|
| | | processRouteItemMapper.delete(Wrappers.<ProcessRouteItem>lambdaQuery().in(ProcessRouteItem::getRouteId, ids)); |
| | | return processRouteMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public int updateProcessRoute(ProcessRoute processRoute) { |
| | | this.updateById(processRoute); |
| | | processRouteItemMapper.delete(Wrappers.<ProcessRouteItem>lambdaQuery().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | if(CollectionUtils.isNotEmpty(processRoute.getProcessRouteItems())){ |
| | | for (ProcessRouteItem processRouteItem : processRoute.getProcessRouteItems()) { |
| | | processRouteItem.setRouteId(processRoute.getId()); |
| | | processRouteItemMapper.insert(processRouteItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.basic.pojo.Product; |
| | |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | | * éå½ä¿å BOMï¼å
ä¿åç¶é¡¹ â ä¿åå项 â 建ç«å
³ç³» â éå½å项çå项 |
| | | * @param children å½åç¶é¡¹çå项å表 |
| | | * @return ä¿ååçç¶é¡¹äº§åID |
| | | */ |
| | | private void saveBomRecursive(List<BomImportDto> children,ProductBom bom,ProductModel rootModel,Map<String, Long> processMap) { |
| | | // 1. è·åchildrenä¸å项产åç¼å·ä¸ºç©ºçæ°æ® |
| | | List<BomImportDto> parentChildren = children |
| | | .stream() |
| | | .filter(child -> StringUtils.isEmpty(child.getChildCode())) |
| | | .collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(parentChildren)){ |
| | | throw new ServiceException("è¯·éæ©ç¶é¡¹äº§åç¼å·"); |
| | | } |
| | | BomImportDto parentId = parentChildren.get(0); // ç¶çº§æ°æ® |
| | | ProductStructure rootNode = new ProductStructure(); |
| | | rootNode.setBomId(bom.getId()); |
| | | rootNode.setParentId(null); // 顶屿²¡æç¶èç¹ |
| | | rootNode.setProductModelId(rootModel.getId()); |
| | | rootNode.setUnitQuantity(BigDecimal.ONE); |
| | | rootNode.setUnit(rootModel.getUnit()); |
| | | productStructureService.save(rootNode); |
| | | |
| | | // 2. éåå项ï¼é个å¤ç |
| | | for (BomImportDto child : children) { |
| | | // è·³è¿æ²¡æå项çç¶é¡¹ |
| | | if(StringUtils.isEmpty(child.getChildCode())){ |
| | | continue; |
| | | } |
| | | // è·åå项模åä¿¡æ¯ |
| | | ProductModel childModel = findModel(child.getChildName(), child.getChildSpec()); |
| | | |
| | | // æå
¥ç»æè¡¨ |
| | | ProductStructure node = new ProductStructure(); |
| | | node.setBomId(bom.getId()); |
| | | node.setParentId(rootNode.getId()); // ç¶èç¹ID |
| | | node.setProductModelId(childModel.getId()); |
| | | node.setUnitQuantity(child.getUnitQty()); |
| | | node.setUnit(childModel.getUnit()); |
| | | if (processMap.containsKey(child.getProcess())) { |
| | | node.setProcessId(processMap.get(child.getProcess())); |
| | | } |
| | | productStructureService.save(node); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult uploadBom(MultipartFile file) { |
| | |
| | | handleProcess(list); |
| | | Map<String, Long> processMap = productProcessService.list().stream() |
| | | .collect(Collectors.toMap(ProductProcess::getName, ProductProcess::getId, (k1, k2) -> k1)); |
| | | |
| | | // å建 BOM æ°æ® |
| | | BomImportDto first = list.get(0); |
| | | ProductModel rootModel = findModel(first.getParentName(), first.getParentSpec()); |
| | | ProductBom bom = new ProductBom(); |
| | | bom.setProductModelId(rootModel.getId()); |
| | | bom.setVersion("1.0"); |
| | | productBomMapper.insert(bom); |
| | | bom.setBomNo("BM." + String.format("%05d", bom.getId())); |
| | | productBomMapper.updateById(bom); |
| | | |
| | | // è®°å½å·²ç»æå
¥ç»æçèç¹ï¼Key = "åç§°+è§æ ¼", Value = structure_id |
| | | Map<String, Long> treePathMap = new HashMap<>(); |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | BomImportDto dto = list.get(i); |
| | | String parentKey = dto.getParentName() + "|" + dto.getParentSpec(); |
| | | String childKey = dto.getChildName() + "|" + dto.getChildSpec(); |
| | | |
| | | //å¤çæ ¹èç¹,第ä¸è¡ä¸å项为空 |
| | | if (i == 0 && StringUtils.isBlank(dto.getChildName())) { |
| | | ProductStructure rootNode = new ProductStructure(); |
| | | rootNode.setBomId(bom.getId()); |
| | | rootNode.setParentId(null); // 顶屿²¡æç¶èç¹ |
| | | rootNode.setProductModelId(rootModel.getId()); |
| | | rootNode.setUnitQuantity(BigDecimal.ONE); |
| | | rootNode.setUnit(rootModel.getUnit()); |
| | | productStructureService.save(rootNode); |
| | | |
| | | treePathMap.put(parentKey, rootNode.getId()); |
| | | continue; |
| | | } |
| | | |
| | | // å¤çåå±çº§èç¹ |
| | | // æ¾å°ç¶èç¹å¨æ°æ®åºéç ID |
| | | Long parentStructureId = treePathMap.get(parentKey); |
| | | if (parentStructureId == null) { |
| | | // 妿 Map éæ¾ä¸å°ï¼è¯´æ Excel 顺åºä¹±äºæè
æ°æ®æè¯¯ |
| | | throw new ServiceException("导å
¥å¤±è´¥: ç¶é¡¹[" + dto.getParentName() + "]å¿
é¡»å¨å
¶å项ä¹åå®ä¹"); |
| | | } |
| | | |
| | | // è·åå项模åä¿¡æ¯ |
| | | ProductModel childModel = findModel(dto.getChildName(), dto.getChildSpec()); |
| | | |
| | | // æå
¥ç»æè¡¨ |
| | | ProductStructure node = new ProductStructure(); |
| | | node.setBomId(bom.getId()); |
| | | node.setParentId(parentStructureId); // ç¶èç¹ID |
| | | node.setProductModelId(childModel.getId()); |
| | | node.setUnitQuantity(dto.getUnitQty()); |
| | | node.setUnit(childModel.getUnit()); |
| | | if (processMap.containsKey(dto.getProcess())) { |
| | | node.setProcessId(processMap.get(dto.getProcess())); |
| | | } |
| | | productStructureService.save(node); |
| | | |
| | | // æå½åå项记å½å° Map,ä½ä¸ºä»¥åæ´æ·±å±çº§çç¶é¡¹æ¥æ¾ä¾æ® |
| | | // åä¸ç¶é¡¹ä¸çååå项ä¸éè¦éå¤è®°å½ |
| | | treePathMap.put(childKey, node.getId()); |
| | | // 1. æç¶é¡¹ç¼ç åç» |
| | | Map<String, List<BomImportDto>> parentMap = list.stream() |
| | | .filter(bom -> StringUtils.isNotBlank(bom.getParentCode())) |
| | | .collect(Collectors.groupingBy(BomImportDto::getParentCode)); |
| | | // 2. éåææç¶é¡¹ï¼éå½ä¿å |
| | | for (Map.Entry<String, List<BomImportDto>> entry : parentMap.entrySet()) { |
| | | // å建 BOM æ°æ® |
| | | BomImportDto first = entry.getValue().get(0); |
| | | ProductModel rootModel = findModel(first.getParentName(), first.getParentSpec()); |
| | | ProductBom bom = new ProductBom(); |
| | | bom.setProductModelId(rootModel.getId()); |
| | | bom.setVersion("1.0"); |
| | | productBomMapper.insert(bom); |
| | | bom.setBomNo("BM." + String.format("%05d", bom.getId())); |
| | | productBomMapper.updateById(bom); |
| | | // å¤çbomåè¡¨æ°æ® |
| | | List<BomImportDto> children = entry.getValue(); |
| | | saveBomRecursive(children,bom,rootModel,processMap); |
| | | } |
| | | |
| | | return AjaxResult.success("BOM导å
¥æå"); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | 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.FileNameType; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.service.impl.StockInventoryServiceImpl; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | @Autowired |
| | | private ProductStructureRecordMapper productStructureRecordMapper; |
| | | |
| | | @Autowired |
| | | private ProcessRouteItemMapper processRouteItemMapper; |
| | |
| | | @Autowired |
| | | private StockInventoryServiceImpl stockInventoryService; |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | |
| | | @Override |
| | | public IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder) { |
| | | IPage<ProductOrderDto> productOrderDtoIPage = productOrderMapper.pageProductOrder(page, productOrder); |
| | |
| | | if(stockInventoryDtoIPage.getTotal() > 0){ |
| | | productOrderDto.setInventoryQuantity(stockInventoryDtoIPage.getRecords().get(0).getQualitity()); |
| | | } |
| | | // éä»¶ |
| | | productOrderDto.setSalesLedgerFiles(commonFileService.getFileListByBusinessId(productOrderDto.getId() |
| | | , FileNameType.PRODUCT_ORDER.getValue())); |
| | | }); |
| | | return productOrderDtoIPage; |
| | | } |
| | |
| | | productProcessRoute.setProductOrderId(productOrder.getId()); |
| | | productProcessRoute.setBomId(processRoute.getBomId()); |
| | | productProcessRouteMapper.insert(productProcessRoute); |
| | | // ç»å®ç产bomæ¸
å |
| | | List<ProductStructureRecord> productStructureDtos = productOrder.getProductStructureRecords(); |
| | | productStructureDtos.forEach(item ->{ |
| | | item.setProductOrderId(productOrder.getId()); |
| | | productStructureRecordMapper.insert(item); |
| | | }); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | List<ProductProcessRouteItem> processRouteItems = productOrder.getProcessRouteItems(); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | for (ProductProcessRouteItem productProcessRouteItem : processRouteItems) { |
| | | productProcessRouteItem.setProductModelId(productOrder.getProductModelId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | productProcessRouteItem.setDragSort(processRouteItem.getDragSort()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectMax(datePrefix); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = "GD" + String.format("%s%03d", datePrefix, sequenceNumber); |
| | | String workOrderNoStr = getWorkOrderNoStr(lastWorkOrder, datePrefix); // å·¥åå· |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | ProductOrder order = productOrderMapper.selectById(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setPlanStartTime(productProcessRouteItem.getPlanStartTime()); |
| | | productWorkOrder.setPlanEndTime(productProcessRouteItem.getPlanEndTime()); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrder.setUserPower(productProcessRouteItem.getUserPower()); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | } |
| | | return productOrderMapper.updateById(productOrder); |
| | | } |
| | | |
| | | @NotNull |
| | | private static String getWorkOrderNoStr(ProductWorkOrder lastWorkOrder, String datePrefix) { |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = "GD" + String.format("%s%03d", datePrefix, sequenceNumber); |
| | | return workOrderNoStr; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean addProductOrder(ProductOrder productOrder) { |
| | | public Boolean addProductOrder(ProductOrder productOrder) throws IOException { |
| | | String string = generateNextOrderNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); |
| | | productOrder.setNpsNo(string); |
| | | productOrder.setCompleteQuantity(BigDecimal.ZERO); |
| | | productOrder.setStatus("å¾
ç产"); |
| | | this.save(productOrder); |
| | | if (ObjectUtils.isNotEmpty(productOrder.getRouteId())) { |
| | | this.bindingRoute(productOrder); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(productOrder.getTempFileIds())){ |
| | | commonFileService.migrateTempFilesToFormal(productOrder.getId(), productOrder.getTempFileIds()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean delete(Long[] ids) { |
| | | |
| | | //æ¹éæ¥è¯¢productOrder |
| | | List<ProductOrder> productOrders = productOrderMapper.selectList( |
| | | new LambdaQueryWrapper<ProductOrder>() |
| | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getId, ids)); |
| | | // å é¤éä»¶ |
| | | commonFileService.deleteByBusinessIds(Arrays.asList(ids), FileNameType.PRODUCT_ORDER.getValue()); |
| | | // å é¤ç产订å-ç©ææ¸
å |
| | | productStructureRecordMapper.delete(new LambdaQueryWrapper<ProductStructureRecord>() |
| | | .in(ProductStructureRecord::getProductOrderId, ids)); |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Object startOrPause(ProductOrderDto item) { |
| | | ProductOrder productOrder = productOrderMapper.selectById(item.getId()); |
| | | if(productOrder == null){ |
| | | throw new ServiceException("ç产订åä¸åå¨"); |
| | | } |
| | | int i; |
| | | if(item.getOperation().equals(1)){ |
| | | i = 2; |
| | | } else { |
| | | i = 1; |
| | | } |
| | | productOrder.setStatus(item.getOperation() == 1 ? "ç产ä¸" : "å¾
ç产"); |
| | | productOrderMapper.updateById(productOrder); |
| | | List<ProductWorkOrder> productWorkOrders = productWorkOrderMapper.selectList(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .eq(ProductWorkOrder::getProductOrderId, productOrder.getId())); |
| | | if(CollectionUtils.isNotEmpty(productWorkOrders)){ |
| | | |
| | | productWorkOrders.forEach(productWorkOrder -> { |
| | | productWorkOrder.setStatus(i); |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | }); |
| | | } |
| | | return "æä½æå"; |
| | | } |
| | | |
| | | //è·åå½åç产订åå· |
| | | public String getMaxOrderNoByDate(String datePrefix) { |
| | | QueryWrapper<ProductOrder> queryWrapper = new QueryWrapper<>(); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | |
| | | @Override |
| | | public ProcessRouteDto listMain(Long orderId) { |
| | | public List<ProcessRouteDto> listMain(Long orderId) { |
| | | return productProcessRouteMapper.listMain(orderId); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.dto.SysDeptAndUserDto; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.pojo.ProductProcessRouteItem; |
| | | import com.ruoyi.production.service.ProductProcessService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | private ProcessRouteItemMapper processRouteItemMapper; |
| | | @Autowired |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductProcessDto> listPage(Page page, ProductProcessDto productProcessDto) { |
| | |
| | | productProcessMapper.deleteBatchIds(ids); |
| | | return null; |
| | | } |
| | | |
| | | public List<SysDeptAndUserDto> listDeptUserTree() { |
| | | return buildDeptUserTree(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æå»ºå®æ´çé¨é¨-ç¨æ·æ å½¢ç»æ |
| | | */ |
| | | public List<SysDeptAndUserDto> buildDeptUserTree() { |
| | | // 1. æ¥è¯¢æææ ¹é¨é¨ï¼parent_id = 0ï¼ |
| | | List<SysDeptAndUserDto> rootDeptList = sysDeptMapper.selectChildrenDeptByParentId(0L); |
| | | |
| | | // 2. éå½æå»ºæ¯ä¸ªæ ¹é¨é¨çåèç¹ï¼å¹¶æè½½ç¨æ· |
| | | for (SysDeptAndUserDto rootDept : rootDeptList) { |
| | | buildChildrenDept(rootDept); |
| | | loadDeptUser(rootDept); |
| | | } |
| | | |
| | | return rootDeptList; |
| | | } |
| | | |
| | | /** |
| | | * éå½æå»ºåé¨é¨ |
| | | */ |
| | | private void buildChildrenDept(SysDeptAndUserDto parentDept) { |
| | | // æ¥è¯¢å½åé¨é¨çåé¨é¨ |
| | | List<SysDeptAndUserDto> childrenDept = sysDeptMapper.selectChildrenDeptByParentId(parentDept.getDeptId()); |
| | | if (childrenDept == null || childrenDept.isEmpty()) { |
| | | parentDept.setChildrenList(new ArrayList<>()); |
| | | return; |
| | | } |
| | | |
| | | // 为æ¯ä¸ªåé¨é¨éå½æå»ºä¸çº§ï¼å¹¶æè½½ç¨æ· |
| | | for (SysDeptAndUserDto childDept : childrenDept) { |
| | | buildChildrenDept(childDept); |
| | | loadDeptUser(childDept); |
| | | } |
| | | |
| | | parentDept.setChildrenList(childrenDept); |
| | | } |
| | | |
| | | /** |
| | | * 为é¨é¨å è½½å
³èçç¨æ· |
| | | */ |
| | | private void loadDeptUser(SysDeptAndUserDto dept) { |
| | | // æ¥è¯¢é¨é¨å
³èçç¨æ·ID |
| | | List<Long> userIdList = sysUserDeptMapper.selectUserIdByDeptId(dept.getDeptId()); |
| | | if (userIdList == null || userIdList.isEmpty()) { |
| | | dept.setUserList(new ArrayList<>()); |
| | | return; |
| | | } |
| | | |
| | | // æ ¹æ®ç¨æ·IDæ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | List<SysUser> userList = sysUserMapper.selectUserListByIds(userIdList); |
| | | dept.setUserList(userList); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.ruoyi.production.pojo.ProductStructureRecord; |
| | | import com.ruoyi.production.mapper.ProductStructureRecordMapper; |
| | | import com.ruoyi.production.service.ProductStructureRecordService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * ç产订å-ç©ææ¸
å表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-26 10:34:23 |
| | | */ |
| | | @Service |
| | | public class ProductStructureRecordServiceImpl extends ServiceImpl<ProductStructureRecordMapper, ProductStructureRecord> implements ProductStructureRecordService { |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listBybomId(Integer bomId) { |
| | | List<ProductStructureDto> list = productStructureMapper.listBybomId(bomId); |
| | | List<ProductStructureDto> list = productStructureMapper.listBybomId(bomId,false); |
| | | |
| | | Map<Long, ProductStructureDto> map = new HashMap<>(); |
| | | for (ProductStructureDto node : list) { |
| | |
| | | return tree; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listBybomIdIsParent(Integer bomId) { |
| | | return productStructureMapper.listBybomId(bomId,true); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | if (productProcessRouteItem == null) { |
| | | throw new RuntimeException("å·¥èºè·¯çº¿é¡¹ä¸åå¨"); |
| | | } |
| | | // è·å订åç已宿工å |
| | | List<ProductWorkOrder> productWorkOrderList = productWorkOrderMapper.selectList(Wrappers.<ProductWorkOrder>lambdaQuery() |
| | | .eq(ProductWorkOrder::getProductOrderId, productProcessRouteItem.getProductOrderId()) |
| | | .eq(ProductWorkOrder::getStatus, 3)); |
| | | if(CollectionUtils.isEmpty(productWorkOrderList)){ |
| | | productWorkOrderList = new ArrayList<>(); |
| | | } |
| | | //å½åå
·ä½å·¥åº |
| | | ProductProcess productProcess = productProcessMapper.selectById(productProcessRouteItem.getProcessId()); |
| | | //å·¥èºè·¯çº¿ä¸å½åå·¥åºå¯¹åºç产åºè§æ ¼åå· |
| | |
| | | |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductModelId(productStructureDto.getProductModelId()); |
| | | productionProductInput.setQuantity(productStructureDto.getUnitQuantity().multiply(dto.getQuantity())); |
| | | productionProductInput.setQuantity(dto.getQuantity()); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | stockUtils.substractStock(productStructureDto.getProductModelId(), productionProductInput.getQuantity(), StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode(), productionProductMain.getId()); |
| | |
| | | //对åºçè¿ç¨æ£æè
åºåæ£ |
| | | int inspectType = 1; |
| | | String process = productProcess.getName();//å·¥åº |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | if (productWorkOrderList.size() == productProcessRouteItems.size() - 1) { |
| | | //æåä¸éå·¥åºçæåºåæ£ |
| | | inspectType = 2; |
| | | process = null; |
| | |
| | | productWorkOrder.setCompleteQuantity(productWorkOrder.getCompleteQuantity().add(productQty)); |
| | | if (ObjectUtils.isNull(productWorkOrder.getActualStartTime())) { |
| | | productWorkOrder.setActualStartTime(LocalDate.now());//å®é
å¼å§æ¶é´ |
| | | productWorkOrder.setStatus(2); |
| | | } |
| | | if (productWorkOrder.getCompleteQuantity().compareTo(productWorkOrder.getPlanQuantity()) == 0) { |
| | | productWorkOrder.setActualEndTime(LocalDate.now());//å®é
ç»ææ¶é´ |
| | | productWorkOrder.setStatus(3); |
| | | } |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | //ç产订å |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (ObjectUtils.isNull(productOrder.getStartTime())) { |
| | | productOrder.setStartTime(LocalDateTime.now());//å¼å§æ¶é´ |
| | | productOrder.setStatus("ç产ä¸"); |
| | | } |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | if (productWorkOrderList.size() == productProcessRouteItems.size() - 1) { |
| | | //å¦ææ¯æåä¸éå·¥åºæ¥å·¥ä¹åç产订å宿æ°é+ |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().add(productQty)); |
| | | if (productOrder.getCompleteQuantity().compareTo(productOrder.getQuantity()) == 0) { |
| | | productOrder.setEndTime(LocalDateTime.now());//ç»ææ¶é´ |
| | | productOrder.setStatus("已宿"); |
| | | } |
| | | } |
| | | productOrderMapper.updateById(productOrder); |
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.ruoyi.production.dto.SysDeptAndUserDto;
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | |
| | | * @return
|
| | | */
|
| | | Long maxLevelDeptId(Long deptId);
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢ææææé¨é¨ï¼æªå é¤ãç¶ææ£å¸¸ï¼
|
| | | */
|
| | | List<SysDeptAndUserDto> selectAllDept();
|
| | |
|
| | | /**
|
| | | * æ ¹æ®é¨é¨IDæ¥è¯¢åé¨é¨
|
| | | */
|
| | | List<SysDeptAndUserDto> selectChildrenDeptByParentId(@Param("parentId") Long parentId);
|
| | | }
|
| | |
| | | public interface SysUserDeptMapper extends BaseMapper<SysUserDept> { |
| | | |
| | | List<SysUserDeptVo> userLoginFacotryList(@Param("userDeptVo") SysUserDeptVo userDeptVo); |
| | | |
| | | /** |
| | | * æ ¹æ®é¨é¨IDæ¥è¯¢å
³èçç¨æ·IDå表 |
| | | */ |
| | | List<Long> selectUserIdByDeptId(@Param("deptId") Long deptId); |
| | | } |
| | |
| | | List<Long> getUserByRole(@Param("role") String role);
|
| | |
|
| | | List<Long> getUserByPerms(@Param("perms") List<String> perms);
|
| | |
|
| | | /**
|
| | | * æ ¹æ®ç¨æ·IDå表æ¥è¯¢ç¨æ·ä¿¡æ¯
|
| | | */
|
| | | List<SysUser> selectUserListByIds(@Param("userIds") List<Long> userIds);
|
| | | }
|
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | |
| | | Path formalFilePath = formalDirPath.resolve(formalFilename); |
| | | |
| | | try { |
| | | // æ§è¡æä»¶è¿ç§»ï¼ä½¿ç¨ååæä½ç¡®ä¿å®å
¨æ§ï¼ |
| | | // Files.move( |
| | | // Paths.get(tempFile.getTempPath()), |
| | | // formalFilePath, |
| | | // StandardCopyOption.REPLACE_EXISTING, |
| | | // StandardCopyOption.ATOMIC_MOVE |
| | | // ); |
| | | // ååç§»å¨å¤±è´¥ï¼ä½¿ç¨å¤å¶+å é¤ |
| | | Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING); |
| | | Files.deleteIfExists(Paths.get(tempFile.getTempPath())); |
| | |
| | | if (processRoute == null) { |
| | | return R.fail("请å
设置工èºè·¯çº¿"); |
| | | } |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomId(processRoute.getBomId()); |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomId(processRoute.getBomId(),false); |
| | | if (productStructureDtos.isEmpty()) { |
| | | return R.fail("请å
设置产åç»æ"); |
| | | } |
| | |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | pm.drawing_number as drawingNumber, |
| | | pm.product_type as productType |
| | | pm.product_type as productType, |
| | | pr.id as routeId, |
| | | pr.process_route_name as routeName |
| | | from product_model pm |
| | | left join product p on p.id = pm.product_id |
| | | left join product p on p.id = pm.product_id |
| | | left join process_route pr on pr.id = pm.route_id |
| | | <where> |
| | | <if test="req.productName != null and req.productName != ''"> |
| | | and p.product_name like concat('%',#{req.productName},'%') |
| | |
| | | pm.model, |
| | | p.product_name, |
| | | pm.unit, |
| | | pm.drawing_number |
| | | pm.drawing_number, |
| | | pp.user_power |
| | | from |
| | | process_route_item pri |
| | | left join product_model pm on pri.product_model_id = pm.id |
| | |
| | | </resultMap> |
| | | |
| | | <select id="pageProcessRouteDto" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select ps.*, p.product_name,pm.product_id,pm.model,pb.bom_no,pm.drawing_number |
| | | select ps.*, p.product_name,pm.product_id,pm.model,pb.bom_no,pm.drawing_number,group_concat(pp.name) as processName |
| | | from process_route ps |
| | | left join process_route_item ppi on ps.id = ppi.route_id |
| | | left join product_process pp on ppi.process_id = pp.id |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | |
| | | <if test="c.model != null and c.model != ''"> |
| | | and pm.model like concat('%',#{c.model},'%') |
| | | </if> |
| | | <if test="c.processRouteCode != null and c.processRouteCode != ''"> |
| | | and ps.process_route_code like concat('%',#{c.processRouteCode},'%') |
| | | </if> |
| | | <if test="c.processRouteName != null and c.processRouteName != ''"> |
| | | and ps.process_route_name like concat('%',#{c.processRouteName},'%') |
| | | </if> |
| | | <if test="c.processName != null and c.processName != ''"> |
| | | and pp.name like concat('%',#{c.processName},'%') |
| | | </if> |
| | | </where> |
| | | group by ps.id |
| | | order by ps.id asc |
| | | </select> |
| | | </mapper> |
| | |
| | | left join product p on pm.product_id = p.id)A |
| | | where 1=1 |
| | | <if test="c.productModelName != null"> |
| | | and productModelName = #{c.productModelName} |
| | | and product_model_name = #{c.productModelName} |
| | | </if> |
| | | <if test="c.productModelId != null"> |
| | | and product_model_id = #{c.productModelId} |
| | | </if> |
| | | <if test="c.productName != null"> |
| | | and productName = #{c.productName} |
| | | and product_name = #{c.productName} |
| | | </if> |
| | | <if test="c.bomNo != null"> |
| | | and bom_no = #{c.bomNo} |
| | |
| | | ps.product_model_id, |
| | | ps.process_id, |
| | | ps.unit_quantity, |
| | | ps.unit_quantity * po.quantity as demandedQuantity, |
| | | ps.demanded_quantity as demandedQuantity, |
| | | ps.unit, |
| | | p.product_name, |
| | | pm.drawing_number, |
| | | pp.name as process_name, |
| | | pm.product_id, |
| | | pm.model, |
| | | pb.bom_no |
| | | pm.model |
| | | from |
| | | product_structure ps |
| | | product_structure_record ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join product_process_route ppr on ps.bom_id = ppr.bom_id |
| | | left join product_order po on po.id = ppr.product_order_id |
| | | where ppr.product_order_id = #{orderId} |
| | | where ps.product_order_id = #{orderId} |
| | | order by ps.id |
| | | </select> |
| | | |
| | |
| | | <result column="product_order_id" property="productOrderId"/> |
| | | </resultMap> |
| | | <select id="listMain" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select ppr.*, p.product_name, pm.product_id, pm.model, pb.bom_no,pm.drawing_number |
| | | select ppr.*, p.product_name, pm.product_id, pm.model, pb.bom_no,pm.drawing_number,pp.name as processName |
| | | from product_process_route ppr |
| | | left join product_process_route_item ppri on ppr.id = ppri.product_route_id |
| | | left join product_process pp on pp.id = ppri.process_id |
| | | left join product_bom pb on ppr.bom_id = pb.id |
| | | left join product_model pm on ppr.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where ppr.product_order_id = #{orderId} |
| | | group by ppri.id |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | where ps.bom_id = #{bomId} |
| | | <if test="isParent"> |
| | | and ps.parent_id is not null |
| | | </if> |
| | | order by ps.id |
| | | </select> |
| | | <select id="listBybomAndProcess" resultType="com.ruoyi.production.dto.ProductStructureDto"> |
| | |
| | | pm.model, |
| | | pm.drawing_number |
| | | from |
| | | product_structure ps |
| | | product_structure_record ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | where ps.bom_id = #{bomId} |
| | | and ps.process_id=#{processId} |
| | | where ps.process_id=#{processId} |
| | | order by ps.id |
| | | </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.production.mapper.ProductStructureRecordMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductStructureRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="product_order_id" property="productOrderId" /> |
| | | <result column="process_id" property="processId" /> |
| | | <result column="unit_quantity" property="unitQuantity" /> |
| | | <result column="demanded_quantity" property="demandedQuantity" /> |
| | | <result column="unit" property="unit" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="bom_id" property="bomId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | LEFT JOIN product_process pp ON pp.id = ppri.process_id |
| | | LEFT JOIN product_model pm ON pm.id = ppri.product_model_id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | where 1=1 |
| | | where pwo.status != 1 |
| | | <if test="c.workOrderNo != null and c.workOrderNo != ''"> |
| | | and pwo.work_order_no like concat('%',#{c.workOrderNo},'%') |
| | | </if> |
| | |
| | | FROM DepartmentHierarchy |
| | | WHERE parent_id = 100; |
| | | </select> |
| | | <select id="selectAllDept" resultType="com.ruoyi.production.dto.SysDeptAndUserDto"> |
| | | SELECT dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, |
| | | status, del_flag, create_by, create_time, update_by, update_time, dept_nick |
| | | FROM sys_dept |
| | | WHERE del_flag = '0' AND status = '0' |
| | | ORDER BY order_num ASC |
| | | </select> |
| | | <select id="selectChildrenDeptByParentId" resultType="com.ruoyi.production.dto.SysDeptAndUserDto"> |
| | | SELECT dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, |
| | | status, del_flag, create_by, create_time, update_by, update_time, dept_nick |
| | | FROM sys_dept |
| | | WHERE parent_id = #{parentId} AND del_flag = '0' AND status = '0' |
| | | ORDER BY order_num ASC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectUserIdByDeptId" resultType="java.lang.Long"> |
| | | SELECT user_id FROM sys_user_dept WHERE dept_id = #{deptId} |
| | | </select> |
| | | </mapper> |
| | |
| | | ) |
| | | </if> |
| | | </select> |
| | | <select id="selectUserListByIds" resultType="com.ruoyi.project.system.domain.SysUser"> |
| | | SELECT user_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, |
| | | password, status, del_flag, login_ip, login_date, create_by, create_time, |
| | | update_by, update_time, remark, tenant_id |
| | | FROM sys_user |
| | | WHERE user_id IN |
| | | <foreach collection="userIds" item="userId" open="(" separator="," close=")"> |
| | | #{userId} |
| | | </foreach> |
| | | AND del_flag = '0' AND status = '0' |
| | | </select> |
| | | |
| | | </mapper> |