From 52b1acf9aa11e2e510f74ce801b326eb9ef2425e Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 17 四月 2024 16:26:49 +0800
Subject: [PATCH] 出库入库调拨3个模块的添加编辑增加辅助单位,辅助数量根多单位是否启用是否浮动获辅助数量是否编辑的逻辑

---
 src/views/overview/OverviewListView.vue                  |   62 +++++++---
 src/router/product/index.js                              |    9 +
 src/router/report/index.js                               |   11 +
 src/api/date.js                                          |  210 +++++++++++++++++++++++++++++++++++
 src/api/reportForm/inventoryRwport.js                    |    8 +
 src/views/productManage/product/components/bomDialog.vue |    1 
 6 files changed, 281 insertions(+), 20 deletions(-)

diff --git a/src/api/date.js b/src/api/date.js
new file mode 100644
index 0000000..c7ea884
--- /dev/null
+++ b/src/api/date.js
@@ -0,0 +1,210 @@
+export default (() => {
+  const getDateObj = ms => {
+    const now = ms ? new Date(ms) : new Date()
+    const y = now.getFullYear()
+    let m = now.getMonth() + 1
+    m = m > 9 ? m : '0' + m
+    let d = now.getDate()
+    d = d > 9 ? d : '0' + d
+    return { y, m, d }
+  }
+  // 鑾峰彇褰撳墠鏃ユ湡
+  const getCurrentDate = ms => {
+    const dateObj = getDateObj(ms)
+    return '' + dateObj.y + '-' + dateObj.m + '-' + dateObj.d
+  }
+  //鑾峰彇褰撳墠 鍓嶅悗N澶╃殑鏃堕棿
+  const getDateStr = (AddDayCount = 0) => {
+    let dd = new Date()
+    dd.setDate(dd.getDate() + AddDayCount)
+    let y = dd.getFullYear()
+    let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //鑾峰彇褰撳墠鏈堜唤鐨勬棩鏈燂紝涓嶈冻10琛�0
+    let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //鑾峰彇褰撳墠鍑犲彿锛屼笉瓒�10琛�0
+    return y + '-' + m + '-' + d
+  }
+  //鑾峰彇鏌愪釜鏃ユ湡 鍓嶅悗N澶╃殑鏃堕棿
+  const getDateDay2 = (time, AddDayCount) => {
+    if (time) {
+      let dd = new Date(time)
+      dd.setDate(dd.getDate() + AddDayCount)
+      let y = dd.getFullYear()
+      let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //鑾峰彇褰撳墠鏈堜唤鐨勬棩鏈燂紝涓嶈冻10琛�0
+      let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //鑾峰彇褰撳墠鍑犲彿锛屼笉瓒�10琛�0
+      return y + '-' + m + '-' + d
+    } else {
+      return '--'
+    }
+  }
+  //鑾峰彇褰撳墠骞翠唤
+  const getCurrentYear = ms => {
+    const dateObj = getDateObj(ms)
+    return '' + dateObj.y
+  }
+  // 鑾峰彇褰撳墠鏈堜唤
+  const getCurrentMonth = ms => {
+    const dateObj = getDateObj(ms)
+    return '' + dateObj.y + '-' + dateObj.m
+  }
+  // 鑾峰彇涓婃湀鏈堜唤
+  const getPreviousMonth = ms => {
+    const dateObj = getDateObj(ms)
+    const b = dateObj.m - 1 > 0
+    let y = b ? dateObj.y : dateObj.y - 1
+    let m = b ? dateObj.m - 1 : 12
+    m = m > 9 ? m : '0' + m
+    return '' + y + '-' + m
+  }
+  // 鑾峰彇涓嬫湀鏈堜唤
+  const getNextMonth = ms => {
+    const dateObj = getDateObj(ms)
+    const b = dateObj.m - (-1) != 13;
+    let y = b ? dateObj.y : dateObj.y + 1
+    let m = b ? dateObj.m - (-1) : 1
+    m = m > 9 ? m : '0' + m
+    return '' + y + '-' + m
+  }
+  // 鏍煎紡鍖栨椂闂� ==> yyyy-mm-dd
+  const formatDate = (value, str) => {
+    if (value) {
+      let date_arr = value.split(str)
+      let m = date_arr[1].length == 1 && date_arr[1] < 10 ? '0' + date_arr[1] : date_arr[1]
+      let d = date_arr[2].length == 1 && date_arr[2] < 10 ? '0' + date_arr[2] : date_arr[2]
+      return date_arr[0] + '-' + m + '-' + d
+    } else {
+      return '--'
+    }
+  }
+  const getK = value => {
+    if (value) {
+      let date = new Date(value)
+      return date
+    } else {
+      let v = new Date().getTime()
+      return v
+    }
+  }
+  //杞负鏃堕棿鎴�
+  const formatTime = value => {
+    if (value) {
+      let date = new Date(value)
+      return date.getTime()
+    }
+  }
+  const formatDate2 = (time, format = 'YY-MM-DD hh:mm:ss') => {
+    if (time) {
+      let date = time ? new Date(time) : new Date()
+      let year = date.getFullYear(),
+        month = date.getMonth() + 1, //鏈堜唤鏄粠0寮�濮嬬殑
+        day = date.getDate(),
+        hour = date.getHours(),
+        min = date.getMinutes(),
+        sec = date.getSeconds()
+      let preArr = Array.apply(null, Array(10)).map(function (elem, index) {
+        return '0' + index
+      }) //寮�涓暱搴︿负10鐨勬暟缁� 鏍煎紡涓� 00 01 02 03
+
+      let newTime = format
+        .replace(/YY/g, year)
+        .replace(/MM/g, preArr[month] || month)
+        .replace(/DD/g, preArr[day] || day)
+        .replace(/hh/g, preArr[hour] || hour)
+        .replace(/mm/g, preArr[min] || min)
+        .replace(/ss/g, preArr[sec] || sec)
+
+      return newTime
+    } else {
+      return '--'
+    }
+  }
+
+  const getLastDay = dateStr => {
+    dateStr = dateStr || getCurrentMonth()
+    let nextMonthMS = new Date(getNextMonth(new Date(dateStr).getTime())).getTime()
+    return getCurrentDate(new Date(nextMonthMS - 1000 * 60 * 60 * 24).getTime())
+  }
+
+  // 瀵规瘮鏃堕棿
+  const compareTime = (date1, date2) => {
+    let d1_date1 = new Date(date1),
+      d1_date2 = new Date(date2);
+    let time_span1 = d1_date1.getTime(),
+      time_span2 = d1_date2.getTime();
+    return time_span1 - time_span2;
+  }
+  //鏍煎紡yy-mm month1灏忕殑  month2澶х殑
+  const intervalMonth = (month1, month2) => {
+    let yearMonth, number;
+    let year1 = Number(getCurrentYear(month1));
+    let year2 = Number(getCurrentYear(month2));
+    if (year1 != year2) {
+      yearMonth = (year2 - year1) * 12;
+    } else {
+      yearMonth = 0;
+    }
+    let min = Number(month1.split('-')[1]);
+    let max = Number(month2.split('-')[1]);
+    if (min < max) {
+      number = max - min + yearMonth + 1
+    } else {
+      number = yearMonth - (min - max) + 1
+    }
+    return Number(number);
+  }
+  //鑾峰彇瀛e害鐨勬椂闂� val 渚嬪 yyyy,1 鏈�缁堢粨鏋�  yyyy-mm-dd,yyyy-mm-dd
+  const qurterDay = (val) => {
+    let value;
+    let num = val.split(',')[1]
+    if (num == 1) {
+      value = val.split(',')[0] + '-01-01,' + val.split(',')[0] + '-03-31'
+    } else if (num == 2) {
+      value = val.split(',')[0] + '-04-30,' + val.split(',')[0] + '-06-30'
+    } else if (num == 3) {
+      value = val.split(',')[0] + '-07-31,' + val.split(',')[0] + '-09-30'
+    } else if (num == 4) {
+      value = val.split(',')[0] + '-10-30,' + val.split(',')[0] + '-12-31'
+    }
+    return [value, num];
+  }
+  //鑾峰彇鏌愭湀鏈�鍚庝竴澶�
+  const getMonthLastDay = (dateStr) => {
+    let dateObj = getNextMonth(dateStr)
+    let date = getDateDay2(dateObj + '-01', -1)
+    return date
+  }
+  /*鑾峰彇褰撳墠鏃ユ湡*/
+  const getWeekdayTime = (value) => {
+    let d = new Date(value)
+    let week = d.getDay()
+    let weekday = ''
+    if (week == 0)
+      weekday = '鏄熸湡鏃�'
+    else if (week == 1)
+      weekday = '鏄熸湡涓�'
+    else if (week == 2)
+      weekday = '鏄熸湡浜�'
+    else if (week == 3)
+      weekday = '鏄熸湡涓�'
+    else if (week == 4)
+      weekday = '鏄熸湡鍥�'
+    else if (week == 5)
+      weekday = '鏄熸湡浜�'
+    else if (week == 6)
+      weekday = '鏄熸湡鍏�'
+    return weekday
+  }
+  //璁$畻褰撳墠鏃堕棿鍒颁粖澶╃粨鏉熸椂杩樺墿澶氬皯 姣
+  const getRestOfDayTime = () => {
+    let x = new Date();
+    x.setHours(0, 0, 0, 0);
+    let y = new Date();
+    return 24 * 3600 * 1000 - (y.getTime() - x.getTime())
+  }
+  /* 鐢ㄤ簬鏈堟棩杩欑闇�瑕佸姞鍓嶇疆0鐨勬柟娉�
+  *  @param num  闇�瑕佸姞0鐨勫弬鏁� string | number
+  *  @return 缁撴灉 濮嬬粓淇濊瘉缁撴灉涓哄瓧绗︿覆  string
+  */
+  const paddingZero = (num) => {
+    return num < 10 ? "0" + num : String(num)
+  }
+  return { paddingZero, getDateObj, getCurrentDate, getDateStr, getDateDay2, getCurrentYear, getCurrentMonth, getPreviousMonth, getNextMonth, formatDate, formatDate2, formatTime, getK, compareTime, getLastDay, intervalMonth, getMonthLastDay, qurterDay, getWeekdayTime, getRestOfDayTime }
+})()
diff --git a/src/api/reportForm/inventoryRwport.js b/src/api/reportForm/inventoryRwport.js
index fa597c3..de91f23 100644
--- a/src/api/reportForm/inventoryRwport.js
+++ b/src/api/reportForm/inventoryRwport.js
@@ -52,4 +52,12 @@
     method: "get",
     data
   })
+}
+// 鏈堝害缁熻鎶ヨ〃
+export function getmonthStats(data) {
+  return request({
+    url: "/api-wms/v1/forms/monthStats",
+    method: "post",
+    data
+  })
 }
\ No newline at end of file
diff --git a/src/router/product/index.js b/src/router/product/index.js
index ffbae30..76dfc41 100644
--- a/src/router/product/index.js
+++ b/src/router/product/index.js
@@ -3,6 +3,7 @@
 const product = (resolve) => require(["@/views/productManage/product/index"], resolve) // 浜у搧
 const inboundOutboundDetail = (resolve) => require(["@/views/reportForm/inboundOutboundDetail/index"], resolve) // 鍏ュ簱鏄庣粏鎶ヨ〃
 const outboundDetail = (resolve) => require(["@/views/reportForm/outboundDetail/index"], resolve) // 鍏ュ簱鏄庣粏鎶ヨ〃
+const monthboundDetail= (resolve) => require(["@/views/reportForm/monthboundDetail/index"], resolve) // 鏈堝害鏄庣粏鎶ヨ〃
 const productCategory = (resolve) => require(["@/views/productManage/productCategory/index"], resolve) // 浜у搧绫诲埆
 const productList = (resolve) => require(["@/views/productManage/productCategory/ProductList"], resolve) // 浜у搧绫诲埆-浜у搧
 const overviewList = (resolve) => require(["@/views/overview/OverviewListView"], resolve) // 姒傝堪-浜у搧鍒楄〃
@@ -43,6 +44,14 @@
     }
   },
   {
+    path: "/reportForm/monthboundDetail",
+    name: "monthboundDetail",
+    component: monthboundDetail,
+    meta: {
+      title: "鏈堝害缁熻鎶ヨ〃"
+    }
+  },
+  {
     path: "/productManage/productList",
     name: "productList",
     component: productList,
diff --git a/src/router/report/index.js b/src/router/report/index.js
index 668db2e..69cbfcf 100644
--- a/src/router/report/index.js
+++ b/src/router/report/index.js
@@ -3,6 +3,7 @@
 const inventoryReport = (resolve) => require(["@/views/reportForm/inventoryReport/index"], resolve) // 搴撳瓨鎶ヨ〃
 const locationReport = (resolve) => require(["@/views/reportForm/locationReport/index"], resolve) // 浣嶇疆鎶ヨ〃
 const inboundOutboundDetail = (resolve) => require(["@/views/reportForm/inboundOutboundDetail/index"], resolve) // 鍘嗗彶璁板綍
+const monthboundDetail= (resolve) => require(["@/views/reportForm/monthboundDetail/index"], resolve) // 鏈堝害鏄庣粏鎶ヨ〃
 
 const appconfig = [
   {
@@ -28,7 +29,15 @@
     meta: {
       title: "鍏ュ簱鏄庣粏鎶ヨ〃"
     }
-  }
+  },
+  {
+    path: "/reportForm/monthboundDetail",
+    name: "monthboundDetail",
+    component: monthboundDetail,
+    meta: {
+      title: "鏈堝害缁熻鎶ヨ〃"
+    }
+  },
 ]
 
 export default appconfig
diff --git a/src/views/overview/OverviewListView.vue b/src/views/overview/OverviewListView.vue
index 49354f5..177b5e5 100644
--- a/src/views/overview/OverviewListView.vue
+++ b/src/views/overview/OverviewListView.vue
@@ -120,7 +120,7 @@
       numberLabel: "鍗曞彿",
       TabsIndex: "0",
       productTableList: {},
-      showBottomCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О", "浜у搧瑙勬牸", "浜у搧鍨嬪彿", "璁¢噺鍗曚綅", "璋冨嚭浣嶇疆", "璋冨叆浣嶇疆", "鏁伴噺","涓荤","浼氳","淇濈鍛�",'杈呭姪鏁伴噺','杈呭姪鍗曚綅'],
+      showBottomCol: ["浜у搧缂栧彿", "浜у搧鍚嶇О", "浜у搧瑙勬牸", "浜у搧鍨嬪彿", "璁¢噺鍗曚綅", "璋冨嚭浣嶇疆", "璋冨叆浣嶇疆", "鏁伴噺","涓荤","浼氳","淇濈鍛�",'杈呭姪鏁伴噺','杈呭姪鍗曚綅','姣涢噸','鎬绘瘺閲�','鍑�閲�','鎬诲噣閲�'],
       tableBottomColumn: [],
       selectRow: {},
       productColumn: [
@@ -131,7 +131,11 @@
         { label: "鏁伴噺", prop: "amount" },
         { label: "璁¢噺鍗曚綅", prop: "unit" },
         { label: "杈呭姪鏁伴噺", prop: "adjunctAmount" },
-        { label: "杈呭姪鍗曚綅", prop: "adjunctUnit" }
+        { label: "杈呭姪鍗曚綅", prop: "adjunctUnit" },
+        { label: "姣涢噸", prop: "grossWeight" },
+        { label: "鎬绘瘺閲�", prop: "totalGrossWeight" },
+        { label: "鍑�閲�", prop: "netWeight" },
+        { label: "鎬诲噣閲�", prop: "totalNetWeight" }
       ],
       allotProductColumn: [
         { label: "浜у搧缂栧彿", prop: "id", default: true },
@@ -143,7 +147,11 @@
         { label: "璋冨叆浣嶇疆", prop: "toLocation" },
         { label: "鏁伴噺", prop: "amount" },
         { label: "杈呭姪鏁伴噺", prop: "adjunctAmount" },
-        { label: "杈呭姪鍗曚綅", prop: "adjunctUnit" }
+        { label: "杈呭姪鍗曚綅", prop: "adjunctUnit" },
+        { label: "姣涢噸", prop: "grossWeight" },
+        { label: "鎬绘瘺閲�", prop: "totalGrossWeight" },
+        { label: "鍑�閲�", prop: "netWeight" },
+        { label: "鎬诲噣閲�", prop: "totalNetWeight" }
       ]
     }
   },
@@ -350,27 +358,45 @@
     // bottom浜у搧淇℃伅鏁版嵁澶勭悊
     bottomProductData(arr) {
       const list = arr.details.map((item) => {
-        let adjunctUnit=''
-        let adjunctAmount=''
-        if(item.product.moreUnit&&item.product.moreUnitList){
-          let moreUnitList=item.product.moreUnitList
-          if(moreUnitList.length>0){
-            for(let j in moreUnitList){
-              if(moreUnitList[j].floating){
-                adjunctUnit=moreUnitList[j].unit
-                adjunctAmount=moreUnitList[j].amount
-              }
-            }
-          }
-        }
+        // let adjunctUnit=''
+        // let adjunctAmount=''
+        // if(item.product.moreUnit&&item.product.moreUnitList){
+        //   let moreUnitList=item.product.moreUnitList
+        //   if(moreUnitList.length>0){
+        //     let isValue=false
+        //     for(let j in moreUnitList){
+        //       if(moreUnitList[j].floating){
+        //         isValue=true;
+        //         adjunctUnit=moreUnitList[j].unit
+        //         adjunctAmount=moreUnitList[j].amount
+        //         break;
+        //       }
+        //     }
+        //     if(!isValue){
+        //       for(let j in moreUnitList){
+        //          if(moreUnitList[j].unit){
+        //           adjunctUnit=moreUnitList[j].unit
+        //           adjunctAmount=moreUnitList[j].amount
+        //           break;
+        //         }
+        //       }
+        //     }
+        //   }
+        // }
         return {
           ...item,
           productName: item.product.name,
           unit: item.product.unit,
+          model:item.product.model,
+          specs:item.product.specs,
           location: arr.location.name,
           toLocation: arr.toLocation.name,
-          adjunctUnit:adjunctUnit,
-          adjunctAmount:adjunctAmount
+          adjunctUnit:item.auxiliaryUnit,
+          adjunctAmount:item.auxiliaryAmount,
+          grossWeight:item.product.grossWeight,
+          totalGrossWeight:item.totalGrossWeight,
+          netWeight:item.product.netWeight, 
+          totalNetWeight:item.totalNetWeight,  
         }
       })
       this.productTableList.tableInfomation = list
diff --git a/src/views/productManage/product/components/bomDialog.vue b/src/views/productManage/product/components/bomDialog.vue
index faa97cd..9d34367 100644
--- a/src/views/productManage/product/components/bomDialog.vue
+++ b/src/views/productManage/product/components/bomDialog.vue
@@ -114,7 +114,6 @@
     handleAdd() {
       this.BomTableData=this.thatEditRow.BomTableData
       this.BomTableData.push({ name: "", isDefault: false });
-      debugger
       this.$nextTick(()=>{
         setTimeout(() => {
           this.$refs.unitTable.bodyWrapper.scrollTop=this.$refs.unitTable.bodyWrapper.scrollHeight

--
Gitblit v1.8.0