chenrui 11 ماه پیش
والد
کامیت
8573fc6934

+ 39 - 22
src/api/purchase.js

@@ -85,10 +85,11 @@ export const detailBaseSave = (params) => {
     }
     }
   })
   })
 }
 }
-//  优惠活动 保存
-export const promoRuleSave = (params) => {
+
+// 采购入库提交
+export const purchaseSubmit = (params) => {
   return axios({
   return axios({
-    url: '/promoRule/save',
+    url: `/purchase/submit/${params.sn}`,
     data: params,
     data: params,
     method: 'post',
     method: 'post',
     headers: {
     headers: {
@@ -96,47 +97,63 @@ export const promoRuleSave = (params) => {
     }
     }
   })
   })
 }
 }
-//  优惠活动 删除
-export const promoRuleDel = (params) => {
-  const url = `/promoRule/delete/${params.sn}`
+// 采购入库  明细详情
+export const getDetailData = (params) => {
+  const url = `/purchase/queryDetailBySn/${params.sn}`
   return axios({
   return axios({
     url: url,
     url: url,
-    method: 'get',
+    method: 'post',
     headers: {
     headers: {
-      'module': encodeURIComponent('删除')
+      'module': encodeURIComponent('明细详情')
     }
     }
   })
   })
 }
 }
-//  优惠活动 详情
-export const promoRuleDetail = (params) => {
-  const url = `/promoRule/findBySn/${params.sn}`
+
+// 采购入库 编辑页面 删除 sparePartsDetailSn
+export const purchaseDetailDel = (params) => {
+  const url = `/purchase/deleteDetail/${params.sn}`
   return axios({
   return axios({
     url: url,
     url: url,
-    method: 'get',
+    method: 'post',
     headers: {
     headers: {
-      'module': encodeURIComponent('详情')
+      'module': encodeURIComponent('删除')
     }
     }
   })
   })
 }
 }
-//  优惠活动 详情  包含规则
-export const promoRuleDetailD = (params) => {
-  const url = `/promoRule/findDetailBySn/${params.sn}`
+
+//  采购入库   解析导入的文件
+export const purchaseImportData = (params) => {
   return axios({
   return axios({
+    url: '/purchase/detail/parseProducts',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('导入和不可导入列表')
+    }
+  })
+}
+// 采购入库 导出错误项
+export const exportPurchaseData = params => {
+  const url = `/purchase/detail/downloadFailExcel`
+  return axios.request({
     url: url,
     url: url,
-    method: 'get',
+    data: params,
+    method: 'post',
+    responseType: 'blob',
     headers: {
     headers: {
-      'module': encodeURIComponent('详情')
+      'module': encodeURIComponent('导出错误项')
     }
     }
   })
   })
 }
 }
-//  促销规则  获取可导入和不可导入列表数据
-export const promoRuleGoods = (params) => {
+// 采购入库 确定要导入的数据
+
+export const purchaseImportBatchInsert = (params) => {
   return axios({
   return axios({
-    url: '/promoRule/parseGoods',
+    url: 'purchase/detail/batchInsert',
     data: params,
     data: params,
     method: 'post',
     method: 'post',
     headers: {
     headers: {
-      'module': encodeURIComponent('选择产品')
+      'module': encodeURIComponent('确定导入')
     }
     }
   })
   })
 }
 }

+ 6 - 10
src/views/purchasingManagement/purchaseReceipt/addModal.vue

@@ -82,7 +82,7 @@ import { VSelect } from '@/components'
 import debounce from 'lodash/debounce'
 import debounce from 'lodash/debounce'
 import { supplierProductList } from '@/api/supplier'
 import { supplierProductList } from '@/api/supplier'
 import { warehouseCascadeList } from '@/api/warehouse'
 import { warehouseCascadeList } from '@/api/warehouse'
-import { savePurchaseDetail } from '@/api/purchase'
+import { savePurchaseDetail, getDetailData } from '@/api/purchase'
 export default {
 export default {
   name: 'BulkWarehousingOrderBasicInfoModal',
   name: 'BulkWarehousingOrderBasicInfoModal',
   mixins: [commonMixin],
   mixins: [commonMixin],
@@ -185,14 +185,10 @@ export default {
     // 详情
     // 详情
     getDetail () {
     getDetail () {
       this.spinning = true
       this.spinning = true
-      sparePartsDetail({ sn: this.itemSn }).then(res => {
+      getDetailData({ sn: this.itemSn }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           const data = res.data
           const data = res.data
           this.form = Object.assign(this.form, data)
           this.form = Object.assign(this.form, data)
-          // this.fetchUser(this.form.productCode)
-          this.warehouseSnBackups = this.form.warehouseSn || undefined
-          this.warehouseLocationSnBackups = this.form.warehouseLocationSn || undefined
-          this.isGift = this.form.giftFlag == 1
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
@@ -207,6 +203,7 @@ export default {
           form.sparePartsSn = this.nowData.sparePartsSn
           form.sparePartsSn = this.nowData.sparePartsSn
           form.sparePartsNo = this.nowData.sparePartsNo
           form.sparePartsNo = this.nowData.sparePartsNo
           form.warehouseSn = this.nowData.warehouseSn
           form.warehouseSn = this.nowData.warehouseSn
+          form.sparePartsDetailSn = this.itemSn ? this.itemSn : undefined
           _this.spinning = true
           _this.spinning = true
           savePurchaseDetail(form).then(res => {
           savePurchaseDetail(form).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
@@ -259,13 +256,12 @@ export default {
         productName: '',
         productName: '',
         productCode: '',
         productCode: '',
         productOrigCode: '',
         productOrigCode: '',
-        warehouseSn: this.warehouseSnBackups,
-        warehouseLocationSn: this.warehouseLocationSnBackups,
+        warehouseSn: undefined,
+        warehouseLocationSn: undefined,
         productCost: '',
         productCost: '',
         productQty: ''
         productQty: ''
       }
       }
       this.productCost = ''
       this.productCost = ''
-      this.isGift = false
       this.itemSn = ''
       this.itemSn = ''
     }
     }
   },
   },
@@ -278,7 +274,7 @@ export default {
     isShow (newValue, oldValue) {
     isShow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
         this.$emit('close')
         this.$emit('close')
-        // this.resetData()
+        this.resetData()
       } else {
       } else {
         this.getWarehouseCascade()
         this.getWarehouseCascade()
       }
       }

+ 5 - 7
src/views/purchasingManagement/purchaseReceipt/chooseImportModal.vue

@@ -67,7 +67,8 @@
 
 
 <script>
 <script>
 import { hdExportExcel } from '@/libs/exportExcel'
 import { hdExportExcel } from '@/libs/exportExcel'
-import { sparePartsDetailParseProducts, sparePartsDetailFailExcel } from '@/api/spareParts'
+// 接口
+import { purchaseImportData, exportPurchaseData } from '@/api/purchase'
 export default {
 export default {
   name: 'ChooseImportModal',
   name: 'ChooseImportModal',
   props: {
   props: {
@@ -89,7 +90,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qtyText', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '数量', dataIndex: 'qtyText', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
       ],
       loadData: [],
       loadData: [],
       nowUnColumns: [
       nowUnColumns: [
@@ -111,7 +112,7 @@ export default {
         sparePartsSn: this.paramsData.sparePartsSn,
         sparePartsSn: this.paramsData.sparePartsSn,
         path: this.paramsData.path
         path: this.paramsData.path
       }
       }
-      sparePartsDetailParseProducts(params).then(res => {
+      purchaseImportData(params).then(res => {
         this.loading = false
         this.loading = false
         if (res.status == 200) {
         if (res.status == 200) {
           if (res.data.okList && res.data.okList.length > 0) {
           if (res.data.okList && res.data.okList.length > 0) {
@@ -146,10 +147,7 @@ export default {
         return
         return
       }
       }
       _this.spinning = true
       _this.spinning = true
-      const params = {
-        list: _this.unLoadData
-      }
-      hdExportExcel(sparePartsDetailFailExcel, params, '产品导入错误项', function () {
+      hdExportExcel(exportPurchaseData, _this.unLoadData, '采购产品导入错误项', function () {
         _this.spinning = false
         _this.spinning = false
       })
       })
     }
     }

+ 30 - 15
src/views/purchasingManagement/purchaseReceipt/edit.vue

@@ -128,10 +128,10 @@
       :itemSn="itemSn"
       :itemSn="itemSn"
       :openModal="openAddModal"
       :openModal="openAddModal"
       :nowData="detailsData"
       :nowData="detailsData"
-      @ok="handleOk"
+      @ok="ahandleAddOk"
       @close="openAddModal=false" />
       @close="openAddModal=false" />
     <!-- 导入弹窗 -->
     <!-- 导入弹窗 -->
-    <importGuideModal :openModal="openGuideModal" :params="{sparePartsSn: $route.params.sn}" @close="openGuideModal=false" @ok="hanldeOk" />
+    <importGuideModal :openModal="openGuideModal" :params="{sparePartsSn: $route.query.sn}" @close="openGuideModal=false" @ok="hanldleImportOk" />
     <!-- 编辑基础信息弹窗 -->
     <!-- 编辑基础信息弹窗 -->
     <basic-info-modal
     <basic-info-modal
       v-drag
       v-drag
@@ -153,7 +153,7 @@ import importGuideModal from './importGuideModal.vue'
 
 
 // 接口
 // 接口
 import { sparePartsPageCount } from '@/api/spareParts'
 import { sparePartsPageCount } from '@/api/spareParts'
-import { purchaseDetailPageList, queryDetailCount } from '@/api/purchase'
+import { purchaseDetailPageList, queryDetailCount, purchaseDetailDel, purchaseSubmit, purchaseImportBatchInsert } from '@/api/purchase'
 import { getThirdStockQty } from '@/api/salesNew'
 import { getThirdStockQty } from '@/api/salesNew'
 export default {
 export default {
   name: 'PurchaseReturnEdit',
   name: 'PurchaseReturnEdit',
@@ -239,19 +239,19 @@ export default {
             return text || '--'
             return text || '--'
           }
           }
         },
         },
-        { title: '采购数量', align: 'center', width: '13%', scopedSlots: { customRender: 'qty' } },
+        { title: '采购数量', dataIndex: 'productQty', align: 'center', width: '13%', customRender: function (text) { return text || text == 0 ? text : '--' } },
         {
         {
           title: '第三方库存',
           title: '第三方库存',
-          dataIndex: 'productQty',
+          dataIndex: 'thirdStockQty',
           align: 'center',
           align: 'center',
           width: '10%',
           width: '10%',
           customRender: function (text) {
           customRender: function (text) {
-            return text || '--'
+            return text || text == 0 ? text : '--'
           }
           }
         },
         },
         {
         {
           title: '采购单价',
           title: '采购单价',
-          dataIndex: 'cost',
+          dataIndex: 'productCost',
           width: '8%',
           width: '8%',
           align: 'right',
           align: 'right',
           customRender: function (text) {
           customRender: function (text) {
@@ -260,7 +260,7 @@ export default {
         },
         },
         {
         {
           title: '采购金额',
           title: '采购金额',
-          dataIndex: 'totalCost',
+          dataIndex: 'subtotal',
           width: '8%',
           width: '8%',
           align: 'right',
           align: 'right',
           customRender: function (text) {
           customRender: function (text) {
@@ -300,8 +300,19 @@ export default {
       }
       }
       getThirdStockQty(params).then(res => {
       getThirdStockQty(params).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
-          this.resetTable(true)
+          this.handleAddOk(true)
+        }
+      })
+    },
+    // 导入产品
+    hanldleImportOk (listCon) {
+      this.spinning = true
+      purchaseImportBatchInsert(listCon).then(res => {
+        if (res.status == 200) {
+          this.$message.success('导入成功')
+          this.handleAddOk()
         }
         }
+        this.spinning = false
       })
       })
     },
     },
     // 编辑基础信息
     // 编辑基础信息
@@ -322,6 +333,10 @@ export default {
       this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
       this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
       this.openAddModal = true
       this.openAddModal = true
     },
     },
+    handleAddOk () {
+      this.getBasicsData()
+      this.resetTable()
+    },
     // 导入产品
     // 导入产品
     handleImport () {
     handleImport () {
       this.openGuideModal = true
       this.openGuideModal = true
@@ -339,13 +354,13 @@ export default {
         onOk () {
         onOk () {
           _this.delLoading = true
           _this.delLoading = true
           _this.spinning = true
           _this.spinning = true
-          sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn })
+          purchaseDetailDel({ sn: row.sparePartsDetailSn })
             .then(res => {
             .then(res => {
               if (res.status == 200) {
               if (res.status == 200) {
                 _this.resetTable(false)
                 _this.resetTable(false)
-                _this.getStatisticsData()
-                _this.getChooseList()
-                _this.$refs.partQuery.refreshLength()
+                _this.getBasicsData()
+                // _this.getChooseList()
+                // _this.$refs.partQuery.refreshLength()
               }
               }
               _this.$message.info(res.message)
               _this.$message.info(res.message)
               _this.delLoading = false
               _this.delLoading = false
@@ -438,10 +453,10 @@ export default {
         this.$message.warning('请先添加要退货的产品!')
         this.$message.warning('请先添加要退货的产品!')
       }
       }
     },
     },
-    // 提交采购退货
+    // 提交采购入库
     handleSubmit (data) {
     handleSubmit (data) {
       this.spinning = true
       this.spinning = true
-      sparePartsReturnSubmit({ sparePartsReturnSn: this.sparePartsReturnSn, ...data }).then(res => {
+      purchaseSubmit({ sn: this.sparePartsSn }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.handleBack()
           this.handleBack()
           this.$message.success(res.message)
           this.$message.success(res.message)

+ 3 - 3
src/views/purchasingManagement/purchaseReceipt/importGuideModal.vue

@@ -113,9 +113,9 @@ export default {
       }
       }
     },
     },
     // 导入
     // 导入
-    hanldeOk (obj) {
-      if (obj && obj.length > 0) {
-        this.$emit('ok', obj)
+    hanldeOk (list) {
+      if (list && list.length > 0) {
+        this.$emit('ok', list)
         this.isShow = false
         this.isShow = false
       }
       }
     },
     },