yaorongkeji 1 неделя назад
Родитель
Сommit
e6f01a54a5

+ 5 - 0
inventory-admin/src/main/java/com/ruoyi/web/controller/inventory/BillsController.java

@@ -107,6 +107,11 @@ public class BillsController extends BaseController {
     }
 
 
+    @GetMapping("/byGoodsCode")
+    public AjaxResult selectByGoodsCode(String goodsCode){
+        return success(billsDetailsService.selectByGoodsCode(goodsCode));
+    }
+
 
 
 }

+ 8 - 0
inventory-system/src/main/java/com/ruoyi/system/mapper/BillsDetailsMapper.java

@@ -65,4 +65,12 @@ public interface BillsDetailsMapper<updateBatchByBillsId>
      * @return
      */
     public int updateBatchByBillsId(List<BillsDetails> billsDetailsList);
+
+
+    /**
+     * 根据商品code查询单据详情轨迹
+     * @param goodsCode
+     * @return
+     */
+    List<BillsDetails> selectByGoodsCode(String goodsCode);
 }

+ 6 - 0
inventory-system/src/main/java/com/ruoyi/system/service/IBillsDetailsService.java

@@ -66,4 +66,10 @@ public interface IBillsDetailsService
      * @param billsDetails
      */
     public void updateBatchByBillsId(List<BillsDetails> billsDetails);
+
+    /**
+     * 根据商品code查询单据详情轨迹
+     * @return
+     */
+    List<BillsDetails> selectByGoodsCode(String goodsCode);
 }

+ 10 - 0
inventory-system/src/main/java/com/ruoyi/system/service/impl/BillsDetailsServiceImpl.java

@@ -167,4 +167,14 @@ public class BillsDetailsServiceImpl implements IBillsDetailsService
     public void updateBatchByBillsId(List<BillsDetails> billsDetails) {
         billsDetailsMapper.updateBatchByBillsId(billsDetails);
     }
+
+    /**
+     * 根据商品code查询单据详情轨迹
+     * @param goodsCode
+     * @return
+     */
+    @Override
+    public List<BillsDetails> selectByGoodsCode(String goodsCode) {
+        return billsDetailsMapper.selectByGoodsCode(goodsCode);
+    }
 }

+ 6 - 0
inventory-system/src/main/resources/mapper/system/BillsDetailsMapper.xml

@@ -108,4 +108,10 @@
             #{id}
         </foreach>
     </delete>
+
+
+    <select id="selectByGoodsCode" parameterType="String" resultMap="BillsDetailsResult">
+        <include refid="selectBillsDetailsVo"/>
+        where goods_code = #{goodsCode} ORDER BY `create_time` DESC
+    </select>
 </mapper>

+ 1 - 0
inventory-system/src/main/resources/mapper/system/BillsMapper.xml

@@ -25,6 +25,7 @@
     <select id="selectBillsList" parameterType="Bills" resultMap="BillsResult">
         <include refid="selectBillsVo"/>
         <where>
+            <if test="id != null and id != ''">and id = #{id}</if>
             <if test="billsType != null  and billsType != ''"> and bills_type = #{billsType}</if>
             <if test="principal != null  and principal != ''"> and principal like concat('%', #{principal}, '%')</if>
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->

+ 7 - 0
inventory-ui/src/api/inventory/bills.js

@@ -59,4 +59,11 @@ export function listBillsDetails(query) {
     method: 'get',
     params: query
   })
+}
+
+export function selectByGoodsCode(goodsCode) {
+  return request({
+    url: '/inventory/bills/byGoodsCode?goodsCode='+ goodsCode,
+    method: 'get'
+  })
 }

+ 12 - 2
inventory-ui/src/views/inventory/bills/index.vue

@@ -1,6 +1,15 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" >
+      <el-form-item label="单据id" prop="id">
+        <el-input
+          v-model="queryParams.id"
+          placeholder="请输入单据id"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
       <el-form-item label="单据类型" prop="billsType">
         <el-select
           v-model="queryParams.billsType"
@@ -94,13 +103,13 @@
             v-hasPermi="['inventory:bills:edit']"
           >修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-share" @click="selectBillsDetails(scope.row)">查看单据详情</el-button>
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['inventory:bills:remove']"
-          >删除</el-button>
+          >删除</el-button> -->
         </template>
       </el-table-column>
     </el-table>
@@ -324,6 +333,7 @@ export default {
         billsTime: null,
         givePlace: null,
         updateTime: null,
+        id: null,
       },
       // 表单参数
       form: {},

+ 33 - 2
inventory-ui/src/views/inventory/goods/index.vue

@@ -120,6 +120,12 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['inventory:goods:remove']"
           >删除</el-button>
+          <el-button
+          size="mini"
+          type="text"
+          icon="el-icon-date"
+          @click="goodsTrack(scope.row.goodsCode)"
+          >出入库轨迹</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -184,15 +190,31 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
+    <el-dialog title="物品出入库轨迹" :visible.sync="trackOpen" width="500px" append-to-body>
+        <el-table
+          :data="billsDetailsData"
+          style="width: 100%">
+        <el-table-column prop="createTime" label="时间" align="center"></el-table-column>
+        <el-table-column prop="billsId" label="关联单据id" align="center"></el-table-column>
+        <el-table-column prop="goodsStatus" label="状态" align="center">
+          <template slot-scope="scope">
+            <dict-tag :options="dict.type.inventory_goods_status" :value="scope.row.goodsStatus"/>
+        </template>
+        </el-table-column>
+      </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {listGoods, addGoods, getGoods,updateGoods,delGoods} from "@/api/inventory/goods"
+import {selectByGoodsCode} from "@/api/inventory/bills"
 
 export default {
   name: "Goods",
-  dicts: ['inventory_goods_status', 'inventory_goods_type','inventory_ware_house'],
+  dicts: ['inventory_goods_status', 'inventory_goods_type','inventory_ware_house','inventory_bills_type'],
   data() {
     return {
       // 遮罩层
@@ -230,13 +252,22 @@ export default {
       },
       lastKeyPressTime: 0,  
       manualInputThreshold: 300, // 毫秒,手动输入的时间间隔阈值  
-      expectedCharacters: '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', // 预期的字符集  
+      expectedCharacters: '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ', // 预期的字符集 
+      trackOpen: false,
+      billsDetailsData: []
     };
   },
   created() {
     this.getList();
   },
    methods: {
+    goodsTrack(goodsCode) {
+      selectByGoodsCode(goodsCode).then(resp => {
+        console.log(resp)
+        this.billsDetailsData = resp.data
+        this.trackOpen = true
+      })
+    },
     /** 查询物品列表 */
     getList() {
       this.loading = true;