From e9c696914911ef12fa9313c5ef89a2ff62a4e23a Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期三, 16 七月 2025 12:28:18 +0800
Subject: [PATCH] 送货单添加

---
 north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml           |   36 +++---
 north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheetLuoyang.vue |  272 +++++++++++++++++++++++++++++++++-----------
 north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue         |    4 
 3 files changed, 221 insertions(+), 91 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheetLuoyang.vue b/north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheetLuoyang.vue
index e5886cf..ca37945 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheetLuoyang.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/delivery/PrintSheetLuoyang.vue
@@ -5,7 +5,7 @@
 import companyInfo from "@/stores/sd/companyInfo"
 import deepClone from "@/utils/deepClone";
 import {ElMessage} from "element-plus";
-import {add,multiply,multiplyAuto,divideAuto} from '@/utils/decimal';
+import {add,addAuto} from '@/utils/decimal';
 
 const company = companyInfo()
 let produceList = ref([])
@@ -29,11 +29,14 @@
 let produceList2 = ref([])
 
 
+const deliveryId = ref()
 
+const pageData = ref()
 const getData = () => {
   if(props.deliveryId===null  || props.deliveryId===undefined || props.deliveryId===''){
     return
   }
+  deliveryId.value = props.deliveryId[0].deliveryId
   form.value.deliveryId=props.deliveryId
   form.value.type=company.productName
   form.value.state=props.type
@@ -41,15 +44,13 @@
 
   request.post(`/delivery/getSelectDeliveryPrinting`,form.value).then((res) => {
     if(res.code==200){
-      console.log(res.data)
       produceList.value = deepClone(res.data)
       for(let i=0;i<produceList.value.length;i++){
         produceList.value[i].data.forEach(item =>{
+          let para =
           item.DeliveryDetail.orderId=
-              takeCare.value+
-              item.DeliveryDetail.orderDetail.edgingType
-              +'\n'
-              +item.DeliveryDetail.orderDetail.shape || ''
+              `${takeCare.value}\n${item.DeliveryDetail.orderDetail.edgingType || item.DeliveryDetail.orderDetail.shape}`
+
         })
         let produceList1= ({
           data:null,
@@ -108,6 +109,12 @@
         }
 
       }
+      //缁欐暟鎹繘琛屽垎椤�
+      pageData.value = groupArrayByFive(produceList2.value[0].data)
+      delivery.value = produceList2.value[0].delivery
+      console.log(delivery.value)
+
+
 
     }else{
       ElMessage.warning(res.msg)
@@ -116,7 +123,20 @@
   })
 }
 
+function groupArrayByFive(arr) {
+  let result = [];
+  for (let i = 0; i < arr.length; i += 4) {
+    result.push(arr.slice(i, i + 4));
+  }
+  return result;
+}
+let deliveryDate = ref()
 onMounted(() => {
+  const today = new Date
+  today.setTime(today.getTime())
+  deliveryDate.value = today.getFullYear() +
+      '-' + ("0" + (today.getMonth() + 1)).slice(-2)
+      + '-' + ("0" + today.getDate()).slice(-2)
   getData()
 })
 
@@ -154,8 +174,33 @@
 
 const printSheet = () => {
 }
+let companyName = ref('娲涢槼鐜荤拑鍏徃')
 
-
+const getQuantitySum = (page)=>{
+  console.log(page)
+  if(pageData.value[page] === undefined){
+    return  0
+  }
+  return pageData.value[page].reduce((accumulator, currentValue) => {
+    return addAuto(accumulator,currentValue.DeliveryDetail.quantity,2)
+  }, 0)
+}
+const getAreaSum = (page)=>{
+  if(pageData.value[page] === undefined){
+    return  0
+  }
+  return pageData.value[page].reduce((accumulator, currentValue) => {
+    return addAuto(accumulator,currentValue.DeliveryDetail.area,2)
+  }, 0)
+}
+const getMoneySum = (page)=>{
+  if(pageData.value[page] === undefined){
+    return  0
+  }
+  return pageData.value[page].reduce((accumulator, currentValue) => {
+    return addAuto(accumulator,currentValue.DeliveryDetail.money,2)
+  }, 0)
+}
 
 
 defineExpose({
@@ -164,59 +209,119 @@
 </script>
 
 <template>
-  <div id="sheet">
-    <div class="pages" v-for="(item, index) in produceList2" :key="index">
+  <div >
+    <el-row id="footsum" :gutter="20" >
+      <el-col :span="20"></el-col>
+      <el-col :span="4" style="font-weight: bolder;font-size: 17px" >{{delivery.creator}}</el-col>
+    </el-row>
+    <el-row id="footsum1" :gutter="20" >
+      <el-col :span="2" ></el-col>
+      <el-col :span="5" style="font-weight: bolder;font-size: 17px">{{ delivery.contacts }}</el-col>
+      <el-col :span="5" style="font-weight: bolder;font-size: 17px">{{ delivery.contactNumber }}</el-col>
+      <el-col :span="1" ></el-col>
+      <el-col :span="11" style="font-weight: bolder;font-size: 17px">{{ delivery.deliveryAddress }}</el-col>
+    </el-row>
+
+    <table  class="content1" v-for="(page,pageIndex) in pageData" >
+      <thead>
+        <tr style="height: 3.2cm"><td></td></tr>
+
+        <tr>
+          <td colspan="6" >
+            <el-row :gutter="20">
+              <el-col :span="2"></el-col>
+              <el-col :span="9">
+                <input v-model="companyName" style="border: 0;width: 100%;height: 100%;font-size:19px;font-weight: bolder "/>
+              </el-col>
+              <el-col :span="5" style="font-weight: bolder;font-size: 17px"> {{deliveryId}} </el-col>
+              <el-col :span="5"></el-col>
+              <el-col :span="3" style="white-space: nowrap;">{{deliveryDate}}</el-col>
+            </el-row>
+          </td>
+        </tr>
+        <tr style="height: 0.5cm"><td></td></tr>
+
+        <tr style="margin-top: 20px">
+          <td colspan="6">
+            <el-row :gutter="20">
+              <el-col :span="3"></el-col>
+              <el-col :span="9" style="font-size: 21px;font-weight: bold">{{delivery.customerName }}</el-col>
+              <el-col :span="3"> </el-col>
+              <el-col :span="9" style="font-size: 21px;font-weight: bold;white-space: nowrap;"> {{delivery.project }}</el-col>
+            </el-row>
+          </td>
+        </tr>
+        <tr style="height: 0.4cm"><td></td></tr>
+        <tr>
+          <td colspan="6">
+            <el-row :gutter="20">
+              <el-col :span="2"></el-col>
+              <el-col :span="12" style="font-size: 17px"> {{delivery.orderId }}</el-col>
+            </el-row>
+          </td>
+        </tr>
+
+        <tr style="height: 0.2cm"><td></td></tr>
 
 
-    <div id="header">
-      <div id="header-pane">
-        <div>娲涢槼鐜荤拑鍏徃</div>
-        <div style="margin: auto;">{{item.delivery.deliveryId}}</div>
-        <div>{{item.delivery.deliveryDate }}</div>
-      </div>
 
-      <div id="header-customer" style="display: flex;height: 50px;line-height: 50px">
-        <div>{{item.delivery.customerName }}</div>
-        <div style="margin-left: 60%;">{{item.delivery.project }}</div>
-      </div>
+      </thead>
+      <tbody  >
+        <tr v-for="(item,index) in page">
+          <td style="width: 5cm">
+            <el-input  class="textarea" type="textarea"
+                       style="font-weight: bolder;"
+                       :autosize="{ minRows: 1, maxRows: 20 }"
+                       v-model="item.DeliveryDetail.orderDetail.productName" />
+          </td>
+          <td style="width: 0.8cm"></td>
 
-      <div id="header-order-id" style="height: 50px;line-height: 50px">
-        <div>{{item.delivery.orderId }}</div>
-      </div>
-    </div>
+          <td style="width: 5cm">
+            <el-input  class="textarea" type="textarea"
+                       style="font-weight: bolder;"
+                       :autosize="{ minRows: 1, maxRows: 20 }"
+                       v-model="item.DeliveryDetail.orderId" />
 
-    <div id="content">
-      <div style="display:flex;margin-top: 20px" id="content-pane" v-for="(items, index) in item.data" :key="index">
-        <div style="width: 200px;">
-          <el-input  class="textarea" type="textarea" :autosize="{ minRows: 2, maxRows: 20 }" v-model="items.DeliveryDetail.orderDetail.productName" />
-        </div>
-        <div style="width: 200px">
-          <el-input  class="textarea" type="textarea" :autosize="{ minRows: 2, maxRows: 20 }" v-model="items.DeliveryDetail.orderId" />
-        </div>
-        <div style="width: 70px">{{items.DeliveryDetail.quantity}}</div>
-        <div style="width: 70px">{{items.DeliveryDetail.area}}</div>
-        <div style="width: 70px" v-if="props.type===1">{{items.DeliveryDetail.price}}</div>
-        <div style="width: 70px" v-if="props.type===1">{{items.DeliveryDetail.money}}</div>
-      </div>
-      <div style="display:flex;height: 50px" id="content-total">
-        <div style="width: 200px;"></div>
-        <div style="width: 200px"></div>
-        <div style="width: 70px">{{item.delivery.quantity}}</div>
-        <div style="width: 70px">{{item.delivery.area}}</div>
-        <div style="width: 70px"></div>
-        <div style="width: 70px" v-if="props.type===1">{{item.delivery.money }}</div>
-      </div>
-      <div style="height: 70px" id="content-name">
-        <div style="margin-left: 610px">{{item.delivery.creator }}</div>
-      </div>
-      <div style="display:flex;" id="content-customer">
-        <div style="margin-left: 80px">{{item.delivery.contacts}}&nbsp;{{item.delivery.contactNumber }}</div>
-        <div style="margin-left: 200px">{{item.delivery.deliveryAddress}}</div>
-      </div>
+          </td>
+          <td style="width: 60px">
+            {{item.DeliveryDetail.quantity}}
+          </td>
+          <td style="width: 100px">
+            {{item.DeliveryDetail.area}}
+          </td>
 
-    </div>
+          <td
+              v-if="props.type===1"
+              style="width: 80px"
+          >
+            {{item.DeliveryDetail.price}}
+          </td>
+          <td
+              v-if="props.type===1"
+          >
+            {{item.DeliveryDetail.money}}
+          </td>
+        </tr>
 
-  </div>
+        <tr>
+          <td></td>
+          <td></td>
+          <td></td>
+          <td>
+            {{getQuantitySum(pageIndex)}}
+          </td>
+          <td>
+            {{getAreaSum(pageIndex)}}
+          </td>
+          <td></td>
+          <td v-if="props.type===1">
+            {{getMoneySum(pageIndex)}}
+          </td>
+        </tr>
+      </tbody>
+    </table>
+
+
   </div>
 
 
@@ -226,30 +331,46 @@
 
 
 <style scoped>
+#sheet{
+  width: 21cm;
+}
+table{
+  width: 21cm
 
+}
+.content1{
+  page-break-after: always;
 
+}
+span{
+  width: 7cm;
+  text-align: center;
+}
+tbody *{
+  font-size: 16px;  font-weight: bolder;
+}
+tbody *{
+  font-size: 16px;  font-weight: bolder;
+}
+#footsum1,#footsum{
+  font-weight: bolder;font-size: 17px;
+}
 
 @media print {
-  @page {
-    margin: 12mm 10mm 20mm 10mm !important;
-  }
-  .pages {
-    page-break-after: always;
-  }
-  @page {
-    @top-right {
-      margin-top: 50px;
-      content: ""; /* 浣跨敤counter娣诲姞椤电爜 */
-    }
-  }
+  #footsum{
+    position: fixed;
+    bottom: 4.2cm;
+    width: 100%; /* 鎴栬�呰缃垚鍏蜂綋鐨勫搴� */
+    font-size: 17px;
 
+  }
+  #footsum1{
+    position: fixed;
+    bottom: 2cm;
+    width: 100%; /* 鎴栬�呰缃垚鍏蜂綋鐨勫搴� */
+  }
 }
-#header-pane{
-  display: flex;
-  width: 100%;
-  height: 90px;
-  line-height: 90px;
-}
+
 .textarea{
 --el-border-color: rgba(255,255,255,0.0);
 --el-input-focus-border-color: rgba(255,255,255,0.0);
@@ -257,6 +378,15 @@
 --el-input-hover-border-color: rgba(255,255,255,0.0);
 --el-input-hover-border-width: 0px;
 }
+textarea {
+
+  font-size: 16px;
+  border:none;
+  text-align: right;
+  font-weight: bolder;
+  width: 100%;
+  height: 100%;
+}
 
 
 
diff --git a/north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue b/north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue
index 0b7d410..5f32f1c 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/delivery/SelectDelivery.vue
@@ -584,8 +584,8 @@
       </template>
       <print-sheet1 id="child"  v-if="sheetIndex===1" :deliveryId="flowData.delivery" />
       <print-sheet2 id="child"  v-if="sheetIndex===2" :deliveryId="flowData.delivery" />
-      <print-sheet-luoyang id="child"  v-if="sheetIndex===3" :deliveryId="flowData.delivery" :type=1 />
-      <print-sheet-luoyang id="child"  v-if="sheetIndex===4" :deliveryId="flowData.delivery" :type=2 />
+      <print-sheet-luoyang id="child"  v-if="sheetIndex===3" :deliveryId="flowData.delivery" :type="1" />
+      <print-sheet-luoyang id="child"  v-if="sheetIndex===4" :deliveryId="flowData.delivery" :type="2" />
 
     </el-dialog>
   </div>
diff --git a/north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml
index 996780b..d2c8b57 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml
@@ -1047,23 +1047,23 @@
                                    CASE
 
                                        WHEN width &lt; 4000 AND width >= 3660 and width>height THEN
-                                           '3660&lt;W&lt;4000'
+                                           '3660&lt;H&lt;4000'
                                        WHEN width &lt; 5000 AND width >= 4000 and width>height THEN
-                                           '4000&lt;W&lt;5000'
+                                           '4000&lt;H&lt;5000'
                                        WHEN width &lt; 6000 AND width >= 5000 and width>height THEN
-                                           '5000&lt;W&lt;6000'
+                                           '5000&lt;H&lt;6000'
                                        WHEN width &lt; 7000 AND width >= 6000 and width>height THEN
-                                           '6000&lt;W&lt;7000'
+                                           '6000&lt;H&lt;7000'
                                        WHEN width &lt; 8000 AND width >= 7000 and width>height THEN
-                                           '7000&lt;W&lt;8000'
+                                           '7000&lt;H&lt;8000'
                                        WHEN width &lt; 9000 AND width >= 8000 and width>height THEN
-                                           '8000&lt;W&lt;9000'
+                                           '8000&lt;H&lt;9000'
                                        WHEN width &lt; 10000 AND width >= 9000 and width>height THEN
-                                           '9000&lt;W&lt;10000'
+                                           '9000&lt;H&lt;10000'
                                        WHEN width &lt; 11000 AND width >= 10000 and width>height THEN
-                                           '10000&lt;W&lt;11000'
+                                           '10000&lt;H&lt;11000'
                                        WHEN width &lt; 12000 AND width >= 11000 and width>height THEN
-                                           '11000&lt;W&lt;12000'
+                                           '11000&lt;H&lt;12000'
                                        ELSE
                                            ''
                                        END width
@@ -1116,23 +1116,23 @@
                                    CASE
 
                                        WHEN width &lt; 4000 AND width >= 3660 and width>height THEN
-                                           '3660&lt;W&lt;4000'
+                                           '3660&lt;H&lt;4000'
                                        WHEN width &lt; 5000 AND width >= 4000 and width>height THEN
-                                           '4000&lt;W&lt;5000'
+                                           '4000&lt;H&lt;5000'
                                        WHEN width &lt; 6000 AND width >= 5000 and width>height THEN
-                                           '5000&lt;W&lt;6000'
+                                           '5000&lt;H&lt;6000'
                                        WHEN width &lt; 7000 AND width >= 6000 and width>height THEN
-                                           '6000&lt;W&lt;7000'
+                                           '6000&lt;H&lt;7000'
                                        WHEN width &lt; 8000 AND width >= 7000 and width>height THEN
-                                           '7000&lt;W&lt;8000'
+                                           '7000&lt;H&lt;8000'
                                        WHEN width &lt; 9000 AND width >= 8000 and width>height THEN
-                                           '8000&lt;W&lt;9000'
+                                           '8000&lt;H&lt;9000'
                                        WHEN width &lt; 10000 AND width >= 9000 and width>height THEN
-                                           '9000&lt;W&lt;10000'
+                                           '9000&lt;H&lt;10000'
                                        WHEN width &lt; 11000 AND width >= 10000 and width>height THEN
-                                           '10000&lt;W&lt;11000'
+                                           '10000&lt;H&lt;11000'
                                        WHEN width &lt; 12000 AND width >= 11000 and width>height THEN
-                                           '11000&lt;W&lt;12000'
+                                           '11000&lt;H&lt;12000'
                                        ELSE
                                            ''
                                        END width

--
Gitblit v1.8.0