Переглянути джерело

增加机器狗盘点流程

liuyanpeng 6 місяців тому
батько
коміт
4c12c4cf16

+ 22 - 0
src/custom/api/asset/AssetInventoryResource.js

@@ -131,6 +131,28 @@ export default {
     });
   },
 
+  // 机器狗生成盘点单
+  generateCheckVouchMechanicalDog: function (params) {
+    var requestUrl = 'api/CheckVouchResource/generateCheckVouchMechanicalDog';
+    return new Promise((resolve, reject) => {
+      $.ajax({
+        url: Common.getApiUrl2(requestUrl),
+        type: 'post',
+      contentType: 'application/json',
+      data: JSON.stringify(params),
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+  },
+
   /**
    * 工具类自动生成的方法
    * 工具作者: 杨志杰

+ 8 - 0
src/custom/inventory/AssetInventoryStep.vue

@@ -24,6 +24,10 @@
       @previous="previousStep" />
     <asset-inventory-step5 v-if="pageInformation.showPage == 4" :current-step="pageInformation" @next="nextStep"
       @previous="previousStep" />
+    <asset-inventory-step6 v-if="pageInformation.showPage == 5" :current-step="pageInformation" @next="nextStep"
+      @previous="previousStep" />
+    <asset-inventory-step7 v-if="pageInformation.showPage == 6" :current-step="pageInformation" @next="nextStep"
+      @previous="previousStep" />
   </section>
 </template>
 
@@ -34,6 +38,8 @@ import AssetInventoryStep2 from './AssetInventoryStep2.vue';
 import AssetInventoryStep3 from './AssetInventoryStep3.vue';
 import AssetInventoryStep4 from './AssetInventoryStep4.vue';
 import AssetInventoryStep5 from './AssetInventoryStep5.vue';
+import AssetInventoryStep6 from './AssetInventoryStep6.vue';
+import AssetInventoryStep7 from './AssetInventoryStep7.vue';
 
 export default {
 
@@ -43,6 +49,8 @@ export default {
     'asset-inventory-step3': AssetInventoryStep3,
     'asset-inventory-step4': AssetInventoryStep4,
     'asset-inventory-step5': AssetInventoryStep5,
+    'asset-inventory-step6': AssetInventoryStep6,
+    'asset-inventory-step7': AssetInventoryStep7,
   },
   data: function () {
     return {

+ 1 - 0
src/custom/inventory/AssetInventoryStep1.vue

@@ -3,6 +3,7 @@
     <a-radio-group v-model:value="value">
       <a-radio :style="radioStyle" :value="1">全盘。</a-radio>
       <a-radio :style="radioStyle" :value="3">抽盘。</a-radio>
+      <a-radio :style="radioStyle" :value="5">机器狗盘点。</a-radio>
     </a-radio-group>
   </div>
   <a-divider style="margin:14px 0 20px 0 !important;" />

+ 184 - 0
src/custom/inventory/AssetInventoryStep6.vue

@@ -0,0 +1,184 @@
+<template>
+  <div>
+    <a-form :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
+      <a-form-item label="盘点单名称" :rules="[{ required: true }]" class="m-form-item">
+        <a-input v-model:value="inventorySheetName" placeholder="请输入盘点单名称" />
+      </a-form-item>
+      <a-form-item label="仓库" :rules="[{ required: true }]" class="m-form-item">
+        <a-select v-model:value="warehouseId" :allow-clear="true" show-search option-filter-prop="label" :options="warehouseOptions" placeholder="请选择仓库" />
+      </a-form-item>
+    </a-form>
+    <a-divider style="margin:14px 0 20px 0 !important;" />
+    <a-button type="primary" @click="previous">上一步</a-button>
+    <a-button style="float: right;" type="primary" @click="next">下一步</a-button>
+  </div>
+</template>
+
+<script>
+import { Notify } from 'pc-component-v3';
+import AssetInventoryResource from '../api/asset/AssetInventoryResource.js';
+
+
+export default {
+
+  components: {},
+
+  props: {
+    currentStep: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+  },
+
+  // 定义抛出的事件名称
+  emits: ['previous', 'next'],
+  data: function () {
+    return {
+      inventorySheetName: null,
+      warehouseId: undefined,
+      warehouseOptions: [],
+      currentStepTempory: {},
+    };
+  },
+
+  watch: {
+    currentStep: {
+      handler(newVal, oldVal) {
+        console.log(newVal);
+        if (newVal != null) {
+          this.currentStepTempory = JSON.parse(JSON.stringify(newVal));
+          if (newVal.assetInventoryStep6) {
+            this.inventorySheetName = newVal.assetInventoryStep6.inventorySheetName || null;
+            this.warehouseId = newVal.assetInventoryStep6.warehouseId;
+          }
+        }
+      },
+      immediate: true,
+    },
+
+    currentStepTempory: {
+      handler(newVal, oldVal) {
+        clearTimeout(this.timer); //清除延迟执行
+        let _self = this;
+        this.timer = setTimeout(() => { //设置延迟执行
+          _self.$emit('update', _self.currentStepTempory);
+        }, 1000);
+      },
+      deep: true,
+    },
+  },
+  mounted: function () {
+    this.getWarehouseList();
+  },
+
+  methods: {
+    getWarehouseList: function () {
+      var _self = this;
+      AssetInventoryResource.getWarehouseList().then(
+        successData => {
+          if (successData && successData.length > 0) {
+            _self.warehouseOptions = successData.map(item => {
+              return {
+                value: item.id,
+                label: item.name,
+              };
+            });
+          }
+        },
+        errorData => {
+          console.log(errorData);
+        },
+      );
+    },
+    next: function () {
+      var _self = this;
+      if (_self.inventorySheetName == null || _self.inventorySheetName == '') {
+        Notify.error('错误', '请填写盘点单名称', 1000);
+        return;
+      }
+      if (_self.warehouseId == null || _self.warehouseId == undefined) {
+        Notify.error('错误', '请选择仓库', 1000);
+        return;
+      }
+      var param = {
+        inventorySheetName: _self.inventorySheetName,
+        warehouseId: _self.warehouseId,
+      };
+
+
+      console.log(this.currentStep);
+      var data = {
+        currentStep: 2,
+        showPage: 6,
+        assetInventoryStep6: param,
+      };
+      this.$emit('next', data);
+    },
+
+    previous: function () {
+      var data = {
+        currentStep: 0,
+        showPage: 0,
+      };
+      this.$emit('previous', data);
+    },
+  },
+};
+</script>
+<style scoped>
+.grid-container {
+  display: grid;
+  grid-template-rows: 8% 8% 84%;
+  grid-template-columns: 100%;
+  width: 100%;
+  /*视口被均分为 100 单位的 vh 占据整个窗口,扣掉顶部 topNav 的距离后,计算得到 responseOrganizationSelect 的高度*/
+  height: calc(100vh - 130px);
+  margin-top: 10px;
+}
+
+.grid-item-1 {
+  grid-row: 1/2;
+}
+
+.grid-item-2 {
+  grid-row: 2/3;
+}
+
+.grid-item-3 {
+  grid-row: 3/4;
+}
+
+.box {
+  border: 1px #ccc solid;
+  margin-bottom: 15px;
+  padding-top: 10px;
+  border-radius: 5px;
+  background-color: #ffffff;
+}
+
+.label {
+  float: left;
+}
+
+.div-form {
+  margin-bottom: 10px;
+}
+
+.m-monthly-picker>>>.month-year-display {
+  height: 35px;
+  font-size: 1.5rem;
+  padding-left: 0.9rem;
+  font-weight: 400;
+}
+
+.m-form-item {
+  margin-bottom: 5px;
+}
+
+:deep(.ant-form-item-label > label) {
+  font-size: 14px !important;
+  font-weight: 500 !important;
+}
+</style>

+ 175 - 0
src/custom/inventory/AssetInventoryStep7.vue

@@ -0,0 +1,175 @@
+<template>
+  <div>
+    <a-result v-if="isShow" status="success" title="操作成功!" :sub-title="successText">
+      <template #extra>
+        <div style="text-align: left; margin-bottom: 20px;">
+          <a-table :columns="columns" :data-source="organizationNames">
+            <template #bodyCell="{ column, record }">
+              <template v-if="column.key === 'name'" />
+              <template v-else-if="column.key === 'documentName'">
+                <span>
+                  {{ record.documentName }}
+                </span>
+              </template>
+              <template v-else-if="column.key === 'documentNo'">
+                <span>
+                  {{ record.documentNo }}
+                </span>
+              </template>
+              <template v-else-if="column.key === 'operation'">
+                <a-button type="primary" @click="openCurdWindow(record.id)">查看盘点单</a-button>
+              </template>
+            </template>
+          </a-table>
+        </div>
+      </template>
+    </a-result>
+
+    <a-result v-else title="机器狗盘点生成盘点单">
+      <template #extra>
+        <a-button key="console" type="primary" @click="end">确认生成盘点单</a-button>
+      </template>
+    </a-result>
+
+
+    <a-divider style="margin:14px 0 20px 0 !important;" />
+
+    <a-button key="console" type="primary" @click="previous">上一步</a-button>
+    <a-button key="console" style="float: right;" type="primary" @click="next">返回</a-button>
+    <Loading v-if="loading" />
+  </div>
+</template>
+
+<script>
+
+import Common from '../common/Common.js';
+import { Notify, Uuid } from 'pc-component-v3';
+import AssetInventoryResource from '../api/asset/AssetInventoryResource.js';
+
+export default {
+
+  components: {},
+
+  props: {
+    currentStep: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
+  },
+
+  // 定义抛出的事件名称
+  emits: ['previous', 'next'],
+  data: function () {
+    return {
+      currentStepTempory: {},
+      isShow: false,
+      loading: false,
+      organizationNames: [],
+      columns: [{
+        title: '部门',
+        dataIndex: 'name',
+        key: 'name',
+      }, {
+        title: '盘点单名称',
+        dataIndex: 'documentName',
+        key: 'documentName',
+      }, {
+        title: '盘点单编号',
+        dataIndex: 'documentNo',
+        key: 'documentNo',
+      },
+      {
+        title: '操作',
+        dataIndex: 'operation',
+        key: 'operation',
+      }],
+      successText: '',
+    };
+  },
+
+  watch: {
+    currentStep: {
+      handler(newVal, oldVal) {
+        console.log(newVal);
+        if (newVal != null) {
+          this.currentStepTempory = JSON.parse(JSON.stringify(newVal));
+        }
+      },
+      immediate: true,
+    },
+
+    currentStepTempory: {
+      handler(newVal, oldVal) {
+        clearTimeout(this.timer);  //清除延迟执行
+        let _self = this;
+        this.timer = setTimeout(() => {   //设置延迟执行
+          _self.$emit('update', _self.currentStepTempory);
+        }, 1000);
+      },
+      deep: true,
+    },
+  },
+  mounted: function () {
+
+  },
+
+  methods: {
+    /**
+       * 打开资产盘点单的CURD窗口
+       */
+    openCurdWindow: function (data) {
+      let url = Common.getRedirectUrl('#/desktop/window1/window-read/view/081001/0/' + data +
+        '?currPage=1&currIndex=1&totalCount=1&uuid=' + Uuid.createUUID());
+      window.open(url);
+    },
+
+    end: function () {
+      var _self = this;
+      var param = {
+        checkVouchName: _self.currentStep.assetInventoryStep6.inventorySheetName,
+        warehouseId: _self.currentStep.assetInventoryStep6.warehouseId,
+      };
+      _self.loading = true;
+      AssetInventoryResource.generateCheckVouchMechanicalDog(param).then(
+        data => {
+          if (data.errorCode != 0) {
+            Notify.error('失败', data.errorMessage, false);
+          } else {
+            Notify.success('成功', data.errorMessage, false);
+            _self.successText = data.errorMessage;
+            _self.organizationNames = [
+              {
+                name: data.data.organizationName,
+                documentNo: data.data.documentNo,
+                documentName: data.data.name,
+                id: data.data.id,
+              }
+            ]
+          }
+
+          _self.isShow = true;
+          _self.loading = false;
+        }, xmlHttpRequest => {
+          _self.loading = false;
+          Common.processException(xmlHttpRequest);
+        });
+    },
+
+    previous: function () {
+      var data = {
+        currentStep: 1,
+        showPage: 1,
+        assetInventoryStep6: this.currentStep.assetInventoryStep6,
+      };
+      this.$emit('previous', data);
+    },
+    next: function () {
+      var _self = this;
+      _self.$router.push('/wms/asset-inventory');
+    },
+  },
+};
+</script>
+<style></style>