Merge remote-tracking branch 'origin/jtwy' into jtwy
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | alter table product_work_order |
| | | add product_order_id bigint not null default 0 comment 'ç产订åid'; |
| | |
| | | create_time datetime null comment 'å½å
¥æ¶é´', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | work_order_no varchar(255) not null default '' comment 'å·¥åç¼å·', |
| | | plan_start_time datetime null comment '计åå¼å§æ¶é´', |
| | | plan_end_time datetime null comment '计åç»ææ¶é´', |
| | | actual_start_time datetime null comment 'å®é
å¼å§æ¶é´', |
| | | actual_end_time datetime null comment 'å®é
ç»ææ¶é´', |
| | | status int not null default 0 comment 'ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产 ', |
| | | tenant_id bigint not null comment 'ç§æ·id' |
| | | ); |
| | |
| | | * å建æ¶é´ |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * è®¾å¤æ¥ä¿®id |
| | | */ |
| | | private Long deviceRepairId; |
| | | /** |
| | | * æ¥ä¿®éé¢ |
| | | */ |
| | | private BigDecimal maintenancePrice; |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | |
| | | |
| | | @Autowired |
| | | private CommonFileMapper fileMapper; |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | |
| | | |
| | | public ApproveProcess getApproveById(String id) { |
| | |
| | | approveProcess.setApproveUserCurrentId(approveNode1.getApproveNodeUserId()); |
| | | approveProcess.setApproveUserCurrentName(approveNode1.getApproveNodeUser()); |
| | | } |
| | | if (approveProcess.getApproveStatus() != 1){ |
| | | if(approveProcess.getApproveStatus().equals(2) || approveProcess.getApproveStatus().equals(3) || approveProcess.getApproveStatus().equals(4)){ |
| | | approveProcess.setApproveOverTime(new Date()); |
| | | } |
| | | approveProcessMapper.updateById(approveProcess); |
| | | |
| | | DeviceRepair deviceRepair = deviceRepairMapper.selectById(approveProcess.getDeviceRepairId()); |
| | | if(deviceRepair == null) throw new RuntimeException("è®¾å¤æ¥ä¿®ä¸åå¨"); |
| | | if(approveProcess.getApproveStatus().equals(2)){ |
| | | // åæ |
| | | deviceRepair.setStatus(1); |
| | | }else if(approveProcess.getApproveStatus().equals(3)){ |
| | | // æç» |
| | | deviceRepair.setStatus(2); |
| | | } |
| | | deviceRepairMapper.updateById(deviceRepair); |
| | | // ç»å®éä»¶ |
| | | if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){ |
| | | tempFileService.migrateTempFilesToFormal(approveNode.getId(), approveNode.getTempFileIds(), FileNameType.ApproveNode.getValue()); |
| | |
| | | if(CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("å®¡æ ¸ç¨æ·ä¸åå¨"); |
| | | if(sysDept == null) throw new RuntimeException("é¨é¨ä¸åå¨"); |
| | | if(sysUser == null) throw new RuntimeException("ç³è¯·äººä¸åå¨"); |
| | | // String today = LocalDate.now().format(DATE_FORMAT); |
| | | String approve_process = OrderUtils.countTodayByCreateTime(approveProcessMapper, ""); |
| | | // Long approveId = dailyRedisCounter.incrementAndGetByDb(); |
| | | // String formattedCount = String.format("%03d", approveId); |
| | | String today = LocalDate.now().format(DATE_FORMAT); |
| | | Long approveId = dailyRedisCounter.incrementAndGetByDb(); |
| | | String formattedCount = String.format("%03d", approveId); |
| | | //æµç¨ ID |
| | | // String approveID = today + formattedCount; |
| | | String approveID = today + formattedCount; |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | BeanUtils.copyProperties(approveProcessVO, approveProcess); |
| | | approveProcess.setApproveId(approve_process); |
| | | approveProcess.setApproveId(approveID); |
| | | approveProcess.setApproveUser(approveProcessVO.getApproveUser()); |
| | | approveProcess.setApproveUserName(sysUser.getNickName()); |
| | | approveProcess.setApproveDeptId(approveProcessVO.getApproveDeptId()); |
| | |
| | | approveProcess.setApproveUserNames(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.joining(","))); |
| | | approveProcess.setApproveTime(StringUtils.isEmpty(approveProcessVO.getApproveTime()) ? null : dateFormat.parse(approveProcessVO.getApproveTime())); |
| | | approveProcess.setApproveReason(approveProcessVO.getApproveReason()); |
| | | approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId()); |
| | | approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice()); |
| | | approveProcess.setApproveOverTime(null); |
| | | approveProcess.setApproveStatus(0); |
| | | approveProcess.setApproveDelete(0); |
| | |
| | | } |
| | | save(approveProcess); |
| | | //åå§å审æ¹èç¹ |
| | | approveNodeService.initApproveNodes(approveProcessVO.getApproveUserIds(),approve_process,approveProcessVO.getApproveDeptId()); |
| | | approveNodeService.initApproveNodes(approveProcessVO.getApproveUserIds(),approveID,approveProcessVO.getApproveDeptId()); |
| | | // éä»¶ç»å® |
| | | tempFileService.migrateTempFilesToFormal(approveProcess.getId(), approveProcessVO.getTempFileIds(), FileNameType.ApproveProcess.getValue()); |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class ApproveProcessVO { |
| | | |
| | | /** |
| | | * ä¸´æ¶æä»¶idå表 |
| | | */ |
| | | private List<String> tempFileIds; |
| | | |
| | | /** |
| | | * å®¡æ¹æµç¨id |
| | | */ |
| | | private Long id; |
| | | |
| | | |
| | | private String approveId; |
| | | /** |
| | | * 审æ¹é¨é¨id |
| | | */ |
| | | private Long approveDeptId; |
| | | |
| | | private String approveDeptName; |
| | | |
| | | /** |
| | | * å®¡æ¹æ¶é´ |
| | | */ |
| | | private String approveTime; |
| | | |
| | | /** |
| | | * ç³è¯·äººid |
| | | */ |
| | | // ç³è¯·äºº |
| | | private Long approveUser; |
| | | |
| | | /** |
| | | * 审æ¹äººidå表 |
| | | */ |
| | | // 审æ¹äºº |
| | | private String approveUserIds; |
| | | |
| | | /** |
| | | * 审æ¹çç± |
| | | */ |
| | | private String approveReason; |
| | | |
| | | @Excel(name = "å¼å§æ¶é´", dateFormat = "yyyy-MM-dd",width = 30) |
| | |
| | | * 审æ¹ç±»å |
| | | */ |
| | | private Integer approveType; |
| | | /** |
| | | * è®¾å¤æ¥ä¿®id |
| | | */ |
| | | private Long deviceRepairId; |
| | | /** |
| | | * æ¥ä¿®éé¢ |
| | | */ |
| | | private BigDecimal maintenancePrice; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.SupplierManageFile; |
| | | import com.ruoyi.basic.service.SupplierManageFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä¾åºåéä»¶ |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/basic/supplierManageFile") |
| | | public class SupplierManageFileController { |
| | | |
| | | |
| | | @Resource |
| | | private SupplierManageFileService supplierManageFileService; |
| | | |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | * @param supplierManageFile |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.save(supplierManageFile)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return AjaxResult.success(supplierManageFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | *å页æ¥è¯¢ |
| | | * @param page |
| | | * @param supplierManageFile |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.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.pojo.SupplierManageFile; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | @Mapper |
| | | public interface SupplierManageFileMapper extends BaseMapper<SupplierManageFile> { |
| | | |
| | | |
| | | IPage<SupplierManageFile> supplierManageFileListPage(Page page, @Param("supplierManageFile") SupplierManageFile supplierManageFile); |
| | | } |
| | |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | /** 客æ·åç±»ï¼é¶å®å®¢æ·ï¼è¿éåå®¢æ· */ |
| | | |
| | | @Excel(name = "客æ·åç±»") |
| | | private String customerType; |
| | | |
| | | /** |
| | | * 纳ç¨äººè¯å«å· |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | // @Excel(name = "ç»´æ¤æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDate maintainTime; |
| | | @Excel(name = "æ¯å¦ç½åå") |
| | | @ApiModelProperty(value = "æ¯å¦ç½ååï¼0æ¯ 1å¦ï¼") |
| | | private Integer isWhite; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * ä¾åºå管ç--éä»¶ |
| | | * supplier_manage_file |
| | | */ |
| | | @TableName(value = "supplier_manage_file") |
| | | @Data |
| | | public class SupplierManageFile implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æä»¶åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "æä»¶è·¯å¾") |
| | | private String url; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å°") |
| | | private int fileSize; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºåID") |
| | | @NotBlank(message = "ä¾åºåidä¸è½ä¸ºç©º!") |
| | | private Long supplierId; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.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.pojo.SupplierManageFile; |
| | | |
| | | public interface SupplierManageFileService extends IService<SupplierManageFile> { |
| | | |
| | | |
| | | IPage<SupplierManageFile> supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile); |
| | | } |
| | |
| | | // 2. æå»ºæ¥è¯¢æ¡ä»¶ï¼å¢å¼ºç©ºå¼å®å
¨ï¼ |
| | | LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>(); |
| | | String customerName = customer.getCustomerName(); |
| | | String customerType = customer.getCustomerType(); |
| | | if (StringUtils.isNotBlank(customerName)) { |
| | | queryWrapper.like(Customer::getCustomerName, customerName); |
| | | } |
| | | if (StringUtils.isNotBlank(customerType)) { |
| | | queryWrapper.like(Customer::getCustomerType, customerType); |
| | | } |
| | | |
| | | // 3. æ§è¡å页æ¥è¯¢ï¼ä¿çå页å
æ°æ®ï¼ |
| | | IPage<Customer> customerPage = customerMapper.selectPage(page, queryWrapper); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.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.mapper.SupplierManageFileMapper; |
| | | import com.ruoyi.basic.pojo.SupplierManageFile; |
| | | import com.ruoyi.basic.service.SupplierManageFileService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class SupplierManageFileServiceImpl extends ServiceImpl<SupplierManageFileMapper, SupplierManageFile> implements SupplierManageFileService { |
| | | |
| | | private SupplierManageFileMapper supplierManageFileMapper; |
| | | |
| | | @Override |
| | | public IPage<SupplierManageFile> supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return supplierManageFileMapper.supplierManageFileListPage(page, supplierManageFile); |
| | | } |
| | | } |
| | |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceLedgerService.export(response, ids); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @GetMapping("/report/forms") |
| | | @ApiOperation("æ¥è¯¢è®¾å¤å°è´¦å¾è¡¨æ°æ®") |
| | | public AjaxResult report() { |
| | | return AjaxResult.success(deviceLedgerService.report()); |
| | | } |
| | | @PostMapping("import") |
| | | @ApiModelProperty("导å
¥è®¾å¤å°è´¦") |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | |
| | | package com.ruoyi.device.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "è®¾å¤æ¥ä¿®ç®¡ç") |
| | | @RequestMapping("/device/repair") |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | @Autowired |
| | | private IApproveProcessService approveProcessService; |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiModelProperty("æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) throws Exception { |
| | | deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | ApproveProcessVO approveProcessVO = new ApproveProcessVO(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | // è·åå½åç»å½å
¬å¸ |
| | | Long tenantId = loginUser.getTenantId(); |
| | | if(null != tenantId){ |
| | | LambdaQueryWrapper<DeviceRepair> QueryWrapper = new LambdaQueryWrapper<>(); |
| | | QueryWrapper.eq(DeviceRepair::getDeviceLedgerId,deviceRepair.getDeviceLedgerId()) |
| | | .eq(DeviceRepair::getRemark,deviceRepair.getRemark()) |
| | | .eq(DeviceRepair::getDeviceName,deviceRepair.getDeviceName()) |
| | | .eq(DeviceRepair::getApproverId,deviceRepair.getApproverId()) |
| | | .eq(DeviceRepair::getRepairTime,deviceRepair.getRepairTime()); |
| | | DeviceRepair one = deviceRepairService.getOne(QueryWrapper); |
| | | if(ObjectUtils.isEmpty(one)){ |
| | | return AjaxResult.error("è®¾å¤æ¥ä¿®ä¸åå¨"); |
| | | } |
| | | //è·åå½åç»å½é¨é¨id |
| | | approveProcessVO.setApproveDeptId(tenantId); |
| | | //è·åå½åç»å½ç¨æ·id |
| | | approveProcessVO.setApproveUser(loginUser.getUserId()); |
| | | //è·åå½åæ¶é´ |
| | | approveProcessVO.setApproveTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | approveProcessVO.setApproveType(4); |
| | | approveProcessVO.setApproveUserIds(deviceRepair.getApproverId().toString()); |
| | | approveProcessVO.setApproveReason(deviceRepair.getRemark()); |
| | | approveProcessVO.setDeviceRepairId(one.getId()); |
| | | approveProcessVO.setMaintenancePrice(deviceRepair.getMaintenancePrice()); |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @ApiModelProperty("æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("å é¤è®¾å¤æ¥ä¿®") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | LambdaQueryWrapper<ApproveProcess> QueryWrapper = new LambdaQueryWrapper<>(); |
| | | QueryWrapper.in(ApproveProcess::getDeviceRepairId,ids); |
| | | List<ApproveProcess> approveProcessList = approveProcessService.list(QueryWrapper); |
| | | if(!approveProcessList.isEmpty()){ |
| | | approveProcessList.forEach(approveProcess -> { |
| | | if (approveProcess.getApproveStatus() != 0){ |
| | | //æåºå¼å¸¸ |
| | | throw new RuntimeException("ææ£å¨å¤çä¸çå®¡æ¹æµç¨ï¼ä¸è½å é¤"); |
| | | } |
| | | }); |
| | | } |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.device.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 设å¤èµäº§ä¿¡æ¯Dto-èµäº§æ¥è¡¨ |
| | | */ |
| | | @Data |
| | | public class DeviceAssetInfoDto { |
| | | /** |
| | | * è®¾å¤æ»æ° |
| | | */ |
| | | private Integer totalEquipment; |
| | | /** |
| | | * èµäº§åå¼ |
| | | */ |
| | | private BigDecimal totalOriginalValue; |
| | | /** |
| | | * ç´¯è®¡ææ§ |
| | | */ |
| | | private BigDecimal totalDepreciation; |
| | | /** |
| | | * åå¼ |
| | | */ |
| | | private BigDecimal totalNetValue; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @ApiModelProperty("ç»´ä¿®ä»·æ ¼") |
| | | private String maintenancePrice; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import nonapi.io.github.classgraph.json.Id; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦id") |
| | | private Long deviceLedgerId; |
| | | |
| | | @ApiModelProperty("设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @ApiModelProperty("设å¤åå·") |
| | | private String deviceModel; |
| | | |
| | | @ApiModelProperty("æ¥ä¿®æ¶é´") |
| | |
| | | @ApiModelProperty("ç»´ä¿®ç»æ") |
| | | private String maintenanceResult; |
| | | |
| | | @ApiModelProperty("ç¶æ 0 å¾
ç»´ä¿® 1å®ç» 2 失败") |
| | | @ApiModelProperty("ç¶æ:0å®¡æ ¸ä¸,1å®¡æ ¸éè¿,2å®¡æ ¸å¤±è´¥,3ç»´ä¿®ä¸,4ç»´ä¿®éè¿,5维修失败") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | |
| | | @ApiModelProperty("ç§æ·id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @ApiModelProperty("ç»´ä¿®ä»·æ ¼") |
| | | private BigDecimal maintenancePrice; |
| | | @ApiModelProperty("审æ¹äººid") |
| | | private Integer approverId; |
| | | } |
| | |
| | | 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.device.dto.DeviceAssetInfoDto; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | | Boolean importData(MultipartFile file) throws IOException; |
| | | DeviceAssetInfoDto report(); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.device.dto.DeviceAssetInfoDto; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.execl.DeviceLedgerExeclDto; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | |
| | | return true; |
| | | } |
| | | @Override |
| | | public DeviceAssetInfoDto report() { |
| | | List<DeviceLedger> list = deviceLedgerMapper.selectList(null); |
| | | DeviceAssetInfoDto deviceAssetInfoDto = new DeviceAssetInfoDto(); |
| | | deviceAssetInfoDto.setTotalEquipment(list.stream().map(DeviceLedger::getNumber).reduce(BigDecimal.ZERO, BigDecimal::add).intValue()); |
| | | deviceAssetInfoDto.setTotalOriginalValue(list.stream().map(DeviceLedger::getTaxIncludingPriceTotal).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | deviceAssetInfoDto.setTotalNetValue(list.stream().map(DeviceLedger::getUnTaxIncludingPriceTotal).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | deviceAssetInfoDto.setTotalDepreciation(deviceAssetInfoDto.getTotalOriginalValue().subtract(deviceAssetInfoDto.getTotalNetValue())); |
| | | return deviceAssetInfoDto; |
| | | } |
| | | } |
| | |
| | | // .ge(SalesLedger::getEntryDate, startDate) |
| | | // .lt(SalesLedger::getEntryDate, endDate) |
| | | ); |
| | | BigDecimal receivableMoney = salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal receivableMoney = salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal receivableMoney = sumAmount(salesLedgers, SalesLedger::getContractAmount); |
| | | // åºä» |
| | | List<PurchaseLedger> procurementRecords = purchaseLedgerMapper.selectList(new LambdaQueryWrapper<PurchaseLedger>() |
| | | // .ge(PurchaseLedger::getEntryDate, startDate) |
| | | // .lt(PurchaseLedger::getEntryDate, endDate) |
| | | ); |
| | | BigDecimal payableMoney = procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal payableMoney = procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal payableMoney = sumAmount(procurementRecords, PurchaseLedger::getContractAmount); |
| | | // 颿¶ |
| | | List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>() |
| | | // .ge(ReceiptPayment::getReceiptPaymentDate, startDate) |
| | | // .lt(ReceiptPayment::getReceiptPaymentDate, endDate) |
| | | ); |
| | | BigDecimal advanceMoney = receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal advanceMoney = receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal advanceMoney = sumAmount(receiptPayments, ReceiptPayment::getReceiptPaymentAmount); |
| | | // é¢ä» |
| | | List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new LambdaQueryWrapper<PaymentRegistration>() |
| | | // .ge(PaymentRegistration::getPaymentDate, startDate) |
| | | // .lt(PaymentRegistration::getPaymentDate, endDate) |
| | | ); |
| | | BigDecimal prepayMoney = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // BigDecimal prepayMoney = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal prepayMoney = sumAmount(paymentRegistrations, PaymentRegistration::getCurrentPaymentAmount); |
| | | StatisticsReceivablePayableDto statisticsReceivablePayableDto = new StatisticsReceivablePayableDto(); |
| | | statisticsReceivablePayableDto.setPayableMoney(payableMoney.subtract(prepayMoney)); |
| | | statisticsReceivablePayableDto.setReceivableMoney(receivableMoney.subtract(advanceMoney)); |
| | |
| | | |
| | | return statisticsReceivablePayableDto; |
| | | } |
| | | |
| | | public static <T> BigDecimal sumAmount(List<T> list, java.util.function.Function<T, BigDecimal> amountExtractor) { |
| | | return list.stream() |
| | | // æåé颿¶ï¼å°nullæ¿æ¢ä¸ºBigDecimal.ZERO |
| | | .map(item -> Optional.ofNullable(amountExtractor.apply(item)).orElse(BigDecimal.ZERO)) |
| | | // ç´¯å ï¼åå§å¼ä¸º0ï¼é¿å
空æµé®é¢ |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | } |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.procurementrecord.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/7/7 14:32 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "éè´å¼å¸¸è®°å½") |
| | | @RequestMapping("/procurementExceptionRecord") |
| | | public class ProcurementExceptionRecordController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private ProcurementExceptionRecordMapper procurementExceptionRecordMapper; |
| | | |
| | | @PostMapping("/add") |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.insert(procurementExceptionRecord)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Transactional |
| | | public AjaxResult updatePro(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.updateById(procurementExceptionRecord)); |
| | | } |
| | | } |
| | |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/listReport") |
| | | @ApiOperation(value = "æ¥è¯¢åºåå¾è¡¨æ°æ®") |
| | | public AjaxResult listReport() { |
| | | return AjaxResult.success(procurementRecordService.getReportList()); |
| | | } |
| | | @GetMapping("/listPageByProduction") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-å
¥åºæ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "å
¥åºæ¥è¯¢") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * åè´§æ ¸ç®ä¿¡æ¯Dto-èµäº§æ¥è¡¨ |
| | | */ |
| | | @Data |
| | | public class InventoryInformationDto { |
| | | /** |
| | | * æ»åºåæ°é |
| | | */ |
| | | private Integer totalInventoryCount; |
| | | /** |
| | | * æ»åºåéé¢ |
| | | */ |
| | | private BigDecimal totalInventoryValue; |
| | | /** |
| | | * åºåå卿°é |
| | | */ |
| | | private Integer inventoryChangeCount; |
| | | /** |
| | | * åºååå¨éé¢ |
| | | */ |
| | | private BigDecimal inventoryChangeValue; |
| | | } |
| | |
| | | private Integer type; |
| | | |
| | | private String typeName; |
| | | private Integer purchaseLedgerId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord; |
| | | |
| | | |
| | | public interface ProcurementExceptionRecordMapper extends BaseMapper<ProcurementExceptionRecord> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @TableName("procurement_exception_record") |
| | | @Data |
| | | @Builder |
| | | public class ProcurementExceptionRecord { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * éè´å°è´¦id |
| | | */ |
| | | private Integer purchaseLedgerId; |
| | | /** |
| | | * å¼å¸¸æè¿° |
| | | */ |
| | | private String exceptionReason; |
| | | |
| | | /** |
| | | * å¼å¸¸æ°é |
| | | */ |
| | | private BigDecimal exceptionNum; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
|
| | | */ |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | } |
| | |
| | | int updateManagementByCustom(ProcurementManagementUpdateDto procurementDto); |
| | | |
| | | BigDecimal getProcurementAmount(Long salesProductId); |
| | | InventoryInformationDto getReportList(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public InventoryInformationDto getReportList() { |
| | | InventoryInformationDto inventoryInformationDto = new InventoryInformationDto(); |
| | | IPage<ProcurementPageDto> procurementPageDtoIPage = this.listPage(new Page<>(1, -1), new ProcurementPageDto()); |
| | | if(CollectionUtils.isEmpty(procurementPageDtoIPage.getRecords())){ |
| | | return inventoryInformationDto; |
| | | } |
| | | // è®¡ç®æ»åºåæ°é |
| | | inventoryInformationDto.setTotalInventoryCount(procurementPageDtoIPage.getRecords().stream() |
| | | .map(ProcurementPageDto::getInboundNum0) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .intValue()); |
| | | // è®¡ç®æ»åºåéé¢-ProcurementPageDtoéæ¯ä¸ªå¯¹è±¡çinboundNum0å¼åtaxInclusiveUnitPriceçä¹ç§¯ï¼ä¹åç¸å å¾å°æ»åºåéé¢ |
| | | BigDecimal totalInventoryValue = procurementPageDtoIPage.getRecords().stream() |
| | | // è¿æ»¤ç©ºå¯¹è±¡ï¼é¿å
NPE |
| | | .filter(Objects::nonNull) |
| | | // å¤çæ¯ä¸ªå¯¹è±¡ç空å¼ï¼null转为0 |
| | | .map(dto -> { |
| | | // å
¥åºæ°éï¼null â 0 |
| | | BigDecimal inboundNum0 = Optional.ofNullable(dto.getInboundNum0()).orElse(BigDecimal.ZERO); |
| | | // å«ç¨åä»·ï¼null â 0 |
| | | BigDecimal taxInclusiveUnitPrice = Optional.ofNullable(dto.getTaxInclusiveUnitPrice()).orElse(BigDecimal.ZERO); |
| | | // 计ç®å个对象çåºåéé¢ï¼æ°é à å«ç¨åä»· |
| | | return inboundNum0.multiply(taxInclusiveUnitPrice); |
| | | }) |
| | | // ææå个é颿±åï¼åå§å¼ä¸º0 |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 设置æ»åºåéé¢ |
| | | inventoryInformationDto.setTotalInventoryValue(totalInventoryValue); |
| | | // 计ç®åºåå卿°é-ProcurementPageDtoéæ¯ä¸ªå¯¹è±¡çinboundNumå¼åinboundNum0å¼çå·®å¼ï¼ä¹åç¸å å¾å°åºåå卿°é |
| | | inventoryInformationDto.setInventoryChangeCount(procurementPageDtoIPage.getRecords().stream() |
| | | // è¿æ»¤ç©ºå¯¹è±¡ï¼é¿å
NPE |
| | | .filter(Objects::nonNull) |
| | | // å¤çæ¯ä¸ªå¯¹è±¡ç空å¼ï¼null转为0 |
| | | .map(dto -> { |
| | | // å
¥åºæ°éï¼null â 0 |
| | | BigDecimal inboundNum = Optional.ofNullable(dto.getInboundNum()).orElse(BigDecimal.ZERO); |
| | | // å¾
åºåºæ°éï¼null â 0 |
| | | BigDecimal inboundNum0 = Optional.ofNullable(dto.getInboundNum0()).orElse(BigDecimal.ZERO); |
| | | // 计ç®å个对象çåºåå卿°éï¼æ°é - å¾
åºåºæ°é |
| | | return inboundNum.subtract(inboundNum0); |
| | | }) |
| | | // ææå个å卿°éæ±åï¼åå§å¼ä¸º0 |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add) |
| | | .intValue()); |
| | | // 计ç®åºååå¨éé¢ProcurementPageDtoéæ¯ä¸ªå¯¹è±¡çtaxInclusiveTotalPriceå¼çå |
| | | BigDecimal inventoryChangeValue = procurementPageDtoIPage.getRecords().stream() |
| | | // è¿æ»¤ç©ºå¯¹è±¡ï¼é¿å
NPE |
| | | .filter(Objects::nonNull) |
| | | // å¤çæ¯ä¸ªå¯¹è±¡ç空å¼ï¼null转为0 |
| | | .map(dto -> { |
| | | // å«ç¨æ»ä»·ï¼null â 0 |
| | | BigDecimal taxInclusiveTotalPrice = Optional.ofNullable(dto.getTaxInclusiveTotalPrice()).orElse(BigDecimal.ZERO); |
| | | // 计ç®å个对象çå
¥åºåºåéé¢ï¼å«ç¨æ»ä»· |
| | | return taxInclusiveTotalPrice; |
| | | }) |
| | | // ææå个åå¨é颿±åï¼åå§å¼ä¸º0 |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 设置åºååå¨éé¢ |
| | | inventoryInformationDto.setInventoryChangeValue(inventoryChangeValue.subtract(totalInventoryValue)); |
| | | return inventoryInformationDto; |
| | | } |
| | | @Override |
| | | public IPage<ProcurementPageDto> listPageByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProduction(page, procurementDto); |
| | | List<ProcurementPageDto> procurementPageDtos = procurementPageDtoIPage.getRecords(); |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProcessRouteItemDto; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductProcessRouteItem; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.production.service.ProductProcessRouteItemService; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RequestMapping("productProcessRoute") |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RequestMapping("/productProcessRoute") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @Api(tags = "ç产工èºè·¯çº¿") |
| | | public class ProductProcessRouteItemController { |
| | | @Autowired |
| | | |
| | | private ProductProcessRouteItemService productProcessRouteItemService; |
| | | |
| | | private ProductWorkOrderService productWorkOrderService; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | @GetMapping("list") |
| | | @ApiOperation("æ ¹æ®Idæ¥è¯¢å·¥èºé¡¹ç®") |
| | |
| | | return R.ok(productProcessRouteItemService.listItem(orderId)); |
| | | } |
| | | |
| | | @PostMapping () |
| | | @ApiOperation("æ°å¢ä¿®æ¹") |
| | | @PostMapping("/updateRouteItem") |
| | | @ApiOperation("æ¹éæ°å¢ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addOrUpdate(@RequestBody ProductProcessRouteItemDto processRouteItemDto) { |
| | | productProcessRouteItemService.remove(new QueryWrapper<ProductProcessRouteItem>().lambda().eq(ProductProcessRouteItem::getRouteId, processRouteItemDto.getRouteId())); |
| | | return R.ok(productProcessRouteItemService.saveBatch(processRouteItemDto.getProcessRouteItem())); |
| | | List<ProductProcessRouteItem> items = processRouteItemDto.getProcessRouteItem(); |
| | | if (CollectionUtils.isEmpty(items)) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | Map<Boolean, List<ProductProcessRouteItem>> partitioned = items.stream() |
| | | .collect(Collectors.partitioningBy( |
| | | item -> item.getId() != null && item.getId() > 0 |
| | | )); |
| | | |
| | | List<ProductProcessRouteItem> toUpdate = partitioned.get(true); |
| | | List<ProductProcessRouteItem> toInsert = partitioned.get(false); |
| | | // æ¹éå¤ç |
| | | boolean result = true; |
| | | if (!toInsert.isEmpty()) { |
| | | result = productProcessRouteItemService.saveBatch(toInsert); |
| | | if (result) { |
| | | // çæå·¥åå· |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | // æ¥è¯¢ä»æ¥æå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .select("MAX(work_order_no) as maxNo"); |
| | | |
| | | List<Map<String, Object>> maxNoList = productWorkOrderMapper.selectMaps(queryWrapper); |
| | | String maxWorkOrderNo = null; |
| | | if (!maxNoList.isEmpty() && maxNoList.get(0) != null && maxNoList.get(0).get("maxNo") != null) { |
| | | maxWorkOrderNo = maxNoList.get(0).get("maxNo").toString(); |
| | | } |
| | | int startSequence = 1; |
| | | if (maxWorkOrderNo != null && maxWorkOrderNo.startsWith(datePrefix)) { |
| | | try { |
| | | String seqStr = maxWorkOrderNo.substring(datePrefix.length()); |
| | | startSequence = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | startSequence = 1; |
| | | } |
| | | } |
| | | // æ¹éçæå·¥å |
| | | List<ProductWorkOrder> workOrders = new ArrayList<>(); |
| | | for (int i = 0; i < toInsert.size(); i++) { |
| | | ProductProcessRouteItem item = toInsert.get(i); |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, startSequence + i); |
| | | ProductWorkOrder workOrder = new ProductWorkOrder(); |
| | | workOrder.setProductProcessRouteItemId(item.getId()); |
| | | workOrder.setProductOrderId(item.getRouteId()); |
| | | workOrder.setWorkOrderNo(workOrderNoStr); |
| | | workOrder.setStatus(1); |
| | | workOrders.add(workOrder); |
| | | } |
| | | result = productWorkOrderService.saveBatch(workOrders); |
| | | } |
| | | } |
| | | if (!toUpdate.isEmpty()) { |
| | | result = productProcessRouteItemService.updateBatchById(toUpdate) && result; |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteRouteItem") |
| | | @ApiOperation("å é¤ç产工èºè·¯çº¿") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteRouteItem(@RequestBody ProductProcessRouteItemDto processRouteItemDto) { |
| | | if (processRouteItemDto == null || processRouteItemDto.getId() == null) { |
| | | return R.fail("åæ°é误ï¼IDä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | try { |
| | | // å
å é¤å
³èçå·¥åæ°æ® |
| | | LambdaQueryWrapper<ProductWorkOrder> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ProductWorkOrder::getProductProcessRouteItemId, processRouteItemDto.getId()); |
| | | productWorkOrderMapper.delete(wrapper); |
| | | |
| | | // å é¤ä¸»è¡¨æ°æ® |
| | | productProcessRouteItemService.removeById(processRouteItemDto.getId()); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("å é¤å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @ApiOperation("æ ¹æ®productIdæ¥è¯¢") |
| | | @GetMapping("listByproductModelId/{productModelId}") |
| | | @GetMapping("/listByproductModelId/{productModelId}") |
| | | public R listByproductModelId( @PathVariable("productModelId") Long productModelId){ |
| | | return R.ok(productStructureService.listByproductModelId( productModelId)); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/productWorkOrder") |
| | | public class ProductWorkOrderController { |
| | | |
| | | private ProductWorkOrderService productWorkOrderservice; |
| | | |
| | | |
| | | /** |
| | | * 产åå·¥åå®ä½ç±»å页æ¥è¯¢ |
| | | */ |
| | | @ApiOperation("产åå·¥åå®ä½ç±»å页æ¥è¯¢") |
| | | @GetMapping("/page") |
| | | public R page(Page<ProductWorkOrderDto> page, ProductWorkOrderDto productWorkOrder) { |
| | | return R.ok(productWorkOrderservice.listPage(page, productWorkOrder)); |
| | | } |
| | | |
| | | /** |
| | | * 产åå·¥åæ´æ° |
| | | */ |
| | | @ApiOperation("产å工忴æ°") |
| | | @PostMapping ("/updateProductWorkOrder") |
| | | public R updateProductWorkOrder(@RequestBody ProductWorkOrderDto productWorkOrderDto) { |
| | | return R.ok(productWorkOrderservice.updateProductWorkOrder(productWorkOrderDto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductionProductInputDto; |
| | | import com.ruoyi.production.service.ProductionProductInputService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RequestMapping("productionProductInput") |
| | | @RestController |
| | | @Api(value = "ç产æå
¥") |
| | | public class ProductionProductInputController { |
| | | |
| | | @Autowired |
| | | private ProductionProductInputService productionProductInputService; |
| | | |
| | | @GetMapping("listPage") |
| | | public R page(Page<ProductionProductInputDto> page, ProductionProductInputDto productionProductInputDto) { |
| | | return R.ok(productionProductInputService.listPageProductionProductInputDto(page, productionProductInputDto)); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productionProductMain") |
| | | @RestController |
| | |
| | | @Autowired |
| | | private ProductionProductMainService productionProductMainService; |
| | | |
| | | /** |
| | | * æ¥å·¥æ¥è¯¢ |
| | | * @param page |
| | | * @param productionProductMainDto |
| | | * @return |
| | | */ |
| | | @GetMapping("listPage") |
| | | public R page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥å·¥æ°å¢æ´æ° |
| | | * @param productionProductMainDto |
| | | * @return |
| | | */ |
| | | @PostMapping("addProductMain") |
| | | public R addProductMain(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.addProductMain(productionProductMainDto)); |
| | | } |
| | | |
| | | @ApiOperation("å 餿¥å·¥") |
| | | @DeleteMapping("/delete") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R delete(@RequestBody ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.removeProductMain(productionProductMainDto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductionProductInputDto; |
| | | import com.ruoyi.production.dto.ProductionProductOutputDto; |
| | | import com.ruoyi.production.service.ProductionProductInputService; |
| | | import com.ruoyi.production.service.ProductionProductOutputService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @RequestMapping("productionProductOutput") |
| | | @RestController |
| | | @Api(value = "ç产产åº") |
| | | public class ProductionProductOutputController { |
| | | |
| | | @Autowired |
| | | private ProductionProductOutputService productionProductOutputService; |
| | | |
| | | @GetMapping("listPage") |
| | | public R page(Page<ProductionProductOutputDto> page, ProductionProductOutputDto productionProductOutputDto) { |
| | | return R.ok(productionProductOutputService.listPageProductionProductOutputDto(page, productionProductOutputDto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | public class ProductWorkOrderDto extends ProductWorkOrder { |
| | | |
| | | //产ååç§° |
| | | @ApiModelProperty(value = "产ååç§°") |
| | | private String productName; |
| | | |
| | | //è§æ ¼ |
| | | @ApiModelProperty(value = "è§æ ¼") |
| | | private String model; |
| | | |
| | | //å·¥åº |
| | | @ApiModelProperty(value = "å·¥åº") |
| | | private String processName; |
| | | |
| | | //åä½ |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | |
| | | //ç产订åå· |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String productOrderNpsNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ProductionProductInputDto extends ProductionProductInput { |
| | | @ApiModelProperty(value = "æ¥å·¥åå·") |
| | | private String productNo; |
| | | |
| | | @ApiModelProperty(value = "产ååå·") |
| | | private String model; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ProductionProductMainDto extends ProductionProductMain { |
| | | @ApiModelProperty(value = "å·¥åç¼å·") |
| | |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥äººåæµç§°") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦æ¥å·¥") |
| | | private boolean reportWork; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ProductionProductOutputDto extends ProductionProductOutput { |
| | | @ApiModelProperty(value = "æ¥å·¥åå·") |
| | | private String productNo; |
| | | |
| | | @ApiModelProperty(value = "产ååå·") |
| | | private String model; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | public interface ProductWorkOrderMapper extends BaseMapper<ProductWorkOrder> { |
| | | |
| | | IPage<ProductWorkOrderDto> pageProductWorkOrder(Page<ProductWorkOrderDto> page, @Param("c") ProductWorkOrderDto productWorkOrder); |
| | | |
| | | int updatePlanQuantity(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 忻工åè®¡åæ°éï¼ä»production_product_outputåquantityå åplan_quantity |
| | | * @param productMainId |
| | | * @return |
| | | */ |
| | | int rollbackPlanQuantity(@Param("productMainId") Long productMainId); |
| | | } |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductInputDto; |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductionProductInputMapper extends BaseMapper<ProductionProductInput> { |
| | | IPage<ProductionProductInputDto> listPageProductionProductInputDto(Page page, @Param("c") ProductionProductInputDto productionProductInputDto); |
| | | |
| | | /** |
| | | * æ ¹æ®ç产主表IDæ¹éå 餿å
¥è¡¨æ°æ® |
| | | */ |
| | | int deleteByProductMainIds(@Param("productMainIds") List<Long> productMainIds); |
| | | } |
| | |
| | | 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.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import javax.annotation.ManagedBean; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductionProductMainMapper extends BaseMapper<ProductionProductMain> { |
| | | |
| | | IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, @Param("c") ProductionProductMainDto productionProductMainDto); |
| | | |
| | | /** |
| | | * æ ¹æ®å·¥åIDæ¹éå é¤çäº§ä¸»è¡¨æ°æ® |
| | | */ |
| | | int deleteByWorkOrderIds(@Param("workOrderIds") List<Long> workOrderIds); |
| | | } |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductOutputDto; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductionProductOutputMapper extends BaseMapper<ProductionProductOutput> { |
| | | IPage<ProductionProductOutputDto> listPageProductionProductOutputDto(Page page, @Param("c") ProductionProductOutputDto productionProductOutputDto); |
| | | |
| | | /** |
| | | * æ ¹æ®ç产主表IDæ¹éå é¤äº§åºè¡¨æ°æ® |
| | | */ |
| | | int deleteByProductMainIds(@Param("productMainIds") List<Long> productMainIds); |
| | | } |
| | |
| | | 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.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("process_route_item") |
| | | public class ProcessRouteItem { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @TableName("product_process") |
| | | @Data |
| | | public class ProductProcess { |
| | | public class ProductProcess implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "å·¥èºè·¯çº¿id") |
| | | @ApiModelProperty(value = "ç产订åid(product_order_id)") |
| | | private Long routeId; |
| | | |
| | | @ApiModelProperty(value = "å·¥åºid") |
| | |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value ="æå¨æåº") |
| | | private Integer dragSort; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 产åå·¥åå®ä½ç±» |
| | | * å¯¹åºæ°æ®åºè¡¨ï¼product_work_order |
| | | */ |
| | | @Data |
| | | @TableName("product_work_order") |
| | | public class ProductWorkOrder implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主é®id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | |
| | | private Long productProcessRouteItemId; |
| | | |
| | | /** |
| | | * ç产订åid |
| | | */ |
| | | @ApiModelProperty(value = "ç产订åid") |
| | | private Long productOrderId; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * å·¥åç¼å· |
| | | */ |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | @ApiModelProperty(value = "å·¥åç¼å·") |
| | | private String workOrderNo; |
| | | |
| | | /** |
| | | * çäº§ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产 |
| | | * ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产 |
| | | */ |
| | | @ApiModelProperty(value = "çäº§ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产") |
| | | private String status; |
| | | @ApiModelProperty(value = "ç¶æ 1 å¾
确认 2 å¾
ç产 3çäº§ä¸ 4å·²ç产") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * ç§æ·id |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | //å建æ¶é´ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 计åå¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åå¼å§æ¶é´") |
| | | private LocalDate planStartTime; |
| | | |
| | | //ä¿®æ¹æ¶é´ |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | /** |
| | | * 计åç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "计åç»ææ¶é´") |
| | | private LocalDate planEndTime; |
| | | |
| | | } |
| | | /** |
| | | * å®é
å¼å§æ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®é
å¼å§æ¶é´") |
| | | private LocalDate actualStartTime; |
| | | |
| | | /** |
| | | * å®é
ç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty(value = "å®é
ç»ææ¶é´") |
| | | private LocalDate actualEndTime; |
| | | |
| | | /** |
| | | * æ¯å¦æ¥å·¥ |
| | | */ |
| | | @ApiModelProperty(value = "æ¯å¦æ¥å·¥") |
| | | private boolean reportWork; |
| | | |
| | | |
| | | /** |
| | | * è®¡åæ°é |
| | | */ |
| | | @ApiModelProperty(value = "è®¡åæ°é") |
| | | private BigDecimal planQuantity; |
| | | |
| | | /** |
| | | * å®é
æ°é |
| | | */ |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * æ¥å·¥id |
| | | */ |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productMainId; |
| | | } |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("production_product_input") |
| | | public class ProductionProductInput { |
| | | |
| | | @TableId |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productionProductId; |
| | | private Long productMainId; |
| | | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productModelId; |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("production_product_main") |
| | | public class ProductionProductMain { |
| | | |
| | | @TableId |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥åå·") |
| | |
| | | @ApiModelProperty(value = "æ¥å·¥äººåid") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥äººå") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "ç产项ç®id") |
| | | private Long productProcessRouteItemId; |
| | | |
| | | @ApiModelProperty(value = "å·¥åid") |
| | | private String workOrderId; |
| | | private Long workOrderId; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥ç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("production_product_output") |
| | | public class ProductionProductOutput { |
| | | |
| | | @TableId |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | private Long productionProductId; |
| | | private Long productMainId; |
| | | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productModelId; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | |
| | | public interface ProductWorkOrderService extends IService<ProductWorkOrder>{ |
| | | |
| | | IPage<ProductWorkOrderDto> listPage(Page<ProductWorkOrderDto> page, ProductWorkOrderDto productWorkOrder); |
| | | |
| | | int updateProductWorkOrder(ProductWorkOrderDto productWorkOrderDto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductInputDto; |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | |
| | | public interface ProductionProductInputService extends IService<ProductionProductInput> { |
| | | IPage<ProductionProductInputDto> listPageProductionProductInputDto(Page page, ProductionProductInputDto productionProductInputDto); |
| | | } |
| | |
| | | |
| | | public interface ProductionProductMainService extends IService<ProductionProductMain> { |
| | | IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, ProductionProductMainDto productionProductMainDto); |
| | | |
| | | Boolean addProductMain(ProductionProductMainDto productionProductMainDto); |
| | | |
| | | Boolean removeProductMain(ProductionProductMainDto productionProductMainDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductOutputDto; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | | |
| | | public interface ProductionProductOutputService extends IService<ProductionProductOutput> { |
| | | IPage<ProductionProductOutputDto> listPageProductionProductOutputDto(Page page, ProductionProductOutputDto productionProductOutputDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.production.service.ProductWorkOrderService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class ProductWorkOrderServiceImpl extends ServiceImpl<ProductWorkOrderMapper, ProductWorkOrder> implements ProductWorkOrderService { |
| | | |
| | | private ProductWorkOrderMapper productWorkOrdermapper; |
| | | |
| | | @Override |
| | | public IPage<ProductWorkOrderDto> listPage(Page<ProductWorkOrderDto> page, ProductWorkOrderDto productWorkOrder) { |
| | | return productWorkOrdermapper.pageProductWorkOrder(page, productWorkOrder); |
| | | } |
| | | |
| | | @Override |
| | | public int updateProductWorkOrder(ProductWorkOrderDto productWorkOrderDto) { |
| | | return productWorkOrdermapper.updateById(productWorkOrderDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductInputDto; |
| | | import com.ruoyi.production.mapper.ProductionProductInputMapper; |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | import com.ruoyi.production.service.ProductionProductInputService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ProductionProductInputServiceImpl extends ServiceImpl<ProductionProductInputMapper, ProductionProductInput> implements ProductionProductInputService { |
| | | @Autowired |
| | | private ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductionProductInputDto> listPageProductionProductInputDto(Page page, ProductionProductInputDto productionProductInputDto) { |
| | | return productionProductInputMapper.listPageProductionProductInputDto(page, productionProductInputDto); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | 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.production.dto.ProcessRouteItemDto; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.production.controller.ProductWorkOrderController; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ProductionProductMainServiceImpl extends ServiceImpl<ProductionProductMainMapper, ProductionProductMain> implements ProductionProductMainService { |
| | | @Autowired |
| | | |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private ProductWorkOrderController productWorkOrderController; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | | private ProcessRouteItemMapper processRouteItemMapper; |
| | | |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private ProductProcessMapper productProcessMapper; |
| | | |
| | | private ProductMapper productMapper; |
| | | |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | |
| | | private QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | | private ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | private SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listPageProductionProductMainDto(Page page, ProductionProductMainDto productionProductMainDto) { |
| | | return productionProductMainMapper.listPageProductionProductMainDto(page, productionProductMainDto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addProductMain(ProductionProductMainDto dto) { |
| | | if (dto == null) { |
| | | throw new RuntimeException("åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | |
| | | |
| | | // æ°å¢é»è¾ |
| | | ProductionProductMain productionProductMain = new ProductionProductMain(); |
| | | ProductProcessRouteItem productProcessRouteItem = productProcessRouteItemMapper.selectById(dto.getProductProcessRouteItemId()); |
| | | if (productProcessRouteItem == null) { |
| | | throw new RuntimeException("å·¥èºè·¯çº¿é¡¹ä¸åå¨"); |
| | | } |
| | | |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | |
| | | QueryWrapper<ProductionProductMain> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("MAX(product_no) as maxNo") |
| | | .likeRight("product_no", datePrefix); |
| | | |
| | | List<Map<String, Object>> resultList = productionProductMainMapper.selectMaps(queryWrapper); |
| | | |
| | | int sequenceNumber = 1; |
| | | if (resultList != null && !resultList.isEmpty()) { |
| | | Map<String, Object> result = resultList.get(0); |
| | | |
| | | if (result != null) { |
| | | Object maxNoObj = result.get("maxNo"); |
| | | if (maxNoObj != null) { |
| | | String lastNo = maxNoObj.toString(); |
| | | System.out.println("lastNo: " + lastNo); |
| | | |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | try { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String productNo = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | productionProductMain.setProductNo(productNo); |
| | | productionProductMain.setUserId(user.getUserId()); |
| | | productionProductMain.setProductProcessRouteItemId(dto.getProductProcessRouteItemId()); |
| | | productionProductMain.setWorkOrderId(dto.getWorkOrderId()); |
| | | productionProductMain.setStatus(0); |
| | | |
| | | // æ·»å æ¥å·¥ä¸»è¡¨ |
| | | int insert = productionProductMainMapper.insert(productionProductMain); |
| | | |
| | | //æ´æ°å·¥å |
| | | if (insert > 0) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("quantity", dto.getQuantity()); |
| | | params.put("productMainId", productionProductMain.getId()); |
| | | params.put("workOrderId", dto.getWorkOrderId()); |
| | | params.put("deductQuantity", dto.getQuantity()); |
| | | |
| | | productWorkOrderMapper.updatePlanQuantity(params); |
| | | } |
| | | ProductProcess productProcess = productProcessMapper.selectById(productProcessRouteItem.getProcessId()); |
| | | ProductModel productModel = productProcessRouteItem.getProductModelId() != null ? |
| | | productModelMapper.selectById(productProcessRouteItem.getProductModelId()) : null; |
| | | |
| | | if (productModel != null) { |
| | | Product product = productMapper.selectById(productModel.getProductId()); |
| | | int inspectType = "ç»è£
".equals(productProcess.getName()) ? 2 : 1; |
| | | |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setProductId(product.getId()); |
| | | qualityInspect.setProductName(product.getProductName()); |
| | | qualityInspect.setModel(productModel.getModel()); |
| | | qualityInspect.setUnit(productModel.getUnit()); |
| | | qualityInspect.setQuantity(dto.getQuantity()); |
| | | qualityInspect.setProcess(productProcess.getName()); |
| | | qualityInspect.setInspectState(0); |
| | | qualityInspect.setInspectType(inspectType); |
| | | qualityInspect.setProductMainId(productionProductMain.getId()); |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | |
| | | qualityTestStandardMapper.selectList( |
| | | new LambdaQueryWrapper<QualityTestStandard>() |
| | | .eq(QualityTestStandard::getProductId, product.getId()) |
| | | ).forEach(standard -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(standard, param); |
| | | param.setId(null); |
| | | param.setInspectId(qualityInspect.getId()); |
| | | qualityInspectParamMapper.insert(param); |
| | | }); |
| | | } |
| | | // æ·»å æå
¥ |
| | | if (productModel != null) { |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listByproductModelId(productModel.getId()); |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductModelId(productStructureDto.getProductModelId()); |
| | | productionProductInput.setQuantity(productStructureDto.getUnitQuantity()); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | } |
| | | } |
| | | |
| | | // æ·»å äº§åº |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductModelId(productProcessRouteItem.getProductModelId()); |
| | | productionProductOutput.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO); |
| | | productionProductOutputMapper.insert(productionProductOutput); |
| | | |
| | | // è·åç产订å |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | if (productOrder == null) { |
| | | throw new RuntimeException("ç产订åä¸åå¨"); |
| | | } |
| | | // æ·»å çäº§æ ¸ç® |
| | | SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder() |
| | | .salesLedgerWorkId(productionProductMain.getId()) |
| | | .salesLedgerSchedulingId(0L) |
| | | .salesLedgerId(productOrder.getSalesLedgerId()) |
| | | .salesLedgerProductId(productOrder.getProductModelId()) |
| | | .schedulingUserId(user.getUserId()) |
| | | .schedulingUserName(user.getNickName()) |
| | | .finishedNum(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO) |
| | | .workHours(productProcess.getSalaryQuota()) |
| | | .process(productProcess.getName()) |
| | | .schedulingDate(LocalDate.now()) |
| | | .tenantId(dto.getTenantId()) |
| | | .build(); |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean removeProductMain(ProductionProductMainDto dto) { |
| | | Long id = dto.getId(); |
| | | |
| | | // æ´æ°å·¥å |
| | | productWorkOrderMapper.rollbackPlanQuantity(id); |
| | | // å é¤è´¨æ£åæ°åè´¨æ£è®°å½ |
| | | qualityInspectMapper.selectList( |
| | | new LambdaQueryWrapper<QualityInspect>() |
| | | .eq(QualityInspect::getProductMainId, id) |
| | | ).forEach(q -> { |
| | | qualityInspectParamMapper.delete( |
| | | new LambdaQueryWrapper<QualityInspectParam>() |
| | | .eq(QualityInspectParam::getInspectId, q.getId())); |
| | | qualityInspectMapper.deleteById(q.getId()); |
| | | }); |
| | | |
| | | // å é¤äº§åºè®°å½ |
| | | productionProductOutputMapper.delete(new LambdaQueryWrapper<ProductionProductOutput>() |
| | | .eq(ProductionProductOutput::getProductMainId, id) |
| | | ); |
| | | |
| | | // å é¤å
³èçæ ¸ç®æ°æ® |
| | | salesLedgerProductionAccountingMapper.delete( |
| | | new LambdaQueryWrapper<SalesLedgerProductionAccounting>() |
| | | .eq(SalesLedgerProductionAccounting::getSalesLedgerWorkId, id) |
| | | ); |
| | | |
| | | // å é¤ä¸»è¡¨ |
| | | return productionProductMainMapper.deleteById(id) > 0; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.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.production.dto.ProductionProductOutputDto; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.pojo.ProductionProductOutput; |
| | | import com.ruoyi.production.service.ProductionProductOutputService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ProductionProductOutputServiceImpl extends ServiceImpl<ProductionProductOutputMapper, ProductionProductOutput> implements ProductionProductOutputService { |
| | | @Autowired |
| | | private ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | | @Override |
| | | public IPage<ProductionProductOutputDto> listPageProductionProductOutputDto(Page page, ProductionProductOutputDto productionProductOutputDto) { |
| | | return productionProductOutputMapper.listPageProductionProductOutputDto(page, productionProductOutputDto); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.purchase.controller; |
| | | |
| | | 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.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.service.IPurchaseLedgerService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * éè´å°è´¦Controller |
| | |
| | | @RestController |
| | | @RequestMapping("/purchase/ledger") |
| | | @AllArgsConstructor |
| | | @Api(tags = "111") |
| | | public class PurchaseLedgerController extends BaseController { |
| | | private IPurchaseLedgerService purchaseLedgerService; |
| | | |
| | | private ISalesLedgerService salesLedgerService; |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | |
| | | /** |
| | | * æ¥è¯¢éè´å°è´¦å表 |
| | |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws IOException { |
| | | return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto)); |
| | | } |
| | | /** |
| | | * æ°å¢éè´æ¨¡æ¿ |
| | | */ |
| | | @PostMapping("/addPurchaseTemplate") |
| | | public AjaxResult addPurchaseTemplate(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws IOException { |
| | | return toAjax(purchaseLedgerService.addPurchaseTemplate(purchaseLedgerDto)); |
| | | } |
| | | /** |
| | | * æ¥è¯¢éè´æ¨¡æ¿ |
| | | */ |
| | | @ApiOperation("/2222") |
| | | @GetMapping("/getPurchaseTemplateList") |
| | | public AjaxResult getPurchaseTemplateList() { |
| | | PurchaseLedgerDto purchaseLedgerDto = new PurchaseLedgerDto(); |
| | | purchaseLedgerDto.setApprovalStatus(3); |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(new Page(1, -1), purchaseLedgerDto); |
| | | List<PurchaseLedgerDto> purchaseLedgers = purchaseLedgerDtoIPage.getRecords(); |
| | | |
| | | purchaseLedgers.forEach(purchaseLedgerDto1 -> { |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedgerDto1.getId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.list(queryWrapper); |
| | | if (!list.isEmpty()) { |
| | | purchaseLedgerDto1.setProductData(list); |
| | | } |
| | | }); |
| | | return AjaxResult.success(purchaseLedgers); |
| | | } |
| | | /** |
| | | * ä¿®æ¹éè´å°è´¦å®¡æ¹ç¶æ |
| | | */ |
| | | @PostMapping("/updateApprovalStatus") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | return toAjax(purchaseLedgerService.updateById(purchaseLedger)); |
| | | } |
| | | /** |
| | | * æ¥è¯¢éè´å°è´¦å产åç¶åå表 |
| | | */ |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger)); |
| | | IPage<PurchaseLedgerDto> purchaseLedgerDtoIPage = purchaseLedgerService.selectPurchaseLedgerListPage(page ,purchaseLedger); |
| | | //è¿æ»¤æapprovalStatus=3çè®°å½ |
| | | purchaseLedgerDtoIPage.getRecords().removeIf(purchaseLedgerDto -> purchaseLedgerDto.getApprovalStatus() == 3); |
| | | return AjaxResult.success(purchaseLedgerDtoIPage); |
| | | } |
| | | |
| | | @ApiOperation("çæéè´åºåå·") |
| | |
| | | */ |
| | | @Excel(name = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | /** |
| | | * æ¯å¦ç½åå |
| | | */ |
| | | @Excel(name = "æ¯å¦ç½åå") |
| | | private Integer isWhite; |
| | | |
| | | /** |
| | | * å½å
¥äººå§åid |
| | |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @ApiModelProperty("审æ¹ç¶æ") |
| | | private Integer approvalStatus; |
| | | @ApiModelProperty(value = "模æ¿åç§°") |
| | | private String templateName; |
| | | @ApiModelProperty(value = "审æ¹äººid") |
| | | private Integer approverId; |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | @ApiModelProperty("审æ¹ç¶æ") |
| | | private Integer approvalStatus; |
| | | |
| | | @ApiModelProperty(value = "模æ¿åç§°") |
| | | private String templateName; |
| | | @ApiModelProperty(value = "审æ¹äººid") |
| | | private Integer approverId; |
| | | |
| | | } |
| | |
| | | List<InvoiceRegistrationProduct> getProductBySalesNo(Long id); |
| | | |
| | | String getPurchaseNo(); |
| | | |
| | | int addPurchaseTemplate(PurchaseLedgerDto purchaseLedgerDto) throws IOException; |
| | | } |
| | |
| | | } |
| | | return purchaseLedgerMapper.selectList(queryWrapper); |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addPurchaseTemplate(PurchaseLedgerDto purchaseLedgerDto)throws IOException { |
| | | //å½å
¥äºº |
| | | SysUser sysUser = userMapper.selectUserById(purchaseLedgerDto.getRecorderId()); |
| | | |
| | | SupplierManage supplierManage = supplierManageMapper.selectById(purchaseLedgerDto.getSupplierId()); |
| | | PurchaseLedger purchaseLedger = new PurchaseLedger(); |
| | | // BeanUtils.copyProperties(purchaseLedger,purchaseLedgerDto); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if(ObjectUtils.isNotEmpty(loginUser) && null != loginUser.getTenantId()) { |
| | | purchaseLedger.setTenantId(loginUser.getTenantId()); |
| | | } |
| | | purchaseLedger.setPaymentMethod(purchaseLedgerDto.getPaymentMethod()); |
| | | purchaseLedger.setRecorderId(purchaseLedgerDto.getRecorderId()); |
| | | purchaseLedger.setSupplierId(purchaseLedgerDto.getSupplierId()); |
| | | purchaseLedger.setTemplateName(purchaseLedgerDto.getTemplateName()); |
| | | // purchaseLedger.setSalesLedgerPId(purchaseLedgerDto.getSalesLedgerId()); |
| | | purchaseLedger.setApprovalStatus(3); |
| | | purchaseLedger.setSupplierName(supplierManage.getSupplierName()); |
| | | purchaseLedger.setRecorderName(sysUser.getNickName()); |
| | | purchaseLedger.setPhoneNumber(sysUser.getPhonenumber()); |
| | | purchaseLedger.setPurchaseContractNumber(UUID.randomUUID().toString().replaceAll("-", "")); |
| | | purchaseLedger.setEntryDate(Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant())); |
| | | int insert = purchaseLedgerMapper.insert(purchaseLedger); |
| | | |
| | | LambdaQueryWrapper<PurchaseLedger> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(PurchaseLedger::getSupplierName, purchaseLedger.getSupplierName()) |
| | | .eq(PurchaseLedger::getPurchaseContractNumber, purchaseLedger.getPurchaseContractNumber()) |
| | | .eq(PurchaseLedger::getApprovalStatus,3); |
| | | PurchaseLedger purchaseLedger1 = purchaseLedgerMapper.selectOne(queryWrapper); |
| | | |
| | | if(ObjectUtils.isNotEmpty(purchaseLedgerDto.getProductData())) { |
| | | // 4. å¤çåè¡¨æ°æ® |
| | | List<SalesLedgerProduct> salesLedgerProductList = purchaseLedgerDto.getProductData(); |
| | | salesLedgerProductList.forEach(salesLedgerProduct -> { |
| | | salesLedgerProduct.setSalesLedgerId(purchaseLedger1.getId()); |
| | | salesLedgerProduct.setType(2); |
| | | }); |
| | | salesLedgerProductList.forEach(salesLedgerProductMapper::insert); |
| | | } |
| | | return insert; |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int addOrEditPurchase(PurchaseLedgerDto purchaseLedgerDto) throws IOException { |
| | |
| | | PurchaseLedger purchaseLedgerDB = purchaseLedgerMapper.selectById(purchaseLedger.getId()); |
| | | List<AccountExpense> accountExpenseDBs = accountExpenseService.getByInvoiceNumberList(purchaseLedger.getPurchaseContractNumber()); |
| | | if (!CollectionUtils.isEmpty(accountExpenseDBs)) { |
| | | accountExpenseDBs.forEach(accountExpenseDB -> { |
| | | accountExpenseDBs.forEach(accountExpenseDB ->{ |
| | | accountExpenseDB.setExpenseDate(purchaseLedgerDB.getEntryDate()); |
| | | accountExpenseDB.setExpenseType("0"); |
| | | accountExpenseDB.setSupplierName(purchaseLedgerDB.getSupplierName()); |
| | |
| | | @Override |
| | | public int deletePurchaseLedgerByIds(Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | throw new BaseException("请éä¸è³å°ä¸æ¡æ°æ®"); |
| | | throw new BaseException("请éä¸è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | // æ¹éå é¤å
³èçéè´å°è´¦äº§å |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | salesLedgerProductMapper.delete(queryWrapper); |
| | | // æ¹éå é¤å
³èçéè´å°è´¦çæ¥ç¥¨ç»è®° |
| | | LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getPurchaseLedgerId, ids); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getSalesLedgerId,ids); |
| | | ticketRegistrationMapper.delete(ticketRegistrationLambdaQueryWrapper); |
| | | // æ¹éå é¤å
³èçéè´å°è´¦çæ¥ç¥¨ç»è®°è®°å½ |
| | | LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | productRecordLambdaQueryWrapper.in(ProductRecord::getPurchaseLedgerId, ids); |
| | | productRecordLambdaQueryWrapper.in(ProductRecord::getPurchaseLedgerId,ids); |
| | | productRecordMapper.delete(productRecordLambdaQueryWrapper); |
| | | // æ¹éå é¤ä»æ¬¾ç»è®° |
| | | LambdaQueryWrapper<PaymentRegistration> paymentRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | .map(QualityInspect::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | LambdaQueryWrapper<QualityInspectParam> qualityStandardLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | qualityStandardLambdaQueryWrapper.in(QualityInspectParam::getInspectId, inspectIds); |
| | | qualityInspectParamMapper.delete(qualityStandardLambdaQueryWrapper); |
| | | if (inspectIds.size() > 0) { |
| | | LambdaQueryWrapper<QualityInspectParam> qualityStandardLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | qualityStandardLambdaQueryWrapper.in(QualityInspectParam::getInspectId, inspectIds); |
| | | qualityInspectParamMapper.delete(qualityStandardLambdaQueryWrapper); |
| | | } |
| | | |
| | | //æ¹éå é¤åæææ£éªæ°æ® |
| | | qualityInspectMapper.delete(materialInspectLambdaQueryWrapper); |
| | | // æ¹éå é¤éè´å°è´¦ |
| | |
| | | // 3.æ¥è¯¢ä¸ä¼ æä»¶ |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, purchaseLedger.getId()) |
| | | .eq(CommonFile::getType, FileNameType.PURCHASE.getValue()); |
| | | .eq(CommonFile::getType,FileNameType.PURCHASE.getValue()); |
| | | List<CommonFile> salesLedgerFiles = commonFileMapper.selectList(salesLedgerFileWrapper); |
| | | |
| | | // 4. è½¬æ¢ DTO |
| | |
| | | IPage<QualityInspect> qualityInspectListPage(Page page, @Param("qualityInspect") QualityInspect qualityInspect); |
| | | |
| | | List<QualityInspect> qualityInspectExport(@Param("qualityInspect") QualityInspect qualityInspect); |
| | | |
| | | /** |
| | | * æ ¹æ®ç产主表IDæ¹éå é¤è¿ç¨æ£éª |
| | | */ |
| | | int deleteByProductMainIds(@Param("productMainIds") List<Long> productMainIds); |
| | | } |
| | |
| | | |
| | | private Long purchaseLedgerId; |
| | | |
| | | /** |
| | | * æ¥å·¥id |
| | | */ |
| | | private Long productMainId; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | 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.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.mapper.ShipmentApprovalMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShipmentApproval; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ShipmentApprovalService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/shipmentApproval") |
| | | @Api(tags = "å货审æ¹ç®¡ç") |
| | | public class ShipmentApprovalController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ShipmentApprovalService shipmentApprovalService; |
| | | @Autowired |
| | | private ShipmentApprovalMapper shipmentApprovalMapper; |
| | | |
| | | @Autowired |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å货审æ¹å表") |
| | | public AjaxResult listPage(Page page, ShipmentApproval req) { |
| | | IPage<ShipmentApproval> listPage = shipmentApprovalService.listPage(page,req); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("å货审æ¹,æ´æ°å货审æ¹ç¶æ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ShipmentApproval req) { |
| | | ShipmentApproval shipmentApproval = shipmentApprovalMapper.selectById(req.getId()); |
| | | if (shipmentApproval == null) { |
| | | return AjaxResult.error("å货审æ¹ä¸åå¨"); |
| | | } |
| | | |
| | | shipmentApproval.setApproveStatus(req.getApproveStatus()); |
| | | boolean update = shipmentApprovalService.updateById(shipmentApproval); |
| | | if(update){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(shipmentApproval.getSalesLedgerProductId()); |
| | | salesLedgerProduct.setApproveStatus(req.getApproveStatus()); |
| | | salesLedgerProductService.updateById(salesLedgerProduct); |
| | | } |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºåè´§ä¿¡æ¯ç®¡ç |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åºå货审æ¹") |
| | | public void export(HttpServletResponse response) { |
| | | List<ShipmentApproval> list = shipmentApprovalService.list(null); |
| | | ExcelUtil<ShipmentApproval> util = new ExcelUtil<ShipmentApproval>(ShipmentApproval.class); |
| | | util.exportExcel(response, list, "å货审æ¹"); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | 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.common.utils.poi.ExcelUtil; |
| | |
| | | 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.sales.mapper.ShipmentApprovalMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShipmentApproval; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | @Autowired |
| | | private ShippingInfoService shippingInfoService; |
| | | @Autowired |
| | | private ShipmentApprovalMapper shipmentApprovalMapper; |
| | | @Autowired |
| | | private ISalesLedgerProductService salesLedgerProductService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ·»å åè´§ä¿¡æ¯") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ShippingInfo req) { |
| | | LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ShippingInfo::getSalesLedgerId, req.getSalesLedgerId()); |
| | | wrapper.eq(ShippingInfo::getSalesLedgerProductId, req.getSalesLedgerProductId()); |
| | | List<ShippingInfo> list = shippingInfoService.list(wrapper); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | return AjaxResult.error("åè´§ä¿¡æ¯å·²åå¨"); |
| | | } |
| | | boolean save = shippingInfoService.save(req); |
| | | if(save){ |
| | | ShippingInfo shippingInfo = shippingInfoService.getOne(wrapper); |
| | | ShipmentApproval shipmentApproval = new ShipmentApproval(); |
| | | shipmentApproval.setSalesLedgerId(req.getSalesLedgerId()); |
| | | shipmentApproval.setSalesLedgerProductId(req.getSalesLedgerProductId()); |
| | | shipmentApproval.setApproveUserId(req.getApproverId()); |
| | | shipmentApproval.setApproveStatus(2); |
| | | shipmentApproval.setShippingInfoId(shippingInfo.getId()); |
| | | shipmentApprovalMapper.insert(shipmentApproval); |
| | | |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(req.getSalesLedgerProductId()); |
| | | if(salesLedgerProduct != null){ |
| | | salesLedgerProduct.setApproveStatus(2); |
| | | salesLedgerProductService.updateById(salesLedgerProduct); |
| | | } |
| | | |
| | | } |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | |
| | | |
| | | import com.ruoyi.common.config.MyBaseMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 产åä¿¡æ¯Mapperæ¥å£ |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> { |
| | | List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.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.sales.pojo.ShipmentApproval; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface ShipmentApprovalMapper extends BaseMapper<ShipmentApproval> { |
| | | IPage<ShipmentApproval> listPage(Page page,@Param("req") ShipmentApproval req); |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "çäº§ç¶æ") |
| | | private String productionStatus = "æªå¼å§"; |
| | | } |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 产åä¿¡æ¯å¯¹è±¡ sales_ledger_product |
| | |
| | | */ |
| | | @TableName("sales_ledger_product") |
| | | @Data |
| | | public class SalesLedgerProduct { |
| | | public class SalesLedgerProduct implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "ç»è®°æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime registerDate; |
| | | /** |
| | | * å货车çå· |
| | | */ |
| | | @Excel(name = "å货车çå·") |
| | | @TableField(exist = false) |
| | | private String shippingCarNumber; |
| | | |
| | | /** |
| | | * åè´§æ¥æ |
| | | */ |
| | | @Excel(name = "åè´§æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date shippingDate; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "çäº§ç¶æ") |
| | | private String productionStatus = "æªå¼å§"; |
| | | /** |
| | | * å货审æ¹ç¶æ |
| | | */ |
| | | // @TableField(exist = false) |
| | | @ApiModelProperty(value = "审æ¹ç¶æ") |
| | | private Integer approveStatus; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("shipment_approval") |
| | | public class ShipmentApproval { |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | @ApiModelProperty(value = "åè´§ä¿¡æ¯id") |
| | | private Long shippingInfoId; |
| | | @ApiModelProperty(value = "éå®å°è´¦id") |
| | | private Long salesLedgerId; |
| | | @ApiModelProperty(value = "é宿¥ä»·äº§å表id") |
| | | private Long salesLedgerProductId; |
| | | @ApiModelProperty(value = "ç³è¯·é¨é¨id") |
| | | private Long approveDeptId; |
| | | |
| | | @ApiModelProperty(value = "ç³è¯·é¨é¨åç§°") |
| | | @Excel(name = "ç³è¯·é¨é¨") |
| | | private String approveDeptName; |
| | | @ApiModelProperty(value = "审æ¹ç¨æ·id") |
| | | private Integer approveUserId; |
| | | @ApiModelProperty(value = "审æ¹ç¨æ·åç§°") |
| | | @Excel(name = "审æ¹ç¨æ·") |
| | | private String approveUserNames; |
| | | |
| | | /** |
| | | * 审æ¹ç¶æ |
| | | */ |
| | | @ApiModelProperty(value = "审æ¹ç¶æï¼0æªåºåº,1å·²åºåº,2å¾
å®¡æ ¸,3å®¡æ ¸å®æ,4å®¡æ ¸å¤±è´¥") |
| | | @Excel(name = "审æ¹ç¶æ", readConverterExp = "0=æªåºåº,1=å·²åºåº,2=å¾
å®¡æ ¸,3=å®¡æ ¸å®æ,4=å®¡æ ¸å¤±è´¥") |
| | | private Integer approveStatus; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "åè´§æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | private Date shippingDate; |
| | | |
| | | @Excel(name = "å货车çå·") |
| | | @TableField(exist = false) |
| | | private String shippingCarNumber; |
| | | |
| | | /** |
| | | * é¢è¦æ°é |
| | | */ |
| | | |
| | | @TableField(exist = false) |
| | | private BigDecimal warnNum; |
| | | |
| | | /** |
| | | * 产å大类 |
| | | */ |
| | | @Excel(name = "产å大类") |
| | | @TableField(exist = false) |
| | | private String productCategory; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @TableField(exist = false) |
| | | private String specificationModel; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "åä½") |
| | | @TableField(exist = false) |
| | | private String unit; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é") |
| | | @TableField(exist = false) |
| | | private BigDecimal quantity; |
| | | @Excel(name = "æä½åºåæ°é") |
| | | @TableField(exist = false) |
| | | private BigDecimal minStock; |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @Excel(name = "ç¨ç") |
| | | @TableField(exist = false) |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | @Excel(name = "å«ç¨åä»·") |
| | | @TableField(exist = false) |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "å«ç¨æ»ä»·") |
| | | @TableField(exist = false) |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | |
| | | /** |
| | | * ä¸å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "ä¸å«ç¨æ»ä»·") |
| | | @TableField(exist = false) |
| | | private BigDecimal taxExclusiveTotalPrice; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | |
| | | @TableField(exist = false) |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * å°è´¦ç±»å 1.éå® 2ï¼éè´ |
| | | */ |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | |
| | | /** |
| | | * æ¬æ¬¡æ¥ç¥¨æ° |
| | | */ |
| | | @TableField(exist = false) |
| | | private BigDecimal ticketsNum; |
| | | |
| | | /** |
| | | * æ¬æ¬¡æ¥ç¥¨éé¢(å
) |
| | | */ |
| | | @TableField(exist = false) |
| | | private BigDecimal ticketsAmount; |
| | | |
| | | /** |
| | | * æªæ¥ç¥¨æ° |
| | | */ |
| | | @TableField(exist = false) |
| | | private BigDecimal futureTickets; |
| | | |
| | | /** |
| | | * æªæ¥ç¥¨éé¢(å
) |
| | | */ |
| | | @TableField(exist = false) |
| | | private BigDecimal futureTicketsAmount; |
| | | |
| | | @ApiModelProperty(value = "å¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal invoiceNum; |
| | | |
| | | @ApiModelProperty(value = "æªå¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal noInvoiceNum; |
| | | |
| | | @ApiModelProperty(value = "å¼ç¥¨éé¢") |
| | | @TableField(exist = false) |
| | | private BigDecimal invoiceAmount; |
| | | |
| | | @ApiModelProperty(value = "æªå¼ç¥¨éé¢") |
| | | @TableField(exist = false) |
| | | private BigDecimal noInvoiceAmount; |
| | | |
| | | @ApiModelProperty(value = "æ¬æ¬¡å¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal currentInvoiceNum; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "æ¬æ¬¡å¼ç¥¨éé¢") |
| | | private BigDecimal currentInvoiceAmount; |
| | | |
| | | /** |
| | | * 产åid |
| | | */ |
| | | @TableField(exist = false) |
| | | private Long productId; |
| | | |
| | | /** |
| | | * 产åè§æ ¼id |
| | | */ |
| | | @TableField(exist = false) |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "åå§æªå¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal originalNoInvoiceNum; |
| | | |
| | | @ApiModelProperty(value = "ä¸´æ¶æªå¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempNoInvoiceNum; |
| | | |
| | | @ApiModelProperty(value = "ä¸´æ¶æªå¼ç¥¨éé¢") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempnoInvoiceAmount; |
| | | |
| | | @ApiModelProperty(value = "ä¸´æ¶æªæ¥ç¥¨æ°") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempFutureTickets; |
| | | |
| | | @ApiModelProperty(value = "ä¸´æ¶æªæ¥ç¥¨éé¢") |
| | | @TableField(exist = false) |
| | | private BigDecimal tempFutureTicketsAmount; |
| | | |
| | | @ApiModelProperty("ç»è®°äºº") |
| | | @TableField(exist = false) |
| | | private String register; |
| | | |
| | | @ApiModelProperty("ç»è®°æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "ç»è®°æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(exist = false) |
| | | private LocalDateTime registerDate; |
| | | /** |
| | | * éå®ååå· |
| | | */ |
| | | @Excel(name = "éå®ååå·") |
| | | @TableField(exist = false) |
| | | private String salesContractNo; |
| | | |
| | | /** |
| | | * 客æ·ååå· |
| | | */ |
| | | @Excel(name = "客æ·ååå·") |
| | | @TableField(exist = false) |
| | | private String customerContractNo; |
| | | |
| | | |
| | | /** |
| | | * 项ç®åç§° |
| | | */ |
| | | @Excel(name = "项ç®åç§°") |
| | | @TableField(exist = false) |
| | | private String projectName; |
| | | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | private Date entryDate; |
| | | |
| | | /** |
| | | * ä¸å¡å |
| | | */ |
| | | @Excel(name = "ä¸å¡å") |
| | | @TableField(exist = false) |
| | | private String salesman; |
| | | |
| | | @TableField(exist = false) |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | @TableField(exist = false) |
| | | private String customerName; |
| | | |
| | | /** |
| | | * å½å
¥äºº |
| | | */ |
| | | @TableField(exist = false) |
| | | private String entryPerson; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "å½å
¥äºº") |
| | | @Excel(name = "å½å
¥äºº") |
| | | private String entryPersonName; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | @Excel(name = "夿³¨") |
| | | @TableField(exist = false) |
| | | private String remarks; |
| | | |
| | | /** |
| | | * éä»¶ææï¼å卿件åçç¸å
³ä¿¡æ¯ |
| | | */ |
| | | @TableField(exist = false) |
| | | private String attachmentMaterials; |
| | | |
| | | |
| | | /** |
| | | * ååéé¢ï¼äº§åå«ç¨æ»ä»·ï¼ |
| | | */ |
| | | @Excel(name = "ååéé¢") |
| | | @TableField(exist = false) |
| | | private BigDecimal contractAmount; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "æªå¼ç¥¨éé¢(å
)") |
| | | @Excel(name = "æªå¼ç¥¨éé¢") |
| | | private BigDecimal noInvoiceAmountTotal = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "ç¾è®¢æ¥æ") |
| | | @TableField(exist = false) |
| | | private LocalDate executionDate; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "å·²å¼ç¥¨éé¢(å
)") |
| | | @Excel(name = "å·²å¼ç¥¨éé¢") |
| | | private BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "忬¾éé¢") |
| | | private BigDecimal receiptPaymentAmountTotal = BigDecimal.ZERO; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "å¾
忬¾éé¢") |
| | | private BigDecimal noReceiptAmount = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ¹å¼") |
| | | @TableField(exist = false) |
| | | private String paymentMethod; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "çäº§ç¶æ") |
| | | private String productionStatus = "æªå¼å§"; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "éå®å°è´¦id") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty(value = "é宿¥ä»·äº§å表id") |
| | | private Long salesLedgerProductId; |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "éå®ååå·") |
| | | @Excel(name = "éå®ååå·") |
| | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | @ApiModelProperty(value = "审æ¹äººid") |
| | | @TableField(exist = false) |
| | | private Integer approverId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.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.sales.pojo.ShipmentApproval; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | |
| | | |
| | | public interface ShipmentApprovalService extends IService<ShipmentApproval>{ |
| | | IPage<ShipmentApproval> listPage(Page page, ShipmentApproval req); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProcessRouteMapper; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductProcessRouteItem; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | private ProcessRouteItemMapper processRouteItemMapper; |
| | | |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | @Autowired |
| | | |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | @Autowired |
| | | |
| | | private ProcessRouteMapper processRouteMapper; |
| | | |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | @Override |
| | | public SalesLedgerProduct selectSalesLedgerProductById(Long id) { |
| | |
| | | |
| | | @Override |
| | | public List<SalesLedgerProduct> selectSalesLedgerProductList(SalesLedgerProduct salesLedgerProduct) { |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId()) |
| | | .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(queryWrapper); |
| | | if (!CollectionUtils.isEmpty(salesLedgerProducts)) { |
| | | // LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedgerProduct.getSalesLedgerId()) |
| | | // .eq(SalesLedgerProduct::getType, salesLedgerProduct.getType()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if(!CollectionUtils.isEmpty(salesLedgerProducts)){ |
| | | InvoiceRegistrationProductDto invoiceRegistrationProductDto = new InvoiceRegistrationProductDto(); |
| | | invoiceRegistrationProductDto.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId().intValue()); |
| | | List<InvoiceRegistrationProductDto> invoiceRegistrationProductDtoList = invoiceRegistrationProductMapper.invoiceRegistrationProductList(invoiceRegistrationProductDto); |
| | |
| | | BigDecimal invoiceNum = BigDecimal.ZERO; |
| | | BigDecimal invoiceAmount = BigDecimal.ZERO; |
| | | for (InvoiceRegistrationProductDto registrationProductDto : invoiceRegistrationProductDtoList) { |
| | | if (ledgerProduct.getId().intValue() == registrationProductDto.getSalesLedgerProductId()) { |
| | | invoiceNum = invoiceNum.add(registrationProductDto.getInvoiceNum()); |
| | | if(ledgerProduct.getId().intValue() == registrationProductDto.getSalesLedgerProductId()){ |
| | | invoiceNum = invoiceNum.add(registrationProductDto.getInvoiceNum()); |
| | | invoiceAmount = invoiceAmount.add(registrationProductDto.getInvoiceAmount()); |
| | | } |
| | | } |
| | |
| | | return 0; // 没æå¯å é¤çæ°æ® |
| | | } |
| | | |
| | | // å¯è½å±äºå¤ä¸ªä¸»è¡¨ï¼ä½é常ä¸ä¸ªæ¥å£åªå¤çä¸ä¸ªä¸»è¡¨ï¼ |
| | | // å¯è½å±äºå¤ä¸ªä¸»è¡¨ |
| | | Set<Long> mainIds = deletedProducts.stream() |
| | | .map(SalesLedgerProduct::getSalesLedgerId) |
| | | .filter(Objects::nonNull) |
| | |
| | | // 2. æ§è¡å é¤æä½ |
| | | int result = salesLedgerProductMapper.deleteBatchIds(Arrays.asList(ids)); |
| | | //å é¤å¯¹åºçç产订å |
| | | for (Long id : ids) { |
| | | ProductOrder productOrder = productOrderMapper.selectOne(new LambdaQueryWrapper<ProductOrder>().eq(ProductOrder::getProductModelId, id)); |
| | | if (productOrder != null) { |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>().eq(ProductProcessRouteItem::getRouteId, productOrder.getId())); |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>().eq(ProductOrder::getProductModelId, id)); |
| | | //æ¹éæ¥è¯¢productOrder |
| | | List<ProductOrder> productOrders = productOrderMapper.selectList( |
| | | new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, ids) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(productOrders)) { |
| | | List<Long> orderIds = productOrders.stream() |
| | | .map(ProductOrder::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¹éæ¥è¯¢processRouteItems |
| | | List<ProductProcessRouteItem> allRouteItems = productProcessRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(allRouteItems)) { |
| | | List<Long> routeItemIds = allRouteItems.stream() |
| | | .map(ProductProcessRouteItem::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¹éå é¤workOrder |
| | | productWorkOrderMapper.delete(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .in(ProductWorkOrder::getProductProcessRouteItemId, routeItemIds)); |
| | | } |
| | | |
| | | // æ¹éå é¤processRouteItem |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds)); |
| | | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, ids)); |
| | | } |
| | | |
| | | // 3. 对æ¯ä¸ªä¸»è¡¨IDè¿è¡é颿´æ° |
| | |
| | | ProcessRoute processRoute = processRouteMapper.selectOne(new QueryWrapper<ProcessRoute>().lambda().eq(ProcessRoute::getProductModelId, salesLedgerProduct.getProductModelId())); |
| | | if (processRoute != null) { |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(productOrder.getProductModelId()); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setRouteId(productOrder.getId()); |
| | | productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | |
| | | 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 = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(salesLedgerProduct.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | |
| | | } |
| | | productOrder.setRouteId(processRoute.getId()); |
| | | productOrderMapper.updateById(productOrder); |
| | |
| | | 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.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.mapper.*; |
| | |
| | | private final ProcessRouteItemMapper processRouteItemMapper; |
| | | |
| | | private final ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | |
| | | private final ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | private final ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | private final ProductionProductOutputMapper productionProductOutputMapper; |
| | | |
| | | private final ProductionProductInputMapper productionProductInputMapper; |
| | | |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | |
| | | return 0; |
| | | } |
| | | // å é¤éå®ç®¡çæ°æ® |
| | | // 1. å
å é¤åè¡¨æ°æ® |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList); |
| | | salesLedgerProductMapper.delete(productWrapper); |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getSalesLedgerId, idList) |
| | | .select(SalesLedgerProduct::getId); |
| | | |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(queryWrapper); |
| | | List<Long> productIds = products.stream() |
| | | .map(SalesLedgerProduct::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | //æ¹éæ¥è¯¢productOrder |
| | | List<ProductOrder> productOrders = productOrderMapper.selectList( |
| | | new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, productIds) |
| | | ); |
| | | |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(productOrders)) { |
| | | List<Long> orderIds = productOrders.stream() |
| | | .map(ProductOrder::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¹éæ¥è¯¢processRouteItems |
| | | List<ProductProcessRouteItem> allRouteItems = productProcessRouteItemMapper.selectList( |
| | | new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds) |
| | | ); |
| | | |
| | | if (!CollectionUtils.isEmpty(allRouteItems)) { |
| | | // è·åè¦å é¤çå·¥åºé¡¹ID |
| | | List<Long> routeItemIds = allRouteItems.stream() |
| | | .map(ProductProcessRouteItem::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¥è¯¢å
³èçå·¥åID |
| | | List<ProductWorkOrder> workOrders = productWorkOrderMapper.selectList( |
| | | new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .in(ProductWorkOrder::getProductProcessRouteItemId, routeItemIds) |
| | | ); |
| | | if (!CollectionUtils.isEmpty(workOrders)) { |
| | | List<Long> workOrderIds = workOrders.stream() |
| | | .map(ProductWorkOrder::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¥è¯¢å
³èçç产主表ID |
| | | List<ProductionProductMain> productMains = productionProductMainMapper.selectList( |
| | | new LambdaQueryWrapper<ProductionProductMain>() |
| | | .in(ProductionProductMain::getWorkOrderId, workOrderIds) |
| | | ); |
| | | List<Long> productMainIds = productMains.stream() |
| | | .map(ProductionProductMain::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // å é¤äº§åºè¡¨ãæå
¥è¡¨æ°æ® |
| | | if (!CollectionUtils.isEmpty(productMainIds)) { |
| | | productionProductOutputMapper.deleteByProductMainIds(productMainIds); |
| | | productionProductInputMapper.deleteByProductMainIds(productMainIds); |
| | | qualityInspectMapper.deleteByProductMainIds(productMainIds); |
| | | } |
| | | |
| | | // å é¤çäº§ä¸»è¡¨æ°æ® |
| | | productionProductMainMapper.deleteByWorkOrderIds(workOrderIds); |
| | | |
| | | // å é¤å·¥åæ°æ® |
| | | productWorkOrderMapper.delete(new LambdaQueryWrapper<ProductWorkOrder>() |
| | | .in(ProductWorkOrder::getProductProcessRouteItemId, routeItemIds)); |
| | | } |
| | | } |
| | | // æ¹éå é¤processRouteItem |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getRouteId, orderIds)); |
| | | |
| | | // æ¹éå é¤productOrder |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getProductModelId, productIds)); |
| | | } |
| | | |
| | | // æ¹éå é¤äº§åå表 |
| | | if (!productIds.isEmpty()) { |
| | | salesLedgerProductMapper.deleteBatchIds(productIds); |
| | | } |
| | | |
| | | LambdaQueryWrapper<InvoiceRegistrationProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.in(InvoiceRegistrationProduct::getSalesLedgerId, idList); |
| | |
| | | wrapperTree.in(ReceiptPayment::getInvoiceLedgerId, invoiceLedgerIds); |
| | | receiptPaymentMapper.delete(wrapperTree); |
| | | } |
| | | |
| | | |
| | | // å é¤çäº§ç®¡æ§æ°æ® |
| | | // å é¤çäº§è®¢åæ°æ® |
| | |
| | | ProcessRoute processRoute = processRouteMapper.selectOne(new QueryWrapper<ProcessRoute>().lambda().eq(ProcessRoute::getProductModelId, salesLedgerProduct.getProductModelId())); |
| | | if (processRoute != null) { |
| | | List<ProcessRouteItem> processRouteItems = processRouteItemMapper.selectList(new QueryWrapper<ProcessRouteItem>().lambda().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | int dragSort = 1; |
| | | for (ProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | productProcessRouteItem.setProductModelId(productOrder.getProductModelId()); |
| | | productProcessRouteItem.setProductModelId(processRouteItem.getProductModelId()); |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setRouteId(productOrder.getId()); |
| | | productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | productProcessRouteItem.setDragSort(dragSort); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | |
| | | 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 = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(salesLedgerProduct.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | dragSort++; |
| | | } |
| | | productOrder.setRouteId(processRoute.getId()); |
| | | productOrderMapper.updateById(productOrder); |
| | |
| | | |
| | | return datePart + String.format("%03d", nextSequence); |
| | | } finally { |
| | | // 3. éæ¾éï¼ä½¿ç¨Luaèæ¬ä¿è¯ååæ§ï¼é¿å
误å å
¶ä»çº¿ç¨çéï¼ |
| | | // 3. éæ¾é |
| | | String luaScript = "if redis.call('GET', KEYS[1]) == ARGV[1] then return redis.call('DEL', KEYS[1]) else return 0 end"; |
| | | redisTemplate.execute( |
| | | new DefaultRedisScript<>(luaScript, Long.class), |
| | | Collections.singletonList(lockKey), |
| | | lockValue // åªæææç¸åå¼ççº¿ç¨æè½å é¤é |
| | | lockValue |
| | | ); |
| | | } |
| | | } |
| | |
| | | if (sequences.isEmpty()) { |
| | | return 1; |
| | | } |
| | | // æåºåæ¥æ¾ç¬¬ä¸ä¸ªç¼ºå¤±çæ£æ´æ°ï¼ä¸åé»è¾ä¸è´ï¼ |
| | | // æåºåæ¥æ¾ç¬¬ä¸ä¸ªç¼ºå¤±çæ£æ´æ° |
| | | sequences.sort(Integer::compareTo); |
| | | int next = 1; |
| | | for (int seq : sequences) { |
| | |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // æé ä¸»è¡¨æ´æ°å¯¹è±¡ï¼æ¯æä»»æä¸»è¡¨ç±»åï¼ |
| | | // æé ä¸»è¡¨æ´æ°å¯¹è±¡ |
| | | try { |
| | | S entity = mainEntityClass.getDeclaredConstructor().newInstance(); |
| | | Field idField = mainEntityClass.getDeclaredField("id"); |
| | | idField.setAccessible(true); |
| | | idField.set(entity, mainId); |
| | | |
| | | // 设置 contractAmount åæ®µï¼æ³¨æè¿éåè®¾åæ®µå为 "contractAmount" |
| | | Field amountField = mainEntityClass.getDeclaredField("contractAmount"); |
| | | amountField.setAccessible(true); |
| | | amountField.set(entity, totalAmount); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.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.sales.mapper.ShipmentApprovalMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.ShipmentApproval; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ShipmentApprovalService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/10/22 9:33 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ShipmentApprovalServiceImpl extends ServiceImpl<ShipmentApprovalMapper, ShipmentApproval> implements ShipmentApprovalService { |
| | | |
| | | @Autowired |
| | | private ShipmentApprovalMapper shipmentApprovalMapper; |
| | | |
| | | @Override |
| | | public IPage<ShipmentApproval> listPage(Page page, ShipmentApproval req) { |
| | | IPage<ShipmentApproval> listPage = shipmentApprovalMapper.listPage(page, req); |
| | | return listPage; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.basic.mapper.SupplierManageFileMapper"> |
| | | <select id="supplierManageFileListPage" resultType="com.ruoyi.basic.pojo.SupplierManageFile"> |
| | | select * |
| | | from supplier_manage_file |
| | | where supplier_id = #{supplierManageFile.supplierId} |
| | | </select> |
| | | </mapper> |
| | |
| | | T1.update_time, |
| | | T1.update_user, |
| | | T1.tenant_id, |
| | | T1.is_white, |
| | | T2.nick_name AS maintainUserName |
| | | FROM supplier_manage T1 |
| | | LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id |
| | | <where> |
| | | <if test="supplierManageDto.supplierName != null and supplierManageDto.supplierName != '' "> |
| | | AND T1.supplier_name LIKE CONCAT('%',#{supplierManageDto.supplierName},'%') |
| | | </if> |
| | | <if test="supplierManageDto.isWhite != null"> |
| | | AND T1.is_white = #{supplierManageDto.isWhite} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | T1.update_time, |
| | | T1.update_user, |
| | | T1.tenant_id, |
| | | T1.is_white, |
| | | T2.nick_name AS maintainUserName |
| | | FROM supplier_manage T1 |
| | | LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id |
| | |
| | | <if test="supplierManageDto.supplierName != null and supplierManageDto.supplierName != '' "> |
| | | AND T1.supplier_name LIKE CONCAT('%',#{supplierManageDto.supplierName},'%') |
| | | </if> |
| | | <if test="supplierManageDto.isWhite != null"> |
| | | AND T1.is_white = #{supplierManageDto.isWhite} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | dr.maintenance_name, |
| | | dr.maintenance_time, |
| | | dr.maintenance_result, |
| | | dr.maintenance_price, |
| | | dr.status, |
| | | dr.create_time, |
| | | dr.update_time, |
| | |
| | | dr.maintenance_name, |
| | | dr.maintenance_time, |
| | | dr.maintenance_result, |
| | | dr.maintenance_price, |
| | | dr.status, |
| | | dr.create_time, |
| | | dr.update_time, |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper"> |
| | | <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.dto.SparePartsDto"> |
| | | select sp.*,sp1.name as parentName from spare_parts sp |
| | | select sp.*,sp1.name as parentName |
| | | from spare_parts sp |
| | | left join spare_parts sp1 on sp1.id = sp.parent_id |
| | | <where> |
| | | <if test="spareParts.name != null"> |
| | | and name like concat('%',#{spareParts.name},'%') |
| | | <if test="spareParts.name != null and spareParts.name != ''"> |
| | | and sp.name like concat('%',#{spareParts.name},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.procurementrecord.mapper.ProcurementExceptionRecordMapper"> |
| | | |
| | | </mapper> |
| | |
| | | sum(t1.total_price) as totalPrice, |
| | | sum(t1.inbound_num) as inboundNum, |
| | | sum(t1.inbound_num) as inboundNum0, |
| | | t1.inbound_num as totalInboundNum, |
| | | t1.create_time, |
| | | t1.update_time, |
| | | t1.create_by, |
| | |
| | | and t1.create_time <= #{req.endDate} |
| | | </if> |
| | | </where> |
| | | group by t2.product_category,t2.specification_model,t1.unit_price |
| | | group by t3.supplier_name,t2.product_category,t2.specification_model,t1.unit_price |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy"> |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*,sl.sales_contract_no,sl.project_name,sl.customer_name,slp.product_category,slp.specification_model |
| | | select po.*,sl.sales_contract_no,sl.customer_name,slp.product_category,slp.specification_model |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.product_model_id = slp.id |
| | |
| | | </if> |
| | | <if test="c.salesContractNo != null and c.salesContractNo != ''"> |
| | | and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%') |
| | | </if> |
| | | <if test="c.projectName != null and c.projectName != ''"> |
| | | and sl.project_name like concat('%',#{c.projectName},'%') |
| | | </if> |
| | | <if test="c.customerName != null and c.customerName != ''"> |
| | | and sl.customer_name like concat('%',#{c.customerName},'%') |
| | |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on pp.id = ppri.process_id |
| | | where ppri.route_id = #{orderId} |
| | | order by ppri.id |
| | | order by ppri.drag_sort |
| | | </select> |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ProductWorkOrderMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductWorkOrder"> |
| | | <result column="id" property="id"/> |
| | | <result column="product_process_route_item_id" property="productProcessRouteItemId"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="work_order_no" property="workOrderNo"/> |
| | | <result column="status" property="status"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | <result column="actual_end_time" property="planStartTime"/> |
| | | <result column="plan_end_time" property="planEndTime"/> |
| | | <result column="actual_start_time" property="actualStartTime"/> |
| | | <result column="actualEndTime" property="actualEndTime"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProductWorkOrder" resultType="com.ruoyi.production.dto.ProductWorkOrderDto"> |
| | | SELECT |
| | | pwo.*, |
| | | pp.NAME as processName, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name AS productName, |
| | | po.nps_no AS productOrderNpsNo |
| | | FROM |
| | | `product_work_order` pwo |
| | | LEFT JOIN product_process_route_item ppri ON ppri.id = pwo.product_process_route_item_id |
| | | LEFT JOIN product_order po ON po.id = pwo.product_order_id |
| | | 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> |
| | | <if test="c.workOrderNo != null and c.workOrderNo != ''"> |
| | | pwo.work_order_no like concat('%',#{c.workOrderNo},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <update id="updatePlanQuantity" parameterType="java.util.Map"> |
| | | UPDATE product_work_order |
| | | SET |
| | | report_work = #{reportWork}, |
| | | quantity = #{quantity}, |
| | | plan_quantity = plan_quantity - #{deductQuantity}, |
| | | product_main_id = #{productMainId} |
| | | WHERE id = #{workOrderId} |
| | | </update> |
| | | |
| | | <update id="rollbackPlanQuantity" parameterType="java.lang.Long"> |
| | | UPDATE product_work_order pwo |
| | | INNER JOIN production_product_main ppm |
| | | ON pwo.id = ppm.work_order_id |
| | | AND ppm.id = #{productMainId} |
| | | INNER JOIN production_product_output ppo |
| | | ON ppo.product_main_id = ppm.id |
| | | SET |
| | | pwo.plan_quantity = pwo.plan_quantity + ppo.quantity, |
| | | pwo.report_work = 0, |
| | | pwo.quantity = 0 |
| | | WHERE pwo.id = ppm.work_order_id |
| | | </update> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.production.mapper.ProductionProductInputMapper"> |
| | | |
| | | <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProductionProductInput"> |
| | | <id property="id" column="id"/> |
| | | <result property="productMainId" column="product_main_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="quantity" column="quantity"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | </resultMap> |
| | | <select id="listPageProductionProductInputDto" resultType="com.ruoyi.production.dto.ProductionProductInputDto"> |
| | | select ppi.*, |
| | | pm.model as model, |
| | | ppm.product_no as productNo |
| | | from |
| | | production_product_input ppi |
| | | left join production_product_main ppm on ppm.id = ppi.product_main_id |
| | | left join product_model pm on pm.id = ppi.product_model_id |
| | | <where> |
| | | <if test="c.productMainId != null and c.productMainId > 0"> |
| | | and ppm.id = #{c.productMainId} |
| | | </if> |
| | | </where> |
| | | order by ppi.id |
| | | </select> |
| | | |
| | | <delete id="deleteByProductMainIds" parameterType="java.util.List"> |
| | | DELETE FROM production_product_input |
| | | WHERE product_main_id IN |
| | | <foreach collection="productMainIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | </where> |
| | | order by ppm.id |
| | | </select> |
| | | |
| | | <delete id="deleteByWorkOrderIds" parameterType="java.util.List"> |
| | | DELETE FROM production_product_main |
| | | WHERE work_order_id IN |
| | | <foreach collection="workOrderIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.production.mapper.ProductionProductOutputMapper"> |
| | | |
| | | <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProductionProductOutput"> |
| | | <id property="id" column="id"/> |
| | | <result property="productMainId" column="product_main_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="quantity" column="quantity"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | </resultMap> |
| | | |
| | | <select id="listPageProductionProductOutputDto" resultType="com.ruoyi.production.dto.ProductionProductOutputDto"> |
| | | select ppo.*, |
| | | pm.model as model, |
| | | ppm.product_no as productNo |
| | | from |
| | | production_product_output ppo |
| | | left join production_product_main ppm on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | <where> |
| | | <if test="c.productMainId != null and c.productMainId > 0"> |
| | | and ppm.id = #{c.productMainId} |
| | | </if> |
| | | </where> |
| | | order by ppo.id |
| | | </select> |
| | | |
| | | <delete id="deleteByProductMainIds" parameterType="java.util.List"> |
| | | DELETE FROM production_product_output |
| | | WHERE product_main_id IN |
| | | <foreach collection="productMainIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | left join product_model pm on pm.id = pr.product_model_id |
| | | WHERE type = 2 |
| | | <if test="c.salesContractNo != null and c.salesContractNo != ''"> |
| | | and sl.sales_contract_no = #{c.salesContractNo} |
| | | and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%') |
| | | </if> |
| | | <if test="c.supplierName != null and c.supplierName != ''"> |
| | | and pl.supplier_name = #{c.supplierName} |
| | | and pl.supplier_name like concat('%',#{c.supplierName},'%') |
| | | </if> |
| | | <if test="c.createdAtStart != null and c.createdAtStart != ''"> |
| | | and pr.created_at >= date_format(#{c.createdAtStart},'%Y-%m-%d hh:mm:ss') |
| | |
| | | pl.id, |
| | | pl.purchase_contract_number , |
| | | pl.sales_contract_no, |
| | | pl.supplier_id, |
| | | pl.supplier_name, |
| | | pl.project_name, |
| | | pl.contract_amount, |
| | | sum(pr.tickets_amount)as receipt_payment_amount, |
| | | pl.contract_amount-sum(pr.tickets_amount) AS unReceipt_payment_amount, |
| | | pl.entry_date, |
| | | pl.execution_date, |
| | | pl.recorder_id, |
| | | pl.recorder_name, |
| | | pl.template_name, |
| | | pl.approver_id, |
| | | sm.is_white, |
| | | pl.approval_status, |
| | | pl.payment_method |
| | | from purchase_ledger pl |
| | | left join product_record pr on pl.id = pr.purchase_ledger_id |
| | | left join supplier_manage sm on pl.supplier_id = sm.id |
| | | <where> |
| | | 1 = 1 |
| | | <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''"> |
| | | and pl.purchase_contract_number like concat('%',#{c.purchaseContractNumber},'%') |
| | | </if> |
| | | <if test="c.approvalStatus != null and c.approvalStatus != ''"> |
| | | and pl.approval_status = #{c.approvalStatus} |
| | | </if> |
| | | <if test="c.supplierName != null and c.supplierName != ''"> |
| | | and pl.supplier_name like concat('%',#{c.supplierName},'%') |
| | |
| | | pl.recorder_name, |
| | | pl.contract_amount |
| | | order by pl.entry_date desc |
| | | |
| | | </select> |
| | | <select id="getPaymentRegistrationDtoById" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | |
| | | where |
| | | inspect_type=#{qualityInspect.inspectType} |
| | | <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' "> |
| | | AND supplier = #{qualityInspect.supplier} |
| | | AND supplier like concat('%',#{qualityInspect.supplier},'%') |
| | | </if> |
| | | <if test="qualityInspect.customer != null and qualityInspect.customer != '' "> |
| | | AND customer = #{qualityInspect.customer} |
| | | AND customer like concat('%',#{qualityInspect.customer},'%') |
| | | </if> |
| | | <if test="qualityInspect.process != null and qualityInspect.process != '' "> |
| | | AND process = #{qualityInspect.process} |
| | | AND process like concat('%',#{qualityInspect.process},'%') |
| | | </if> |
| | | <if test="qualityInspect.productName != null and qualityInspect.productName != '' "> |
| | | AND product_name = #{qualityInspect.productName} |
| | | AND product_name like concat('%',#{qualityInspect.productName},'%') |
| | | </if> |
| | | <if test="qualityInspect.entryDateStart != null and qualityInspect.entryDateStart != '' "> |
| | | AND check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-%d') |
| | |
| | | AND product_name = #{qualityInspect.productName} |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="deleteByProductMainIds"> |
| | | DELETE FROM quality_inspect |
| | | WHERE product_main_id IN |
| | | <foreach collection="productMainIds" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | T1.contract_amount, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method, |
| | | t3.shipping_car_number, |
| | | t3.shipping_date |
| | | T1.payment_method |
| | | FROM |
| | | sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | | left join shipping_info t3 on T1.id = t3.sales_ledger_id |
| | | <where> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.SalesLedgerProductMapper"> |
| | | |
| | | <select id="selectSalesLedgerProductList" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct"> |
| | | SELECT |
| | | T1.*, |
| | | t3.shipping_car_number, |
| | | t3.shipping_date |
| | | FROM |
| | | sales_ledger_product T1 |
| | | left join shipping_info t3 on T1.id = t3.sales_ledger_id |
| | | <where> |
| | | 1=1 |
| | | <if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' "> |
| | | AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId} |
| | | </if> |
| | | <if test="salesLedgerProduct.type != null and salesLedgerProduct.type != '' "> |
| | | AND T1.type = #{salesLedgerProduct.type} |
| | | </if> |
| | | </where> |
| | | </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.sales.mapper.ShipmentApprovalMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.sales.pojo.ShipmentApproval"> |
| | | SELECT *, |
| | | si.shipping_car_number, |
| | | T2.nick_name AS entry_person_name |
| | | FROM shipment_approval sa |
| | | LEFT JOIN shipping_info si ON sa.shipping_info_id = si.id |
| | | LEFT JOIN sales_ledger sl ON sa.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id |
| | | LEFT JOIN sys_user T2 ON sl.entry_person = T2.user_id |
| | | <where> |
| | | 1=1 |
| | | <if test="req.approveStatus != null and req.approveStatus != '' "> |
| | | AND sa.approve_status = #{req.approveStatus} |
| | | </if> |
| | | <if test="req.salesContractNo != null and req.salesContractNo != '' "> |
| | | AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |