廖井涛
2024-05-11 91f291a2c3b4e41fc0b44f2395ad5c956803ee8c
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
12个文件已修改
2个文件已添加
1个文件已删除
497 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/layout/MainErpView.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/basicData/BasicData.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/basicData/SearchBasicData.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/basicData/SearchGlassType.vue 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicGlassTypeController.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/sd/BasicGlassType.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/BasicGlassTypeMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeServise.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/BasicGlassTypeMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/BasicGlassTypeMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/target/classes/mapper/sd/ProductMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/layout/MainErpView.vue
@@ -17,6 +17,7 @@
const router = useRouter()
const userStore = useUserInfoStore()
const user = userStore.user.userName
//监听异步返回代码
watch(()=>userStore.responseCode,(newVal) => {
    switch (newVal){
      case 401:{
@@ -41,6 +42,8 @@
)
store.createWebSocket();
// 退出登录
function quit(){
  userStore.$patch({
    user:null
@@ -59,7 +62,6 @@
let menuList=$ref([])
onMounted(()=>{
  request.get(`/menu/getMenu/${lang}`).then((res) => {
    if(res.code==200){
      menuList= deepClone(res.data)
    }
north-glass-erp/northglass-erp/src/router/index.js
@@ -74,6 +74,11 @@
              component: () => import('../views/sd/basicData/SearchBasicData.vue')
            },
            {
              path: 'searchGlassType',
              name: 'searchGlassType',
              component: () => import('../views/sd/basicData/SearchGlassType.vue')
            },
            {
              name: 'OrderBasicData',
              path: '',
              redirect:'/main/orderBasicData/searchBasicData'
north-glass-erp/northglass-erp/src/views/sd/basicData/BasicData.vue
@@ -21,6 +21,7 @@
    <div id="div-title">
      <el-breadcrumb :separator-icon="ArrowRight">
        <el-breadcrumb-item @click="changeRouter(1)" :class="indexFlag===1?'indexTag':''" :to="{ path: '/main/orderBasicData/searchBasicData' }">基础数据</el-breadcrumb-item>
        <el-breadcrumb-item @click="changeRouter(2)" :class="indexFlag===2?'indexTag':''" :to="{ path: '/main/orderBasicData/searchGlassType' }">玻璃类别</el-breadcrumb-item>
        <el-breadcrumb-item v-show="false" :to="{ path: '/main/order/orderReport' }">报表</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
north-glass-erp/northglass-erp/src/views/sd/basicData/SearchBasicData.vue
@@ -18,7 +18,6 @@
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  id: 'OrderList',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
@@ -62,21 +61,6 @@
    zoom: true,
    custom: true
  },
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        // if (columnIndex === 0) {
        //   return t('basicData.total')
        // }
        // if (props.tableProp.footList.includes(column.field)) {
        //   return sumNum(data, column.field)
        // }
        return ''
      })
    ]
  }
})
const gridEvents = {
  toolbarButtonClick ({ code }) {
@@ -88,15 +72,6 @@
          dialogTableVisible.value = true
          break
        }
      }
    }
  },
  menuClick ({ menu, row, column }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (menu.code) {
      }
    }
north-glass-erp/northglass-erp/src/views/sd/basicData/SearchGlassType.vue
New file
@@ -0,0 +1,204 @@
<script setup>
import {onMounted, reactive, ref} from "vue";
import {VXETable} from "vxe-table";
import {ElMessage} from "element-plus";
import request from "@/utils/request"
import CreateBasicData from "@/views/sd/basicData/CreateBasicData.vue"
import {useRouter,useRoute} from "vue-router"
import {useI18n} from "vue-i18n"
const { t } = useI18n()
let dialogTableVisible = ref(false)
const router = useRouter()
const xGrid = ref()
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  id: 'OrderList',
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollY:{ enabled: true },//开启虚拟滚动
  showOverflow:true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    remote: true
  },
  customConfig: {
    storage: true
  },
  editConfig: {
    trigger: 'click',
    mode: 'row',
    showStatus: true
  },
  //表头参数
  columns:[
    {title: t('basicData.operate'), width: 110, slots: { default: 'button_slot' },fixed:"left",},
    {type: 'seq', title: '序号', width: 80 ,fixed:"left",},
    {field:'level',title: '类别等级'},
    {field:'typeName',title: '名称'},
    {field:'createTime',title: '创建日期'}
  ],
  //表头按钮
  toolbarConfig: {
    buttons: [
      {'code': 'add', 'name': '新增',status: 'primary'},
    ],
    // import: false,
    // export: true,
    // print: true,
    zoom: true,
    custom: true
  },
})
const rowIndex = ref(null)
const glassType = reactive([
  {
    value:1,
    label:'一级类别'
  },
  {
    value: 2,
    label: '二级类别',
    children: []
  }
])
const submit = ref({
  glassLevel:[null,null],
  value:null,
  type:null,
  id:null
})
onMounted(()=>{
  request.get(`/basicGlassType/findAll`).then(res => {
    xGrid.value.reloadData(res.data)
    console.log(res.data)
  })
  request.get(`/basicGlassType/getOneLevelListMap`).then(res => {
    glassType[1].children = res.data
  })
})
const gridEvents = {
  toolbarButtonClick ({ code }) {
    const $grid = xGrid.value
    if ($grid) {
      switch (code) {
        case 'add': {
          dialogTableVisible.value = true
          break
        }
      }
    }
  }
}
const getTableRow =  (row,type) => {
  switch (type) {
    case 'edit': {
      rowIndex.value = row
      submit.value.glassLevel = row.belong===''?[parseInt(row.level)]:[parseInt(row.level),row.belong]
      submit.value.value = row.typeName
      submit.value.id = row.id
      dialogTableVisible.value = true
      break
    }
    case 'delete': {
      request.get(`/basicGlassType/deleteById/${row.id}`).then((res) => {
        if(res.code==='200' && res.data===true){
          ElMessage.success(t('searchOrder.msgDeleteSuccess'))
          router.push({
            path:'/main/orderBasicData/searchGlassType',
            query:{random:Math.random()
            }
          })
        }else{
          ElMessage.warning(t('searchOrder.msgDeleteFail'))
        }
      })
      break
    }
  }
}
const saveBasicData =  (type) =>{
  submit.value.type = type
  request.post(`/basicGlassType/add`, submit.value).then(res => {
    if (res.code==='200') {
      ElMessage.success('保存成功')
      router.push({
        path:'/main/orderBasicData/searchGlassType',
        query:{random:Math.random()
        }
      })
    }
  })
}
</script>
<template>
  <div>
    <vxe-grid
        style="width: 40vw;"
        class="mytable-scrollbar"
        max-height="500px"
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
    >
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{ $t('basicData.edit') }}</el-button>
        <el-popconfirm @confirm="getTableRow(row,'delete')" :title="$t('searchOrder.deleteConfirm')">
          <template #reference>
            <el-button  link type="primary" size="small">{{ $t('basicData.delete') }}</el-button>
          </template>
        </el-popconfirm>
      </template>
    </vxe-grid>
    <el-dialog
        v-model="dialogTableVisible"
        destroy-on-close
        style="width: 30%;height:30% ">
      <el-row>
        <el-cascader
            v-model="submit.glassLevel"
            :options="glassType"
            clearable
            placeholder=""
            :disabled="rowIndex"
        />
      </el-row>
      <el-row>
          <el-input v-model="submit.value"/>
      </el-row>
      <el-row>
        <el-button v-if="!rowIndex" @click="saveBasicData('add')"   type="primary">新增</el-button>
        <el-button v-else @click="saveBasicData('update')" type="primary">修改</el-button>
      </el-row>
    </el-dialog>
  </div>
</template>
<style scoped>
.el-row{
  margin-top: 10px;
}
</style>
north-glass-erp/src/main/java/com/example/erp/controller/sd/BasicGlassTypeController.java
@@ -1,17 +1,17 @@
package com.example.erp.controller.sd;
import com.example.erp.common.Result;
import com.example.erp.service.sd.BasicGlassTypeServise;
import com.example.erp.service.sd.BasicGlassTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/basicGlassType")
public class BasicGlassTypeController {
    @Autowired
    BasicGlassTypeServise basicGlassTypeServise;
    BasicGlassTypeService basicGlassTypeServise;
    @GetMapping("/getOneLevel")
    public Result getOneLevel(){
@@ -26,4 +26,25 @@
    public Result getAll(){
        return Result.seccess(basicGlassTypeServise.getAll());
    }
    @GetMapping("/findAll")
    public Result findAll(){
        return Result.seccess(basicGlassTypeServise.findAll());
    }
    @GetMapping("/deleteById/{id}")
    public Result deleteById(@PathVariable Integer id){
        return Result.seccess(basicGlassTypeServise.deleteById(id));
    }
    @GetMapping("/getOneLevelListMap")
    public Result getOneLevelListMap(){
        return Result.seccess(basicGlassTypeServise.getOneLevelListMap());
    }
    @PostMapping("/add")
    public Result add(@RequestBody Map<String,Object> map){
        return Result.seccess(basicGlassTypeServise.add(map));
    }
}
north-glass-erp/src/main/java/com/example/erp/entity/sd/BasicGlassType.java
@@ -10,7 +10,7 @@
    private Integer id;
    private Integer level;
    private String belong;
    private String typeID;
    private String typeId;
    private String typeName;
    private String createTime;
north-glass-erp/src/main/java/com/example/erp/mapper/sd/BasicGlassTypeMapper.java
@@ -1,13 +1,22 @@
package com.example.erp.mapper.sd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.entity.sd.BasicGlassType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BasicGlassTypeMapper {
public interface BasicGlassTypeMapper extends BaseMapper<BasicGlassType> {
    List<BasicGlassType> getOneLevel();
    List<BasicGlassType> getTwoLevel();
    BasicGlassType selectMaxType(Integer type);
    BasicGlassType selectMaxTowLevelType(String type);
    Boolean updateGlassTypeName(@Param("basicGlassType") BasicGlassType basicGlassType);
}
north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeService.java
New file
@@ -0,0 +1,102 @@
package com.example.erp.service.sd;
import com.alibaba.fastjson.JSON;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.sd.BasicGlassType;
import com.example.erp.mapper.sd.BasicGlassTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@DS("sd")
public class BasicGlassTypeService {
    @Autowired
    BasicGlassTypeMapper basicGlassTypeMapper;
    public List<BasicGlassType> getOneLevel() {
        return basicGlassTypeMapper.getOneLevel();
    }
    public List<BasicGlassType>  getTwoLevel() {
        return basicGlassTypeMapper.getTwoLevel();
    }
    public List<Map<String,String>> getAll() {
        List<BasicGlassType> oneGlassType = basicGlassTypeMapper.getOneLevel();
        List<BasicGlassType> twoGlassType = basicGlassTypeMapper.getTwoLevel();
        List<Map<String,String>> list = new ArrayList<>();
        for (BasicGlassType glassType : oneGlassType) {
            Map<String, String> map = new HashMap<>();
            map.put("value", glassType.getTypeId());
            map.put("label", glassType.getTypeName());
            map.put("children", "");
            List<String> equalList = new ArrayList<>();
            for (BasicGlassType basicGlassType : twoGlassType) {
                if (Objects.equals(basicGlassType.getBelong(), glassType.getTypeId())) {
                    Map<String,String> getMap = JSON.parseObject(JSON.toJSONString(basicGlassType), Map.class);
                    getMap.put("value",getMap.get("typeId"));
                    getMap.put("label",getMap.get("typeName"));
                    equalList.add(JSON.toJSONString(getMap)   );
                }
            }
            map.replace("children",equalList.toString());
            list.add(map);
        }
        return list;
    }
    public List<BasicGlassType> findAll() {
        return basicGlassTypeMapper.selectList(null);
    }
    public Boolean deleteById(Integer id) {
        return basicGlassTypeMapper.deleteById(id) > 0;
    }
    public List<Map<String,Object>> getOneLevelListMap() {
        List<BasicGlassType> oneGlassType = basicGlassTypeMapper.getOneLevel();
        List<Map<String,Object>> list = new ArrayList<>();
        for (BasicGlassType glassType : oneGlassType) {
            Map<String,Object> map = new HashMap<>();
            map.put("value", glassType.getTypeId());
            map.put("label", glassType.getTypeName());
            list.add(map);
        }
        return list;
    }
    public Boolean add(Map<String, Object> map) {
        List<Object> list = (List<Object>) map.get("glassLevel");
        if(list.get(0)==null
                || map.get("value") == null
                || map.get("value").equals("")){
            return false;
        }
        BasicGlassType basicGlassTypeS = new BasicGlassType();
        if(map.get("type").equals("add")){
            if(list.size()==1){
                BasicGlassType basicGlassType =  basicGlassTypeMapper.selectMaxType((Integer) list.get(0));
                int maxId = Integer.parseInt(basicGlassType.getTypeId());
                String newTypeId = String.format("%02d", maxId+1);
                basicGlassTypeS.setLevel((Integer) list.get(0));
                basicGlassTypeS.setTypeId(newTypeId);
                basicGlassTypeS.setTypeName((String) map.get("value"));
            }else if(list.size()==2) {
                BasicGlassType basicGlassType =  basicGlassTypeMapper.selectMaxTowLevelType((String) list.get(1));
                int maxId = Integer.parseInt(basicGlassType.getTypeId().substring(2));
                String newTypeId =list.get(1) + String.format("%02d", maxId+1);
                basicGlassTypeS.setLevel((Integer) list.get(0));
                basicGlassTypeS.setTypeId(newTypeId);
                basicGlassTypeS.setTypeName((String) map.get("value"));
                basicGlassTypeS.setBelong((String) list.get(1));
            }
            return basicGlassTypeMapper.insert(basicGlassTypeS)>0;
        }else{
            basicGlassTypeS.setId((Integer) map.get("id"));
            basicGlassTypeS.setTypeName((String) map.get("value"));
           return basicGlassTypeMapper.updateGlassTypeName(basicGlassTypeS);
        }
    }
}
north-glass-erp/src/main/java/com/example/erp/service/sd/BasicGlassTypeServise.java
File was deleted
north-glass-erp/src/main/resources/mapper/sd/BasicGlassTypeMapper.xml
@@ -19,4 +19,33 @@
        ORDER BY  a.id ;
    </select>
    <select id="selectMaxType">
        select
            *
        from
            basic_glass_type  as a
        where a.level=1
        ORDER BY  a.id  desc limit 1;
    </select>
    <select id="selectMaxTowLevelType">
        select
            *
        from
            basic_glass_type  as a
        where
            a.level=2
            and a.belong = #{type}
        ORDER BY  a.id  desc limit 1;
    </select>
    <update id="updateGlassTypeName" parameterType="com.example.erp.entity.sd.BasicGlassType" >
        update
            basic_glass_type as a
        set a.type_name = #{basicGlassType.typeName}
        where a.id = #{basicGlassType.id}
    </update>
</mapper>
north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
@@ -47,7 +47,7 @@
    <select id="getOrderList">
        select
            *,
        sum(fgi.quantity_available) as goodsQuantity
        ifnull(sum(fgi.quantity_available),0) as goodsQuantity
        from
            `order` as o
        left join mm.finished_goods_inventory as  fgi
north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml
@@ -17,7 +17,7 @@
        <result column="update_time" property="updateTime"/>
        <!--接收其他外键实体类数据-->
        <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType">
            <result column="type_id" property="typeID"/>
            <result column="type_id" property="typeId"/>
            <result column="type_name" property="typeName"/>
        </association>
north-glass-erp/target/classes/mapper/sd/BasicGlassTypeMapper.xml
@@ -19,4 +19,33 @@
        ORDER BY  a.id ;
    </select>
    <select id="selectMaxType">
        select
            *
        from
            basic_glass_type  as a
        where a.level=1
        ORDER BY  a.id  desc limit 1;
    </select>
    <select id="selectMaxTowLevelType">
        select
            *
        from
            basic_glass_type  as a
        where
            a.level=2
            and a.belong = #{type}
        ORDER BY  a.id  desc limit 1;
    </select>
    <update id="updateGlassTypeName" parameterType="com.example.erp.entity.sd.BasicGlassType" >
        update
            basic_glass_type as a
        set a.type_name = #{basicGlassType.typeName}
        where a.id = #{basicGlassType.id}
    </update>
</mapper>
north-glass-erp/target/classes/mapper/sd/ProductMapper.xml
@@ -17,7 +17,7 @@
        <result column="update_time" property="updateTime"/>
        <!--接收其他外键实体类数据-->
        <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType">
            <result column="type_id" property="typeID"/>
            <result column="type_id" property="typeId"/>
            <result column="type_name" property="typeName"/>
        </association>