|
|
@@ -1,428 +1,663 @@
|
|
|
<template>
|
|
|
- <div class="adjust-positions-container">
|
|
|
- <a-page-header title="货位调整" />
|
|
|
-
|
|
|
- <a-form :layout="formLayout" class="search-form">
|
|
|
- <a-form-item label="调整前货位" required>
|
|
|
- <a-select
|
|
|
- v-model="positionBeforeId"
|
|
|
- placeholder="请选择调整前货位"
|
|
|
- show-search
|
|
|
- filter-option="filterOption"
|
|
|
- @change="handlePositionBeforeChange"
|
|
|
- >
|
|
|
- <a-select-option
|
|
|
- v-for="item in positionBefores"
|
|
|
- :key="item.positionId"
|
|
|
- :value="item.positionId"
|
|
|
- >
|
|
|
- {{ item.positionNo }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="调整后货位" required>
|
|
|
- <a-select
|
|
|
- v-model="positionAfterId"
|
|
|
- placeholder="请选择调整后货位"
|
|
|
- show-search
|
|
|
- filter-option="filterOption"
|
|
|
- >
|
|
|
- <a-select-option
|
|
|
- v-for="item in positionAfters"
|
|
|
- :key="item.positionId"
|
|
|
- :value="item.positionId"
|
|
|
- >
|
|
|
- {{ item.positionNo }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="搜索内容">
|
|
|
- <a-input
|
|
|
- v-model="queryMessage"
|
|
|
- placeholder="请输入工具的中文名称或SKU或序列号"
|
|
|
- @press-enter="handleSearch"
|
|
|
- />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item label="工具类型">
|
|
|
- <a-select v-model="selectType" @change="changeSelectType">
|
|
|
- <a-select-option value="1">RFID管理</a-select-option>
|
|
|
- <a-select-option value="2">非RFID管理</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item>
|
|
|
- <a-button type="primary" @click="handleSearch">查询</a-button>
|
|
|
- <a-button type="primary" @click="submitBefore">确认调整</a-button>
|
|
|
- </a-form-item>
|
|
|
- </a-form>
|
|
|
-
|
|
|
- <a-table
|
|
|
- :columns="columns"
|
|
|
- :data-source="selectType === '2' ? currentStockDtos : inventoryInstanceDatas"
|
|
|
- :pagination="pagination"
|
|
|
- :loading="loading"
|
|
|
- row-key="id"
|
|
|
- @change="handleTableChange"
|
|
|
- >
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
- <template v-if="column.key === 'image'">
|
|
|
- <img
|
|
|
- :src="Common.getThumbnailImageSrc(className, record.imageName)"
|
|
|
- class="image"
|
|
|
- @click="$refs.imagePreview.preview(className, record.imageName)"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <template v-if="column.key === 'adjustQuantity' && selectType === '2'">
|
|
|
- <a-input-number
|
|
|
- v-model="record.adjustQuantity"
|
|
|
- :min="0"
|
|
|
- @change="checkBoxChange(record)"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
-
|
|
|
- <a-modal
|
|
|
- v-model:visible="modal"
|
|
|
- title="调整确认"
|
|
|
- :footer="null"
|
|
|
- >
|
|
|
- <p>您确认要进行货位调整吗?</p>
|
|
|
- <div class="modal-footer">
|
|
|
- <a-button @click="closeModal">取消</a-button>
|
|
|
- <a-button type="primary" @click="handleSubmit">确认</a-button>
|
|
|
+ <div>
|
|
|
+ <div class=" flex-container">
|
|
|
+ <div class=" flex-header">
|
|
|
+ <StockOutPrepareTemplateHeader active-index="1" />
|
|
|
+ <div class="form-inline">
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="projectItem">
|
|
|
+ <span class="text-danger">
|
|
|
+ *
|
|
|
+ </span>
|
|
|
+ 项目事件
|
|
|
+ </label>
|
|
|
+ <select id="projectItem" class="form-control" />
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="warehouse">
|
|
|
+ <span class="text-danger">
|
|
|
+ *
|
|
|
+ </span>
|
|
|
+ 仓库
|
|
|
+ </label>
|
|
|
+ <select id="warehouse" class="form-control" />
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="stockOutPrepateTemplate">
|
|
|
+ <span class="text-danger">
|
|
|
+ *
|
|
|
+ </span>
|
|
|
+ 需求模板
|
|
|
+ </label>
|
|
|
+ <select id="stockOutPrepateTemplate" class="form-control" />
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <button type="button" class="btn btn-primary" @click="queryLines">查询</button>
|
|
|
+ <button type="button" class="btn btn-info" @click="clear">清空</button>
|
|
|
+ <button type="button" class="btn btn-success" @click="save">确定领料</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </a-modal>
|
|
|
-
|
|
|
- <Loading v-if="loading" />
|
|
|
- <ImagePreview ref="imagePreview" />
|
|
|
+ <div class=" flex-content">
|
|
|
+ <table class="fixed-table table table-responsive table-bordered">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <td style="width: 150px;">物料编码</td>
|
|
|
+ <td style="width: 200px;">物料名称</td>
|
|
|
+ <td style="width: 150px;">规格型号</td>
|
|
|
+ <td style="width: 120px;">库存数量</td>
|
|
|
+ <td style="width: 150px;">待出库数量</td>
|
|
|
+ <td style="width: 150px;">可领用数量</td>
|
|
|
+ <td style="width: 120px;">需求数量</td>
|
|
|
+ <td style="width: 120px;">领用数量</td>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody v-if="pageStockOutPrepateTemplates.length>0">
|
|
|
+ <tr v-for="item in pageStockOutPrepateTemplates" :key="item.inventoryId" :class="{'danger' : item.currentStockCanPickQuantity < item.pickQuantity}">
|
|
|
+ <td>{{ item.inventoryNo }}</td>
|
|
|
+ <td>{{ item.inventoryName }}</td>
|
|
|
+ <td>{{ item.inventoryType }}</td>
|
|
|
+ <td>{{ item.currentStockQuantity }}</td>
|
|
|
+ <td>{{ item.currentStockOutQuantity }}</td>
|
|
|
+ <td>{{ item.currentStockCanPickQuantity }}</td>
|
|
|
+ <td>{{ item.quantity }}</td>
|
|
|
+ <td><input v-model="item.pickQuantity" autocomplete="off" type="number" class="form-control" placeholder="领料数量" aria-describedby="basic-addon1" /></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class=" flex-footer">
|
|
|
+ <div class="pull-left">
|
|
|
+ <span>第{{ (pagination.current_page-1)*pagination.per_page+1 }}-{{ pagination.current_page*pagination.per_page }}条,共计{{ pagination.total }}条,每页显示</span>
|
|
|
+ <PageSizeSelect @page-size-changed="gridSizeSelect" />
|
|
|
+ <span>条</span>
|
|
|
+ </div>
|
|
|
+ <div class="pull-right">
|
|
|
+ <VueBootstrapPagination v-if="pagination.last_page > 0" :pagination="pagination" :callback="getDatas" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <Loading v-if="loading" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import Common from '../common/Common.js';
|
|
|
-import CurrentStockResource from '../api/wms/CurrentStockResource.js';
|
|
|
-import AdjustPositionResource from '../api/wms/AdjustPositionResource.js';
|
|
|
-import InventoryInstanceResource from '../api/common/InventoryInstanceResource.js';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import StockOutPrepareResource from '../api/wms/StockOutPrepareResource.js';
|
|
|
+import StockOutPrepateTemplateResource from '../api/wms/StockOutPrepateTemplateResource.js';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import StockOutPrepareTemplateHeader from './StockOutPrepareTemplateHeader.vue';
|
|
|
|
|
|
export default {
|
|
|
- data() {
|
|
|
+ components: {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ StockOutPrepareTemplateHeader,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
return {
|
|
|
- formLayout: {
|
|
|
- labelCol: { span: 8 },
|
|
|
- wrapperCol: { span: 16 },
|
|
|
- },
|
|
|
- checked: false,
|
|
|
- positionBefores: [],
|
|
|
- positionBeforeId: null,
|
|
|
- positionAfterId: null,
|
|
|
- positionAfters: [],
|
|
|
- queryMessage: '',
|
|
|
- currentStockDtos: [],
|
|
|
- inventoryInstanceDatas: [],
|
|
|
+ stockOutPrepateTemplates: [],
|
|
|
+ pageStockOutPrepateTemplates: [],
|
|
|
+ stockOutPrepateTemplateId: undefined,
|
|
|
+ warehouseId: undefined,
|
|
|
+ projectItemId: undefined,
|
|
|
pagination: {
|
|
|
total: 0,
|
|
|
- pageSize: Common.pageSize,
|
|
|
- current: 1,
|
|
|
+ per_page: Common.pageSize, // required
|
|
|
+ current_page: 1, // required
|
|
|
+ last_page: 0, // required
|
|
|
},
|
|
|
- className: 'com.leanwo.prodog.model.common.Inventory',
|
|
|
- selectType: '1',
|
|
|
+ hot: '',
|
|
|
+ count: 0,
|
|
|
+ storageLife: undefined,
|
|
|
+ checked: false,
|
|
|
+ page: 20,
|
|
|
+ length: undefined,
|
|
|
+ start: undefined,
|
|
|
+ stockOutPrepateTemplateName:'',
|
|
|
+ warehouseName: '',
|
|
|
+ projectItemName: '',
|
|
|
+ projectItems:[],
|
|
|
+ warehouses:[],
|
|
|
+ stockOutPrepateTemplateNames:[],
|
|
|
loading: false,
|
|
|
- modal: false,
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: '序号',
|
|
|
- key: 'index',
|
|
|
- render: (text, record, index) => index + 1,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '图片',
|
|
|
- key: 'image',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '中文名称',
|
|
|
- dataIndex: 'inventoryName',
|
|
|
- key: 'inventoryName',
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'SKU',
|
|
|
- dataIndex: 'inventoryCode',
|
|
|
- key: 'inventoryCode',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '序列号',
|
|
|
- dataIndex: 'no',
|
|
|
- key: 'no',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '库存数量',
|
|
|
- dataIndex: 'stockQuantity',
|
|
|
- key: 'stockQuantity',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '调整数量',
|
|
|
- key: 'adjustQuantity',
|
|
|
- },
|
|
|
- ],
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.loadSelectPositionBefore();
|
|
|
- this.loadSelectPositionAfter();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- handleTableChange(pagination) {
|
|
|
- this.pagination.current = pagination.current;
|
|
|
- this.pagination.pageSize = pagination.pageSize;
|
|
|
- this.handleSearch();
|
|
|
- },
|
|
|
- filterOption(input, option) {
|
|
|
- return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
|
- },
|
|
|
- handlePositionBeforeChange() {
|
|
|
- this.handleSearch();
|
|
|
- },
|
|
|
- handleSearch() {
|
|
|
- if (this.selectType === '1') {
|
|
|
- this.queryInventoryInstance();
|
|
|
- } else {
|
|
|
- this.queryInventory();
|
|
|
- }
|
|
|
- },
|
|
|
- changeSelectType() {
|
|
|
- this.handleSearch();
|
|
|
- },
|
|
|
- checkBoxChange(item) {
|
|
|
- if (!item.adjustQuantity || item.adjustQuantity === 0) {
|
|
|
- item.checked = false;
|
|
|
- } else {
|
|
|
- item.checked = true;
|
|
|
- }
|
|
|
- },
|
|
|
- closeModal() {
|
|
|
- this.modal = false;
|
|
|
- },
|
|
|
- submitBefore() {
|
|
|
- if (!this.positionBeforeId || !this.positionAfterId) {
|
|
|
- Notify.error('错误', '调整前货位与调整后货位不允许为空', false);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.positionBeforeId === this.positionAfterId) {
|
|
|
- Notify.error('错误', '调整前货位与调整后货位不能相同', false);
|
|
|
- return;
|
|
|
- }
|
|
|
- const data =
|
|
|
- this.selectType === '2' ? this.currentStockDtos : this.inventoryInstanceDatas;
|
|
|
- let checkCount = 0;
|
|
|
- let falseData = true;
|
|
|
- data.forEach(item => {
|
|
|
- if (item.checked) {
|
|
|
- checkCount++;
|
|
|
- if (this.selectType === '2' && (!item.adjustQuantity || item.adjustQuantity <= 0)) {
|
|
|
- falseData = false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if (!falseData) {
|
|
|
- Notify.error('错误', '调整数量必须大于0', false);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (checkCount > 0) {
|
|
|
- this.modal = true;
|
|
|
- } else {
|
|
|
- Notify.error('错误', '请选择最少一条数据进行提交', false);
|
|
|
- }
|
|
|
- },
|
|
|
- handleSubmit() {
|
|
|
- this.modal = false;
|
|
|
- if (this.selectType === '2') {
|
|
|
- this.submit1();
|
|
|
- } else {
|
|
|
- this.submit2();
|
|
|
+ watch: {
|
|
|
+ 'page': function(curVal, oldVal) {
|
|
|
+ if(curVal != undefined) {
|
|
|
+ this.getDatas();
|
|
|
}
|
|
|
},
|
|
|
- submit1() {
|
|
|
- const currentStockDtoBs = this.currentStockDtos.filter(item => item.checked);
|
|
|
- this.loading = true;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('AdjustPositionResource/saveAdjustPosition'),
|
|
|
- type: 'post',
|
|
|
- data: {
|
|
|
- currentStockDtoBs: JSON.stringify(currentStockDtoBs),
|
|
|
- positionBeforeId: this.positionBeforeId,
|
|
|
- positionAfterId: this.positionAfterId,
|
|
|
- },
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: successData => {
|
|
|
- this.loading = false;
|
|
|
- if (successData.errorCode === 0) {
|
|
|
- if (successData.data) {
|
|
|
- Notify.success('成功', '操作成功', false);
|
|
|
- this.queryInventory();
|
|
|
+ },
|
|
|
+
|
|
|
+ created: function() {
|
|
|
+ if(!window.localStorage) {
|
|
|
+ alert('浏览器不支持localstorage');
|
|
|
+ } else {
|
|
|
+ var storage = window.localStorage;
|
|
|
+ this.warehouseId = storage.getItem('warehouseId');
|
|
|
+ this.warehouseName = storage.getItem('warehouseName');
|
|
|
+ this.projectItemId = storage.getItem('projectItemId');
|
|
|
+ this.projectItemName = storage.getItem('projectItemName');
|
|
|
+ this.stockOutPrepateTemplateId = storage.getItem('stockOutPrepateTemplateId');
|
|
|
+ this.stockOutPrepateTemplateName = storage.getItem('stockOutPrepateTemplateName');
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted: function() {
|
|
|
+ this.loadSelectProjectItem();
|
|
|
+ this.loadSelectWarehouse();
|
|
|
+ this.loadSelectTemplate();
|
|
|
+ if (this.warehouseId != null) {
|
|
|
+ var warehouse = new Option(this.warehouseName, this.warehouseId);
|
|
|
+ $('#warehouse').append(warehouse);
|
|
|
+ }
|
|
|
+ if (this.projectItemId != null) {
|
|
|
+ var projectItem = new Option(this.projectItemName, this.projectItemId);
|
|
|
+ $('#projectItem').append(projectItem);
|
|
|
+
|
|
|
+ }
|
|
|
+ if (this.stockOutPrepateTemplateId != null) {
|
|
|
+ var stockOutPrepateTemplate = new Option(this.stockOutPrepateTemplateName, this.stockOutPrepateTemplateId);
|
|
|
+ $('#stockOutPrepateTemplate').append(stockOutPrepateTemplate);
|
|
|
+ }
|
|
|
+
|
|
|
+ $('.fixed-table').tableFixer({'left' : 2,'head':true});
|
|
|
+
|
|
|
+ $('.fixed-table').colResizable({
|
|
|
+ resizeMode: 'overflow',
|
|
|
+ partialRefresh: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目事件
|
|
|
+ */
|
|
|
+ loadSelectProjectItem: function() {
|
|
|
+ var _self = this;
|
|
|
+ $('#projectItem').select2({
|
|
|
+ // 请求搜索框数据
|
|
|
+ //data: _self.data,
|
|
|
+ theme: 'bootstrap',
|
|
|
+ placeholder: '项目事件',
|
|
|
+ minimumInputLength: 0,
|
|
|
+ placeholderOption: 'first',
|
|
|
+ quietMillis: 250,
|
|
|
+ allowClear: true,
|
|
|
+ language: 'zh-CN',
|
|
|
+ width: 'resolve',
|
|
|
+ // 请求搜索框数据
|
|
|
+ ajax: {
|
|
|
+ url: function(params) {
|
|
|
+ return Common.getApiURL('ProjectItemResource/queryByCondition');
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ type: 'get',
|
|
|
+ delay: 250,
|
|
|
+ minimumInputLength: 0,
|
|
|
+ transport: function(params, success, failure) {
|
|
|
+ params.beforeSend = Common.addTokenToRequest;
|
|
|
+ var $request = $.ajax(params);
|
|
|
+ $request.then(success);
|
|
|
+ $request.fail(failure);
|
|
|
+ return $request;
|
|
|
+ },
|
|
|
+ data: function(params) {
|
|
|
+ return {
|
|
|
+ 'name': params.term,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ processResults: function(data, params) {
|
|
|
+ if(data.errorCode == 0) {
|
|
|
+ var more = (params * 10) <= data.datas.length;
|
|
|
+ for(var i = 0; i < data.datas.length; i++) {
|
|
|
+ data.datas[i].text = data.datas[i].name;
|
|
|
+ }
|
|
|
+ _self.projectItems = data.datas;
|
|
|
+ return {
|
|
|
+ results: data.datas,
|
|
|
+ more: more,
|
|
|
+ };
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
- Common.processException(errorData);
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- submit2() {
|
|
|
- const inventoryInstanceDtos = this.inventoryInstanceDatas.filter(item => item.checked);
|
|
|
- this.loading = true;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('AdjustPositionResource/saveAdjustPosition2'),
|
|
|
- type: 'post',
|
|
|
- data: {
|
|
|
- inventoryInstanceDtos: JSON.stringify(inventoryInstanceDtos),
|
|
|
- positionBeforeId: this.positionBeforeId,
|
|
|
- positionAfterId: this.positionAfterId,
|
|
|
- },
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: successData => {
|
|
|
- this.loading = false;
|
|
|
- if (successData.errorCode === 0) {
|
|
|
- if (successData.data) {
|
|
|
- Notify.success('成功', '操作成功', false);
|
|
|
- this.queryInventoryInstance();
|
|
|
+ }).on('change', function() {
|
|
|
+ if($(this).val() == null) {
|
|
|
+ _self.projectItemId = undefined;
|
|
|
+ var storage = window.localStorage;
|
|
|
+ storage.setItem('projectItemId', _self.projectItemId);
|
|
|
+ _self.projectItemName = '';
|
|
|
+ storage.setItem('projectItemName', _self.projectItemName);
|
|
|
+ _self.clear();
|
|
|
+ } else {
|
|
|
+ _self.projectItemId = $(this).val();
|
|
|
+ for (var i = 0; i < _self.projectItems.length; i++) {
|
|
|
+ if (_self.projectItems[i].id == _self.projectItemId) {
|
|
|
+ _self.projectItemName = _self.projectItems[i].name;
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
- Common.processException(errorData);
|
|
|
- },
|
|
|
+ _self.clear();
|
|
|
+ storage.setItem('projectItemId', _self.projectItemId);
|
|
|
+ storage.setItem('projectItemName', _self.projectItemName);
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
- queryInventory() {
|
|
|
- this.loading = true;
|
|
|
- const queryMessage = $.trim(this.queryMessage);
|
|
|
- const start = (this.pagination.current - 1) * this.pagination.pageSize;
|
|
|
- const length = this.pagination.pageSize;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('CurrentStockResource/queryCurrentStockByPosition'),
|
|
|
- type: 'get',
|
|
|
- data: {
|
|
|
- positionBeforeId: this.positionBeforeId,
|
|
|
- queryMessage,
|
|
|
- start,
|
|
|
- length,
|
|
|
+ /**
|
|
|
+ * 仓库
|
|
|
+ */
|
|
|
+ loadSelectWarehouse: function() {
|
|
|
+ var _self = this;
|
|
|
+ var storage = window.localStorage;
|
|
|
+ $('#warehouse').select2({
|
|
|
+ // 请求搜索框数据
|
|
|
+ //data: _self.data,
|
|
|
+ theme: 'bootstrap',
|
|
|
+ placeholder: '仓库',
|
|
|
+ minimumInputLength: 0,
|
|
|
+ placeholderOption: 'first',
|
|
|
+ quietMillis: 250,
|
|
|
+ allowClear: true,
|
|
|
+ language: 'zh-CN',
|
|
|
+ width: 'resolve',
|
|
|
+ // 请求搜索框数据
|
|
|
+ ajax: {
|
|
|
+ url: function(params) {
|
|
|
+ return Common.getApiURL('WarehouseResource/queryByCondition');
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ type: 'get',
|
|
|
+ delay: 250,
|
|
|
+ minimumInputLength: 0,
|
|
|
+ transport: function(params, success, failure) {
|
|
|
+ params.beforeSend = Common.addTokenToRequest;
|
|
|
+ var $request = $.ajax(params);
|
|
|
+ $request.then(success);
|
|
|
+ $request.fail(failure);
|
|
|
+ return $request;
|
|
|
+ },
|
|
|
+ data: function(params) {
|
|
|
+ return {
|
|
|
+ 'name': params.term,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ processResults: function(data, params) {
|
|
|
+ if(data.errorCode == 0) {
|
|
|
+ var more = (params * 10) <= data.datas.length;
|
|
|
+ for(var i = 0; i < data.datas.length; i++) {
|
|
|
+ data.datas[i].text = data.datas[i].name;
|
|
|
+ }
|
|
|
+ _self.warehouses = data.datas;
|
|
|
+ return {
|
|
|
+ results: data.datas,
|
|
|
+ more: more,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: successData => {
|
|
|
- this.loading = false;
|
|
|
- if (successData.errorCode === 0) {
|
|
|
- if (successData.datas) {
|
|
|
- this.currentStockDtos = successData.datas.map(item => ({
|
|
|
- ...item,
|
|
|
- checked: false,
|
|
|
- }));
|
|
|
- this.pagination.total = successData.total;
|
|
|
+ }).on('change', function() {
|
|
|
+ if($(this).val() == null) {
|
|
|
+ _self.warehouseId = undefined;
|
|
|
+ _self.warehouseName = '';
|
|
|
+ storage.setItem('warehouseId', _self.warehouseId);
|
|
|
+ storage.setItem('warehouseName', _self.warehouseName);
|
|
|
+ _self.clear();
|
|
|
+ } else {
|
|
|
+ _self.warehouseId = $(this).val();
|
|
|
+ for (var i = 0; i < _self.warehouses.length; i++) {
|
|
|
+ if (_self.warehouses[i].id == _self.warehouseId) {
|
|
|
+ _self.warehouseName = _self.warehouses[i].name;
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
- Common.processException(errorData);
|
|
|
- },
|
|
|
+ _self.clear();
|
|
|
+ storage.setItem('warehouseId', _self.warehouseId);
|
|
|
+ storage.setItem('warehouseName', _self.warehouseName);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
- queryInventoryInstance() {
|
|
|
- this.loading = true;
|
|
|
- const queryMessage = $.trim(this.queryMessage);
|
|
|
- const start = (this.pagination.current - 1) * this.pagination.pageSize;
|
|
|
- const length = this.pagination.pageSize;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('InventoryInstanceResource/queryByPosition'),
|
|
|
- type: 'get',
|
|
|
- data: {
|
|
|
- positionBeforeId: this.positionBeforeId,
|
|
|
- queryMessage,
|
|
|
- start,
|
|
|
- length,
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 需求模板
|
|
|
+ */
|
|
|
+ loadSelectTemplate: function() {
|
|
|
+ var _self = this;
|
|
|
+ var storage = window.localStorage;
|
|
|
+ $('#stockOutPrepateTemplate').select2({
|
|
|
+ // 请求搜索框数据
|
|
|
+ //data: _self.data,
|
|
|
+ theme: 'bootstrap',
|
|
|
+ placeholder: '需求模板',
|
|
|
+ minimumInputLength: 0,
|
|
|
+ placeholderOption: 'first',
|
|
|
+ quietMillis: 250,
|
|
|
+ allowClear: true,
|
|
|
+ language: 'zh-CN',
|
|
|
+ width: 'resolve',
|
|
|
+ // 请求搜索框数据
|
|
|
+ ajax: {
|
|
|
+ url: function(params) {
|
|
|
+ return Common.getApiURL('StockOutPrepateTemplateResource/queryByCondition');
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ type: 'get',
|
|
|
+ delay: 250,
|
|
|
+ minimumInputLength: 0,
|
|
|
+ transport: function(params, success, failure) {
|
|
|
+ params.beforeSend = Common.addTokenToRequest;
|
|
|
+ var $request = $.ajax(params);
|
|
|
+ $request.then(success);
|
|
|
+ $request.fail(failure);
|
|
|
+ return $request;
|
|
|
+ },
|
|
|
+ data: function(params) {
|
|
|
+ return {
|
|
|
+ 'name': params.term,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ processResults: function(data, params) {
|
|
|
+ if(data.errorCode == 0) {
|
|
|
+ var more = (params * 10) <= data.datas.length;
|
|
|
+ for(var i = 0; i < data.datas.length; i++) {
|
|
|
+ data.datas[i].text = data.datas[i].name;
|
|
|
+ }
|
|
|
+ _self.stockOutPrepateTemplateNames = data.datas;
|
|
|
+ return {
|
|
|
+ results: data.datas,
|
|
|
+ more: more,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: successData => {
|
|
|
- this.loading = false;
|
|
|
- if (successData.errorCode === 0) {
|
|
|
- if (successData.datas) {
|
|
|
- this.inventoryInstanceDatas = successData.datas.map(item => ({
|
|
|
- ...item,
|
|
|
- checked: false,
|
|
|
- }));
|
|
|
- this.pagination.total = successData.total;
|
|
|
+ }).on('change', function() {
|
|
|
+ if($(this).val() == null) {
|
|
|
+ _self.stockOutPrepateTemplateId = undefined;
|
|
|
+ _self.clear();
|
|
|
+ _self.stockOutPrepateTemplateName = '';
|
|
|
+ storage.setItem('stockOutPrepateTemplateId', _self.stockOutPrepateTemplateId);
|
|
|
+ storage.setItem('stockOutPrepateTemplateName', _self.stockOutPrepateTemplateName);
|
|
|
+ } else {
|
|
|
+ _self.stockOutPrepateTemplateId = $(this).val();
|
|
|
+ for (var i = 0; i < _self.stockOutPrepateTemplateNames.length; i++) {
|
|
|
+ if (_self.stockOutPrepateTemplateNames[i].id == _self.stockOutPrepateTemplateId) {
|
|
|
+ _self.stockOutPrepateTemplateName = _self.stockOutPrepateTemplateNames[i].name;
|
|
|
}
|
|
|
}
|
|
|
- },
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
- Common.processException(errorData);
|
|
|
- },
|
|
|
+ _self.clear();
|
|
|
+ storage.setItem('stockOutPrepateTemplateId', _self.stockOutPrepateTemplateId);
|
|
|
+ storage.setItem('stockOutPrepateTemplateName', _self.stockOutPrepateTemplateName);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
- loadSelectPositionBefore() {
|
|
|
- this.loading = true;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('positionResource/queryByCondition'),
|
|
|
- type: 'get',
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: data => {
|
|
|
- this.loading = false;
|
|
|
- if (data.errorCode === 0) {
|
|
|
- this.positionBefores = data.datas.map(item => ({
|
|
|
- positionId: item.positionId,
|
|
|
- positionNo: item.positionNo,
|
|
|
- }));
|
|
|
- }
|
|
|
- },
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
- Common.processException(errorData);
|
|
|
- },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改每页显示的数量
|
|
|
+ * @param {Object} newPageSize
|
|
|
+ */
|
|
|
+ gridSizeSelect: function(newPageSize) {
|
|
|
+ var _self = this;
|
|
|
+ this.pagination.per_page = newPageSize;
|
|
|
+ this.pagination.current_page = 1;
|
|
|
+ // 刷新界面
|
|
|
+
|
|
|
+ //清空这样显示数据
|
|
|
+ _self.pageStockOutPrepateTemplates.splice(0, _self.pageStockOutPrepateTemplates.length);
|
|
|
+
|
|
|
+ //清空查询数据,重新查询数据
|
|
|
+ _self.stockOutPrepateTemplates.splice(0, _self.stockOutPrepateTemplates.length);
|
|
|
+
|
|
|
+
|
|
|
+ this.queryLines();
|
|
|
+ },
|
|
|
+
|
|
|
+ //查询领料模板详情
|
|
|
+ queryLines: function() {
|
|
|
+ var _self = this;
|
|
|
+ if(_self.projectItemId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择项目事件', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.warehouseId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择仓库', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.stockOutPrepateTemplateId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择需求模板', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var param = {
|
|
|
+ warehouseId: _self.warehouseId,
|
|
|
+ projectItemId: _self.projectItemId,
|
|
|
+ stockOutPrepateTemplateDtoId: _self.stockOutPrepateTemplateId,
|
|
|
+ };
|
|
|
+ _self.loading=true;
|
|
|
+
|
|
|
+ //清空这样显示数据
|
|
|
+ _self.pageStockOutPrepateTemplates.splice(0, _self.pageStockOutPrepateTemplates.length);
|
|
|
+
|
|
|
+ StockOutPrepateTemplateResource.queryStockOutPrepateTemplateDto(param).then(successData =>{
|
|
|
+ if(successData.errorCode == 0) {
|
|
|
+ _self.pagination.total = successData.data.stockOutPrepateTemplateLineDtos.length;
|
|
|
+ _self.stockOutPrepateTemplates = successData.data.stockOutPrepateTemplateLineDtos;
|
|
|
+ _self.pagination.last_page = Math.ceil(successData.data.stockOutPrepateTemplateLineDtos.length / _self.pagination.per_page);
|
|
|
+ _self.getDatas();
|
|
|
+ _self.loading=false;
|
|
|
+ } else {
|
|
|
+ Notify.error('提示', successData.errorMessage, false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ },errorData =>{
|
|
|
+ _self.loading=false;
|
|
|
+ Common.processException(errorData);
|
|
|
});
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getDatas: function() {
|
|
|
+ var _self = this;
|
|
|
+ var start = (_self.pagination.current_page - 1) * _self.pagination.per_page;
|
|
|
+ var end = start + _self.pagination.per_page;
|
|
|
+ //将录入的数据导过来
|
|
|
+ if(_self.pageStockOutPrepateTemplates != null && _self.pageStockOutPrepateTemplates.length > 0) {
|
|
|
+ for(var j = 0; j < _self.pageStockOutPrepateTemplates.length; j++) {
|
|
|
+ var index = _self.pageStockOutPrepateTemplates[j].index;
|
|
|
+ _self.stockOutPrepateTemplates[index].pickQuantity = _self.pageStockOutPrepateTemplates[j].pickQuantity;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //清空这样显示数据
|
|
|
+ _self.pageStockOutPrepateTemplates.splice(0, _self.pageStockOutPrepateTemplates.length);
|
|
|
+
|
|
|
+ //重新生成另一页的数据
|
|
|
+ for(var i = 0; i < _self.stockOutPrepateTemplates.length; i++) {
|
|
|
+ if(i >= start && i < end) {
|
|
|
+ var obj = {
|
|
|
+ inventoryName: _self.stockOutPrepateTemplates[i].inventoryName,
|
|
|
+ inventoryNo: _self.stockOutPrepateTemplates[i].inventoryNo,
|
|
|
+ inventoryType: _self.stockOutPrepateTemplates[i].inventoryType,
|
|
|
+ warehouseName: _self.stockOutPrepateTemplates[i].warehouseName,
|
|
|
+ currentStockQuantity: _self.stockOutPrepateTemplates[i].currentStockQuantity,
|
|
|
+ currentStockOutQuantity: _self.stockOutPrepateTemplates[i].currentStockOutQuantity,
|
|
|
+ currentStockCanPickQuantity: _self.stockOutPrepateTemplates[i].currentStockCanPickQuantity,
|
|
|
+ quantity: _self.stockOutPrepateTemplates[i].quantity,
|
|
|
+ pickQuantity: _self.stockOutPrepateTemplates[i].pickQuantity,
|
|
|
+ index: i,
|
|
|
+ };
|
|
|
+ _self.pageStockOutPrepateTemplates.push(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- loadSelectPositionAfter() {
|
|
|
- this.loading = true;
|
|
|
- $.ajax({
|
|
|
- url: Common.getApiURL('positionResource/queryByCondition'),
|
|
|
- type: 'get',
|
|
|
- beforeSend: request => Common.addTokenToRequest(request),
|
|
|
- success: data => {
|
|
|
- this.loading = false;
|
|
|
- if (data.errorCode === 0) {
|
|
|
- this.positionAfters = data.datas.map(item => ({
|
|
|
- positionId: item.positionId,
|
|
|
- positionNo: item.positionNo,
|
|
|
- }));
|
|
|
+
|
|
|
+ //清空
|
|
|
+ clear:function(){
|
|
|
+ var _self = this;
|
|
|
+ //清空这样显示数据
|
|
|
+ _self.pageStockOutPrepateTemplates.splice(0, _self.pageStockOutPrepateTemplates.length);
|
|
|
+ //清空记录数据
|
|
|
+ _self.stockOutPrepateTemplates.splice(0, _self.stockOutPrepateTemplates.length);
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //提交
|
|
|
+ save: function() {
|
|
|
+ var currentStock = [];
|
|
|
+ var num = 0;
|
|
|
+ var num3 = 0;
|
|
|
+ var num5 = 0;
|
|
|
+ var _self = this;
|
|
|
+ _self.getDatas();
|
|
|
+ this.stockOutPrepateTemplates.forEach(function(item) {
|
|
|
+
|
|
|
+ if(item.pickQuantity == undefined || item.pickQuantity == '') {
|
|
|
+ num++;
|
|
|
+ }
|
|
|
+ if(item.pickQuantity <= 0 && item.currentStockCanPickQuantity > 0) {
|
|
|
+ num5++;
|
|
|
+ }
|
|
|
+ if(item.pickQuantity > item.currentStockCanPickQuantity) {
|
|
|
+ num3++;
|
|
|
+ } else {
|
|
|
+ currentStock.push(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ if(_self.projectItemId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择项目事件', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.warehouseId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择仓库', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(_self.stockOutPrepateTemplateId == undefined) {
|
|
|
+ Common.showDialog('提示', '请选择需求模板', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(num > 0) {
|
|
|
+ Common.showDialog('提示', '请填写领用数量', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(num3 > 0) {
|
|
|
+ Common.showDialog('提示', '领用数量大于可领数量', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(num5 > 0) {
|
|
|
+ Common.showDialog('提示', '填写的领用数量必须大于零', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var param = {
|
|
|
+ projectItemId: _self.projectItemId,
|
|
|
+ warehouseId: _self.warehouseId,
|
|
|
+ stockOutPrepateTemplateId: _self.stockOutPrepateTemplateId,
|
|
|
+ pickingCarDtoList: currentStock,
|
|
|
+ };
|
|
|
+ _self.loading=true;
|
|
|
+ if(currentStock.length > 0) {
|
|
|
+
|
|
|
+
|
|
|
+ StockOutPrepareResource.saveByTemplate(param).then(successData =>{
|
|
|
+ if(successData.errorCode == 0) {
|
|
|
+ Notify.success('成功', '领料成功', 4000);
|
|
|
+ //清空这样显示数据
|
|
|
+ _self.pageStockOutPrepateTemplates.splice(0, _self.pageStockOutPrepateTemplates.length);
|
|
|
+ _self.stockOutPrepateTemplates.splice(0,_self.stockOutPrepateTemplates.length);
|
|
|
+ _self.loading=false;
|
|
|
+ } else {
|
|
|
+ Notify.error('提示', successData.errorMessage, false);
|
|
|
+ return;
|
|
|
}
|
|
|
- },
|
|
|
- error: errorData => {
|
|
|
- this.loading = false;
|
|
|
+ },errorData =>{
|
|
|
+ _self.loading=false;
|
|
|
Common.processException(errorData);
|
|
|
- },
|
|
|
- });
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ _self.loading=false;
|
|
|
+ Common.showDialog('提示', '请选择要提交的内容', 'error');
|
|
|
+ }
|
|
|
},
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.adjust-positions-container {
|
|
|
- padding: 24px;
|
|
|
+.form-inline .form-group label {
|
|
|
+ width: 80px;
|
|
|
+ text-align: right;
|
|
|
+ padding-right: 5px;
|
|
|
}
|
|
|
|
|
|
-.search-form {
|
|
|
- margin-bottom: 24px;
|
|
|
+.form-inline .form-group input,
|
|
|
+.form-inline .form-group select {
|
|
|
+ width: 200px;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .flex-container {
|
|
|
+ display: flex;
|
|
|
+ /* 垂直*/
|
|
|
+ flex-direction: column;
|
|
|
+ width: 100%;
|
|
|
+ /*视口被均分为100单位的vh 占据整个窗口,扣掉顶部topNav的距离后,计算得到container的高度*/
|
|
|
+ height: calc(100vh - 85px);
|
|
|
+ }
|
|
|
+
|
|
|
+ .flex-header {
|
|
|
+ height: 200px;
|
|
|
+ /*放大缩小比例为0 */
|
|
|
+ flex: 0 0 100px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .flex-footer {
|
|
|
+ margin-top: 0.8em;
|
|
|
+ height: 35px;
|
|
|
+ /*放大缩小比例为0 */
|
|
|
+ flex: 0 0 35px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .flex-content {
|
|
|
+ margin-top: 0.8em;
|
|
|
+ flex: 1;
|
|
|
+ overflow: scroll;
|
|
|
+ width: 100%;
|
|
|
+ height: 0;
|
|
|
+ }
|
|
|
+</style>
|
|
|
+<style scoped>
|
|
|
+.fixed-table {
|
|
|
+ table-layout: fixed;
|
|
|
+ width: 800px !important;
|
|
|
+ min-width: 800px !important;
|
|
|
}
|
|
|
|
|
|
-.image {
|
|
|
- width: 40px;
|
|
|
- height: 40px;
|
|
|
+table.fixed-table tr {
|
|
|
+ height: 40px;
|
|
|
}
|
|
|
|
|
|
-.modal-footer {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- margin-top: 24px;
|
|
|
+table.fixed-table th,
|
|
|
+table.fixed-table td {
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
}
|
|
|
</style>
|