Bläddra i källkod

货位产品导入

lilei 2 år sedan
förälder
incheckning
455f6df2d9

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1661158356824
+  "version": 1661219082915
 }

+ 25 - 0
src/api/shelf.js

@@ -66,6 +66,23 @@ export const shelfProductParseProducts = params => {
     data: params,
     method: 'post'
   })
+}
+ // POST 解析货位的导入模板
+export const shelfPlaceReadExcel = params => {
+  return axios({
+    url: '/shelf/place/readExcel',
+    data: params,
+    method: 'post'
+  })
+}
+// POST 导出错误项
+export const shelfPlaceFailExcel = params => {
+  return axios({
+    url: '/shelf/place/downloadFailExcel',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
 }
 // 货架  货位产品  批量插入
 export const shelfProductBatchInsert = params => {
@@ -75,6 +92,14 @@ export const shelfProductBatchInsert = params => {
     method: 'post'
   })
 }
+// 批量保存货位
+export const shelfSaveBatchExcel = params => {
+  return axios({
+    url: '/shelf/place/saveBatchExcel',
+    data: params,
+    method: 'post'
+  })
+}
 // 货架 箭冠产品  分页
 export const shelfDealerProductList = (params) => {
   const url = `/product/queryPageForXPRH/${params.pageNo}/${params.pageSize}`

+ 4 - 4
src/libs/exportExcel.js

@@ -8,7 +8,7 @@ import moment from 'moment'
   *fileName: 导出文件名称
   *callback: 回调函数
 */
-export const hdExportExcel = function (url, params, fileName, callback) {
+export const hdExportExcel = function (url, params, fileName, callback, showDate) {
   url(params).then(res => {
     if (res.type == 'application/json') {
       var reader = new FileReader()
@@ -23,16 +23,16 @@ export const hdExportExcel = function (url, params, fileName, callback) {
       })
       reader.readAsText(res)
     } else {
-      downloadExcel(res, fileName)
+      downloadExcel(res, fileName, showDate)
     }
     callback()
   })
 }
 // 导出下载excel
-export const downloadExcel = function (data, fileName) {
+export const downloadExcel = function (data, fileName, showDate) {
   if (!data) { return }
   const a = moment().format('YYYYMMDDHHmmss')
-  const fname = fileName + a
+  const fname = !showDate ? (fileName + a) : fileName
   const blob = new Blob([data], { type: 'application/vnd.ms-excel' })
   if (window.navigator && window.navigator.msSaveOrOpenBlob) {
     navigator.msSaveBlob(blob, fname + '.xlsx')

+ 39 - 10
src/views/numsGoodsShelves/shelfSet/chooseShelfImportModal.vue

@@ -4,7 +4,7 @@
     class="chooseImport-modal"
     :footer="null"
     :maskClosable="false"
-    title="确认导入"
+    title="确认导入货位"
     v-model="isShow"
     @cancle="isShow=false"
     :width="900">
@@ -53,14 +53,21 @@
           class="button-cancel"
           @click="isShow=false"
           style="padding: 0 40px;margin-left: 15px;">取消</a-button>
+        <a-button
+          type="primary"
+          id="chooseImport-error"
+          size="large"
+          class="button-error"
+          @click="handleError"
+          style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
       </div>
     </div>
   </a-modal>
 </template>
 
 <script>
-// import { hdExportExcel } from '@/libs/exportExcel'
-import { saveBatchExcel, exportExcelData } from '@/api/shelf'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { shelfPlaceReadExcel, shelfSaveBatchExcel, shelfPlaceFailExcel } from '@/api/shelf'
 export default {
   name: 'ChooseImportModal',
   props: {
@@ -79,14 +86,24 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       nowColumns: [
-        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '90%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '45%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '结算价', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最大库容', dataIndex: 'maxQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
       loadData: [],
       nowUnColumns: [
-        { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '40%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '错误原因', dataIndex: 'remarks', width: '50%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '结算价', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最大库容', dataIndex: 'maxQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '错误原因', dataIndex: 'remarks', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       unLoadData: [],
       loading: false
@@ -100,7 +117,7 @@ export default {
         shelfSn: this.paramsData.shelfSn,
         path: this.paramsData.path
       }
-      exportExcelData(params).then(res => {
+      shelfPlaceReadExcel(params).then(res => {
         this.loading = false
         if (res.status == 200) {
           if (res.data.successList && res.data.successList.length > 0) {
@@ -123,13 +140,25 @@ export default {
       if (this.loadData.length == 0) {
         this.$message.warning('无可导入产品!')
       } else {
-        saveBatchExcel(this.loadData).then(res => {
+        shelfSaveBatchExcel(this.loadData).then(res => {
           if (res.status == 200) {
             this.$emit('ok', this.loadData)
             this.isShow = false
           }
         })
       }
+    },
+    // 导出
+    handleError () {
+      const _this = this
+      if (_this.unLoadData.length < 1) {
+        _this.$message.info('暂无可导出错误项~')
+        return
+      }
+      _this.spinning = true
+      hdExportExcel(shelfPlaceFailExcel, _this.unLoadData, '货位绑定产品错误项导出', function () {
+        _this.spinning = false
+      }, true)
     }
   },
   watch: {

+ 5 - 3
src/views/numsGoodsShelves/shelfSet/importHuoweiModal.vue

@@ -24,8 +24,10 @@
             <span>2</span>准备导入数据
           </div>
           <ul>
-            <li>1) 导入的Excel文件中必须包含名为“货位号”的列,且名称必须相同</li>
-            <li>2) 除了“货位号”一列,其他列可自定义,不影响数据导入</li>
+            <li>1) 导入的Excel文件中必须包含名为“货位号”、“产品编码”、“销售价”、“结算价”、“最大库容”的列,且名称必须相同,其他列可自定义,不影响数据导入。</li>
+            <li>2) 如果“产品编码”列为空,则表示此货位暂时不绑定产品,也可以正常导入货位。</li>
+            <li>3) 当“销售价”和“结算价”都为空,系统会自动取该产品的车主价和终端会员价,作为销售价和结算价。</li>
+            <li>4) 如果货位已经绑定产品,则不会导入该行。</li>
           </ul>
 
         </div>
@@ -90,7 +92,7 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
-      filePath: 'https://jianguan-images.oss-cn-beijing.aliyuncs.com/template/goodsAllocationTempl.xlsx', // 文件地址
+      filePath: 'https://jianguan-images.oss-cn-beijing.aliyuncs.com/template/importProductToShelfTpl.xlsx', // 文件地址
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
       paramsData: null,
       uploadParams: {

+ 2 - 2
src/views/purchasingManagement/purchaseReturnApplyForm/chooseImportModal.vue

@@ -154,9 +154,9 @@ export default {
         return
       }
       _this.spinning = true
-      hdExportExcel(exportErrorExcel, _this.unLoadData, '采购退货申请单导出错误项', function () {
+      hdExportExcel(exportErrorExcel, _this.unLoadData, '采购退货申请单错误项导出', function () {
         _this.spinning = false
-      })
+      }, true)
     }
   },
   watch: {