Merge remote-tracking branch 'origin/dev_New' into dev_New
| | |
| | | // æ¼ç¤ºä¾åï¼æ§è¡ main æ¹æ³æ§å¶å°è¾å
¥æ¨¡å表åå车èªå¨çæå¯¹åºé¡¹ç®ç®å½ä¸ |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://127.0.0.1:3306/product-inventory-management-new"; |
| | | public static String database_url = "jdbc:mysql://1.15.17.182:9999/product-inventory-management-new"; |
| | | public static String database_username = "root"; |
| | | public static String database_password= "123456"; |
| | | public static String database_password= "xd@123456.."; |
| | | public static String author = "è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸"; |
| | | public static String model = "account"; // 模å |
| | | public static String model = "stock"; // 模å |
| | | public static String setParent = "com.ruoyi."+ model; // å
è·¯å¾ |
| | | public static String tablePrefix = ""; // è®¾ç½®è¿æ»¤è¡¨åç¼ |
| | | public static void main(String[] args) { |
| | |
| | | /** |
| | | * ç¥è¯ç±»å |
| | | */ |
| | | @Excel(name = "ç¥è¯ç±»å",readConverterExp = "contract=ååç¹æ¹,approval=å®¡æ¹æ¡ä¾,solution=è§£å³æ¹æ¡,experience=ç»éªæ»ç»,guide=æä½æå") |
| | | @Excel(name = "ç¥è¯ç±»å") |
| | | private String type; |
| | | /** |
| | | * éç¨åºæ¯ |
| | |
| | | LambdaQueryWrapper<ApproveProcess> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApproveProcess::getApproveId, id); |
| | | queryWrapper.eq(ApproveProcess::getApproveDelete, 0); |
| | | queryWrapper.eq(ApproveProcess::getTenantId, SecurityUtils.getLoginUser().getTenantId()); |
| | | // queryWrapper.eq(ApproveProcess::getTenantId, SecurityUtils.getLoginUser().getTenantId()); |
| | | queryWrapper.last("limit 1"); |
| | | ApproveProcess one = approveProcessMapper.selectOne(queryWrapper); |
| | | return one; |
| | |
| | | @Override |
| | | public void initApproveNodes(String approveUserIds,String approveID,Long tenantId) { |
| | | Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); |
| | | ApproveProcess approve = getApproveById(approveID); |
| | | String[] names = approveUserIds.split(","); |
| | | String approveId = approve.getApproveId(); |
| | | for (int i = 0; i < names.length; i++) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(Long.parseLong(names[i])); |
| | | if (sysUser == null) continue; |
| | | ApproveNode approveNode = new ApproveNode(); |
| | | approveNode.setApproveProcessId(approveId); |
| | | approveNode.setApproveProcessId(approveID); |
| | | approveNode.setApproveNodeOrder(i +1); |
| | | approveNode.setApproveNodeUser(sysUser.getNickName()); |
| | | approveNode.setApproveNodeUserId(sysUser.getUserId()); |
| | |
| | | LambdaQueryWrapper<ApproveNode> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApproveNode::getApproveProcessId, id); |
| | | queryWrapper.eq(ApproveNode::getDeleteFlag, 0); |
| | | queryWrapper.eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()); |
| | | List<ApproveNode> list = list(queryWrapper); |
| | | // æç
§ approveNodeOrder åæ®µååºæåº |
| | | list.sort(Comparator.comparingInt(ApproveNode::getApproveNodeOrder)); |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, id) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess != null && approveProcess.getApproveStatus() == 3){ |
| | |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess == null) throw new RuntimeException("审æ¹ä¸åå¨"); |
| | |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveNode::getApproveNodeOrder, approveNode.getApproveNodeOrder() + 1) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .last("limit 1"); |
| | | ApproveNode approveNode1 = approveNodeMapper.selectOne(approveNodeLambdaQueryWrapper); |
| | | approveProcess.setApproveStatus(status); |
| | |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveNode.getApproveProcessId()+"æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveNode.getTenantId(), |
| | | "/collaborativeApproval/approvalProcess?approveType="+approveProcess.getApproveType()+"&approveId="+approveNode.getApproveProcessId()); |
| | | } |
| | | break; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.approve.mapper.ApproveNodeMapper; |
| | |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcessVO.getApproveType()), |
| | | approveID + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveProcessVO.getApproveDeptId(), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcessVO.getApproveType() + "&approveId=" + approveID); |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public ApproveProcess getApproveById(String id) { |
| | | LambdaQueryWrapper<ApproveProcess> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApproveProcess::getApproveId, id); |
| | | queryWrapper.eq(ApproveProcess::getApproveDelete, 0); |
| | | queryWrapper.eq(ApproveProcess::getTenantId, SecurityUtils.getLoginUser().getTenantId()); |
| | | queryWrapper.last("limit 1"); |
| | | ApproveProcess one = getOne(queryWrapper); |
| | | ApproveProcess one = approveProcessMapper.selectList(Wrappers.<ApproveProcess>lambdaQuery() |
| | | .eq(ApproveProcess::getApproveId,id) |
| | | .eq(ApproveProcess::getApproveDelete,0)).get(0); |
| | | one.setCommonFileList(commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, one.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveProcess.getValue()))); |
| | |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveProcess.getApproveId()) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | // .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder); |
| | | approveNodeMapper.delete(approveNodeLambdaQueryWrapper); |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approveProcess.getApproveId(), approveProcess.getTenantId()); |
| | |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveProcess.getApproveDeptId(), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | |
| | |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approve.getApproveId()) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | // .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder); |
| | | approveNodeMapper.delete(approveNodeLambdaQueryWrapper); |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approve.getApproveId(), approve.getTenantId()); |
| | |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approve.getApproveType()), |
| | | approve.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approve.getApproveDeptId(), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approve.getApproveType() + "&approveId=" + approve.getApproveId()); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import com.ruoyi.basic.utils.EnumUtils; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Api(tags = "æä¸¾æ¥å£") |
| | | @RequestMapping("/basic/enum") |
| | | public class EnumController { |
| | | |
| | | |
| | | //è·ååºåæä¸¾ |
| | | @GetMapping("/stockRecordType") |
| | | @Anonymous |
| | | public R getStockRecordTypeEnum(){ |
| | | List<Map<String, Object>> list = EnumUtil.toList(StockQualifiedRecordTypeEnum.class); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/{className}") |
| | | @Anonymous |
| | | public R test(@PathVariable String className){ |
| | | return R.ok(EnumUtils.getOptions("com.ruoyi.common.enums." + className)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SelectOptionDTO<T> { |
| | | private T value; |
| | | private String label; |
| | | |
| | | public SelectOptionDTO(T code, String value) { |
| | | this.value = code; |
| | | this.label = value; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.utils; |
| | | |
| | | import com.ruoyi.basic.dto.SelectOptionDTO; |
| | | import com.ruoyi.common.enums.BaseEnum; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class EnumUtils { |
| | | public static List<SelectOptionDTO<?>> getOptions(String className) { |
| | | try { |
| | | Class<?> clazz = Class.forName(className); |
| | | return getOptionsByClass(clazz); |
| | | } catch (ClassNotFoundException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | private static List<SelectOptionDTO<?>> getOptionsByClass(Class<?> clazz) { |
| | | if (!clazz.isEnum()) { |
| | | throw new RuntimeException("䏿¯æä¸¾ï¼" + clazz.getName()); |
| | | } |
| | | if (!BaseEnum.class.isAssignableFrom(clazz)) { |
| | | throw new RuntimeException("æªå®ç° BaseEnumï¼" + clazz.getName()); |
| | | } |
| | | return (List<SelectOptionDTO<?>>) getOptionsInternal((Class) clazz); |
| | | } |
| | | |
| | | private static <T> List<SelectOptionDTO<T>> getOptionsInternal( |
| | | Class<? extends BaseEnum<T>> clazz) { |
| | | |
| | | Enum<?>[] enums = (Enum<?>[]) clazz.getEnumConstants(); |
| | | List<SelectOptionDTO<T>> list = new ArrayList<>(); |
| | | |
| | | for (Enum<?> e : enums) { |
| | | BaseEnum<T> option = (BaseEnum<T>) e; |
| | | list.add(new SelectOptionDTO<>( |
| | | option.getCode(), |
| | | option.getValue() |
| | | )); |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.dto.NoticeDTO; |
| | | import com.ruoyi.collaborativeApproval.pojo.Notice; |
| | | import com.ruoyi.collaborativeApproval.service.NoticeService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.security.Security; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | | sysNoticeService.simpleNoticeAll("éç¥å
Œ", |
| | | noticeDTO.getTitle(), |
| | | noticeDTO.getTenantId(), |
| | | "/collaborativeApproval/noticeManagement?type="+noticeDTO.getType()); |
| | | } |
| | | return AjaxResult.success(noticeService.save(noticeDTO)); |
| | |
| | | //æ£å¼åå¸éç¥ææäººçæ¶æ¯éç¥ |
| | | sysNoticeService.simpleNoticeAll("éç¥å
Œ", |
| | | notice.getTitle(), |
| | | notice.getTenantId(), |
| | | "/collaborativeApproval/noticeManagement?type="+notice.getType()); |
| | | } |
| | | return AjaxResult.success(noticeService.updateById(noticeDTO)); |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody NoticeType noticeType) { |
| | | return AjaxResult.success(noticeTypeService.save(noticeType)); |
| | | return AjaxResult.success(noticeTypeService.saveOrUpdate(noticeType)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement; |
| | | import com.ruoyi.collaborativeApproval.service.SealApplicationManagementService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | |
| | | "ç³è¯·ç¼å·ï¼"+sealApplicationManagement.getApplicationNum()+"\n" |
| | | +"ç³è¯·æ é¢ï¼"+sealApplicationManagement.getTitle(), |
| | | Arrays.asList(sealApplicationManagement.getApproveUserId()), |
| | | sealApplicationManagement.getTenantId(), |
| | | "/collaborativeApproval/sealManagement?applicationNum="+sealApplicationManagement.getApplicationNum()); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | "ä¼è®®æ¶é´ï¼" + application.getStartTime() + "-" + application.getEndTime() + "\n" + |
| | | "å起人ï¼" + application.getApplicant(), |
| | | userIds, |
| | | application.getTenantId(), |
| | | "" |
| | | ); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | public interface BaseEnum<T> { |
| | | @JsonValue |
| | | T getCode(); |
| | | |
| | | String getValue(); |
| | | |
| | | /** |
| | | * éç¨éæå·¥å
·æ¹æ³ï¼å¯è¢«æææä¸¾è°ç¨ï¼ |
| | | */ |
| | | /** |
| | | * éç¨éæå·¥å
·æ¹æ³ï¼æ¯æä» Integer æ String ç±»åç Code è¿è¡ååºåå |
| | | */ |
| | | @JsonCreator(mode = JsonCreator.Mode.DELEGATING) |
| | | static <E extends Enum<E> & BaseEnum<?>> E fromCode(Class<E> enumClass, Object code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | // ç®æ Code çæ´æ°å¼ |
| | | Integer targetCode = null; |
| | | |
| | | if (code instanceof Integer) { |
| | | // 1. å¦æä¼ å
¥çæ¯æ°å (Integer) |
| | | targetCode = (Integer) code; |
| | | } else if (code instanceof String) { |
| | | // 2. å¦æä¼ å
¥çæ¯å符串 ("1") |
| | | try { |
| | | // å°è¯å°å符串转æ¢ä¸ºæ´æ° |
| | | targetCode = Integer.valueOf((String) code); |
| | | } catch (NumberFormatException e) { |
| | | // 妿åç¬¦ä¸²ä¸æ¯ææçæ°åï¼ä¾å¦ "Unknown"ï¼ï¼å targetCode ä¿æä¸º null |
| | | // æ¨ä¹å¯ä»¥å¨è¿éè®°å½æ¥å¿ææ§è¡å
¶ä»é误å¤ç |
| | | // System.err.println("æ æ³å°å符串 Code 转æ¢ä¸ºæ°å: " + code); |
| | | return null; // æè
卿¾ä¸å°å¹é
çæ
åµä¸è¿å null |
| | | } |
| | | } |
| | | // else if (code instanceof Long) { ... æ¨ä¹å¯ä»¥æ·»å 对 Long ç±»åçæ¯æ } |
| | | |
| | | if (targetCode == null) { |
| | | return null; |
| | | } |
| | | |
| | | // 使ç¨è·åå°çæ´æ°å¼è¿è¡æ¥æ¾ |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if (e.getCode().equals(targetCode)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | |
| | | public enum SalesLedgerType { |
| | | public enum SalesLedgerType implements BaseEnum<Integer>{ |
| | | SALES_LEDGER_TYPE_SALES_LEDGER(1, "éå®å°è´¦"), |
| | | SALES_LEDGER_TYPE_PURCHASE_LEDGER(2, "éè´å°è´¦"); |
| | | |
| | |
| | | this.label = label; |
| | | } |
| | | |
| | | public Integer getValue() { |
| | | public Integer getCode() { |
| | | return value; |
| | | } |
| | | |
| | | public String getLabel() { |
| | | public String getValue() { |
| | | return label; |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @AllArgsConstructor |
| | | public enum StaffLeaveReason { |
| | | public enum StaffLeaveReason implements BaseEnum<String> { |
| | | StaffLeaveReasonSalary("salary","èªèµå¾
é"), |
| | | StaffLeaveReasonCareerDevelopment("career_development","èä¸åå±"), |
| | | StaffLeaveReasonWorkEnvironment("work_environment","å·¥ä½ç¯å¢"), |
| | |
| | | return code; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return info; |
| | | } |
| | | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | |
| | | @Getter |
| | | public enum StockQualifiedRecordTypeEnum implements BaseEnum<Integer> { |
| | | CUSTOMIZATION_STOCK_IN(0, "åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_STOCK_OUT(1, "åæ ¼èªå®ä¹åºåº"), |
| | | PRODUCTION_REPORT_STOCK_IN(2, "ç产æ¥å·¥-å
¥åº"), |
| | | PRODUCTION_REPORT_STOCK_OUT(3, "ç产æ¥å·¥-åºåº"), |
| | | DEFECTIVE_PASS(6, "ä¸åæ ¼å¤ç-è®©æ¥æ¾è¡"), |
| | | PURCHASE_STOCK_IN(7, "éè´-å
¥åº"), |
| | | SALE_STOCK_OUT(8, "éå®-åºåº"), |
| | | QUALITYINSPECT_STOCK_IN(11, "è´¨æ£-åæ ¼å
¥åº"); |
| | | |
| | | |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | | |
| | | StockQualifiedRecordTypeEnum(Integer code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | |
| | | @Getter |
| | | public enum StockUnQualifiedRecordTypeEnum implements BaseEnum<Integer> { |
| | | |
| | | |
| | | PRODUCTION_SCRAP(4, "ç产æ¥å·¥-æ¥åº"), |
| | | DEFECTIVE_SCRAP(5, "ä¸åæ ¼å¤ç-æ¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_IN(9, "ä¸åæ ¼èªå®ä¹å
¥åº"), |
| | | CUSTOMIZATION_UNSTOCK_OUT(10, "ä¸åæ ¼èªå®ä¹åºåº"), |
| | | QUALITYINSPECT_UNSTOCK_IN(12, "è´¨æ£-ä¸åæ ¼å
¥åº"); |
| | | |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | | |
| | | StockUnQualifiedRecordTypeEnum(Integer code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | */ |
| | | @AllArgsConstructor |
| | | public enum StorageAttachmentRecordType { |
| | | public enum StorageAttachmentRecordType implements BaseEnum<String> { |
| | | // ä¾å å®é
å¼å请å é¤ |
| | | Template("Template","èä¾"), |
| | | Archives("Archives","ææ¡£ç®¡ç"), |
| | |
| | | return code; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return info; |
| | | } |
| | | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| | |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | public enum UserStatus
|
| | | public enum UserStatus implements BaseEnum<String>
|
| | | {
|
| | | OK("0", "æ£å¸¸"), DISABLE("1", "åç¨"), DELETED("2", "å é¤");
|
| | |
|
| | |
| | | return code;
|
| | | }
|
| | |
|
| | | public String getValue() {
|
| | | return info;
|
| | | }
|
| | |
|
| | | public String getInfo()
|
| | | {
|
| | | return info;
|
| | | }
|
| | |
|
| | | }
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | |
| | | import com.ruoyi.common.enums.BaseEnum; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * éç¨æä¸¾å·¥å
·ç±» |
| | | * éç¨äºææå®ç° BaseEnum æ¥å£çæä¸¾ |
| | | * |
| | | * @author Bu |
| | | */ |
| | | public class EnumUtil { |
| | | |
| | | /** |
| | | * æ ¹æ® code è·åæä¸¾å®ä¾ |
| | | */ |
| | | public static <E extends Enum<E> & BaseEnum> E fromCode(Class<E> enumClass, int code) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | return e; |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("æªç¥ç code: " + code + " å¯¹äºæä¸¾ " + enumClass.getSimpleName()); |
| | | } |
| | | |
| | | public static <E extends Enum<E> & BaseEnum> E fromCodeHasNull(Class<E> enumClass, int code) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static <E extends Enum<E> & BaseEnum> E fromCodeHasDefault(Class<E> enumClass, int code,E defaultE) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if ((int)e.getCode() == code) { |
| | | return e; |
| | | } |
| | | } |
| | | return defaultE; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ® value è·åæä¸¾å®ä¾ |
| | | */ |
| | | public static <E extends Enum<E> & BaseEnum> E fromValue(Class<E> enumClass, String value) { |
| | | for (E e : enumClass.getEnumConstants()) { |
| | | if (Objects.equals(e.getValue(), value)) { |
| | | return e; |
| | | } |
| | | } |
| | | throw new IllegalArgumentException("æªç¥ç value: " + value + " å¯¹äºæä¸¾ " + enumClass.getSimpleName()); |
| | | } |
| | | |
| | | /** |
| | | * è·åæææä¸¾é¡¹å表 |
| | | */ |
| | | public static <E extends Enum<E> & BaseEnum> List<E> listAll(Class<E> enumClass) { |
| | | return Arrays.asList(enumClass.getEnumConstants()); |
| | | } |
| | | |
| | | /** |
| | | * 转为 List<Map>ï¼éåè¿åç»åç«¯ï¼ |
| | | * æ ¼å¼: [{ "code": 1, "value": "ç»çº¿" }, ...] |
| | | */ |
| | | public static <E extends Enum<E> & BaseEnum> List<Map<String, Object>> toList(Class<E> enumClass) { |
| | | return Arrays.stream(enumClass.getEnumConstants()) |
| | | .map(e -> { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("key", e.getCode().toString()); |
| | | map.put("value", e.getValue()); |
| | | return map; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | // /** |
| | | // * 转为 Map<Integer, String> |
| | | // * æ ¼å¼: { 1: "ç»çº¿", 0: "æä¸" } |
| | | // */ |
| | | // public static <E extends Enum<E> & BaseEnum> Map<Integer, String> toMap(Class<E> enumClass) { |
| | | // return Arrays.stream(enumClass.getEnumConstants()) |
| | | // .collect(Collectors.toMap((BaseEnum::getCode, BaseEnum::getValue)); |
| | | // } |
| | | // |
| | | // |
| | | // public static void main(String[] args) { |
| | | // // â
1. æ ¹æ® code è·åæä¸¾ |
| | | // StockRecordTypeEnum status = EnumUtil.fromCode(StockRecordTypeEnum.class, 1); |
| | | // System.out.println(status.getValue()); // ç»çº¿ |
| | | // |
| | | // // â
2. 转æ list (éåå端) |
| | | // System.out.println(EnumUtil.toList(StockRecordTypeEnum.class)); |
| | | // // è¾åº: [{code=1, value=ç»çº¿}, {code=0, value=æä¸}] |
| | | // |
| | | // // â
3. 转æ map |
| | | // System.out.println(EnumUtil.toMap(StockRecordTypeEnum.class)); |
| | | // // è¾åº: {1=ç»çº¿, 0=æä¸} |
| | | // } |
| | | } |
| | |
| | | return AjaxResult.success("æ·»å æå"); |
| | | } |
| | | return AjaxResult.error("æ·»å 失败"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-ç¼è¾", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("å®¢æ·æè®¿-ç¼è¾") |
| | | @PostMapping("update") |
| | | public AjaxResult updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | boolean updateResult = customerVisitsService.updateCustomerVisit(customerVisits); |
| | | if (updateResult) { |
| | | return AjaxResult.success("ç¼è¾æå"); |
| | | } |
| | | return AjaxResult.error("ç¼è¾å¤±è´¥"); |
| | | } |
| | | |
| | | @Log(title = "å®¢æ·æè®¿-å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("å®¢æ·æè®¿-å é¤") |
| | | @DeleteMapping("{customerId}") |
| | | public AjaxResult deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | if (customerId == null) { |
| | | return AjaxResult.error("客æ·IDä¸è½ä¸ºç©º"); |
| | | } |
| | | boolean deleteResult = customerVisitsService.removeById(customerId); |
| | | if (deleteResult) { |
| | | return AjaxResult.success("å 餿å"); |
| | | } |
| | | return AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.customervisits.pojo.CustomerVisits; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | */ |
| | | public interface CustomerVisitsService extends IService<CustomerVisits> { |
| | | IPage<CustomerVisits> listPage(Page page, CustomerVisits customerVisits); |
| | | |
| | | boolean updateCustomerVisit(CustomerVisits customerVisits); |
| | | |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | Page page1 = customerVisitsMapper.selectPage(page, customerVisitsLambdaQueryWrapper); |
| | | return page1; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateCustomerVisit(CustomerVisits customerVisits) { |
| | | if (customerVisits == null || customerVisits.getId() == null) { |
| | | return false; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(customerVisits.getCustomerName()) |
| | | || StringUtils.isEmpty(customerVisits.getPurposeVisit()) |
| | | || StringUtils.isEmpty(customerVisits.getVisitAddress()) |
| | | || StringUtils.isEmpty(customerVisits.getPurposeDate())) { |
| | | return false; |
| | | } |
| | | |
| | | return updateById(customerVisits); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public class DeviceDefectRecordController { |
| | | @Autowired |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @ApiModelProperty("设å¤ç¼ºé·è®°å½å表") |
| | | @ApiOperation("设å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | } |
| | | @ApiModelProperty("设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @ApiOperation("设å¤idæ¥è¯¢è®¾å¤ç¼ºé·è®°å½å表") |
| | | @GetMapping("/find/{deviceLedgerId}") |
| | | public AjaxResult find(@PathVariable Long deviceLedgerId) { |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiModelProperty("æ·»å 设å¤ç¼ºé·è®°å½") |
| | | @ApiOperation("æ·»å 设å¤ç¼ºé·è®°å½") |
| | | public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | } |
| | | @PostMapping("/update") |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @ApiModelProperty("å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | @ApiOperation("å é¤è®¾å¤ç¼ºé·è®°å½") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceDefectRecordService.removeById(id)); |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty("设å¤å°è´¦å表") |
| | | @ApiOperation("设å¤å°è´¦å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("æ·»å 设å¤å°è´¦") |
| | | @ApiOperation("æ·»å 设å¤å°è´¦") |
| | | public AjaxResult add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @ApiModelProperty("æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤å°è´¦") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceLedgerService.getById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤å°è´¦") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤å°è´¦") |
| | | public AjaxResult update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("å é¤è®¾å¤å°è´¦") |
| | | @ApiOperation("å é¤è®¾å¤å°è´¦") |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiModelProperty("导åºè®¾å¤å°è´¦") |
| | | @ApiOperation("导åºè®¾å¤å°è´¦") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceLedgerService.export(response, ids); |
| | | } |
| | | |
| | | @PostMapping("import") |
| | | @ApiModelProperty("导å
¥è®¾å¤å°è´¦") |
| | | @ApiOperation("导å
¥è®¾å¤å°è´¦") |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @ApiModelProperty("è·å设å¤å°è´¦") |
| | | @ApiOperation("è·å设å¤å°è´¦") |
| | | public AjaxResult getDeviceLedger( ) { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @ApiModelProperty("设å¤ä¿å
»å表") |
| | | @ApiOperation("设å¤ä¿å
»å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("æ·»å 设å¤ä¿å
»") |
| | | @ApiOperation("æ·»å 设å¤ä¿å
»") |
| | | public AjaxResult add(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | |
| | | return deviceMaintenanceService.saveDeviceRepair(deviceMaintenance); |
| | | } |
| | | |
| | | @ApiModelProperty("æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤ä¿å
»") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult update(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | |
| | | } |
| | | |
| | | @PostMapping ("maintenance") |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤ä¿å
»") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenance deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("å é¤è®¾å¤ä¿å
»") |
| | | @ApiOperation("å é¤è®¾å¤ä¿å
»") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiModelProperty("导åºè®¾å¤ä¿å
»") |
| | | @ApiOperation("导åºè®¾å¤ä¿å
»") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceMaintenanceService.export(response, ids); |
| | | } |
| | |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | |
| | | @ApiModelProperty("è®¾å¤æ¥ä¿®å表") |
| | | @ApiOperation("è®¾å¤æ¥ä¿®å表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return AjaxResult.success(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @ApiModelProperty("æ·»å è®¾å¤æ¥ä¿®") |
| | | @ApiOperation("æ·»å è®¾å¤æ¥ä¿®") |
| | | public AjaxResult add( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepair); |
| | | } |
| | | |
| | | @ApiModelProperty("æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @ApiOperation("æ ¹æ®idæ¥è¯¢è®¾å¤æ¥ä¿®") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | DeviceRepairDto byId = deviceRepairService.detailById(id); |
| | |
| | | } |
| | | |
| | | @PutMapping () |
| | | @ApiModelProperty("ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | @ApiOperation("ä¿®æ¹è®¾å¤æ¥ä¿®") |
| | | public AjaxResult update( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | } |
| | | |
| | | @PostMapping ("repair") |
| | | @ApiModelProperty("设å¤ç»´ä¿®") |
| | | @ApiOperation("设å¤ç»´ä¿®") |
| | | public AjaxResult repair( @RequestBody DeviceRepair deviceRepair) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepair); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @ApiModelProperty("å é¤è®¾å¤æ¥ä¿®") |
| | | @ApiOperation("å é¤è®¾å¤æ¥ä¿®") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | |
| | | } |
| | | |
| | | @PostMapping("export") |
| | | @ApiModelProperty("导åºè®¾å¤æ¥ä¿®") |
| | | @ApiOperation("导åºè®¾å¤æ¥ä¿®") |
| | | public void export(HttpServletResponse response, Long[] ids) { |
| | | deviceRepairService.export(response, ids); |
| | | } |
| | |
| | | @Autowired |
| | | private HomeService homeService; |
| | | |
| | | /********************************************************åºç¡ç±»*****************************************************/ |
| | | @GetMapping("/todos") |
| | | @Log(title = "å¾
åäºé¡¹", businessType = BusinessType.OTHER) |
| | | @ApiOperation("å¾
åäºé¡¹") |
| | | public AjaxResult todos(ApproveProcess req) throws ParseException { |
| | | List<ApproveProcess> approveProcessList = homeService.todos(); |
| | | return AjaxResult.success(approveProcessList); |
| | | } |
| | | |
| | | @GetMapping("/approveAndDeviceTodos") |
| | | @ApiOperation("审æ¹ååï¼è®¾å¤æ¥ä¿®å¾
åäºé¡¹") |
| | | public AjaxResult approveAndDeviceTodos(){ |
| | | Map<String, Object> map = homeService.approveAndDeviceTodos(); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | @GetMapping("/noticesCount") |
| | | @ApiOperation("æªè¿æçå
¬åæ°é") |
| | | public AjaxResult noticesCount(){ |
| | | Long count = homeService.noticesCount(); |
| | | return AjaxResult.success(count); |
| | | } |
| | | |
| | | |
| | | /********************************************************è¥ééè´ç±»**************************************************/ |
| | | @GetMapping("/business") |
| | | @Log(title = "éå®-éè´-åºåæ°æ®", businessType = BusinessType.OTHER) |
| | | @ApiOperation("éå®-éè´-åºåæ°æ®") |
| | |
| | | return AjaxResult.success(analysisCustomerContractAmounts); |
| | | } |
| | | |
| | | @GetMapping("/qualityStatistics") |
| | | @Log(title = "è´¨éåæ", businessType = BusinessType.OTHER) |
| | | @ApiOperation("è´¨éåæ") |
| | | public AjaxResult qualityStatistics(QualityStatisticsDto req) { |
| | | QualityStatisticsDto qualityStatisticsDto = homeService.qualityStatistics(); |
| | | return AjaxResult.success(qualityStatisticsDto); |
| | | } |
| | | |
| | | @GetMapping("/todos") |
| | | @Log(title = "å¾
åäºé¡¹", businessType = BusinessType.OTHER) |
| | | @ApiOperation("å¾
åäºé¡¹") |
| | | public AjaxResult todos(ApproveProcess req) throws ParseException { |
| | | List<ApproveProcess> approveProcessList = homeService.todos(); |
| | | return AjaxResult.success(approveProcessList); |
| | | } |
| | | |
| | | @GetMapping("/statisticsReceivablePayable") |
| | | @Log(title = "åºæ¶åºä»ç»è®¡", businessType = BusinessType.OTHER) |
| | | @ApiOperation("åºæ¶åºä»ç»è®¡") |
| | | public AjaxResult statisticsReceivablePayable(StatisticsReceivablePayableDto req, @RequestParam(value = "type", defaultValue = "1") Integer type ) { |
| | | StatisticsReceivablePayableDto statisticsReceivablePayable = homeService.statisticsReceivablePayable(type); |
| | | return AjaxResult.success(statisticsReceivablePayable); |
| | | } |
| | | |
| | | @GetMapping("/approveAndDeviceTodos") |
| | | @ApiOperation("审æ¹ååï¼è®¾å¤æ¥ä¿®å¾
åäºé¡¹") |
| | | public AjaxResult approveAndDeviceTodos(){ |
| | | Map<String, Object> map = homeService.approveAndDeviceTodos(); |
| | | return AjaxResult.success(map); |
| | | } |
| | | |
| | | @GetMapping("/noticesCount") |
| | | @ApiOperation("æªè¿æçå
¬åæ°é") |
| | | public AjaxResult noticesCount(){ |
| | | Long count = homeService.noticesCount(); |
| | | return AjaxResult.success(count); |
| | | } |
| | | /********************************************************ç产类*****************************************************/ |
| | | @GetMapping("/progressStatistics") |
| | | @ApiOperation("åç产订åç宿è¿åº¦ç»è®¡") |
| | | public AjaxResult progressStatistics(){ |
| | |
| | | ProductionTurnoverDto productionTurnoverDto = homeService.workInProcessTurnover(); |
| | | return AjaxResult.success(productionTurnoverDto); |
| | | } |
| | | |
| | | |
| | | /********************************************************è´¨éç±»*****************************************************/ |
| | | @GetMapping("/qualityStatistics") |
| | | @Log(title = "è´¨éåæ", businessType = BusinessType.OTHER) |
| | | @ApiOperation("è´¨éåæ") |
| | | public AjaxResult qualityStatistics(QualityStatisticsDto req) { |
| | | QualityStatisticsDto qualityStatisticsDto = homeService.qualityStatistics(); |
| | | return AjaxResult.success(qualityStatisticsDto); |
| | | } |
| | | |
| | | |
| | | /********************************************************è´¢å¡ç±»*****************************************************/ |
| | | @GetMapping("/statisticsReceivablePayable") |
| | | @Log(title = "åºæ¶åºä»ç»è®¡", businessType = BusinessType.OTHER) |
| | | @ApiOperation("åºæ¶åºä»ç»è®¡") |
| | | public AjaxResult statisticsReceivablePayable(StatisticsReceivablePayableDto req, @RequestParam(value = "type", defaultValue = "1") Integer type ) { |
| | | StatisticsReceivablePayableDto statisticsReceivablePayable = homeService.statisticsReceivablePayable(type); |
| | | return AjaxResult.success(statisticsReceivablePayable); |
| | | } |
| | | |
| | | |
| | | /********************************************************ä»å¨ç±»*****************************************************/ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getApproveUserCurrentId, loginUser.getUserId()) |
| | | .ne(ApproveProcess::getApproveStatus, 2) |
| | | .eq(ApproveProcess::getTenantId, loginUser.getTenantId()); |
| | | .ne(ApproveProcess::getApproveStatus, 2); |
| | | // .eq(ApproveProcess::getTenantId, loginUser.getTenantId()); |
| | | List<ApproveProcess> approveProcesses = approveProcessMapper.selectList(approveProcessLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty(approveProcesses)){ |
| | | approveProcesses = new ArrayList<>(); |
| | |
| | | package com.ruoyi.procurementrecord.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import com.ruoyi.stock.service.impl.StockInRecordServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class StockUtils { |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final StockUninventoryService stockUninventoryService; |
| | | private final StockInventoryService stockInventoryService; |
| | | private final StockInRecordService stockInRecordService; |
| | | |
| | | // è·åååå
¥åºæ°é,åºåºæ°é,å©ä½åºå |
| | | public Map<String, BigDecimal> getStockQuantity(Long productModelId) { |
| | |
| | | stockMap.put("stockQuantity", stockQuantity); |
| | | return stockMap; |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæ ¼å
¥åº |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setRecordId(recordId); |
| | | stockUninventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockUninventoryDto.setQualitity(quantity); |
| | | stockUninventoryDto.setProductModelId(productModelId); |
| | | stockUninventoryService.addStockUninventory(stockUninventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæ ¼åºåº |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void subtractUnStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setRecordId(recordId); |
| | | stockUninventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockUninventoryDto.setQualitity(quantity); |
| | | stockUninventoryDto.setProductModelId(productModelId); |
| | | stockUninventoryService.subtractStockUninventory(stockUninventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * åæ ¼å
¥åº |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void addStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryService.addstockInventory(stockInventoryDto); |
| | | } |
| | | |
| | | /** |
| | | * åæ ¼åºåº |
| | | * @param productModelId |
| | | * @param quantity |
| | | * @param recordType |
| | | * @param recordId |
| | | */ |
| | | public void substractStock(Long productModelId, BigDecimal quantity, Integer recordType,Long recordId) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setRecordId(recordId); |
| | | stockInventoryDto.setRecordType(String.valueOf(recordType)); |
| | | stockInventoryDto.setQualitity(quantity); |
| | | stockInventoryDto.setProductModelId(productModelId); |
| | | stockInventoryService.subtractStockInventory(stockInventoryDto); |
| | | } |
| | | |
| | | //ä¸åæ ¼åºåå é¤ |
| | | public void deleteStockRecord(Long recordId, Integer recordType) { |
| | | StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>() |
| | | .lambda().eq(StockInRecord::getRecordId, recordId) |
| | | .eq(StockInRecord::getRecordType, recordType)); |
| | | |
| | | stockInRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductBomDto; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProductBom; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.ruoyi.production.service.ProductProcessRouteService; |
| | | import com.ruoyi.production.service.ProductProcessService; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productBom") |
| | | @Api(tags = "BOM") |
| | | public class ProductBomController { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private ProductProcessRouteService productProcessRouteService; |
| | | |
| | | @Autowired |
| | | private ProductStructureService productStructureService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "BOM-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å é¤bomå表 |
| | | productStructureService.remove(Wrappers.<ProductStructure>lambdaQuery().in(ProductStructure::getBomId,ids)); |
| | | return AjaxResult.success(productBomService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | |
| | | private ProductStructureService productStructureService; |
| | | |
| | | |
| | | @ApiOperation("æ°å¢BOM") |
| | | @ApiOperation("æ°å¢BOMåé") |
| | | @PostMapping() |
| | | public R addOrUpdate(@RequestBody ProductStructureDto productStructureDto){ |
| | | return R.ok(productStructureService.addProductStructureDto(productStructureDto)); |
| | | } |
| | | |
| | | @ApiOperation("BOMæ¥ç详æ
") |
| | | @ApiOperation("BOMæ¥çåé详æ
") |
| | | @GetMapping("/listBybomId/{bomId}") |
| | | public R listBybomId( @PathVariable("bomId") Long bomId){ |
| | | return R.ok(productStructureService.listBybomId(bomId)); |
| | |
| | | @Excel(name = "æ¥å·¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "æ¥åºæ°é") |
| | | @Excel(name = "æ¥åºæ°é") |
| | | private BigDecimal scrapQty; |
| | | |
| | | //产ååç§° |
| | | @Excel(name = "产ååç§°") |
| | | private String productName; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * æ ¹æ®å·¥åIDæ¹éå é¤çäº§ä¸»è¡¨æ°æ® |
| | | */ |
| | | int deleteByWorkOrderIds(@Param("workOrderIds") List<Long> workOrderIds); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¥å·¥idæ¥è¯¢ç产订å |
| | | * @param productMainId |
| | | * @return |
| | | */ |
| | | ProductOrder getOrderByMainId(@Param("productMainId") Long productMainId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "æ°é") |
| | | //åæ ¼æ°é=æ¥å·¥æ°é-æ¥åºæ°é |
| | | @ApiModelProperty(value = "æ¥å·¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "æ¥åºæ°é") |
| | | private BigDecimal scrapQty; |
| | | } |
| | |
| | | |
| | | 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.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | 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.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.quality.mapper.*; |
| | | import com.ruoyi.quality.pojo.*; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import oshi.driver.mac.net.NetStat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductModelId(productProcessRouteItem.getProductModelId()); |
| | | productionProductOutput.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO); |
| | | productionProductOutput.setScrapQty(dto.getScrapQty() != null ? dto.getScrapQty() : BigDecimal.ZERO); |
| | | productionProductOutputMapper.insert(productionProductOutput); |
| | | //åæ ¼æ°é=æ¥å·¥æ°é-æ¥åºæ°é |
| | | BigDecimal productQty = productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()); |
| | | //åªæåæ ¼æ°é>0æè½å¢å ç¸åºæ°æ® |
| | | if (productQty.compareTo(BigDecimal.ZERO)>0) { |
| | | /*æ°å¢è´¨æ£*/ |
| | | //对åºçè¿ç¨æ£æè
åºåæ£ |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | |
| | | qualityInspect.setProductName(product.getProductName()); |
| | | qualityInspect.setModel(productModel.getModel()); |
| | | qualityInspect.setUnit(productModel.getUnit()); |
| | | qualityInspect.setQuantity(dto.getQuantity()); |
| | | qualityInspect.setQuantity(productQty); |
| | | qualityInspect.setProcess(productProcess.getName()); |
| | | qualityInspect.setInspectState(0); |
| | | qualityInspect.setInspectType(inspectType); |
| | |
| | | } |
| | | /*æ´æ°å·¥ååç产订å*/ |
| | | ProductWorkOrder productWorkOrder = productWorkOrderMapper.selectById(dto.getWorkOrderId()); |
| | | productWorkOrder.setCompleteQuantity(productWorkOrder.getCompleteQuantity().add(dto.getQuantity())); |
| | | productWorkOrder.setCompleteQuantity(productQty.add(dto.getQuantity())); |
| | | if (ObjectUtils.isNull(productWorkOrder.getActualStartTime())){ |
| | | productWorkOrder.setActualStartTime(LocalDate.now());//å®é
å¼å§æ¶é´ |
| | | } |
| | |
| | | } |
| | | if (productProcessRouteItem.getDragSort()==productProcessRouteItems.size()){ |
| | | //å¦ææ¯æåä¸éå·¥åºæ¥å·¥ä¹åç产订å宿æ°é+ |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().add(dto.getQuantity())); |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().add(productQty)); |
| | | if (productOrder.getCompleteQuantity().compareTo(productOrder.getQuantity()) == 0){ |
| | | productOrder.setEndTime(LocalDateTime.now());//ç»ææ¶é´ |
| | | } |
| | |
| | | .salesLedgerProductId(productOrder.getProductModelId()) |
| | | .schedulingUserId(user.getUserId()) |
| | | .schedulingUserName(user.getNickName()) |
| | | .finishedNum(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO) |
| | | .finishedNum(productQty) |
| | | .workHours(productProcess.getSalaryQuota()) |
| | | .process(productProcess.getName()) |
| | | .schedulingDate(LocalDate.now()) |
| | | .tenantId(dto.getTenantId()) |
| | | .build(); |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | } |
| | | //妿æ¥åºæ°é>0,éè¦è¿å
¥æ¥åºçåºå |
| | | if (dto.getScrapQty().compareTo(BigDecimal.ZERO) > 0) { |
| | | stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | |
| | | .eq(ProcurementRecordOut::getSalesLedgerProductId, productionProductMain.getId())); |
| | | productionProductInputMapper.delete(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productionProductMain.getId())); |
| | | //å 餿¥åºçå
¥åºè®°å½ |
| | | stockUtils.deleteStockRecord(productionProductMain.getId(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode()); |
| | | // å é¤ä¸»è¡¨ |
| | | productionProductMainMapper.deleteById(productionProductMain.getId()); |
| | | return true; |
| | |
| | | * éè¿æå®äººåéæé
|
| | | * @param title æ é¢
|
| | | * @param message æ¶æ¯
|
| | | * @param tenantId ç§æ·id
|
| | | * @param jumpPath 跳转å°å
|
| | | */
|
| | | void simpleNoticeByUser(final String title, final String message, final List<Long> consigneeId, final Long tenantId, final String jumpPath);
|
| | | void simpleNoticeByUser(final String title, final String message, final List<Long> consigneeId, final String jumpPath);
|
| | |
|
| | | /**
|
| | | * éè¿ææäºº åéæé
|
| | |
| | | * @param message æ¶æ¯
|
| | | * @param jumpPath 跳转å°å
|
| | | */
|
| | | void simpleNoticeAll(final String title, final String message,final Long tenantId,final String jumpPath);
|
| | | void simpleNoticeAll(final String title, final String message,final String jumpPath);
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeByUser(String title, String message, List<Long> consigneeId, Long tenantId,
|
| | | String jumpPath) {
|
| | | public void simpleNoticeByUser(String title, String message, List<Long> consigneeId, String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | Long tenantId = SecurityUtils.getLoginUser().getTenantId();
|
| | | List<SysNotice> sysNotices = consigneeId.stream().map(it -> convertSysNotice(title, message, it,tenantId, jumpPath, userId)).collect(Collectors.toList());
|
| | | sysNoticeService.saveBatch(sysNotices);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeAll(String title, String message, Long rootDeptId, String jumpPath) {
|
| | | public void simpleNoticeAll(String title, String message, String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | if (userId == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | Long rootDeptId = SecurityUtils.getLoginUser().getTenantId();
|
| | | // æ¥ææåé¨é¨
|
| | | List<SysDept> childrenDepts = deptMapper.selectChildrenDeptById(rootDeptId);
|
| | |
|
| | |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | BeanUtils.copyProperties(purchaseLedger, purchaseLedgerDto); |
| | | SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct(); |
| | | salesLedgerProduct.setSalesLedgerId(id); |
| | | salesLedgerProduct.setType(SalesLedgerType.SALES_LEDGER_TYPE_SALES_LEDGER.getValue()); |
| | | salesLedgerProduct.setType(SalesLedgerType.SALES_LEDGER_TYPE_SALES_LEDGER.getCode()); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | purchaseLedgerDto.setProductData(salesLedgerProducts); |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | |
| | | qualityUnqualifiedService.qualityUnqualifiedExport(response, qualityUnqualified); |
| | | } |
| | | |
| | | /** |
| | | * ä¸åæ ¼ç®¡çå¤ç |
| | | * @param qualityUnqualified |
| | | * @return |
| | | */ |
| | | @PostMapping("/deal") |
| | | public AjaxResult deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | |
| | | @ApiModelProperty("å
³èæ£æµid") |
| | | private Long inspectId; |
| | | } |
| | |
| | | IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified); |
| | | |
| | | void qualityUnqualifiedExport(HttpServletResponse response, QualityUnqualified qualityUnqualified); |
| | | |
| | | int deal(QualityUnqualified qualityUnqualified); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.procurementrecord.dto.Details; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementAddDto; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class QualityInspectServiceImpl extends ServiceImpl<QualityInspectMapper, QualityInspect> implements IQualityInspectService { |
| | | |
| | | private final StockUtils stockUtils; |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private IQualityInspectParamService qualityInspectParamService; |
| | |
| | | List<QualityInspectParam> inspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId())); |
| | | String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(",")); |
| | | qualityUnqualified.setDefectivePhenomena(text+"è¿äºææ ä¸åå¨ä¸åæ ¼");//ä¸åæ ¼ç°è±¡ |
| | | qualityUnqualified.setInspectId(qualityInspect.getId()); |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } |
| | | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (qualityInspect.getInspectType() == 0) { |
| | | if ("åæ ¼".equals(qualityInspect.getCheckResult())) { |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(1); |
| | | procurementRecordOutAdd.setTypeName("éè´åæææ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | procurementRecordOutAdd.setPurchaseLedgerId(Math.toIntExact(qualityInspect.getPurchaseLedgerId())); |
| | | if (qualityInspect.getPurchaseLedgerId() == null) { |
| | | throw new BaseException("è¯·éæ©éè´å"); |
| | | } |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(qualityInspect.getProductId()); |
| | | |
| | | ArrayList<Details> detailss = new ArrayList<>(); |
| | | Details details = new Details(); |
| | | details.setId(Math.toIntExact(salesLedgerProduct.getId())); |
| | | details.setInboundQuantity(qualityInspect.getQuantity()); |
| | | details.setWarnNum(salesLedgerProduct.getWarnNum()); |
| | | details.setUnitPrice(salesLedgerProduct.getTaxInclusiveUnitPrice()); |
| | | details.setTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | details.setProductModelId(qualityInspect.getProductModelId()); |
| | | detailss.add( details); |
| | | procurementRecordOutAdd.setDetails(detailss); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | }else if (qualityInspect.getInspectType() == 1) { |
| | | //æ¥è¯¢UnitPrice/TotalPrice |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("ç产è¿ç¨æ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | | details1.setInboundQuantity(qualityInspect.getQuantity()); |
| | | details1.setProductModelId(qualityInspect.getProductModelId()); |
| | | procurementRecordOutAdd.setDetails(details); |
| | | |
| | | ProcurementRecordStorage.ProcurementRecordStorageBuilder procurementRecordBuilder = ProcurementRecordStorage.builder() |
| | | .salesLedgerProductId(0) |
| | | .inboundBatches( "ç产åæåå
¥åº") |
| | | .inboundNum(details1.getInboundQuantity()) |
| | | .type(2) |
| | | .warnNum(new BigDecimal(0)) |
| | | .unitPrice(new BigDecimal(0)) |
| | | .totalPrice(new BigDecimal(0)) |
| | | .createTime(LocalDateTime.now()) |
| | | .createUser(loginUser.getUserId()) |
| | | .updateTime(LocalDateTime.now()) |
| | | .updateUser(loginUser.getUserId()) |
| | | .createBy(procurementRecordOutAdd.getNickName()) |
| | | .productModelId(details1.getProductModelId()) |
| | | .qualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.save(procurementRecordBuilder.build()); |
| | | |
| | | |
| | | |
| | | }else if (qualityInspect.getInspectType() == 2) { |
| | | //æ¥è¯¢UnitPrice/TotalPrice |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectSalesLedgerProductByMainId(qualityInspect.getProductMainId()); |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("ç产åºåæ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | | details1.setInboundQuantity(qualityInspect.getQuantity()); |
| | | details1.setId(Math.toIntExact(salesLedgerProduct.getId())); |
| | | details1.setUnitPrice(salesLedgerProduct.getTaxInclusiveUnitPrice()); |
| | | details1.setTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | details1.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | | details.add(details1); |
| | | procurementRecordOutAdd.setDetails(details); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } else { |
| | | //åæ ¼ç´æ¥å
¥åº |
| | | stockUtils.addStock(inspect.getProductModelId(), inspect.getQuantity(), StockQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), inspect.getId()); |
| | | } |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteMapper; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.quality.service.IQualityUnqualifiedService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class QualityUnqualifiedServiceImpl extends ServiceImpl<QualityUnqualifiedMapper, QualityUnqualified> implements IQualityUnqualifiedService { |
| | | |
| | | private final StockUtils stockUtils; |
| | | private QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | private IQualityInspectService qualityInspectService; |
| | | private ProductOrderService productOrderService; |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | private ProductProcessRouteMapper productProcessRouteMapper; |
| | | private ProductProcessRouteItemMapper productProcessRouteItemMapper; |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | private StockUninventoryService stockUninventoryService; |
| | | |
| | | @Override |
| | | public IPage<QualityUnqualified> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | |
| | | ExcelUtil<QualityUnqualified> util = new ExcelUtil<QualityUnqualified>(QualityUnqualified.class); |
| | | util.exportExcel(response, qualityUnqualifieds, "ä¸åæ ¼ç®¡ç导åº"); |
| | | } |
| | | |
| | | @Override |
| | | public int deal(QualityUnqualified qualityUnqualified) { |
| | | QualityUnqualified unqualified = qualityUnqualifiedMapper.selectById(qualityUnqualified.getId()); |
| | | QualityInspect qualityInspect = qualityInspectService.getById(unqualified.getInspectId()); |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "è¿ä¿®": |
| | | case "è¿å·¥": |
| | | //å¤æè´¨æ£è¡¨æ¯å¦æç¸å
³çæ¥å·¥id,å¦æææ¥å·¥id,é£ä¹è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | if (ObjectUtils.isNotNull(qualityInspect.getProductMainId())) { |
| | | //è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | ProductOrder productOrder = productionProductMainMapper.getOrderByMainId(qualityInspect.getProductMainId()); |
| | | ProductOrder order = new ProductOrder(); |
| | | BeanUtils.copyProperties(productOrder, order); |
| | | order.setId(null); |
| | | order.setQuantity(unqualified.getQuantity()); |
| | | order.setCompleteQuantity(BigDecimal.ZERO); |
| | | order.setStartTime(null); |
| | | order.setEndTime(null); |
| | | productOrderService.save(order); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = productProcessRouteMapper.selectList(Wrappers.<ProductProcessRoute>lambdaQuery().eq(ProductProcessRoute::getProductOrderId, productOrder.getId()).orderByDesc(ProductProcessRoute::getId)).get(0); |
| | | ProductProcessRoute newProcessRoute = new ProductProcessRoute(); |
| | | BeanUtils.copyProperties(productProcessRoute, newProcessRoute); |
| | | newProcessRoute.setId(null); |
| | | newProcessRoute.setProductOrderId(order.getId()); |
| | | productProcessRouteMapper.insert(newProcessRoute); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProductProcessRouteItem> processRouteItems = productProcessRouteItemMapper.selectList(new QueryWrapper<ProductProcessRouteItem>().lambda().eq(ProductProcessRouteItem::getProductRouteId, productProcessRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProductProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | BeanUtils.copyProperties(processRouteItem, productProcessRouteItem); |
| | | productProcessRouteItem.setId(null); |
| | | productProcessRouteItem.setProductRouteId(newProcessRoute.getId()); |
| | | 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(order.getId()); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case "æ¥åº": |
| | | //è°ç¨ä¸åæ ¼åºåæ¥å£ å
¥ä¸åæ ¼åº |
| | | stockUtils.addUnStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(),unqualified.getId()); |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | //è°ç¨æäº¤åæ ¼çæ¥å£ |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(),unqualified.getId()); |
| | | qualityInspect.setCheckResult("åæ ¼"); |
| | | qualityInspectService.submit(qualityInspect); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | qualityUnqualified.setInspectState(1);//å·²å¤ç |
| | | return qualityUnqualifiedMapper.updateById(qualityUnqualified); |
| | | } |
| | | } |
| | |
| | | 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.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | |
| | | return iPage; |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢éå®å°è´¦æ¶èç©æä¿¡æ¯") |
| | | @GetMapping("/getSalesLedgerWithProductsLoss") |
| | | public R getSalesLedgerWithProductsLoss(Long salesLedgerId) { |
| | | return R.ok(salesLedgerService.getSalesLedgerWithProductsLoss(salesLedgerId)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class LossProductModelDto { |
| | | |
| | | private String productName; |
| | | |
| | | private String model; |
| | | |
| | | private String unit; |
| | | |
| | | //æ¶èæ»é |
| | | private BigDecimal lossNum; |
| | | |
| | | //åä½ç¨é |
| | | private BigDecimal unitQuantity; |
| | | |
| | | //å个ç¨é |
| | | private BigDecimal singleQuantity; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.config.MyBaseMapper; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page,@Param("req") SalesLedgerProductDto salesLedgerProduct); |
| | | |
| | | IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page,@Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto); |
| | | |
| | | List<LossProductModelDto> selectProductBomStructure(@Param("salesLedegerId") Long salesLedegerId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | |
| | | IPage<SalesLedger> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | |
| | | List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId); |
| | | |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void invoiceRegistrationSave(SalesLedgerDto salesLedgerDto) { |
| | | // æ°å¢å¼ç¥¨ç»è®°ä¸»è¡¨ |
| | | InvoiceRegistration invoiceRegistration = new InvoiceRegistration(); |
| | | BeanUtils.copyProperties(salesLedgerDto, invoiceRegistration); |
| | | invoiceRegistration.setId(null); |
| | | invoiceRegistration.setCustomerId(salesLedgerDto.getCustomerId().intValue()); |
| | | invoiceRegistration.setSalesLedgerId(salesLedgerDto.getId().intValue()); |
| | | invoiceRegistrationMapper.insert(invoiceRegistration); |
| | | |
| | | List<SalesLedgerProduct> productData = salesLedgerDto.getProductData(); |
| | | BigDecimal invoiceAmountTotal = BigDecimal.ZERO; |
| | | if(CollectionUtils.isNotEmpty(productData)){ |
| | | if (CollectionUtils.isEmpty(productData)) { |
| | | return; |
| | | } |
| | | |
| | | for (SalesLedgerProduct productDatum : productData) { |
| | | // 妿å¼ç¥¨æ°ä¸º0 è·³è¿ |
| | | // æ¬æ¬¡å¼ç¥¨æ° / éé¢ |
| | | BigDecimal currentInvoiceNum = productDatum.getCurrentInvoiceNum(); |
| | | if(null == currentInvoiceNum || BigDecimal.ZERO.compareTo(currentInvoiceNum) == 0){ |
| | | BigDecimal currentInvoiceAmount = productDatum.getCurrentInvoiceAmount(); |
| | | |
| | | if (currentInvoiceNum == null || BigDecimal.ZERO.compareTo(currentInvoiceNum) == 0) { |
| | | continue; |
| | | } |
| | | invoiceAmountTotal = invoiceAmountTotal.add(currentInvoiceNum); |
| | | InvoiceRegistrationProduct invoiceRegistrationProduct = new InvoiceRegistrationProduct(); |
| | | BeanUtils.copyProperties(productDatum, invoiceRegistrationProduct); |
| | | //æ´æ°å·²å¼ç¥¨å©ä½æªå¼ç¥¨æ° |
| | | invoiceRegistrationProductMapper.update( |
| | | |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getId, productDatum.getId()) |
| | | .eq(SalesLedgerProduct::getSalesLedgerId, productDatum.getSalesLedgerId()); |
| | | SalesLedgerProduct dbProduct = salesLedgerProductMapper.selectOne(salesLedgerProductLambdaQueryWrapper); |
| | | |
| | | if (dbProduct == null) { |
| | | throw new RuntimeException("éå®å°è´¦äº§åä¸åå¨ï¼IDï¼" + productDatum.getId()); |
| | | } |
| | | |
| | | // 计ç®ç´¯è®¡å¼ç¥¨ |
| | | BigDecimal newInvoiceNum = dbProduct.getInvoiceNum().add(currentInvoiceNum); |
| | | |
| | | BigDecimal newInvoiceAmount = dbProduct.getInvoiceAmount().add(currentInvoiceAmount); |
| | | |
| | | // è®¡ç®æªå¼ç¥¨ |
| | | BigDecimal newNoInvoiceNum = dbProduct.getQuantity().subtract(newInvoiceNum); |
| | | |
| | | BigDecimal newNoInvoiceAmount = dbProduct.getTaxInclusiveTotalPrice().subtract(newInvoiceAmount); |
| | | |
| | | if (newNoInvoiceNum.compareTo(BigDecimal.ZERO) < 0 |
| | | || newNoInvoiceAmount.compareTo(BigDecimal.ZERO) < 0) { |
| | | throw new RuntimeException("å¼ç¥¨æ°éæéé¢è¶
è¿ååæ»é"); |
| | | } |
| | | |
| | | // æ´æ° sales_ledger_product |
| | | salesLedgerProductMapper.update( |
| | | null, |
| | | new LambdaUpdateWrapper<InvoiceRegistrationProduct>() |
| | | .eq(InvoiceRegistrationProduct::getSalesLedgerId, salesLedgerDto.getId()) |
| | | .set(InvoiceRegistrationProduct::getNoInvoiceAmount, productDatum.getNoInvoiceAmount()) |
| | | new LambdaUpdateWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getId, dbProduct.getId()) |
| | | .set(SalesLedgerProduct::getInvoiceNum, newInvoiceNum) |
| | | .set(SalesLedgerProduct::getInvoiceAmount, newInvoiceAmount) |
| | | .set(SalesLedgerProduct::getNoInvoiceNum, newNoInvoiceNum) |
| | | .set(SalesLedgerProduct::getNoInvoiceAmount, newNoInvoiceAmount) |
| | | ); |
| | | |
| | | InvoiceRegistrationProduct invoiceRegistrationProduct = new InvoiceRegistrationProduct(); |
| | | BeanUtils.copyProperties(dbProduct, invoiceRegistrationProduct); |
| | | |
| | | invoiceRegistrationProduct.setId(null); |
| | | invoiceRegistrationProduct.setSalesLedgerId(salesLedgerDto.getId().intValue()); |
| | | invoiceRegistrationProduct.setInvoiceRegistrationId(invoiceRegistration.getId()); |
| | | invoiceRegistrationProduct.setInvoiceAmount(productDatum.getCurrentInvoiceAmount()); |
| | | invoiceRegistrationProduct.setInvoiceNum(productDatum.getCurrentInvoiceNum()); |
| | | invoiceRegistrationProduct.setSalesLedgerProductId(productDatum.getId().intValue()); |
| | | invoiceRegistrationProduct.setSalesLedgerProductId(dbProduct.getId().intValue()); |
| | | invoiceRegistrationProduct.setInvoiceNum(currentInvoiceNum); |
| | | invoiceRegistrationProduct.setInvoiceAmount(currentInvoiceAmount); |
| | | invoiceRegistrationProduct.setNoInvoiceAmount(newNoInvoiceAmount); |
| | | |
| | | invoiceRegistrationProductMapper.insert(invoiceRegistrationProduct); |
| | | productDatum.setInvoiceNum(currentInvoiceNum); |
| | | productDatum.setInvoiceAmount(productDatum.getCurrentInvoiceAmount()); |
| | | salesLedgerProductMapper.updateById(productDatum); |
| | | // æ°å¢ä¸æ¡å¼ç¥¨å°è´¦æ°æ® |
| | | |
| | | InvoiceLedger invoiceLedger = new InvoiceLedger(); |
| | | invoiceLedger.setInvoiceDate(salesLedgerDto.getIssueDate()); |
| | | invoiceLedger.setInvoiceRegistrationProductId(invoiceRegistrationProduct.getId()); |
| | | invoiceLedger.setInvoiceTotal(invoiceRegistrationProduct.getInvoiceAmount()); |
| | | invoiceLedger.setInvoiceTotal(currentInvoiceAmount); |
| | | invoiceLedger.setInvoiceNo(salesLedgerDto.getInvoiceNo()); |
| | | invoiceLedger.setCreateUser(SecurityUtils.getUserId().intValue()); |
| | | invoiceLedger.setInvoicePerson(productDatum.getRegister()); |
| | | invoiceLedger.setInvoicePerson(dbProduct.getRegister()); |
| | | |
| | | invoiceLedgerMapper.insert(invoiceLedger); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerImportDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductImportDto; |
| | | import com.ruoyi.sales.dto.*; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | |
| | | .findFirst() |
| | | .map(SysUser::getUserId) |
| | | .orElse(null); |
| | | if(aLong == null) throw new RuntimeException("å½å
¥äºº:"+salesLedger.getEntryPerson()+",æ 对åºç¨æ·ï¼"); |
| | | if (aLong == null) |
| | | throw new RuntimeException("å½å
¥äºº:" + salesLedger.getEntryPerson() + ",æ 对åºç¨æ·ï¼"); |
| | | salesLedger.setEntryPerson(aLong.toString()); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | // éå®äº§åæ°æ®ç»å®ï¼éè¿éå®åå·è·å对åºéå®äº§åæ°æ® |
| | | List<SalesLedgerProductImportDto> salesLedgerProductImportDtos = salesLedgerProductImportDtoList.stream() |
| | | .filter(salesLedgerProductImportDto -> salesLedgerProductImportDto.getSalesContractNo().equals(salesLedger.getSalesContractNo())) |
| | | .collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(salesLedgerProductImportDtos)) throw new RuntimeException("éå®åå·:"+salesLedgerImportDto.getSalesContractNo()+",æ 对åºäº§åæ°æ®ï¼"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtos)) |
| | | throw new RuntimeException("éå®åå·:" + salesLedgerImportDto.getSalesContractNo() + ",æ 对åºäº§åæ°æ®ï¼"); |
| | | for (SalesLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) { |
| | | SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct(); |
| | | BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct); |
| | |
| | | return AjaxResult.success("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | @Override |
| | | public List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId) { |
| | | |
| | | |
| | | List<LossProductModelDto> lossProductModelDtos = salesLedgerProductMapper.selectProductBomStructure(salesLedgerId); |
| | | |
| | | |
| | | return lossProductModelDtos; |
| | | } |
| | | |
| | | |
| | | // å
é¨ç±»ç¨äºåå¨èåç»æ |
| | | private static class GroupedCustomer { |
| | | private final Long customerId; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | |
| | | |
| | | @Override |
| | | public List<StaffLeaveDto> staffLeaveReasonAnalytics() { |
| | | List<StaffLeaveDto> result = staffLeaveMapper.staffLeaveReasonAnalytics(); |
| | | result.forEach(dto -> { |
| | | String reasonCode = dto.getReason(); |
| | | StaffLeaveReason reasonEnum = StaffLeaveReason.getByCode(reasonCode); |
| | | if (reasonEnum != null) { |
| | | dto.setReasonText(reasonEnum.getInfo()); |
| | | } else { |
| | | dto.setReasonText("æªç¥åå "); |
| | | List<StaffLeaveDto> dbResult = staffLeaveMapper.staffLeaveReasonAnalytics(); |
| | | |
| | | // å建ä¸ä¸ªMapç¨äºå卿ææä¸¾åå çæ°éï¼é»è®¤å¼ä¸º0 |
| | | Map<String, Integer> reasonCountMap = new HashMap<>(); |
| | | for (StaffLeaveReason reasonEnum : StaffLeaveReason.values()) { |
| | | reasonCountMap.put(reasonEnum.getCode(), 0); |
| | | } |
| | | }); |
| | | |
| | | // å°æ°æ®åºæ¥è¯¢ç»æåå¹¶å°Mapä¸ |
| | | for (StaffLeaveDto dto : dbResult) { |
| | | String reasonCode = dto.getReason(); |
| | | if (reasonCountMap.containsKey(reasonCode)) { |
| | | reasonCountMap.put(reasonCode, dto.getCount()); |
| | | } |
| | | } |
| | | |
| | | // å°Map转æ¢ä¸ºList<StaffLeaveDto> |
| | | List<StaffLeaveDto> result = new ArrayList<>(); |
| | | for (StaffLeaveReason reasonEnum : StaffLeaveReason.values()) { |
| | | StaffLeaveDto dto = new StaffLeaveDto(); |
| | | dto.setReason(reasonEnum.getCode()); |
| | | dto.setCount(reasonCountMap.get(reasonEnum.getCode())); |
| | | dto.setReasonText(reasonEnum.getInfo()); |
| | | result.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | // æ°å¢ç¦»èè®°å½ |
| | | StaffLeave staffLeave = new StaffLeave(); |
| | | staffLeave.setStaffOnJobId(staffLeaveDto.getStaffOnJobId()); |
| | | staffLeave.setReason(staffLeaveDto.getReason()); |
| | | String reason = staffLeaveDto.getReason(); |
| | | if (!StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | staffLeave.setRemark(""); |
| | | if (StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | staffLeave.setRemark(staffLeaveDto.getRemark()); |
| | | } |
| | | staffLeaveMapper.insert(staffLeave); |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.domain.AjaxResult; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "å
¥åº") |
| | | @RequestMapping("/stockInRecord") |
| | | public class StockInRecordController { |
| | | @Autowired |
| | | private StockInRecordService stockInRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产å
¥åº-å
¥åºç®¡ç-å表", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "å
¥åºç®¡çå表") |
| | | public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | IPage<StockInRecordDto> result = stockInRecordService.listPage(page, stockInRecordDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "å
¥åºç®¡ç-å é¤å
¥åº", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(stockInRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/stockInventory") |
| | | @Api(tags = "åºå表") |
| | | public class StockInventoryController { |
| | | |
| | | @Autowired |
| | | private StockInventoryService stockInventoryService; |
| | | |
| | | @GetMapping("/pagestockInventory") |
| | | @ApiOperation("å页æ¥è¯¢åºå") |
| | | public R pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | IPage<StockInventoryDto> stockInventoryDtoIPage = stockInventoryService.pagestockInventory(page, stockInventoryDto); |
| | | return R.ok(stockInventoryDtoIPage); |
| | | } |
| | | |
| | | @PostMapping("/addstockInventory") |
| | | @ApiOperation("æ°å¢åºå") |
| | | public R addstockInventory(@RequestBody StockInventoryDto stockInventoryDto) { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode())); |
| | | stockInventoryDto.setRecordId(0L); |
| | | return R.ok(stockInventoryService.addstockInventory(stockInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/subtractStockInventory") |
| | | @ApiOperation("æ£ååºå") |
| | | public R subtractStockInventory(@RequestBody StockInventoryDto stockInventoryDto) { |
| | | stockInventoryDto.setRecordType(String.valueOf(StockQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode())); |
| | | stockInventoryDto.setRecordId(0L); |
| | | return R.ok(stockInventoryService.subtractStockInventory(stockInventoryDto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("importStockInventory") |
| | | @ApiOperation("导å
¥åºå") |
| | | public R importStockInventory(MultipartFile file) { |
| | | return R.ok(stockInventoryService.importStockInventory(file)); |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.domain.AjaxResult; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Api(tags = "åºåº") |
| | | @RestController |
| | | @RequestMapping("/stockOutRecord") |
| | | public class StockOutRecordController { |
| | | @Autowired |
| | | private StockOutRecordService stockOutRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产åºåº-åºåºç®¡ç-å表", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "åºåºç®¡çå表") |
| | | public AjaxResult listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | | IPage<StockOutRecordDto> result = stockOutRecordService.listPage(page, stockOutRecordDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("") |
| | | @Log(title = "åºåºç®¡ç-æ°å¢åºåº", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return AjaxResult.success(stockOutRecordService.add(stockOutRecordDto)); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @Log(title = "åºåºç®¡ç-æ´æ°åºåº", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return AjaxResult.success(stockOutRecordService.update(id, stockOutRecordDto)); |
| | | } |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "åºåºç®¡ç-å é¤åºåº", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(stockOutRecordService.batchDelete(ids)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/stockUninventory") |
| | | public class StockUninventoryController { |
| | | @Autowired |
| | | private StockUninventoryService stockUninventoryService; |
| | | |
| | | @GetMapping("/pagestockUninventory") |
| | | @ApiOperation("å页æ¥è¯¢åºå") |
| | | public R pagestockUninventory(Page page, StockUninventoryDto stockUninventoryDto) { |
| | | IPage<StockUninventoryDto> stockUninventoryDtoIPage = stockUninventoryService.pageStockUninventory(page, stockUninventoryDto); |
| | | return R.ok(stockUninventoryDtoIPage); |
| | | } |
| | | |
| | | @PostMapping("/addstockUninventory") |
| | | @ApiOperation("æ°å¢åºå") |
| | | public R addstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.addStockUninventory(stockUninventoryDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/subtractstockUninventory") |
| | | @ApiOperation("æ£ååºå") |
| | | public R subtractstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) { |
| | | stockUninventoryDto.setRecordType(String.valueOf(StockUnQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode())); |
| | | stockUninventoryDto.setRecordId(0L); |
| | | return R.ok(stockUninventoryService.subtractStockUninventory(stockUninventoryDto)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.dto; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class StockInRecordDto extends StockInRecord { |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 产åè§æ ¼ |
| | | */ |
| | | private String model; |
| | | /** |
| | | * 产ååä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | private String timeStr; |
| | | |
| | | private String createBy; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.dto; |
| | | |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StockInventoryDto extends StockInventory { |
| | | |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | | |
| | | |
| | | //å
¥åºç±»å |
| | | private String recordType; |
| | | |
| | | //å
¥åºç±»å对åºçid |
| | | private Long recordId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.dto; |
| | | |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class StockOutRecordDto extends StockOutRecord { |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * 产åè§æ ¼ |
| | | */ |
| | | private String model; |
| | | /** |
| | | * 产ååä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | private String timeStr; |
| | | |
| | | private String createBy; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.dto; |
| | | |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StockUninventoryDto extends StockUninventory { |
| | | private String productName; |
| | | private String model; |
| | | private String unit; |
| | | |
| | | |
| | | //å
¥åºç±»å |
| | | private String recordType; |
| | | |
| | | //å
¥åºç±»å对åºçid |
| | | private Long recordId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | public class StockInventoryExportData { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface StockInRecordMapper extends BaseMapper<StockInRecord> { |
| | | IPage<StockInRecordDto> listPage(Page page, @Param("params") StockInRecordDto stockInRecordDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Mapper |
| | | public interface StockInventoryMapper extends BaseMapper<StockInventory> { |
| | | |
| | | IPage<StockInventoryDto> pagestockInventory(Page page, @Param("ew") StockInventoryDto stockInventoryDto); |
| | | |
| | | |
| | | int updateAddStockInventory(@Param("ew") StockInventoryDto stockInventoryDto); |
| | | |
| | | int updateSubtractStockInventory(@Param("ew") StockInventoryDto stockInventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Mapper |
| | | public interface StockOutRecordMapper extends BaseMapper<StockOutRecord> { |
| | | IPage<StockOutRecordDto> listPage(Page page, @Param("params") StockOutRecordDto stockOutRecordDto); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Mapper |
| | | public interface StockUninventoryMapper extends BaseMapper<StockUninventory> { |
| | | |
| | | IPage<StockUninventoryDto> pageStockUninventory(Page page, @Param("ew") StockUninventoryDto stockUninventoryDto); |
| | | |
| | | int updateSubtractStockUnInventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | int updateAddStockUnInventory(StockUninventoryDto stockUninventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("stock_in_record") |
| | | @ApiModel("å
¥åºç®¡ç") |
| | | public class StockInRecord { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * åºå· |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "å
¥åºæ¹æ¬¡") |
| | | private String inboundBatches; |
| | | |
| | | @ApiModelProperty(value = "å
¥åºæ°é") |
| | | private BigDecimal stockInNum; |
| | | |
| | | @ApiModelProperty(value = "è®°å½ç±»å æä¸¾") |
| | | private String recordType; |
| | | |
| | | @ApiModelProperty(value = "è®°å½ID ") |
| | | private Long recordId; |
| | | |
| | | @ApiModelProperty(value = "产åè§æ ¼ID") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0åæ ¼å
¥åº 1ä¸åæ ¼å
¥åº") |
| | | private String type; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.lang.Nullable; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("stock_inventory") |
| | | @ApiModel(value = "StockInventory对象", description = "åºå表") |
| | | public class StockInventory implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("è§æ ¼id") |
| | | @NotBlank(message = "ä¸è½ä¸ºç©º") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("æ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty("被订åé宿°é") |
| | | private BigDecimal lockedQuantity; |
| | | |
| | | @ApiModelProperty("é¢è¦æ°é") |
| | | private Integer warnNum; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("stock_out_record") |
| | | @ApiModel(value = "StockOutRecord对象", description = "åºåºè®°å½è¡¨") |
| | | public class StockOutRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("å
¥åºæ¹æ¬¡") |
| | | private String outboundBatches; |
| | | |
| | | @ApiModelProperty("å
¥åºæ°é") |
| | | private BigDecimal stockOutNum; |
| | | |
| | | @ApiModelProperty("å
¥åºæ¥æºid") |
| | | private Long recordId; |
| | | |
| | | @ApiModelProperty("å
¥åºç±»å") |
| | | private String recordType; |
| | | |
| | | @ApiModelProperty("产åè§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("æ´æ°äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0åæ ¼å
¥åº 1ä¸åæ ¼å
¥åº") |
| | | private String type; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("stock_uninventory") |
| | | @ApiModel(value = "StockUninventory对象", description = "ä¸åæ ¼åºå表") |
| | | public class StockUninventory implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("è§æ ¼id") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("æ°é") |
| | | private BigDecimal qualitity; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateTime; |
| | | |
| | | @ApiModelProperty("çæ¬å·") |
| | | private Integer version; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface StockInRecordService extends IService<StockInRecord> { |
| | | IPage<StockInRecordDto> listPage(Page page, StockInRecordDto stockInRecordDto); |
| | | |
| | | int add(StockInRecordDto stockInRecordDto); |
| | | |
| | | int update(Long id, StockInRecordDto stockInRecordDto); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | public interface StockInventoryService extends IService<StockInventory> { |
| | | |
| | | IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto); |
| | | |
| | | Boolean addstockInventory(StockInventoryDto stockInventoryDto); |
| | | |
| | | Boolean subtractStockInventory(StockInventoryDto stockInventoryDto); |
| | | |
| | | Boolean importStockInventory(MultipartFile file); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.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.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | public interface StockOutRecordService extends IService<StockOutRecord> { |
| | | IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto); |
| | | |
| | | int add(StockOutRecordDto stockOutRecordDto); |
| | | |
| | | int update(Long id, StockOutRecordDto stockOutRecordDto); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | public interface StockUninventoryService extends IService<StockUninventory> { |
| | | |
| | | IPage<StockUninventoryDto> pageStockUninventory(Page page, StockUninventoryDto stockUninventoryDto); |
| | | |
| | | Integer addStockUninventory(StockUninventoryDto stockUninventoryDto); |
| | | |
| | | Integer subtractStockUninventory(StockUninventoryDto stockUninventoryDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.mapper.StockInRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class StockInRecordServiceImpl extends ServiceImpl<StockInRecordMapper, StockInRecord> implements StockInRecordService { |
| | | |
| | | private StockInRecordMapper stockInRecordMapper; |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockUninventoryMapper stockUninventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<StockInRecordDto> listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | return stockInRecordMapper.listPage(page, stockInRecordDto); |
| | | } |
| | | |
| | | // æ°å¢å
¥åº |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int add(StockInRecordDto stockInRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(stockInRecordMapper, "RK"); |
| | | stockInRecordDto.setInboundBatches(no); |
| | | StockInRecord stockInRecord = new StockInRecord(); |
| | | BeanUtils.copyProperties(stockInRecordDto, stockInRecord); |
| | | return stockInRecordMapper.insert(stockInRecord); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int update(Long id, StockInRecordDto stockInRecordDto) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StockInRecord stockInRecord = stockInRecordMapper.selectById(id); |
| | | if (stockInRecord == null){ |
| | | throw new BaseException("该å
¥åºè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id", "inbound_batches"};//æé¤id屿§ |
| | | BeanUtils.copyProperties(stockInRecordDto, stockInRecord, ignoreProperties); |
| | | return stockInRecordMapper.updateById(stockInRecord); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int batchDelete(List<Long> ids) { |
| | | for (Long id : ids) { |
| | | StockInRecord stockInRecord = stockInRecordMapper.selectById(id); |
| | | if (stockInRecord.getType().equals("0")) { |
| | | StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, stockInRecord.getProductModelId())); |
| | | if (stockInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | StockInventoryDto stockInRecordDto = new StockInventoryDto(); |
| | | stockInRecordDto.setProductModelId(stockInventory.getProductModelId()); |
| | | stockInRecordDto.setQualitity(stockInRecord.getStockInNum()); |
| | | stockInventoryMapper.updateAddStockInventory(stockInRecordDto); |
| | | } |
| | | }else if (stockInRecord.getType().equals("1")) { |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>().eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId())); |
| | | if (stockUninventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setProductModelId(stockUninventory.getProductModelId()); |
| | | stockUninventoryDto.setQualitity(stockInRecord.getStockInNum()); |
| | | stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto); |
| | | } |
| | | } |
| | | } |
| | | return stockInRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockInventoryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºå表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 04:16:36 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class StockInventoryServiceImpl extends ServiceImpl<StockInventoryMapper, StockInventory> implements StockInventoryService { |
| | | |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockInRecordService stockInRecordService; |
| | | private StockOutRecordService stockOutRecordService; |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pagestockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pagestockInventory(page, stockInventoryDto); |
| | | } |
| | | |
| | | //å
¥åºè°ç¨ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean addstockInventory(StockInventoryDto stockInventoryDto) { |
| | | //æ°å¢å
¥åºè®°å½åæ·»å åºå |
| | | StockInRecordDto stockInRecordDto = new StockInRecordDto(); |
| | | stockInRecordDto.setRecordId(stockInventoryDto.getRecordId()); |
| | | stockInRecordDto.setRecordType(stockInventoryDto.getRecordType()); |
| | | stockInRecordDto.setStockInNum(stockInventoryDto.getQualitity()); |
| | | stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("0"); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //åè¿è¡æ°å¢åºåæ°éåºå |
| | | //å
æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° |
| | | StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | StockInventory newStockInventory = new StockInventory(); |
| | | newStockInventory.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | newStockInventory.setQualitity(stockInventoryDto.getQualitity()); |
| | | newStockInventory.setVersion(1); |
| | | newStockInventory.setRemark(stockInventoryDto.getRemark()); |
| | | stockInventoryMapper.insert(newStockInventory); |
| | | }else { |
| | | stockInventoryMapper.updateAddStockInventory(stockInventoryDto); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //åºåºè°ç¨ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean subtractStockInventory(StockInventoryDto stockInventoryDto) { |
| | | // æ°å¢åºåºè®°å½ |
| | | StockOutRecordDto stockOutRecordDto = new StockOutRecordDto(); |
| | | stockOutRecordDto.setRecordId(stockInventoryDto.getRecordId()); |
| | | stockOutRecordDto.setRecordType(stockInventoryDto.getRecordType()); |
| | | stockOutRecordDto.setStockOutNum(stockInventoryDto.getQualitity()); |
| | | stockOutRecordDto.setProductModelId(stockInventoryDto.getProductModelId()); |
| | | stockOutRecordDto.setType("0"); |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产ååºåä¸åå¨"); |
| | | }else { |
| | | stockInventoryMapper.updateSubtractStockInventory(stockInventoryDto); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean importStockInventory(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<StockInventoryExportData>(StockInventoryExportData.class); |
| | | List<StockInventoryExportData> list = util.importExcel(file.getInputStream()); |
| | | ArrayList<StockInventory> stockInventories = new ArrayList<>(); |
| | | list.stream().forEach(dto -> { |
| | | // TODO: 2026/1/21 æ·»å å
¥åºè®°å½ |
| | | }); |
| | | |
| | | this.saveOrUpdateBatch(stockInventories); |
| | | return true; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.mapper.StockOutRecordMapper; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockInRecord; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockOutRecord; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åºåºè®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-21 05:27:04 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class StockOutRecordServiceImpl extends ServiceImpl<StockOutRecordMapper, StockOutRecord> implements StockOutRecordService { |
| | | private StockOutRecordMapper stockOutRecordMapper; |
| | | private StockInventoryMapper stockInventoryMapper; |
| | | private StockUninventoryMapper stockUninventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<StockOutRecordDto> listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | | return stockOutRecordMapper.listPage(page, stockOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int add(StockOutRecordDto stockOutRecordDto) { |
| | | String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK"); |
| | | stockOutRecordDto.setOutboundBatches(no); |
| | | StockInRecord stockInRecord = new StockInRecord(); |
| | | BeanUtils.copyProperties(stockOutRecordDto, stockInRecord); |
| | | return stockOutRecordMapper.insert(stockOutRecordDto); |
| | | } |
| | | |
| | | @Override |
| | | public int update(Long id, StockOutRecordDto stockOutRecordDto) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StockOutRecord stockOutRecord = stockOutRecordMapper.selectById(id); |
| | | if (stockOutRecord == null){ |
| | | throw new BaseException("该åºåºè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id", "outbound_batches"};//æé¤id屿§ |
| | | BeanUtils.copyProperties(stockOutRecordDto, stockOutRecord, ignoreProperties); |
| | | return stockOutRecordMapper.updateById(stockOutRecord); |
| | | } |
| | | |
| | | @Override |
| | | public int batchDelete(List<Long> ids) { |
| | | for (Long id : ids) { |
| | | StockOutRecord stockOutRecord = stockOutRecordMapper.selectById(id); |
| | | if (stockOutRecord.getType().equals("0")) { |
| | | StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, stockOutRecord.getProductModelId())); |
| | | if (stockInventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | StockInventoryDto stockInRecordDto = new StockInventoryDto(); |
| | | stockInRecordDto.setProductModelId(stockInventory.getProductModelId()); |
| | | stockInRecordDto.setQualitity(stockOutRecord.getStockOutNum()); |
| | | stockInventoryMapper.updateAddStockInventory(stockInRecordDto); |
| | | } |
| | | }else if (stockOutRecord.getType().equals("1")) { |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>().eq(StockUninventory::getProductModelId, stockOutRecord.getProductModelId())); |
| | | if (stockUninventory == null) { |
| | | throw new BaseException("åºåè®°å½ä¸æ²¡æå¯¹åºç产å,æ æ³å é¤!!!"); |
| | | }else { |
| | | StockUninventoryDto stockUninventoryDto = new StockUninventoryDto(); |
| | | stockUninventoryDto.setProductModelId(stockUninventory.getProductModelId()); |
| | | stockUninventoryDto.setQualitity(stockOutRecord.getStockOutNum()); |
| | | stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto); |
| | | } |
| | | } |
| | | } |
| | | return stockOutRecordMapper.deleteBatchIds(ids); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | | * ä¸åæ ¼åºå表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-22 10:17:45 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class StockUninventoryServiceImpl extends ServiceImpl<StockUninventoryMapper, StockUninventory> implements StockUninventoryService { |
| | | |
| | | private StockUninventoryMapper stockUninventoryMapper; |
| | | private StockOutRecordService stockOutRecordService; |
| | | private StockInRecordService stockInRecordService; |
| | | |
| | | @Override |
| | | public IPage<StockUninventoryDto> pageStockUninventory(Page page, StockUninventoryDto stockUninventoryDto) { |
| | | return stockUninventoryMapper.pageStockUninventory(page, stockUninventoryDto); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addStockUninventory(StockUninventoryDto stockUninventoryDto) { |
| | | //æ°å¢å
¥åºè®°å½åæ·»å åºå |
| | | StockInRecordDto stockInRecordDto = new StockInRecordDto(); |
| | | stockInRecordDto.setRecordId(stockUninventoryDto.getRecordId()); |
| | | stockInRecordDto.setRecordType(stockUninventoryDto.getRecordType()); |
| | | stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity()); |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //åè¿è¡æ°å¢åºåæ°éåºå |
| | | //å
æ¥è¯¢åºå表ä¸çäº§åæ¯å¦åå¨ï¼ä¸å卿°å¢ï¼å卿´æ° |
| | | StockUninventory oldStockUnInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockUnInventory)) { |
| | | StockUninventory newStockUnInventory = new StockUninventory(); |
| | | newStockUnInventory.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | newStockUnInventory.setQualitity(stockUninventoryDto.getQualitity()); |
| | | newStockUnInventory.setVersion(1); |
| | | newStockUnInventory.setRemark(stockUninventoryDto.getRemark()); |
| | | stockUninventoryMapper.insert(newStockUnInventory); |
| | | }else { |
| | | stockUninventoryMapper.updateAddStockUnInventory(stockUninventoryDto); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer subtractStockUninventory(StockUninventoryDto stockUninventoryDto) { |
| | | |
| | | // æ°å¢åºåºè®°å½ |
| | | StockOutRecordDto stockOutRecordDto = new StockOutRecordDto(); |
| | | stockOutRecordDto.setRecordId(stockUninventoryDto.getRecordId()); |
| | | stockOutRecordDto.setRecordType(stockUninventoryDto.getRecordType()); |
| | | stockOutRecordDto.setStockOutNum(stockUninventoryDto.getQualitity()); |
| | | stockOutRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockOutRecordDto.setType("1"); |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockUninventory oldStockInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产ååºåä¸åå¨"); |
| | | }else { |
| | | stockUninventoryMapper.updateSubtractStockUnInventory(stockUninventoryDto); |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | sjlr.phone, |
| | | scp.create_time |
| | | FROM staff_contacts_personal scp |
| | | LEFT JOIN (select * from staff_join_leave_record WHERE staff_state = 1) sjlr ON scp.contact_id=sjlr.id |
| | | LEFT JOIN (select * from staff_on_job WHERE staff_state = 1) sjlr ON scp.contact_id=sjlr.id |
| | | where 1=1 |
| | | <if test="staffContactsPersonalDTO.staffName != null and staffContactsPersonalDTO.staffName != ''"> |
| | | and sjlr.staff_name like concat('%',#{staffContactsPersonalDTO.staffName},'%') |
| | |
| | | t3.dict_label as dictName, |
| | | t4.dict_label as dictTypeName |
| | | from labor_issue t1 |
| | | left join staff_join_leave_record t2 on t1.staff_id = t2.id |
| | | left join staff_on_job t2 on t1.staff_id = t2.id |
| | | left join sys_dict_data t3 on t1.dict_id = t3.dict_value |
| | | left join sys_dict_data t4 on t1.dict_type = t4.dict_value |
| | | <where> |
| | |
| | | t3.dict_label as dictName, |
| | | t4.dict_label as dictTypeName |
| | | from labor_issue t1 |
| | | left join staff_join_leave_record t2 on t1.staff_id = t2.id |
| | | left join staff_on_job t2 on t1.staff_id = t2.id |
| | | left join sys_dict_data t3 on t1.dict_id = t3.dict_value |
| | | left join sys_dict_data t4 on t1.dict_type = t4.dict_value |
| | | <where> |
| | |
| | | p.product_name as productName, |
| | | pm.model as productModelName, |
| | | ppo.quantity, |
| | | ppo.scrap_qty, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | from |
| | |
| | | order by ppm.id |
| | | |
| | | </select> |
| | | <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder"> |
| | | select po.* |
| | | from product_order po |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | left join production_product_main pm on work_order_id=pwo.id |
| | | where pm.id=#{productMainId} |
| | | </select> |
| | | |
| | | <delete id="deleteByWorkOrderIds" parameterType="java.util.List"> |
| | | DELETE FROM production_product_main |
| | |
| | | sl.customer_name, |
| | | sl.contract_amount |
| | | ORDER BY |
| | | sl.sales_contract_no; |
| | | sl.sales_contract_no |
| | | </select> |
| | | <select id="listVat" resultType="com.ruoyi.purchase.dto.VatDto"> |
| | | select * |
| | |
| | | </select> |
| | | |
| | | <select id="getTopParameters" resultType="com.ruoyi.quality.dto.QualityParameterStatDto"> |
| | | WITH parameter_counts AS (SELECT qip.parameter_item AS name, COUNT(*) AS count |
| | | FROM quality_inspect_param qip |
| | | JOIN quality_inspect qi ON qip.inspect_id = qi.id |
| | | WITH parameter_counts AS (SELECT qip.parameter_item AS name, |
| | | SUM(COALESCE(qi.quantity, 0)) AS count |
| | | FROM quality_inspect qi |
| | | JOIN quality_inspect_param qip ON qip.inspect_id = qi.id |
| | | WHERE qi.inspect_type = #{inspectType} |
| | | GROUP BY qip.parameter_item), |
| | | total AS (SELECT SUM(count) as total_count |
| | | ranked AS (SELECT name, |
| | | count, |
| | | ROW_NUMBER() OVER (ORDER BY count DESC) AS rn |
| | | FROM parameter_counts), |
| | | ranked AS (SELECT name, count, ROW_NUMBER() OVER (ORDER BY count DESC) as rn |
| | | total AS (SELECT SUM(count) AS total_count |
| | | FROM parameter_counts) |
| | | SELECT name, |
| | | count, |
| | | CASE |
| | | WHEN (SELECT total_count FROM total) = 0 THEN 0 |
| | | ELSE ROUND(count / (SELECT total_count FROM total) * 100, 2) |
| | | END as percentage |
| | | END AS percentage |
| | | FROM (SELECT name, count, rn |
| | | FROM ranked |
| | | WHERE rn <= 4 |
| | | UNION ALL |
| | | SELECT 'å
¶ä»' as name, SUM(count) as count, 5 as rn |
| | | SELECT 'å
¶ä»æ£æµ' AS name, |
| | | SUM(count) AS count, |
| | | 5 AS rn |
| | | FROM ranked |
| | | WHERE rn > 4 |
| | | HAVING count > 0) sub |
| | | HAVING SUM(count) > 0) t |
| | | ORDER BY rn |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | GROUP BY slp.product_category |
| | | <!-- æäº§å大类æåº --> |
| | | ORDER BY slp.product_category |
| | | </select> |
| | | <select id="selectProductBomStructure" resultType="com.ruoyi.sales.dto.LossProductModelDto"> |
| | | select |
| | | a.model, |
| | | a.product_name, |
| | | a.unit, |
| | | sum(a.single_quantity) AS loss_num |
| | | from (SELECT ps.unit, |
| | | ps.unit_quantity, |
| | | pm1.model, |
| | | p.product_name, |
| | | ps.unit_quantity * slp.quantity AS single_quantity |
| | | FROM sales_ledger sl |
| | | LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id |
| | | LEFT JOIN product_model pm ON pm.id = slp.product_model_id |
| | | LEFT JOIN product_bom pb ON pb.product_model_id = pm.id |
| | | LEFT JOIN product_structure ps ON pb.id = ps.bom_id |
| | | LEFT JOIN product_model pm1 ON pm1.id = ps.product_model_id |
| | | LEFT JOIN product p ON p.id = pm1.product_id |
| | | WHERE sl.id = #{salesLedegerId}) A |
| | | group by a.model, a.product_name, a.unit |
| | | </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.stock.mapper.StockInRecordMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.stock.dto.StockInRecordDto"> |
| | | SELECT |
| | | sir.*, |
| | | p.product_name as productName, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM stock_in_record as sir |
| | | LEFT JOIN product_model as pm on sir.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sir.create_user = u.user_id |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sir.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | | <if test="params.productName != null and params.productName != ''"> |
| | | and p.product_name like concat('%',#{params.productName},'%') |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and sir.type = #{params.type} |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sir.record_type = #{params.recordType} |
| | | </if> |
| | | </where> |
| | | order by sir.id desc |
| | | </select> |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.stock.mapper.StockInventoryMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.stock.pojo.StockInventory"> |
| | | <result column="id" property="id" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="qualitity" property="qualitity" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="version" property="version" /> |
| | | <result column="locked_quantity" property="lockedQuantity" /> |
| | | <result column="warn_num" property="warnNum" /> |
| | | </resultMap> |
| | | <update id="updateAddStockInventory"> |
| | | update stock_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | | </update> |
| | | <update id="updateSubtractStockInventory"> |
| | | update stock_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity - #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | select si.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </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.stock.mapper.StockOutRecordMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.stock.pojo.StockOutRecord"> |
| | | <id column="id" property="id" /> |
| | | <result column="outbound_batches" property="outboundBatches" /> |
| | | <result column="stock_out_num" property="stockOutNum" /> |
| | | <result column="record_id" property="recordId" /> |
| | | <result column="record_type" property="recordType" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | </resultMap> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.stock.dto.StockOutRecordDto"> |
| | | SELECT |
| | | sor.*, |
| | | p.product_name as productName, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | FROM stock_out_record as sor |
| | | LEFT JOIN product_model as pm on sor.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sor.create_user = u.user_id |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sor.create_time like concat('%',#{params.timeStr},'%') |
| | | </if> |
| | | <if test="params.productName != null and params.productName != ''"> |
| | | and p.product_name like concat('%',#{params.productName},'%') |
| | | </if> |
| | | <if test="params.type != null and params.type != ''"> |
| | | and sor.type = #{params.type} |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sor.record_type = #{params.recordType} |
| | | </if> |
| | | </where> |
| | | order by sor.id desc |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.stock.mapper.StockUninventoryMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.stock.pojo.StockUninventory"> |
| | | <result column="id" property="id" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="qualitity" property="qualitity" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="version" property="version" /> |
| | | </resultMap> |
| | | <update id="updateSubtractStockUnInventory"> |
| | | update stock_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity - #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <update id="updateAddStockUnInventory"> |
| | | update stock_inventory |
| | | <set> |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | | where product_model_id = #{ew.productModelId} |
| | | </update> |
| | | <select id="pageStockUninventory" resultType="com.ruoyi.stock.dto.StockUninventoryDto"> |
| | | select su.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |