|
@@ -0,0 +1,446 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <!-- import CSS -->
|
|
|
+ <link rel="stylesheet" href="../../css/index.css">
|
|
|
+ <!-- import Vue before Element -->
|
|
|
+ <script src="../../js/vue.js"></script>
|
|
|
+ <!-- import JavaScript -->
|
|
|
+ <script src="../../js/index.js"></script>
|
|
|
+ <script src="../../js/axios.js"></script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div id="app" v-cloak>
|
|
|
+ <div style="padding: 20px;">
|
|
|
+ <el-form :inline="true" :model="formInline" class="demo-form-inline">
|
|
|
+ <el-form-item label="入库口">
|
|
|
+ <el-select v-model="entryPoint" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="入库类型">
|
|
|
+ <el-select v-model="detailType" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in detailTypeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-input type="text" v-model="palletCode" placeholder="托盘编码" :disabled="true"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-input type="text" v-model="binCode" placeholder="料箱编码" :disabled="true"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-input type="text" v-model="inputCode" placeholder="扫码顺序 托盘 > 料盒 > 物料编码" style="width: 300px" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="addNewRow()">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="getPalletCode()">空托盘出库</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div style="margin-bottom: 22px">
|
|
|
+ <el-table ref="singleTable" :data="migrationResultList" v-loading="loading" :border=true
|
|
|
+ tooltip-effect="dark"
|
|
|
+ highlight-current-row max-height="500" style="width: 100%;"
|
|
|
+ :default-sort="{prop: 'createDate', order: 'descending'}"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="materialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="planAmount" label="计划入库数量" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="amount" label="本次入库数量" :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-model="scope.row.amount" type="number" @input="handleInput(scope.row)"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="realAmount" label="已入库数量" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="pendingAmount" label="待入库数量" :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ getPendingAmount(scope.row) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <!-- 这里放置操作按钮 -->
|
|
|
+ <el-button type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ <!-- 可以添加更多的操作按钮 -->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-table ref="singleTable" :data="locationList" v-loading="loading" :border=true
|
|
|
+ tooltip-effect="dark"
|
|
|
+ highlight-current-row max-height="500" style="width: 100%;"
|
|
|
+ :default-sort="{prop: 'createDate', order: 'descending'}"
|
|
|
+ @selection-change="handleSelectionChange1">
|
|
|
+
|
|
|
+ <el-table-column prop="outMaterialCode" label="物料编码" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="outLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column label="托盘" :show-overflow-tooltip="true">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-select v-model="row.outPalletCode" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="option in row.locationOptions"
|
|
|
+ :key="option.storageLocationCode"
|
|
|
+ :label="option.palletCode"
|
|
|
+ :value="option.palletCode">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template #default="scope">
|
|
|
+ <!-- 这里放置操作按钮 -->
|
|
|
+ <el-button type="primary" @click="getOutPalletCode(scope.row)">出库</el-button>
|
|
|
+ <!-- 可以添加更多的操作按钮 -->
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ </el-table>
|
|
|
+ <div style="display: flex; justify-content: center;margin-top: 22px">
|
|
|
+ <el-button type="primary" @click="submit()">提交</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+</body>
|
|
|
+
|
|
|
+
|
|
|
+<script type="module">
|
|
|
+ new Vue({
|
|
|
+ el: '#app',
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ migrationResultList: [],
|
|
|
+ locationList: [],
|
|
|
+ name: '',
|
|
|
+ createDate: '',
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0,
|
|
|
+ currentPageSize: 10,
|
|
|
+ pageSizes: [10, 50, 100, 200, 300],
|
|
|
+ loading: false,
|
|
|
+ formInline: {
|
|
|
+ palletCode: '',
|
|
|
+ binCode: '',
|
|
|
+ inputCode: '',
|
|
|
+ },
|
|
|
+ options:[],
|
|
|
+ detailTypeOptions:[],
|
|
|
+ locationOptions:[],
|
|
|
+ entryPoint:'',
|
|
|
+ detailType:'',
|
|
|
+ palletCode: '',
|
|
|
+ binCode: '',
|
|
|
+ inputCode: '',
|
|
|
+ outPallectCode:'',
|
|
|
+ selection: [],
|
|
|
+ id: '',
|
|
|
+ orderType: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ console.log("初始化")
|
|
|
+ //this.queryClick();
|
|
|
+ this.getDic();
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ this.id = urlParams.get('id');
|
|
|
+ console.log(this.id)
|
|
|
+ this.queryClick();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSizeChange(pageSize, total) {
|
|
|
+ this.currentPage = 1;
|
|
|
+ this.currentPageSize = pageSize;
|
|
|
+ this.queryClick();
|
|
|
+ },
|
|
|
+ handleCurrentChange(page) {
|
|
|
+ this.currentPage = page;
|
|
|
+ this.queryClick();
|
|
|
+ },
|
|
|
+ clear() {
|
|
|
+ this.ylCard = '';
|
|
|
+ this.master = '';
|
|
|
+ },
|
|
|
+ queryClick() {
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ axios.get('/order/getOrderById/'+this.id, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ if(response.data.success){
|
|
|
+ const res=response.data.data;
|
|
|
+ this.orderType=res.orderType;
|
|
|
+ this.entryPoint=res.entryPoint.toString();
|
|
|
+ this.detailType=res.detailType.toString();
|
|
|
+
|
|
|
+ //TODO 这里还有问题 这里只考虑的托盘 没有考虑料盒
|
|
|
+ this.palletCode=res.vectorCode;
|
|
|
+ this.migrationResultList=res.detailList;
|
|
|
+ res.detailList.forEach(item=>{
|
|
|
+ this.addOutPalletCode(item.materialCode)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.loading =false;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+ }, getDic() {
|
|
|
+ axios.post('/Dic/list', {
|
|
|
+ 'dicCode': 'entryPoint'
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ this.options = response.data;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+ axios.post('/Dic/list', {
|
|
|
+ 'dicCode': 'detailType'
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ console.log(response)
|
|
|
+ this.detailTypeOptions = response.data;
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+ },handleSelectionChange1(val) {
|
|
|
+ this.multipleSelection = val;
|
|
|
+ },handleSelectionChange(selection) {
|
|
|
+ this.selection = selection
|
|
|
+ },addNewRow() {
|
|
|
+ // Define your new row object
|
|
|
+ const code= this.inputCode
|
|
|
+ //判断输入的是托盘编码 料箱编码 物料编码
|
|
|
+ axios.get('/order/verifyCode/'+code, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ const verify=response.data.data;
|
|
|
+ if(verify === null){
|
|
|
+ this.$message.error('无法识别'+code);
|
|
|
+ this.inputCode='';
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.verifCode(code,verify);
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+ },verifCode(code,verify){
|
|
|
+ //0 物料编码 1 托盘编码 2 料盒编码
|
|
|
+ if(verify === 0){
|
|
|
+ const newRow = {
|
|
|
+ materialCode: code,
|
|
|
+ planAmount: 1,
|
|
|
+ amount: 1,
|
|
|
+ realAmount: 0,
|
|
|
+ };
|
|
|
+ if(this.migrationResultList.length === 0){
|
|
|
+ // Push the new row to migrationResultList
|
|
|
+ this.migrationResultList.push(newRow);
|
|
|
+ this.addOutPalletCode(code);
|
|
|
+ }else{
|
|
|
+ let flag = true;
|
|
|
+ this.migrationResultList.forEach(item => {
|
|
|
+ if (item.materialCode === code) {
|
|
|
+ item.planAmount=item.planAmount+1;
|
|
|
+ item.amount=parseInt(item.amount)+1;
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(flag){
|
|
|
+ this.migrationResultList.push(newRow);
|
|
|
+ this.addOutPalletCode(code);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(verify === 1){
|
|
|
+ this.palletCode=code;
|
|
|
+ }else if(verify === 2){
|
|
|
+ this.binCode=code;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.inputCode='';
|
|
|
+ },getPalletCode(){
|
|
|
+ //入库口 即空托盘出库的目的地
|
|
|
+ const inCode=this.entryPoint;
|
|
|
+ getPalletCodeCon(inCode)
|
|
|
+
|
|
|
+ },getOutPalletCode(row){
|
|
|
+ //入库口 即空托盘出库的目的地
|
|
|
+ const inCode=row.storageLocationCode;
|
|
|
+ getPalletCodeCon(inCode)
|
|
|
+
|
|
|
+ },getPalletCodeCon(inCode){
|
|
|
+ axios.get('/wStorageLocationManagement/getPalletCode/'+inCode, {
|
|
|
+ })
|
|
|
+ .then(response => {
|
|
|
+ if(response.data.success){
|
|
|
+ const code=response.data.data;
|
|
|
+ this.$message({
|
|
|
+ message: '空托盘 '+code +' 已出库',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.$message.error(response.data.data);
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+ },addOutPalletCode(code){
|
|
|
+ const newRow = {
|
|
|
+ outMaterialCode: code,
|
|
|
+ locationOptions:[{
|
|
|
+ palletCode:'',
|
|
|
+ storageLocationCode:''
|
|
|
+ }]
|
|
|
+ };
|
|
|
+ axios.get('/wInventoryManagement/getPalletCode/'+code, {
|
|
|
+ }).then(response => {
|
|
|
+ let palletCodeList=[]
|
|
|
+ if(response.data.success){
|
|
|
+ response.data.data.forEach(item =>{
|
|
|
+ const inv={
|
|
|
+ palletCode:item.palletCode,
|
|
|
+ storageLocationCode:item.storageLocationCode,
|
|
|
+ }
|
|
|
+ palletCodeList.push(inv)
|
|
|
+ })
|
|
|
+ this.$set(newRow, 'locationOptions', palletCodeList);
|
|
|
+ this.$forceUpdate();
|
|
|
+ if(palletCodeList.length > 0){
|
|
|
+ newRow.outLocationCode=palletCodeList[0].storageLocationCode;
|
|
|
+ newRow.outPalletCode=palletCodeList[0].palletCode;
|
|
|
+ this.locationList.push(newRow)
|
|
|
+ }
|
|
|
+ console.log(this.locationList)
|
|
|
+ }else{
|
|
|
+ this.$message.error(response.data.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+ },handleDelete(row) {
|
|
|
+ // 从 migrationResultList 中删除当前行
|
|
|
+ const index = this.migrationResultList.indexOf(row);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.migrationResultList.splice(index, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.locationList = this.locationList.filter(item => item.outMaterialCode !== row.materialCode);
|
|
|
+ },submit(){
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: '至少勾选一行数据',
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.selection.forEach(item=>{
|
|
|
+ if(item.amount === '' || item.amount <= 0){
|
|
|
+ this.$message({
|
|
|
+ message: '本次入库数量不能为空或小于等于0',
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(this.entryPoint ===''){
|
|
|
+ this.$message({
|
|
|
+ message: '入库口不能为空',
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.detailType ===''){
|
|
|
+ this.$message({
|
|
|
+ message: '入库类型不能为空',
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.palletCode ===''){
|
|
|
+ this.$message({
|
|
|
+ message: '托盘编码不能为空',
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const order={
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ axios.post('/order/add', {
|
|
|
+ "id":this.id,
|
|
|
+ "orderType":2,
|
|
|
+ "inOutType":2,
|
|
|
+ "detailType":this.detailType,
|
|
|
+ "status":0,
|
|
|
+ "startPosition":this.entryPoint,
|
|
|
+ "vectorCode":this.palletCode,
|
|
|
+ "binCode":this.binCode,
|
|
|
+ "operation":"edit",
|
|
|
+ "detailList":this.selection
|
|
|
+ }).then(response => {
|
|
|
+ if(response.data.success){
|
|
|
+ window.location.href = "index.html";
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: response.data.msg,
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // 处理错误
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }, getPendingAmount(row) {
|
|
|
+ return row.planAmount - row.realAmount;
|
|
|
+ },handleInput(row){
|
|
|
+ if(this.orderType===2){
|
|
|
+ row.planAmount=row.amount;
|
|
|
+ }
|
|
|
+ if(this.orderType===1 && parseInt(row.amount) > parseInt(row.planAmount)){
|
|
|
+ this.$message({
|
|
|
+ message: "本次入库数量不能大于计划入库数量",
|
|
|
+ type: "error"
|
|
|
+ })
|
|
|
+ row.amount=row.planAmount;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+</script>
|
|
|
+
|
|
|
+</html>
|