guoyujie
2025-09-18 4dcb5e299757924aef0edc4d608d2305dbedc780
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
5个文件已添加
7个文件已修改
212 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue
@@ -317,6 +317,7 @@
        </template>
        <template #toolbar_buttons="{ $grid }">
          &nbsp;&nbsp;
          <vxe-select @change="changeOrderType" v-model="values" >
            <vxe-option value="1" label="汇总"></vxe-option>
            <vxe-option value="2" label="明细"></vxe-option>
north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue
@@ -17,9 +17,14 @@
let produceList = ref([])
const dialogTableVisible = ref(false)
const data = ref({
  printList: []
})
//表单验证
const ruleFormRef = ref()
const ruleForm = reactive({
  MaterialId:'',
  MaterialName:'',
  type: '',
  consume: '',
  price: '',
@@ -45,6 +50,14 @@
const submitForm = (formEl) => {
  if (!formEl) return
  data.value.printList = ruleForm
  request.post(`/BomData/saveMaterialBomData`,ruleForm).then((res) => {
    if (res.code == 200 && res.data === true) {
      ElMessage.success(t('basicData.msg.saveSuccess'))
      load()
    }
  })
  formEl.validate((valid) => {
    if (valid) {
      console.log('submit!')
@@ -65,6 +78,8 @@
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
      ruleForm.MaterialId=row.id
      ruleForm.MaterialName=row.name
      dialogTableVisible.value = true
      return
    }
@@ -117,12 +132,13 @@
let arr = [
  {title: t('basicData.operate'), width: '110', slots: { default: 'button_slot' },fixed:'left'},
  { type: 'seq',fixed:'left', title: t('basicData.Number'), width: '80' },
  {field: 'id', width: '150',title: t('ingredients.materialCode'), sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged}
  {field: 'id', width: '150',title: t('ingredients.materialCode'), sortable: true,showOverflow:'ellipsis' ,filters:[{ data: '' }],slots: { filter: 'num1_filter' },filterMethod:filterChanged},
  {field: 'bomType',title: '类型', showOverflow:'ellipsis' },
  {field: 'consume',title: '消耗量',showOverflow:'ellipsis' },
  {field: 'price',title: '使用价格',showOverflow:'ellipsis' }
]
const bomTitle = [
  {field: 'type',title: '类型', showOverflow:'ellipsis' },
  {field: 'consume',title: '消耗量',showOverflow:'ellipsis' },
  {price: '使用价格',title: '使用价格',showOverflow:'ellipsis' }
]
//第一次加载默认
@@ -192,6 +208,21 @@
      for (let i=0;i<res.data.data.length;i++){
        materialStore.value[i]= JSON.parse(res.data.data[i].json)
        materialStore.value[i].id= res.data.data[i].id
        materialStore.value[i].consume= res.data.data[i].consume
        switch (res.data.data[i].bomType) {
          case '1':
            materialStore.value[i].bomType = '面积';
            break;
          case '2':
            materialStore.value[i].bomType = '周长';
            break;
          case "3":
            materialStore.value[i].bomType = '数量';
            break;
          default:
            materialStore.value[i].bomType = res.data.data[i].bomType; // 保留原值
        }
        materialStore.value[i].price= res.data.data[i].price
      }
      total.dataTotal = res.data.total.total*1
north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java
New file
@@ -0,0 +1,31 @@
package com.example.erp.controller.sd;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.BasicData;
import com.example.erp.entity.sd.BomBase;
import com.example.erp.service.sd.BasicDataService;
import com.example.erp.service.sd.BomDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/BomData")
@Api(value="BOM相关controller",tags={"BOM相关操作接口"})
public class BomDataController {
    final
    BomDataService bomDataService;
    public BomDataController(BomDataService bomDataService) {
        this.bomDataService = bomDataService;
    }
    @ApiOperation("更新基础数据")
    @PostMapping("saveMaterialBomData")
    public Result saveMaterialBomData(@RequestBody Map<String, Object> object){
        return  Result.seccess(bomDataService.saveMaterialBomDataSv(object));
    }
}
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java
@@ -15,6 +15,10 @@
    private String json;
    private LocalDate createTime;
    private String consume;
    private String bomType;
    private String price;
}
north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java
New file
@@ -0,0 +1,24 @@
package com.example.erp.entity.sd;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import java.time.LocalDate;
@Data
@TableName("sd.bom_base")
public class BomBase {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private Integer materialId;
    private String material;
    private Integer status;
    private Integer type;
    private Decimal price;
    private Double consume;
    private LocalDate createTime;
}
north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java
@@ -17,7 +17,7 @@
    List<FinishedGlassShelfInformation> getSelectFinishedGlassShelfInformation(@Param("finishedGlassShelfInformation") FinishedGlassShelfInformation finishedGlassShelfInformation);
    List<FinishedGlassShelfInformation> getSelectFinishedGlassShelfInformationInventoryArea(@Param("inventoryArea")String inventoryArea);
    Integer getSelectFinishedGlassShelfInformationInventoryArea(@Param("inventoryArea")String inventoryArea);
    boolean insetFinishedGlassShelfInformation(@Param("finishedGlassShelfInformation") FinishedGlassShelfInformation finishedGlassShelfInformation,String inventoryAreaNumber);
north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java
New file
@@ -0,0 +1,18 @@
package com.example.erp.mapper.sd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.erp.entity.sd.BasicData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BomDataMapper extends BaseMapper<BasicData> {
    Boolean saveMaterialBomDataMp(Integer id, String name, Object consume, Object price, Integer type);
    Integer getMaterialId(Integer id);
    Boolean updateMaterialBomDataMp(Integer id, String name, Object consume, Object price, Integer type);
}
north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java
@@ -77,9 +77,7 @@
                finishedGlassShelfMapper.updateFinishedGlassShelfInformation(finishedGlassShelfInformation,finishedGlassShelfInformation.getId());
                log.setFunction("saveFinishedGlassShelf修改1");
            }else{
                List<FinishedGlassShelfInformation> list=finishedGlassShelfMapper
                        .getSelectFinishedGlassShelfInformationInventoryArea(inventoryArea);
                int index=list.size();
                int index=finishedGlassShelfMapper.getSelectFinishedGlassShelfInformationInventoryArea(inventoryArea);
                for (int i=1;i<=quantity;i++){
                    index++;
                    finishedGlassShelfMapper.insetFinishedGlassShelfInformation(finishedGlassShelfInformation,inventoryArea+index);
north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java
New file
@@ -0,0 +1,52 @@
package com.example.erp.service.sd;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.erp.entity.sd.BasicData;
import com.example.erp.entity.sd.BasicOtherMoney;
import com.example.erp.entity.sd.BomBase;
import com.example.erp.entity.sd.Customer;
import com.example.erp.mapper.sd.BomDataMapper;
import com.example.erp.mapper.sd.BasicOtherMoneyMapper;
import com.example.erp.mapper.sd.CustomerMapper;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@DS("sd")
public class BomDataService {
    private final BomDataMapper bomDataMapper;
    private final CustomerMapper customerMapper;
    private final BasicOtherMoneyMapper basicOtherMoneyMapper;
    public BomDataService(BomDataMapper bomDataMapper, CustomerMapper customerMapper, BasicOtherMoneyMapper basicOtherMoneyMapper) {
        this.bomDataMapper = bomDataMapper;
        this.customerMapper = customerMapper;
        this.basicOtherMoneyMapper = basicOtherMoneyMapper;
    }
    public Boolean saveMaterialBomDataSv(Map<String, Object> object) {
        Integer id = (Integer) object.get("MaterialId");
        String name = (String) object.get("MaterialName");
        Object consume =  object.get("consume");
        Object price =  object.get("price");
        Integer type = (Integer) object.get("type");
        if (id!=null){
            //查询物料编号是否已存在
            Integer countId =  bomDataMapper.getMaterialId(id);
            if (countId == 0){
                bomDataMapper.saveMaterialBomDataMp(id,name,consume,price,type);
            }else {
                bomDataMapper.updateMaterialBomDataMp(id,name,consume,price,type);
            }
            return true;
        }else {
            return false;
        }
    }
}
north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml
@@ -36,13 +36,12 @@
    </select>
    <select id="getSelectFinishedGlassShelfInformationInventoryArea">
        select
            *
        from
            mm.finished_glass_shelf_information
        where
        SELECT
            MAX(CAST(REGEXP_REPLACE(glass_shelf_number, '[^0-9]', '')AS UNSIGNED)) AS maxDindex
        FROM
            finished_glass_shelf_information
        WHERE
            glass_shelf_number regexp #{inventoryArea}
    </select>
north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
@@ -6,9 +6,10 @@
    <select id="getSelectMaterialStore">
        select
        *
        m.id,m.type,m.json,m.create_time,bb.consume,bb.type as bomType,bb.price
        from
        mm.material_store m
        left join sd.bom_base as bb on bb.material_id=m.id
        <where>
            <if test="materialStore.id != null and materialStore.id != ''">
                and m.id regexp #{materialStore.id}
north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
New file
@@ -0,0 +1,23 @@
<?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.example.erp.mapper.sd.BomDataMapper">
    <insert id="saveMaterialBomDataMp">
        insert into sd.bom_base
            (material_id, material, status, type, consume, price,create_time)
        values
            (#{id}, #{name}, 0, #{type}, #{consume},#{price}, now())
    </insert>
    <select id="getMaterialId">
        select count(*) from sd.bom_base where material_id= #{id}
    </select>
    <update id="updateMaterialBomDataMp">
        update sd.bom_base
        set type=#{type},consume=#{consume},price=#{price},create_time=now()
        where material_id = #{id}
    </update>
</mapper>