From 4dcb5e299757924aef0edc4d608d2305dbedc780 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期四, 18 九月 2025 08:59:33 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml                              |   11 +-
 north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java                       |   18 ++++
 north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java               |   31 +++++++
 north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java                       |    4 +
 north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java                             |   24 ++++++
 north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java          |    4 
 north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue |    1 
 north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml                                   |    3 
 north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml                                   |   23 +++++
 north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue                                  |   39 ++++++++-
 north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java            |    2 
 north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java                     |   52 +++++++++++++
 12 files changed, 197 insertions(+), 15 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue b/north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue
index 34507b8..211773d 100644
--- a/north-glass-erp/northglass-erp/src/views/mm/finishedGlassShelf/FinishedGlassShelfInformation.vue
+++ b/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>
diff --git a/north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue b/north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue
index 9277d4a..96af293 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/bom/MaterialBOM.vue
+++ b/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
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java b/north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java
new file mode 100644
index 0000000..3a5927e
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/sd/BomDataController.java
@@ -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));
+    }
+
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java b/north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java
index d0fd4f4..695cb1a 100644
--- a/north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialStore.java
+++ b/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;
+
 
 
 }
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java b/north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java
new file mode 100644
index 0000000..b60f8df
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/sd/BomBase.java
@@ -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;
+
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java
index b1626cc..2b2d297 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/mm/FinishedGlassShelfMapper.java
+++ b/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);
 
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java
new file mode 100644
index 0000000..dd50e4d
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/BomDataMapper.java
@@ -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);
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java b/north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java
index 491f6b6..7f2bc2c 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/mm/FinishedGlassShelfService.java
+++ b/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);
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java
new file mode 100644
index 0000000..5cc9599
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/BomDataService.java
@@ -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;
+        }
+    }
+}
diff --git a/north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml b/north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml
index f6479f6..5bd47af 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/FinishedGlassShelf.xml
+++ b/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>
 
diff --git a/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml b/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
index 42b8df8..2fc6969 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialStore.xml
+++ b/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}
diff --git a/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
new file mode 100644
index 0000000..fe1af16
--- /dev/null
+++ b/north-glass-erp/src/main/resources/mapper/sd/BomDataMapper.xml
@@ -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>
\ No newline at end of file

--
Gitblit v1.8.0