From e4f2d8299d63b6f5de024994345ffae040e2a812 Mon Sep 17 00:00:00 2001
From: 吴健 <14790700720@163.com>
Date: 星期三, 27 十一月 2024 10:22:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 billion-ui/src/components/itemSelect/single.vue                                       |  205 +++++++++++++++++++++++++++++++++++++++++
 billion-ui/src/views/main/bs/bomInfo/index.vue                                        |   16 +++
 billion-main/src/main/java/com/billion/main/bs/domain/BsBomInfo.java                  |    7 -
 billion-main/src/main/java/com/billion/main/bs/service/impl/BsBomInfoServiceImpl.java |   12 +
 billion-main/src/main/resources/mapper/bs/BsBomInfoMapper.xml                         |   22 ++--
 billion-main/src/main/java/com/billion/main/bs/controller/BsBomInfoController.java    |    4 
 billion-ui/src/views/main/bs/bomChildInfo/index.vue                                   |   19 +++
 billion-main/src/main/java/com/billion/main/bs/service/IBsBomInfoService.java         |    2 
 8 files changed, 260 insertions(+), 27 deletions(-)

diff --git a/billion-main/src/main/java/com/billion/main/bs/controller/BsBomInfoController.java b/billion-main/src/main/java/com/billion/main/bs/controller/BsBomInfoController.java
index 2cd5e10..d5da319 100644
--- a/billion-main/src/main/java/com/billion/main/bs/controller/BsBomInfoController.java
+++ b/billion-main/src/main/java/com/billion/main/bs/controller/BsBomInfoController.java
@@ -69,9 +69,9 @@
     @PreAuthorize("@ss.hasPermi('bs:bomInfo:add')")
     @Log(title = "鍩虹BOM", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody BsBomInfo bsBomInfo)
+    public void add(@RequestBody BsBomInfo bsBomInfo)
     {
-        return toAjax(bsBomInfoService.insertBsBomInfo(bsBomInfo));
+       bsBomInfoService.insertBsBomInfo(bsBomInfo);
     }
 
     /**
diff --git a/billion-main/src/main/java/com/billion/main/bs/domain/BsBomInfo.java b/billion-main/src/main/java/com/billion/main/bs/domain/BsBomInfo.java
index 74bf867..ba27d4d 100644
--- a/billion-main/src/main/java/com/billion/main/bs/domain/BsBomInfo.java
+++ b/billion-main/src/main/java/com/billion/main/bs/domain/BsBomInfo.java
@@ -42,13 +42,6 @@
     @Excel(name = "鐘舵��(瀛楀吀)")
     private String status;
 
-    /** 鍒涘缓鐢ㄦ埛 */
-    @Excel(name = "鍒涘缓鐢ㄦ埛")
-    private String createUser;
-
-    /** 鏇存敼鐢ㄦ埛 */
-    @Excel(name = "鏇存敼鐢ㄦ埛")
-    private String updateUser;
 
     /** 鏁版嵁鏉ユ簮 */
     @Excel(name = "鏁版嵁鏉ユ簮")
diff --git a/billion-main/src/main/java/com/billion/main/bs/service/IBsBomInfoService.java b/billion-main/src/main/java/com/billion/main/bs/service/IBsBomInfoService.java
index 3868075..6ea8f12 100644
--- a/billion-main/src/main/java/com/billion/main/bs/service/IBsBomInfoService.java
+++ b/billion-main/src/main/java/com/billion/main/bs/service/IBsBomInfoService.java
@@ -35,7 +35,7 @@
      * @param bsBomInfo 鍩虹BOM
      * @return 缁撴灉
      */
-    public int insertBsBomInfo(BsBomInfo bsBomInfo);
+    public void insertBsBomInfo(BsBomInfo bsBomInfo);
 
     /**
      * 淇敼鍩虹BOM
diff --git a/billion-main/src/main/java/com/billion/main/bs/service/impl/BsBomInfoServiceImpl.java b/billion-main/src/main/java/com/billion/main/bs/service/impl/BsBomInfoServiceImpl.java
index db1421c..85dcbec 100644
--- a/billion-main/src/main/java/com/billion/main/bs/service/impl/BsBomInfoServiceImpl.java
+++ b/billion-main/src/main/java/com/billion/main/bs/service/impl/BsBomInfoServiceImpl.java
@@ -1,6 +1,9 @@
 package com.billion.main.bs.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.billion.common.exception.ServiceException;
 import com.billion.common.utils.DateUtils;
 import com.billion.main.bs.domain.BsBomInfo;
 import com.billion.main.bs.mapper.BsBomInfoMapper;
@@ -53,10 +56,13 @@
      * @return 缁撴灉
      */
     @Override
-    public int insertBsBomInfo(BsBomInfo bsBomInfo)
+    public  void insertBsBomInfo(BsBomInfo bsBomInfo)
     {
-        bsBomInfo.setCreateTime(DateUtils.getNowDate());
-        return bsBomInfoMapper.insertBsBomInfo(bsBomInfo);
+        List<BsBomInfo> checkList = this.list(new LambdaQueryWrapper<BsBomInfo>().eq(BsBomInfo::getBomCode, bsBomInfo.getBomCode()));
+        if (CollUtil.isNotEmpty(checkList)){
+            throw new ServiceException("宸插瓨鍦ㄥ伐鍗曠紪鍙蜂负"+bsBomInfo.getBomCode()+"鐨勬暟鎹�");
+        }
+        this.save(bsBomInfo);
     }
 
     /**
diff --git a/billion-main/src/main/resources/mapper/bs/BsBomInfoMapper.xml b/billion-main/src/main/resources/mapper/bs/BsBomInfoMapper.xml
index 9c97f83..08f6033 100644
--- a/billion-main/src/main/resources/mapper/bs/BsBomInfoMapper.xml
+++ b/billion-main/src/main/resources/mapper/bs/BsBomInfoMapper.xml
@@ -13,16 +13,16 @@
         <result property="version"    column="version"    />
         <result property="status"    column="status"    />
         <result property="remark"    column="remark"    />
-        <result property="createUser"    column="create_user"    />
+        <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
-        <result property="updateUser"    column="update_user"    />
+        <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="dataSource"    column="data_source"    />
         <result property="delFlag"    column="del_flag"    />
     </resultMap>
 
     <sql id="selectBsBomInfoVo">
-        select id, bom_code, bom_name, product_code, product_name, version, status, remark, create_user, create_time, update_user, update_time, data_source, del_flag from bs_bom_info
+        select id, bom_code, bom_name, product_code, product_name, version, status, remark, create_by, create_time, update_by, update_time, data_source, del_flag from bs_bom_info
     </sql>
 
     <select id="selectBsBomInfoList" parameterType="BsBomInfo" resultMap="BsBomInfoResult">
@@ -34,8 +34,8 @@
             <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
             <if test="version != null  and version != ''"> and version = #{version}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
-            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
+            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
+            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
             <if test="dataSource != null  and dataSource != ''"> and data_source = #{dataSource}</if>
         </where>
     </select>
@@ -56,9 +56,9 @@
             <if test="version != null">version,</if>
             <if test="status != null">status,</if>
             <if test="remark != null">remark,</if>
-            <if test="createUser != null">create_user,</if>
+            <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="updateUser != null">update_user,</if>
+            <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="dataSource != null">data_source,</if>
             <if test="delFlag != null">del_flag,</if>
@@ -72,9 +72,9 @@
             <if test="version != null">#{version},</if>
             <if test="status != null">#{status},</if>
             <if test="remark != null">#{remark},</if>
-            <if test="createUser != null">#{createUser},</if>
+            <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="updateUser != null">#{updateUser},</if>
+            <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="dataSource != null">#{dataSource},</if>
             <if test="delFlag != null">#{delFlag},</if>
@@ -91,9 +91,9 @@
             <if test="version != null">version = #{version},</if>
             <if test="status != null">status = #{status},</if>
             <if test="remark != null">remark = #{remark},</if>
-            <if test="createUser != null">create_user = #{createUser},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateUser != null">update_user = #{updateUser},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="dataSource != null">data_source = #{dataSource},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
diff --git a/billion-ui/src/components/itemSelect/single.vue b/billion-ui/src/components/itemSelect/single.vue
new file mode 100644
index 0000000..39bc497
--- /dev/null
+++ b/billion-ui/src/components/itemSelect/single.vue
@@ -0,0 +1,205 @@
+<template>
+  <el-dialog title="鐗╂枡浜у搧閫夋嫨"
+             v-if="showFlag"
+             :visible.sync="showFlag"
+             :modal= false
+             width="80%"
+             center
+  >
+    <el-row :gutter="20">
+      <!--鐗╂枡鏁版嵁-->
+      <el-col :span="24" :xs="24">
+        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="鐗╂枡缂栫爜" prop="materialCode">
+            <el-input
+              v-model="queryParams.materialCode"
+              placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�"
+              clearable
+              style="width: 240px"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="鐗╂枡鍚嶇О" prop="materialName">
+            <el-input
+              v-model="queryParams.materialName"
+              placeholder="璇疯緭鍏ョ墿鏂欏悕绉�"
+              clearable
+              style="width: 240px"
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item style="float: right">
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
+          </el-form-item>
+        </el-form>
+        <el-table border v-loading="loading" :data="itemList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
+          <el-table-column width="50" align="center" >
+            <template v-slot="scope">
+              <el-radio v-model="selectedItemId" :label="scope.row.id" @change="handleRowChange(scope.row)">{{""}}</el-radio>
+            </template>
+          </el-table-column>
+          <el-table-column label="鐗╂枡缂栧彿" align="center" prop="materialCode">
+          </el-table-column>
+          <el-table-column label="鐗╂枡鍚嶇О" align="center" prop="materialName">
+          </el-table-column>
+          <el-table-column label="鍗曚綅" align="center" prop="unit">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.unit" :value="scope.row.unit"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime">
+          </el-table-column>
+          <el-table-column label="鐘舵��" align="center" prop="status">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="鍘傚晢" align="center" prop="supplier">
+          </el-table-column>
+        </el-table>
+
+        <pagination
+          v-show="total>0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </el-col>
+    </el-row>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="confirmSelect">纭� 瀹�</el-button>
+      <el-button @click="showFlag=false">鍙� 娑�</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { listMaterialInfo} from "@/api/main/bs/materialInfo";
+
+export default {
+  name: "MdItemSingle",
+  dicts: ['sys_yes_no','mes_item_product','material_type','unit','sys_normal_disable'],
+  data() {
+    return {
+      showFlag:false,
+      // 閫変腑鏁扮粍
+      selectedItemId: undefined,
+      selectedRows: undefined,
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 鐗╂枡浜у搧琛ㄦ牸鏁版嵁
+      itemList: null,
+      // 閮ㄩ棬鏍戦�夐」
+      itemTypeOptions: undefined,
+      // 閮ㄩ棬鍚嶇О
+      itemTypeName: undefined,
+      defaultProps: {
+        children: "children",
+        label: "label"
+      },
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        materialCode: undefined,
+        materialName: undefined,
+        itemTypeId: 0,
+        typeL: 1,
+      },
+      // 鍒椾俊鎭�
+      columns: [
+        { key: 0, label: `鐗╂枡/浜у搧缂栫爜`, visible: true },
+        { key: 1, label: `鐗╂枡/浜у搧鍚嶇О`, visible: true },
+        { key: 2, label: `瑙勬牸鍨嬪彿`, visible: true },
+        { key: 3, label: `鍗曚綅`, visible: true },
+        { key: 4, label: `鐗╂枡/浜у搧`, visible: true },
+        { key: 5, label: `鐗╂枡鍒嗙被`, visible: true },
+        { key: 6, label: `鍒涘缓鏃堕棿`, visible: true }
+      ]
+    };
+  },
+  watch: {
+    // 鏍规嵁鍚嶇О绛涢�夊垎绫绘爲
+    itemTypeName(val) {
+      this.$refs.tree.filter(val);
+    }
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ鐗╂枡缂栫爜鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listMaterialInfo(this.queryParams).then(response => {
+          this.itemList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        }
+      );
+    },
+    // 绛涢�夎妭鐐�
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+    // 鑺傜偣鍗曞嚮浜嬩欢
+    handleNodeClick(data) {
+      this.queryParams.itemTypeId = data.id;
+      this.handleQuery();
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    handleCurrent(row){
+      if(row){
+        this.selectedRows = row;
+      }
+    },
+    handleRowDbClick(row){
+      if(row){
+        this.selectedRows = row;
+        this.$emit('onSelected',this.selectedRows);
+        this.showFlag = false;
+      }
+    },
+    // 鍗曢�夐�変腑鏁版嵁
+    handleRowChange(row) {
+      debugger;
+      if(row){
+        this.selectedRows = row;
+      }
+    },
+    //纭畾閫変腑
+    confirmSelect(){
+      if(this.selectedItemId ==null || this.selectedItemId==0){
+        this.$notify({
+          title:'鎻愮ず',
+          type:'warning',
+          message: '璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�!'
+        });
+        return;
+      }
+      console.log(this.selectedRows)
+
+      this.$emit('onSelected',this.selectedRows);
+      this.showFlag = false;
+    }
+  }
+};
+</script>
diff --git a/billion-ui/src/views/main/bs/bomChildInfo/index.vue b/billion-ui/src/views/main/bs/bomChildInfo/index.vue
index e4bc548..19d0ada 100644
--- a/billion-ui/src/views/main/bs/bomChildInfo/index.vue
+++ b/billion-ui/src/views/main/bs/bomChildInfo/index.vue
@@ -165,10 +165,13 @@
           <el-input v-model="form.locationName" placeholder="璇疯緭鍏ュ伐浣嶅悕绉�" />
         </el-form-item>
         <el-form-item label="鐗╂枡缂栫爜" prop="materialCode">
-          <el-input v-model="form.materialCode" placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�" />
+          <el-input v-model="form.materialCode" placeholder="璇烽�夋嫨浜у搧" >
+            <el-button slot="append" @click="handleSelectMaterial" icon="el-icon-search"></el-button>
+          </el-input>
+          <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
         </el-form-item>
         <el-form-item label="鐗╂枡鍚嶇О" prop="materialName">
-          <el-input v-model="form.materialName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" />
+          <el-input disabled v-model="form.materialName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" />
         </el-form-item>
         <el-form-item label="鍗曡��" prop="costQty">
           <el-input v-model="form.costQty" placeholder="璇疯緭鍏ュ崟鑰�" />
@@ -191,9 +194,11 @@
 <script>
 import { listBomChildInfo, getBomChildInfo, delBomChildInfo, addBomChildInfo, updateBomChildInfo } from "@/api/main/bs/bomChildInfo";
 import { listBomInfo } from "@/api/main/bs/bomInfo";
+import ItemSelect from "@/components/itemSelect/single.vue";
 
 export default {
   name: "BomChildInfo",
+  components: {ItemSelect},
   data() {
     return {
       // 閬僵灞�
@@ -257,6 +262,16 @@
     this.getProcesses();
   },
   methods: {
+    //鐗╂枡閫夋嫨寮瑰嚭妗�
+    onItemSelected(obj){
+      if(obj !== undefined && obj !== null){
+        this.form.materialCode = obj.materialCode;
+        this.form.materialName = obj.materialName;
+      }
+    },
+    handleSelectMaterial(){
+      this.$refs.itemSelect.showFlag = true;
+    },
     /** 杩斿洖鎸夐挳鎿嶄綔 */
     handleClose() {
       const obj = { path: "/main/bs/bomInfo" };
diff --git a/billion-ui/src/views/main/bs/bomInfo/index.vue b/billion-ui/src/views/main/bs/bomInfo/index.vue
index 0edc8f3..b05d20f 100644
--- a/billion-ui/src/views/main/bs/bomInfo/index.vue
+++ b/billion-ui/src/views/main/bs/bomInfo/index.vue
@@ -97,7 +97,11 @@
       <el-table-column show-overflow-tooltip="true" label="浜у搧缂栫爜" align="center" prop="productCode"/>
       <el-table-column show-overflow-tooltip="true" label="浜у搧鍚嶇О" align="center" prop="productName" />
       <el-table-column show-overflow-tooltip="true" label="鐗堟湰" align="center" prop="version" />
-      <el-table-column show-overflow-tooltip="true" label="鐘舵��" align="center" prop="status" />
+      <el-table-column label="鐘舵��" align="center" prop="status">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+        </template>
+      </el-table-column>
       <el-table-column show-overflow-tooltip="true" label="澶囨敞" align="center" prop="remark" />
     </el-table>
 
@@ -124,6 +128,15 @@
         <el-form-item label="浜у搧鍚嶇О" prop="productName">
           <el-input v-model="form.productName" placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�" />
         </el-form-item>
+        <el-form-item label="宸ュ崟鐘舵��" prop="status">
+          <el-radio-group v-model="form.status">
+            <el-radio
+              v-for="dict in dict.type.sys_normal_disable"
+              :key="dict.value"
+              :label="dict.value"
+            >{{dict.label}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
         <el-form-item label="澶囨敞" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
         </el-form-item>
@@ -141,6 +154,7 @@
 
 export default {
   name: "BomInfo",
+  dicts: ['sys_normal_disable'],
   data() {
     return {
       // 閬僵灞�

--
Gitblit v1.9.3