You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.4 KiB
TypeScript

import { getModule, Module, MutationAction, VuexModule } from 'vuex-module-decorators';
import store from '@/store';
import http from '@/utils/request';
import { url } from '@/utils/url';
import { session } from '@/store/modules/session';
import vm from '@/main';
// import { order } from '@/pages/raw/handover/kan-dan/model';
class OrderInInfo {
stoAmount?: 0;
stoNo?: string; //STO采购单号
orderAmount?: string; //单据总数
Allocated?: string; //已分配
Unallocated?: string; //未分配
}
@Module({
namespaced: true,
dynamic: true,
store,
name: 'Semi-finished-offline',
})
export class PickingModule extends VuexModule {
/**
* 库位列表
*/
returningTypeList: any[] = [];
firstLocation: any = {};
searchCode: any = '';
/**
* 物料列表
*/
materielList: any = [];
/**
* 条码查询结果
*/
orderInInfo: OrderInInfo = new OrderInInfo();
//确认按钮的code码
code = '';
//data
data: any = {};
/**
* 查询库位列表
*/
@MutationAction
async queryReturningTypeList() {
const data: any = await http.get(url.inbound.finishProductOffline.kuwei, {
params: {
factoryCode: session.factoryCode,
loginName: session.loginName,
warehouseCode: session.warehouseCode, //仓库编码
},
});
console.log('data', data.data);
const returningTypeList = data.data.map((item: any) => ({
label: item.locationCode,
value: item.locationCode + '(' + item.sendSpot + ')',
}));
const firstLocation = returningTypeList[0];
// const firstLocation = data.data[0];
// firstLocation.label = firstLocation.locationCode;
// firstLocation.value = firstLocation.locationCode + '(' + firstLocation.sendSpot + ')';
return { returningTypeList, firstLocation };
}
//根据扫描的条码推荐库位
@MutationAction
async queryTypeList(prodCode: any) {
const res: any = await http.post(url.inbound.finishProductOffline.SearchKuwei, {
factoryCode: session.factoryCode,
loginName: session.loginName,
prodCode: prodCode,
});
console.log('data', res.data);
const returningTypeList = res.data.map((item: any) => ({
label: item.locationCode,
value: item.locationCode + '(' + item.sendSpot + ')',
}));
const firstLocation = returningTypeList[0];
return { returningTypeList, firstLocation };
}
/**
* 查询条码号
* @param orderNo
*/
@MutationAction
async queryOrderInInfo(barcode: any) {
const { data, code }: any = await http.post(url.inbound.finishProductOffline.finished, {
barcode,
loginName: session.loginName,
});
const searchCode = code;
const materielList2 = [];
materielList2.push(data);
const materielList = materielList2;
return { searchCode, materielList };
}
@MutationAction
async setSearchCode() {
const searchCode = '';
return { searchCode };
}
/**
* 确认按钮
* @param orderNo
*/
@MutationAction
async confirm(list: any[]) {
const { code, data, msg } = (await http.post(url.inbound.finishProductOffline.batchOffline, list)) as any;
console.log('res数据', code, data, msg);
if (code == '1') {
uni.showToast({
title: msg,
duration: 2000,
image: '/static/icons/icon-51.png',
});
} else {
vm.customToast(msg);
}
return { code, data };
}
}
export default getModule(PickingModule);