Explorar el Código

盘点-重盘

chenrui hace 3 años
padre
commit
c1a8f4f5d7

+ 8 - 0
src/api/checkWarehouse.js

@@ -136,6 +136,14 @@ export const checkWarehouseInventory = (params) => {
     method: 'post'
   })
 }
+//  库存盘点  重盘
+export const checkWarehouseReInventory = (params) => {
+  return axios({
+    url: '/checkWarehouse/reInventory',
+    data: params,
+    method: 'post'
+  })
+}
 //  库存盘点  财务审核
 export const checkWarehouseFinanceAudit = (params) => {
   return axios({

+ 13 - 1
src/libs/tools.js

@@ -213,7 +213,19 @@ export const numberToFixed = function (val, num) {
   else _value = _value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
 
   return _value
-}// 只能输入数字
+}
+// 保留两位小数(不四舍五入)
+export const formatDecimal = function (num, decimal) {
+  num = num.toString()
+  const index = num.indexOf('.')
+  if (index !== -1) {
+    num = num.substring(0, decimal + index + 1)
+  } else {
+    num = num.substring(0)
+  }
+  return parseFloat(num).toFixed(decimal)
+}
+// 只能输入数字
 export const justNumber = function (val) {
   let _value = val + ''
   _value = _value.replace(/\D/g, '')

+ 26 - 9
src/views/financialManagement/inventoryCheckAudit/list.vue

@@ -56,12 +56,12 @@
             id="warehousingAudit-adopt-btn">通过</a-button>
           <a-button
             size="small"
-            v-if="record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit')"
             type="link"
+            v-if="record.state == 'WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckingAgain')"
             class="button-warning"
-            @click="handleExamine(record, false)"
-            id="warehousingAudit-unadopt-btn">不通过</a-button>
-          <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && $hasPermissions('B_inventoryCheckAuditAudit'))">--</span>
+            @click="handleAgain(record)"
+          >重盘</a-button>
+          <span v-if="!(record.state=='WAIT_FINANCE_AUDIT' && ($hasPermissions('B_inventoryCheckAuditAudit') || $hasPermissions('B_inventoryCheckingAgain')))">--</span>
         </template>
       </s-table>
     </a-spin>
@@ -74,7 +74,7 @@
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import inventoryCheckingDetailModal from '@/views/inventoryManagement/inventoryChecking/detailModal.vue'
-import { checkWarehouseAuditList, checkWarehouseFinanceAudit } from '@/api/checkWarehouse'
+import { checkWarehouseAuditList, checkWarehouseFinanceAudit, checkWarehouseReInventory } from '@/api/checkWarehouse'
 export default {
   components: { STable, VSelect, rangeDate, inventoryCheckingDetailModal },
   data () {
@@ -91,16 +91,16 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '17%', align: 'center' },
+        { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
         { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总成本', dataIndex: 'totalStockCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '总成本', dataIndex: 'totalStockCost', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '盘盈数量', dataIndex: 'totalProfitQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '盘亏数量', scopedSlots: { customRender: 'totalLossQty' }, width: '7%', align: 'center' },
         { title: '盘点完成时间', dataIndex: 'checkTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '财务审核时间', dataIndex: 'financeAuditTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '财务审核状态', dataIndex: 'stateDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '11%', align: 'center' }
+        { title: '财务审核状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -159,6 +159,23 @@ export default {
         }
       })
     },
+    // 重盘
+    handleAgain (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '重新盘点后,盘点单状态回退到待提交。确认重新盘点吗?',
+        centered: true,
+        onOk () {
+          checkWarehouseReInventory({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    },
     //  重置
     resetSearchForm () {
       this.$refs.rangeDate.resetDate()

+ 17 - 9
src/views/inventoryManagement/inventoryChecking/detailModal.vue

@@ -34,8 +34,8 @@
             :disabled="localDataSource.length==0"
             @click="handlePrint('export')">导出Excel</a-button>
         </div>
-        <a-descriptions size="small" :column="3">
-          <a-descriptions-item label="盘点单号" :span="3">
+        <a-descriptions size="small" :column="2">
+          <a-descriptions-item label="盘点单号" :span="2">
             {{ (basicInfoData&&basicInfoData.checkWarehouseNo) || '--' }}
             <div style="display: inline-block;margin-left: 10px;">
               <a-tag color="red" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
@@ -43,7 +43,7 @@
           </a-descriptions-item>
           <a-descriptions-item label="盘点类型">{{ (basicInfoData&&basicInfoData.checkTypeDictValue) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="是否区分仓库" v-if="basicInfoData&&basicInfoData.checkType=='SELECT'">{{ (basicInfoData&&basicInfoData.warehouseFlagDictValue) || '--' }}</a-descriptions-item>
-          <a-descriptions-item label="盘点仓库" v-if="basicInfoData&&basicInfoData.warehouseFlag=='1'" :span="3">{{ (basicInfoData&&basicInfoData.warehouseNameList) || '--' }}</a-descriptions-item>
+          <a-descriptions-item label="盘点仓库" v-if="basicInfoData&&basicInfoData.warehouseFlag=='1'" :span="2">{{ (basicInfoData&&basicInfoData.warehouseNameList) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="创建人">{{ (basicInfoData&&basicInfoData.creatorName) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="创建时间">{{ (basicInfoData&&basicInfoData.createDate) || '--' }}</a-descriptions-item>
           <a-descriptions-item label="审核时间">{{ (basicInfoData&&basicInfoData.checkSuperviseTime) || '--' }}</a-descriptions-item>
@@ -139,6 +139,10 @@
           <template slot="checkProfitLossQty" slot-scope="text, record">
             <span :style="{ color: record.checkProfitLossQty>0?'red':record.checkProfitLossQty<0?'green':'', fontWeight: record.checkProfitLossQty!=0?'bold':'' }">{{ (record.checkProfitLossQty || record.checkProfitLossQty==0) ? Math.abs(record.checkProfitLossQty) : '--' }}</span>
           </template>
+          <!-- 盈亏成本 -->
+          <template slot="checkProfitLossCost" slot-scope="text, record">
+            <span :style="{ color: record.checkProfitLossCost>0?'red':record.checkProfitLossCost<0?'green':'', fontWeight: record.checkProfitLossCost!=0?'bold':'' }">{{ (record.checkProfitLossCost || record.checkProfitLossCost==0) ? '¥'+formatDecimal(Math.abs(record.checkProfitLossCost), 2) : '--' }}</span>
+          </template>
         </s-table>
       </a-card>
     </a-spin>
@@ -154,6 +158,7 @@ import { downloadExcel } from '@/libs/JGPrint.js'
 import { STable } from '@/components'
 import printModal from './printModal.vue'
 import ProductType from '@/views/common/productType.js'
+import { formatDecimal } from '@/libs/tools'
 import { checkWarehouseDetailList, checkWarehouseDetail, checkWarehouseDetailCount, checkWarehouseDetailExport, checkWarehouseDetailPrint, checkWarehouseWarehouse } from '@/api/checkWarehouse'
 export default {
   name: 'InventoryCheckingDetailModal',
@@ -216,13 +221,14 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '19%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '产品分类', scopedSlots: { customRender: 'productType' }, align: 'center', width: '12%' },
+        { title: '产品编码', dataIndex: 'productCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, align: 'center', width: '11%' },
         { title: '单位', dataIndex: 'productUnit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '库存数量', dataIndex: 'stockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '盘点数量', dataIndex: 'checkQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '盈亏数量', scopedSlots: { customRender: 'checkProfitLossQty' }, width: '6%', align: 'center' }
+        { title: '盈亏数量', scopedSlots: { customRender: 'checkProfitLossQty' }, width: '6%', align: 'center' },
+        { title: '盈亏成本', scopedSlots: { customRender: 'checkProfitLossCost' }, width: '6%', align: 'right' }
       ]
       if (this.basicInfoData && this.basicInfoData.warehouseFlag == '1') {
         arr.splice(4, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
@@ -232,6 +238,8 @@ export default {
     }
   },
   methods: {
+    // 保留两位小数(不四舍五入)
+    formatDecimal,
     // 详情
     getDetail () {
       checkWarehouseDetail({ sn: this.itemSn }).then(res => {
@@ -319,7 +327,7 @@ export default {
           reader.readAsText(res)
         } else {
           if (this.nowType == 'export' || this.nowType == 'typeExport') {
-			downloadExcel(res, '库存盘点')
+            downloadExcel(res, '库存盘点')
           } else {
             this.print(res, objs.type)
           }
@@ -338,7 +346,7 @@ export default {
         window.frames['printficd'].focus()
         window.frames['printficd'].print()
       }
-    },
+    }
   },
   watch: {
     //  父页面传过来的弹框状态

+ 33 - 6
src/views/inventoryManagement/inventoryChecking/list.vue

@@ -86,6 +86,13 @@
           class="button-warning"
           @click="handleWarehouse(record)"
         >盘点</a-button>
+        <a-button
+          size="small"
+          type="link"
+          v-if="record.state == 'WAIT_CHECK_WAREHOUSE' && $hasPermissions('B_inventoryCheckingAgain')"
+          class="button-warning"
+          @click="handleAgain(record)"
+        >重盘</a-button>
         <a-button
           size="small"
           type="link"
@@ -93,7 +100,10 @@
           class="button-error"
           @click="handleDel(record)"
         >删除</a-button>
-        <span v-if="!((record.state == 'WAIT_SUBMIT') || (record.state == 'AUDIT_REJECT') && ($hasPermissions('B_inventoryCheckingEdit') || $hasPermissions('B_inventoryCheckingDel'))) && !(record.state == 'WAIT_AUDIT' && $hasPermissions('B_inventoryCheckingAudit')) && !(record.state == 'WAIT_CHECK_WAREHOUSE' && $hasPermissions('B_inventoryCheckingInventory'))">--</span>
+        <span
+          v-if="!((record.state == 'WAIT_SUBMIT') || (record.state == 'AUDIT_REJECT') && ($hasPermissions('B_inventoryCheckingEdit') || $hasPermissions('B_inventoryCheckingDel')))
+            && !(record.state == 'WAIT_AUDIT' && $hasPermissions('B_inventoryCheckingAudit'))
+            && !(record.state == 'WAIT_CHECK_WAREHOUSE' && ($hasPermissions('B_inventoryCheckingInventory') || $hasPermissions('B_inventoryCheckingAgain')))">--</span>
       </template>
     </s-table>
     <!-- 基础信息 -->
@@ -111,7 +121,7 @@ import rangeDate from '@/views/common/rangeDate.vue'
 import auditModal from '@/views/common/auditModal.vue'
 import basicInfoModal from './basicInfoModal.vue'
 import inventoryCheckingDetailModal from './detailModal.vue'
-import { checkWarehouseList, checkWarehouseDel, checkWarehouseAudit, checkWarehouseValidate } from '@/api/checkWarehouse'
+import { checkWarehouseList, checkWarehouseDel, checkWarehouseAudit, checkWarehouseValidate, checkWarehouseReInventory } from '@/api/checkWarehouse'
 export default {
   components: { STable, VSelect, rangeDate, auditModal, basicInfoModal, inventoryCheckingDetailModal },
   data () {
@@ -129,12 +139,12 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '16%', align: 'center' },
+        { title: '盘点单号', scopedSlots: { customRender: 'checkWarehouseNo' }, width: '15%', align: 'center' },
         { title: '总款数', dataIndex: 'productTotalCategory', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总数量', dataIndex: 'totalStockQty', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '总成本', dataIndex: 'totalStockCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '盘点类型', dataIndex: 'checkTypeDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '是否区分仓库', dataIndex: 'warehouseFlagDictValue', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '总成本', dataIndex: 'totalStockCost', width: '11%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '盘点类型', dataIndex: 'checkTypeDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '是否区分仓库', dataIndex: 'warehouseFlagDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '状态', dataIndex: 'stateDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核时间', dataIndex: 'checkSuperviseTime', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
@@ -219,6 +229,23 @@ export default {
     handleWarehouse (row) {
       this.$router.push({ path: `/inventoryManagement/inventoryChecking/makeInventory/${row.id}/${row.checkWarehouseSn}` })
     },
+    // 重盘
+    handleAgain (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '重新盘点后,盘点单状态回退到待提交。确认重新盘点吗?',
+        centered: true,
+        onOk () {
+          checkWarehouseReInventory({ id: row.id }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    },
     //  基本信息  保存
     handleOk (data) {
       this.handleEdit(data)