chenlu
2024-07-18 7c4fb2ba6509a609855a6572125a680ceb27b339
报工返工补片添加日志
11个文件已修改
143 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/Replenish/AddReplenish.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/rework/AddRework.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportingWorkController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/userInfo/Log.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/userInfo/LogMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/ReworkService.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/userInfo/LogService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/Replenish/AddReplenish.vue
@@ -9,9 +9,11 @@
import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
import { useI18n } from 'vue-i18n'
import footSum from "@/hook/footSum";
import userInfo from "@/stores/userInfo"
//语言获取
const { t } = useI18n()
const user=userInfo()
let router = useRouter()
@@ -155,8 +157,9 @@
          let flowData = ref({
            patchLog: selectRecords
            patchLog: selectRecords,
            userId:user.user.userId,
            userName:user.user.userName
          })
          request.post("/Replenish/saveReplenish", flowData.value).then((res) => {
            if(res.code==200 && res.data===true){
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -814,7 +814,9 @@
  const requestData = {
    title:titleUploadData.value,
    detail:xGrid.value.getTableData().fullData,
    type:state//审核状态
    type:state,//审核状态
    userId:user.user.userId,
    userName:user.user.userName,
  }
  gridOptions.toolbarConfig.buttons[0].disabled=true
  gridOptions.toolbarConfig.buttons[1].disabled=true
@@ -828,7 +830,6 @@
}
const saveReportingWorkRequest = (requestData) =>{
  //request.post(`/reportingWork/saveReportingWorkLog`, requestData)
  request.post(`/reportingWork/saveReportingWork`,requestData).then(res =>{
    if (res.code == 200){
      ElMessage.success(t('reportingWorks.successfulJobApplication'))
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
@@ -10,11 +10,13 @@
import SelectProduct from "@/views/sd/product/SelectProduct.vue";
import useUserInfoStore from "@/stores/userInfo";
import footSum from "@/hook/footSum"
import userInfo from "@/stores/userInfo"
//语言获取
const { t } = useI18n()
const userStore = useUserInfoStore()
let router=useRouter()
const user=userInfo()
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
@@ -23,7 +25,9 @@
      break
    }
    case 'delete':{
      request.post(`/reportingWork/deleteWork/${row.reportingWorkId}/${row.processId}/${row.thisProcess}`).then((res) => {
      let userId=user.user.userId;
      let userName=user.user.userName;
      request.post(`/reportingWork/deleteWork/${row.reportingWorkId}/${row.processId}/${row.thisProcess}/${userId}/${userName}`).then((res) => {
        if (res.code == 200 && res.data===true) {
          ElMessage.success(t('workOrder.deleteOk'))
          router.push({path: '/main/reportingWorks/SelectReportingWorks', query: {random:Math.random()}})
north-glass-erp/northglass-erp/src/views/pp/rework/AddRework.vue
@@ -9,9 +9,11 @@
import {addListener,toolbarButtonClickEvent} from "@/hook/mouseMove";
import { useI18n } from 'vue-i18n'
import footSum from "@/hook/footSum";
import userInfo from "@/stores/userInfo"
//语言获取
const { t } = useI18n()
const user=userInfo()
let router = useRouter()
@@ -174,8 +176,9 @@
          let flowData = ref({
            rework: selectRecords
            rework: selectRecords,
            userId:user.user.userId,
            userName:user.user.userName
          })
          request.post("/rework/saveRework", flowData.value).then((res) => {
            if(res.code==200 && res.data===true){
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportingWorkController.java
@@ -5,8 +5,10 @@
import com.example.erp.common.Result;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.ReportingWork;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.ReportingWorkService;
import com.example.erp.service.userInfo.LogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,9 +22,11 @@
public class ReportingWorkController {
    final
    ReportingWorkService reportingWorkService;
    LogService logService;
    public ReportingWorkController(ReportingWorkService reportingWorkService) {
    public ReportingWorkController(ReportingWorkService reportingWorkService,LogService logService) {
        this.reportingWorkService = reportingWorkService;
        this.logService =  logService;
    }
    @ApiOperation("报工新增查询")
@@ -82,15 +86,12 @@
    @ApiOperation("删除报工接口")
    @SaCheckPermission("SelectReportingWorks.delete")
    @PostMapping("/deleteWork/{reportingWorkId}/{processId}/{thisProcess}")
    public Result deleteWork(@PathVariable String reportingWorkId,@PathVariable String processId,@PathVariable String thisProcess){
//        if(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess)){
//            return Result.seccess();
//        }else {
//            throw new ServiceException(Constants.Code_500,"删除失败,请检查是否符合删除条件");
//
//        }
        return Result.seccess(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess));
    @PostMapping("/deleteWork/{reportingWorkId}/{processId}/{thisProcess}/{userId}/{userName}")
    public Result deleteWork(@PathVariable String reportingWorkId,@PathVariable String processId,
                             @PathVariable String thisProcess,@PathVariable String userId
    ,@PathVariable String userName){
        return Result.seccess(reportingWorkService.deleteWorkSv(reportingWorkId,processId,thisProcess,userId,userName));
    }
@@ -139,9 +140,4 @@
        return  Result.seccess(reportingWorkService.getPatchConditionSv(reportingWorkId));
    }
    @ApiOperation("报工新增日志")
    @PostMapping  ("/saveReportingWorkLog")
    public Result saveReportingWorkLog(@RequestBody Map<String,Object> reportingWork)  {
        return  Result.seccess(reportingWorkService.SaveReportingWorkSv(reportingWork));
    }
}
north-glass-erp/src/main/java/com/example/erp/entity/userInfo/Log.java
@@ -1,15 +1,22 @@
package com.example.erp.entity.userInfo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDate;
@Data
@TableName(value="erp_log.log")
public class Log {
    @TableId(type = IdType.AUTO)
    private String id;
    private String operatorId;
    private String operator;
    private String content;
    @TableField(value = "`function`")
    private String function;
    private LocalDate createTime;
north-glass-erp/src/main/java/com/example/erp/mapper/userInfo/LogMapper.java
@@ -1,9 +1,15 @@
package com.example.erp.mapper.userInfo;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.entity.userInfo.Log;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
@Mapper
public interface LogMapper extends BaseMapper<Log> {
}
north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java
@@ -7,10 +7,12 @@
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.PatchLog;
import com.example.erp.entity.pp.ReportingWork;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.pp.FlowCardMapper;
import com.example.erp.mapper.pp.PatchLogMapper;
import com.example.erp.mapper.pp.ReportingWorkMapper;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -37,11 +39,14 @@
    final
    FlowCardMapper flowCardMapper;
    public ReplenishService(PatchLogMapper patchMapper, SysErrorService sysErrorService, ReportingWorkMapper reportingWorkMapper,FlowCardMapper flowCardMapper) {
    final LogService logService;
    public ReplenishService(PatchLogMapper patchMapper, SysErrorService sysErrorService, ReportingWorkMapper reportingWorkMapper,FlowCardMapper flowCardMapper,LogService logService) {
        this.patchMapper = patchMapper;
        this.sysErrorService = sysErrorService;
        this.reportingWorkMapper = reportingWorkMapper;
        this.flowCardMapper = flowCardMapper;
        this.logService = logService;
    }
@@ -109,6 +114,14 @@
        }
        //保存日志
        Log log = new Log();
        log.setContent(object.toString());
        log.setFunction("saveReplenish补片新增");
        log.setOperatorId((String) object.get("userId"));
        log.setOperator((String) object.get("userName"));
        logService.saveLog(log);
        return saveState;
    }
north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
@@ -12,12 +12,15 @@
import com.example.erp.entity.pp.ReportingWorkDetail;
import com.example.erp.entity.sd.Order;
import com.example.erp.entity.sd.OrderProcessDetail;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.exception.ServiceException;
import com.example.erp.mapper.pp.*;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.mapper.sd.OrderMapper;
import com.example.erp.mapper.sd.OrderProcessDetailMapper;
import com.example.erp.mapper.userInfo.LogMapper;
import com.example.erp.service.sd.OrderProcessDetailService;
import com.example.erp.service.userInfo.LogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -48,8 +51,13 @@
    final
    OrderProcessDetailService orderProcessDetailService;
    final
    LogService logService;
    public ReportingWorkService(ReportingWorkMapper reportingWorkMapper, BasicDateProduceMapper basicDateProduceMapper, DamageDetailsMapper damageDetailsMapper, ReportingWorkDetailMapper reportingWorkDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper, OrderProcessDetailService orderProcessDetailService, OrderMapper orderMapper, FlowCardMapper flowCardMapper) {
    final LogMapper logMapper;
    public ReportingWorkService(ReportingWorkMapper reportingWorkMapper, BasicDateProduceMapper basicDateProduceMapper, DamageDetailsMapper damageDetailsMapper, ReportingWorkDetailMapper reportingWorkDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper, OrderProcessDetailService orderProcessDetailService, OrderMapper orderMapper, FlowCardMapper flowCardMapper,LogService logService,LogMapper logMapper) {
        this.reportingWorkMapper = reportingWorkMapper;
        this.basicDateProduceMapper = basicDateProduceMapper;
        this.damageDetailsMapper = damageDetailsMapper;
@@ -58,6 +66,8 @@
        this.orderProcessDetailService = orderProcessDetailService;
        this.orderMapper = orderMapper;
        this.flowCardMapper = flowCardMapper;
        this.logService = logService;
        this.logMapper = logMapper;
    }
    public Map<String, Object> AddSelectLastWorkSv(String processIdStr, String technologyStr, String process) {
@@ -280,6 +290,13 @@
        });
        //保存日志
        Log log = new Log();
        log.setContent(reportingWorkMap.toString());
        log.setFunction("saveReportingWork报工新增");
        log.setOperatorId((String) reportingWorkJson.get("userId"));
        log.setOperator((String) reportingWorkJson.get("userName"));
        logService.saveLog(log);
        return true;
    }
@@ -427,6 +444,14 @@
        //修改小片流程表数量为报工明细表数量
        //orderProcessDetailMapper.updateQuantity(reportingWork.getReportingWorkId(), reportingWork.getThisProcess(), "add");
        //保存日志
        Log log = new Log();
        log.setContent(reportingWorkMap.toString());
        log.setFunction("updateReportingWork报工修改");
        log.setOperatorId((String) reportingWorkJson.get("userId"));
        log.setOperator((String) reportingWorkJson.get("userName"));
        logService.saveLog(log);
        return true;
    }
@@ -443,7 +468,7 @@
    }
    //删除报工
    public Boolean deleteWorkSv(String reportingWorkId, String processId, String thisProcess) {
    public Boolean deleteWorkSv(String reportingWorkId, String processId, String thisProcess, String userId, String userName) {
        if (!reportingWorkId.isEmpty() && !processId.isEmpty() && !thisProcess.isEmpty()) {
            //获取当前报工编号下工序
            String nextProcess = reportingWorkMapper.selectNextProcess(reportingWorkId);
@@ -481,6 +506,13 @@
                            }
                            //删除报工,将审核状态改为-1
                            reportingWorkMapper.deleteWork(reportingWorkId);
                            //保存日志
                            Log log = new Log();
                            log.setContent(reportingWorkId+"-"+processId+"-"+thisProcess);
                            log.setFunction("deleteWork报工入库删除");
                            log.setOperatorId(userId);
                            log.setOperator(userName);
                            logService.saveLog(log);
                            return true;
                        } else {
                            return false;
@@ -497,6 +529,14 @@
                        }
                        //删除报工,将审核状态改为-1
                        reportingWorkMapper.deleteWork(reportingWorkId);
                        //保存日志
                        Log log = new Log();
                        log.setContent(reportingWorkId+"-"+processId+"-"+thisProcess);
                        log.setFunction("deleteWork报工删除");
                        log.setOperatorId(userId);
                        log.setOperator(userName);
                        logService.saveLog(log);
                        return true;
                    } else {
                        return false;
north-glass-erp/src/main/java/com/example/erp/service/pp/ReworkService.java
@@ -6,8 +6,10 @@
import com.example.erp.entity.pp.BasicDataProduce;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.Rework;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.entity.userInfo.SysError;
import com.example.erp.mapper.pp.*;
import com.example.erp.service.userInfo.LogService;
import com.example.erp.service.userInfo.SysErrorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -36,8 +38,12 @@
    final
    FlowCardMapper flowCardMapper;
    public ReworkService(FlowCardMapper flowCardMapper) {
    final LogService logService;
    public ReworkService(FlowCardMapper flowCardMapper,LogService logService) {
        this.flowCardMapper = flowCardMapper;
        this.logService = logService;
    }
    public List<Map<String, Object>> getSelectRework(Integer pageNum, Integer pageSize) {
@@ -123,7 +129,13 @@
            saveState = false;
        }
        //保存日志
        Log log = new Log();
        log.setContent(object.toString());
        log.setFunction("saveRework返工新增");
        log.setOperatorId((String) object.get("userId"));
        log.setOperator((String) object.get("userName"));
        logService.saveLog(log);
        return saveState;
    }
north-glass-erp/src/main/java/com/example/erp/service/userInfo/LogService.java
@@ -3,11 +3,11 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.userInfo.Log;
import com.example.erp.mapper.userInfo.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@DS("log")
@Service
@DS("log")
public class LogService {
    private final LogMapper logMapper;