lilei hace 4 años
padre
commit
02a66cfe74

+ 9 - 0
src/api/purchaseDetail.js

@@ -42,4 +42,13 @@ export const purchaseDetailCount = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+//  采购入库 修改仓库仓位
+export const purchaseUpdateWarehouse = (params) => {
+  return axios({
+    url: `/purchaseDetail/updateWarehouse`,
+    data: params,
+    method: 'post'
+  })
 }

+ 1 - 1
src/config/router.config.js

@@ -394,7 +394,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'warehousing/:id',
+                path: 'warehousing/:sn',
                 name: 'purchaseOrderWarehousing',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseOrder/warehousing.vue'),
                 meta: {

+ 1 - 1
src/views/purchasingManagement/purchaseOrder/list.vue

@@ -133,7 +133,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { purchaseList, purchaseDel, purchaseWriteStockIn, purchaseCount } from '@/api/purchase'
+import { purchaseList, purchaseDel, purchaseCount } from '@/api/purchase'
 import { supplierAllList } from '@/api/supplier'
 import moment from 'moment'
 export default {

+ 24 - 11
src/views/purchasingManagement/purchaseOrder/warehousing.vue

@@ -57,8 +57,9 @@
             expand-trigger="hover"
             :options="warehouseCascadeData"
             :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
-            id="bulkWarehousingOrderEdit-warehouseCascade"
+            id="purchaseOrderWarehousing-warehouseCascade"
             placeholder="请选择仓库仓位"
+            :allowClear="false"
             style="width: 100%;" />
         </template>
       </s-table>
@@ -73,8 +74,8 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { purchaseDetailBySn } from '@/api/purchase'
-import { purchaseDetailList, updateWarehouse } from '@/api/purchaseDetail'
+import { purchaseDetailBySn, purchaseWriteStockIn } from '@/api/purchase'
+import { purchaseDetailList, purchaseUpdateWarehouse } from '@/api/purchaseDetail'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import { warehouseCascadeList } from '@/api/warehouse'
@@ -96,7 +97,7 @@ export default {
       warehouseCascadeData: [], //  仓库仓位
       // 表头
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
@@ -104,9 +105,9 @@ export default {
         { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
         { title: '缺货数量', dataIndex: 'oosQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
-        { title: '入库数量', dataIndex: 'putQty', width: 100, align: 'center' },
-        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 300, align: 'center' }
+        { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) }, fixed: 'right' },
+        { title: '入库数量', dataIndex: 'putQty', width: 100, align: 'center', fixed: 'right' },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 250, align: 'center', fixed: 'right' }
       ],
       chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
@@ -156,7 +157,12 @@ export default {
     },
     //  确认入库
     handleWarehousing () {
-
+      purchaseWriteStockIn({ id: this.detail.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.info(res.message)
+          this.handleBack()
+        }
+      })
     },
     //  返回列表
     handleBack () {
@@ -191,7 +197,7 @@ export default {
     changeWarehouseCascade (val, opt, ind) {
       console.log(val, opt, ind)
       let loadData = this.chooseLoadData[ind]
-      if (val.length < 2) {
+      if (val.length == 1) {
         this.$message.warning('当前仓库无仓位,请选择其他仓库')
         const warehouseSnBackups = loadData.warehouseSnBackups || undefined
         const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
@@ -213,8 +219,15 @@ export default {
     },
     // 修改库存
     updateWarehouse (row) {
-      updateWarehouse({ warehouseSn: row.warehouseSn, warehouseLocationSn: row.warehouseLocationSn }).then(res => {
-
+      purchaseUpdateWarehouse({
+        id: row.id,
+        warehouseSn: row.warehouseSn,
+        warehouseLocationSn: row.warehouseLocationSn
+      }).then(res => {
+        if (res.status == 200) {
+          this.$message.info(res.message)
+          this.$refs.table.refresh()
+        }
       })
     }
   },