From 20235a873f123a83f7763c0327e5845caa32c9b9 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期四, 03 四月 2025 16:15:19 +0800
Subject: [PATCH] 入出库订单打印,拣货单打印,搜索条件增加

---
 zy-asrs-admin/src/components/print/orderPrint/template/template1.vue             |   81 ++++++++++++++++
 zy-asrs-admin/src/components/print/orderPrint/index.vue                          |   56 +++++++++++
 zy-asrs-admin/src/views/log/viewWorkIn/index.vue                                 |   40 ++++++-
 zy-asrs-admin/src/components/order/order/orderIn.vue                             |   29 +++++
 zy-asrs-admin/src/components/order/order/orderOut.vue                            |   33 +++++
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java             |   30 ++---
 zy-asrs-admin/src/config.js                                                      |    2 
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/ViewWorkIn.java |    3 
 8 files changed, 242 insertions(+), 32 deletions(-)

diff --git a/zy-asrs-admin/src/components/order/order/orderIn.vue b/zy-asrs-admin/src/components/order/order/orderIn.vue
index a314487..827d393 100644
--- a/zy-asrs-admin/src/components/order/order/orderIn.vue
+++ b/zy-asrs-admin/src/components/order/order/orderIn.vue
@@ -1,5 +1,5 @@
 <script setup>
-import { getCurrentInstance, ref, computed, reactive, defineProps } from 'vue';
+import {getCurrentInstance, ref, computed, reactive, defineProps, nextTick} from 'vue';
 import { useRouter } from "vue-router";
 import { get, post, postBlob, postForm } from '@/utils/request.js'
 import { message, Modal } from 'ant-design-vue';
@@ -8,6 +8,7 @@
 import { formatMessage } from '@/utils/localeUtils.js';
 import useTableSearch from '@/utils/tableUtils.jsx';
 import ShowOrderDetlComponent from '@/components/orderDetl/show.vue';
+import OrderPrint from '@/components/print/orderPrint/index.vue'
 import {
   DownOutlined,
   UploadOutlined,
@@ -216,6 +217,28 @@
   showOrderDetlChild.value.orderId = item.id;
 }
 
+const printChild = ref(null);
+// 鎵撳嵃璁㈠崟
+const handlePrint = async (record) => {
+  let printData = [];
+
+  const resp = await get("/api/orderDetl/orderId/" + record.__v_raw.id, {});
+  let result = resp.data;
+
+  result.data.forEach((item) => {
+    let newItem = {};
+    newItem.matnr = item.mat$.matnr
+    newItem.maktx = item.mat$.maktx
+    newItem.specs = item.mat$.specs
+    newItem.batch = item.batch
+    newItem.anfme = item.anfme
+    printData.push(newItem)
+  })
+  printChild.value.printData = printData;
+  printChild.value.orderNo = record.__v_raw.orderNo
+  printChild.value.open = true;
+}
+
 const handleExport = async (intl) => {
   postBlob('/api/order/export', {
     ioModel: props.ioModel,
@@ -367,6 +390,9 @@
           <div style="display: flex;justify-content: space-evenly;">
             <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.order.orderDetl', '璁㈠崟鏄庣粏')
               }}</a-button>
+            <a-button type="link" primary @click="handlePrint(record)">{{ formatMessage('page.order.orderDetl',
+                '鎵撳嵃璁㈠崟')
+              }}</a-button>
             <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '缂栬緫') }}</a-button>
             <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '鍒犻櫎')
               }}</a-button>
@@ -378,6 +404,7 @@
     <ShowOrderDetlComponent ref="showOrderDetlChild" />
 
   </div>
+  <OrderPrint ref="printChild" />
 </template>
 
 <style></style>
diff --git a/zy-asrs-admin/src/components/order/order/orderOut.vue b/zy-asrs-admin/src/components/order/order/orderOut.vue
index 8b776d7..52cbacb 100644
--- a/zy-asrs-admin/src/components/order/order/orderOut.vue
+++ b/zy-asrs-admin/src/components/order/order/orderOut.vue
@@ -1,5 +1,5 @@
 <script setup>
-import { getCurrentInstance, ref, computed, reactive, defineProps } from 'vue';
+import {getCurrentInstance, ref, computed, reactive, defineProps, nextTick} from 'vue';
 import { useRouter } from "vue-router";
 import { get, post, postBlob, postForm } from '@/utils/request.js'
 import { message, Modal } from 'ant-design-vue';
@@ -8,6 +8,7 @@
 import { formatMessage } from '@/utils/localeUtils.js';
 import useTableSearch from '@/utils/tableUtils.jsx';
 import ShowOrderDetlComponent from '@/components/orderDetl/show.vue';
+import OrderPrint from '@/components/print/orderPrint/index.vue'
 import {
     DownOutlined,
     UploadOutlined,
@@ -237,6 +238,26 @@
     })
 };
 
+const printChild = ref(null);
+// 鎵撳嵃璁㈠崟
+const handlePrint = async (record) => {
+  let printData = [];
+  const resp = await get("/api/orderDetl/orderId/" + record.__v_raw.id, {});
+  const result = resp.data;
+  result.data.forEach((item) => {
+    let newItem = {};
+    newItem.matnr = item.mat$.matnr
+    newItem.maktx = item.mat$.maktx
+    newItem.specs = item.mat$.specs
+    newItem.batch = item.batch
+    newItem.anfme = item.anfme
+    printData.push(newItem)
+  })
+  printChild.value.printData = printData;
+  printChild.value.orderNo = record.__v_raw.orderNo
+  printChild.value.open = true;
+}
+
 const onSearch = () => {
     // console.log('search');
     getPage()
@@ -438,9 +459,12 @@
             <template #bodyCell="{ column, text, record }">
                 <template v-if="column.dataIndex === 'oper'">
                     <div style="display: flex;justify-content: space-evenly;">
-                        <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.order.orderDetl',
-                            '璁㈠崟鏄庣粏')
-                            }}</a-button>
+                      <a-button type="link" primary @click="showDetl(record)">{{ formatMessage('page.order.orderDetl',
+                          '璁㈠崟鏄庣粏')
+                        }}</a-button>
+                      <a-button type="link" primary @click="handlePrint(record)">{{ formatMessage('page.order.orderDetl',
+                          '鎵撳嵃璁㈠崟')
+                        }}</a-button>
                         <a-button type="link" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '缂栬緫')
                             }}</a-button>
                         <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '鍒犻櫎')
@@ -453,6 +477,7 @@
         <ShowOrderDetlComponent ref="showOrderDetlChild" />
 
     </div>
+  <OrderPrint ref="printChild" />
 </template>
 
 <style></style>
diff --git a/zy-asrs-admin/src/components/print/orderPrint/index.vue b/zy-asrs-admin/src/components/print/orderPrint/index.vue
new file mode 100644
index 0000000..b9f6a02
--- /dev/null
+++ b/zy-asrs-admin/src/components/print/orderPrint/index.vue
@@ -0,0 +1,56 @@
+<script setup>
+import {ref, toRaw} from 'vue';
+import { formatMessage } from '@/utils/localeUtils';
+import Template1 from './template/template1.vue';
+
+const template = {
+    Template1
+}
+
+const printChild = ref(null);
+const selectTemplate = ref('Template1');
+let open = ref(false);
+let printData = ref([]);
+let repeatNum = ref(1);
+let orderNo = ref('');
+const handleOk = () => {
+
+}
+
+const printObj = ref({
+    id: "printOrder",
+    beforeOpenCallback(vue) {
+        // console.log(toRaw(printData.value))
+    },
+    openCallback(vue) {
+        console.log('鎵ц浜嗘墦鍗�')
+    },
+    closeCallback(vue) {
+        console.log('鍏抽棴浜嗘墦鍗板伐鍏�')
+    },
+
+});
+
+defineExpose({
+    open,
+    orderNo,
+    printData
+})
+</script>
+
+<template>
+    <a-modal v-model:open="open" :title="formatMessage('', '璁㈠崟鎵撳嵃')" @ok="handleOk" :width="'60%'" v-if="open">
+        <div style="height: 500px;overflow-x: hidden;overflow-y: scroll;">
+            <div style="margin-top: 20px;">
+                <Component :is="template[selectTemplate]" ref="printChild" :list="printData" :repeatNum="repeatNum" :orderNo="orderNo" />
+            </div>
+        </div>
+        <template #footer>
+            <a-button key="submit" type="primary" v-print="printObj" @click="handleOk">
+                {{ formatMessage('common.print', '鎵撳嵃') }}
+            </a-button>
+        </template>
+    </a-modal>
+</template>
+
+<style></style>
\ No newline at end of file
diff --git a/zy-asrs-admin/src/components/print/orderPrint/template/template1.vue b/zy-asrs-admin/src/components/print/orderPrint/template/template1.vue
new file mode 100644
index 0000000..ae08ee5
--- /dev/null
+++ b/zy-asrs-admin/src/components/print/orderPrint/template/template1.vue
@@ -0,0 +1,81 @@
+<script setup>
+import {toRefs, ref, defineProps, watch} from 'vue';
+import { globalState } from '@/config.js'
+import { formatMessage } from '@/utils/localeUtils';
+
+const props = defineProps({
+  orderNo: {
+    type: String,
+    default: ''
+  },
+    list: {
+        type: Array,
+        default: []
+    },
+    repeatNum: {
+        type: Number,
+        default: 1
+    }
+});
+const { orderNo,list, repeatNum } = toRefs(props)
+
+</script>
+
+<template>
+    <div id="printOrder">
+                <div>
+                    <table class="contain" width="1200"
+                        style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
+                        <tr style="height: 100px">
+                            <td colspan="1" align="center" scope="col">璁㈠崟鍙�</td>
+                            <td colspan="2" align="center" scope="col">{{orderNo}}</td>
+                            <td class="barcode" colspan="9" align="center" scope="col">
+                                <img :src="globalState.url + '/api/code/auth?type=1&param=' + orderNo" width="70%;" />
+                                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center;">
+                                    <span>{{ orderNo }} </span>
+                                </div>
+                            </td>
+                        </tr>
+                      <tr style="height: 40px">
+                        <td align="center" colspan="1">搴忓彿</td>
+                        <td align="center" colspan="2">鍟嗗搧缂栧彿</td>
+                        <td align="center" colspan="3">鍟嗗搧鍚嶇О</td>
+                        <td align="center" colspan="2">鎵规</td>
+                        <td align="center" colspan="2">瑙勬牸</td>
+                        <td align="center" colspan="1">鏁伴噺 </td>
+                      </tr>
+                        <template v-for="(item, index) in list" :key="index">
+                        <tr style="height: 40px">
+                          <td align="center" colspan="1">{{index + 1}}</td>
+                          <td align="center" colspan="2">{{ item.matnr }}</td>
+                          <td align="center" colspan="3">{{ item.maktx }}</td>
+                          <td align="center" colspan="2">{{ item.batch }}</td>
+                          <td align="center" colspan="2">{{ item.specs }}</td>
+                          <td align="center" colspan="1">{{ item.anfme }}</td>
+                        </tr>
+                        </template>
+                    </table>
+                </div>
+    </div>
+</template>
+
+<style>
+@media print {
+    body {
+        margin: 0;
+        padding: 0;
+    }
+
+    .print-area {
+        margin: 0;
+        padding: 0;
+        height: auto;
+    }
+
+
+}
+
+.contain td {
+    border: 1px solid #000;
+}
+</style>
\ No newline at end of file
diff --git a/zy-asrs-admin/src/config.js b/zy-asrs-admin/src/config.js
index 0e963ed..3d34292 100644
--- a/zy-asrs-admin/src/config.js
+++ b/zy-asrs-admin/src/config.js
@@ -1,7 +1,7 @@
 import { reactive, inject } from 'vue';
 
 export const globalState = reactive({
-    url: 'http://127.0.0.1:8081/wms',
+    url: 'http://192.168.8.14:8081/wms',
     token: '',
     user: null,
     locale: 'zh_CN', // 榛樿璇█
diff --git a/zy-asrs-admin/src/views/log/viewWorkIn/index.vue b/zy-asrs-admin/src/views/log/viewWorkIn/index.vue
index 7f3d506..72cbfd8 100644
--- a/zy-asrs-admin/src/views/log/viewWorkIn/index.vue
+++ b/zy-asrs-admin/src/views/log/viewWorkIn/index.vue
@@ -14,6 +14,14 @@
 let currentPage = 1;
 let pageSize = 10;
 const searchInput = ref("")
+const searchParam = ref({
+  createTime: null,
+  targetLoc: null,
+  matnr: null,
+  maktx: null,
+  batch: null,
+  barcode: null,
+})
 const editChild = ref(null)
 
 const state = reactive({
@@ -102,7 +110,8 @@
     post('/api/viewWorkIn/page', {
         current: currentPage,
         pageSize: pageSize,
-        condition: searchInput.value
+        condition: searchInput.value,
+        _param: searchParam.value,
     }).then((resp) => {
         let result = resp.data;
         if (result.code == 200) {
@@ -150,7 +159,8 @@
 
 const handleExport = async (intl) => {
     postBlob('/api/viewWorkIn/export', {
-        condition: searchInput.value
+        condition: searchInput.value,
+        _param: searchParam.value,
     }).then(result => {
         const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' });
         window.location.href = window.URL.createObjectURL(blob);
@@ -183,13 +193,27 @@
 
 <template>
     <div>
-        <div class="table-header">
-            <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '璇疯緭鍏�')"
-                style="width: 200px;" @search="onSearch" />
-            <div class="table-header-right">
-                <a-button @click="handleExport">{{ formatMessage('page.export', '瀵煎嚭') }}</a-button>
-            </div>
+      <div class="table-header">
+        <div>
+          <a-input v-model:value="searchParam.createTime" :placeholder="formatMessage('page.locDetl.createTime.input', '鍏ュ簱鏃ユ湡')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input v-model:value="searchParam.targetLoc" :placeholder="formatMessage('page.locDetl.targetLoc.input', '搴撲綅鍙�')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input v-model:value="searchParam.matnr" :placeholder="formatMessage('page.locDetl.matnr.input', '鍟嗗搧缂栧彿')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input v-model:value="searchParam.maktx" :placeholder="formatMessage('page.locDetl.maktx.input', '鍟嗗搧鍚嶇О')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input v-model:value="searchParam.batch" :placeholder="formatMessage('page.locDetl.batch.input', '鎵规')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input v-model:value="searchParam.barcode" :placeholder="formatMessage('page.locDetl.barcode.input', '鏉$爜')"
+                   style="width: 140px;margin-right: 10px;"/>
+          <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '璇疯緭鍏�')"
+                          style="width: 200px;" @search="onSearch"/>
         </div>
+        <div class="table-header-right">
+          <a-button @click="handleExport">{{ formatMessage('page.export', '瀵煎嚭') }}</a-button>
+        </div>
+      </div>
         <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }"
             :data-source="tableData.records" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id"
             :pagination="{ total: tableData.total, onChange: onPageChange }"
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/ViewWorkIn.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/ViewWorkIn.java
index f1aa5c5..bb6ff80 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/ViewWorkIn.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/statistics/ViewWorkIn.java
@@ -10,4 +10,7 @@
 @TableName("view_work_in")
 public class ViewWorkIn extends TaskDetlLog {
 
+    private String maktx;
+
+    private String targetLoc;
 }
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
index 1e9d0dc..e3cc7d2 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
@@ -1,16 +1,13 @@
 package com.zy.asrs.wms.asrs.manage;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fasterxml.jackson.datatype.jsr310.DecimalUtils;
 import com.mysql.cj.util.StringUtils;
 import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wms.asrs.entity.*;
 import com.zy.asrs.wms.asrs.entity.dto.*;
-import com.zy.asrs.wms.asrs.entity.dto.OrderOutMergeDto;
 import com.zy.asrs.wms.asrs.entity.enums.*;
 import com.zy.asrs.wms.asrs.entity.param.*;
-import com.zy.asrs.wms.asrs.entity.*;
 import com.zy.asrs.wms.asrs.service.*;
 import com.zy.asrs.wms.utils.OrderUtils;
 import com.zy.asrs.wms.utils.OutUtils;
@@ -23,11 +20,9 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * 鍑哄簱绠$悊
@@ -1053,11 +1048,11 @@
         if (!flatOrders.isEmpty()) {
             //骞冲簱鍑哄簱
             outStockByFlat(flatOrders, wave);
-        }
-
-        if (!tucOrders.isEmpty()) {
+        } else if (!tucOrders.isEmpty()) {
             //CTU鍑哄簱
             outStockByTUC(tucOrders, wave);
+        } else {
+            throw new CoolException("搴撳瓨涓嶈冻");
         }
 
     }
@@ -1438,15 +1433,14 @@
                     }
 
                     CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, order.getId()));
-                    if (cacheSite == null) {
-                        throw new CoolException("缂撳瓨绔欎笉瀛樺湪");
-                    }
-                    cacheSite.setSiteStatus(CacheSiteStatusType.O.id);
-                    cacheSite.setOrderId(null);
-                    cacheSite.setOrderNo(null);
-                    cacheSite.setUpdateTime(new Date());
-                    if (!cacheSiteService.updateById(cacheSite)) {
-                        throw new CoolException("缂撳瓨绔欐竻绌哄け璐�");
+                    if (cacheSite != null) {
+                        cacheSite.setSiteStatus(CacheSiteStatusType.O.id);
+                        cacheSite.setOrderId(null);
+                        cacheSite.setOrderNo(null);
+                        cacheSite.setUpdateTime(new Date());
+                        if (!cacheSiteService.updateById(cacheSite)) {
+                            throw new CoolException("缂撳瓨绔欐竻绌哄け璐�");
+                        }
                     }
                 }
 

--
Gitblit v1.9.1