|
|
|
import { Action, 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';
|
|
|
|
|
|
|
|
class OrderInInfo {
|
|
|
|
stoAmount?: 0;
|
|
|
|
stoNo?: string; //STO采购单号
|
|
|
|
orderAmount?: string; //单据总数
|
|
|
|
Allocated?: string; //已分配
|
|
|
|
Unallocated?: string; //未分配
|
|
|
|
}
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
namespaced: true,
|
|
|
|
dynamic: true,
|
|
|
|
store,
|
|
|
|
name: 'product.outbound.stoOutbound',
|
|
|
|
})
|
|
|
|
export class ReturningModule extends VuexModule {
|
|
|
|
/**
|
|
|
|
* 月台列表
|
|
|
|
*/
|
|
|
|
returningTypeList: any[] = [];
|
|
|
|
/**
|
|
|
|
* 物料列表
|
|
|
|
*/
|
|
|
|
materielList: any[] = [];
|
|
|
|
locationCodeList: any[] =[];
|
|
|
|
//条码扫描的返回的结果
|
|
|
|
oneMaterielDetail: any = {};
|
|
|
|
/**
|
|
|
|
* 订单号查询结果
|
|
|
|
*/
|
|
|
|
orderInInfo: OrderInInfo = new OrderInInfo();
|
|
|
|
//记账按钮的code码
|
|
|
|
code = '';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 委外出库单号查询
|
|
|
|
* @param orderNo
|
|
|
|
*/
|
|
|
|
@Action
|
|
|
|
async queryOrder(form:any) {
|
|
|
|
const result = await http.post(url.material.commission.goOut.queryOrder, {
|
|
|
|
...form,
|
|
|
|
loginName: session.loginName,
|
|
|
|
factoryCode:session.factoryCode
|
|
|
|
});
|
|
|
|
const orderInInfo = result.data.records[0] || {};
|
|
|
|
return { orderInInfo };
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 库位
|
|
|
|
*/
|
|
|
|
@MutationAction
|
|
|
|
async queryByFactoryCodeAndWorkAreaCode() {
|
|
|
|
const list: [] = await http.post(url.material.commission.goOut.queryByFactoryCodeAndWorkAreaCode, {
|
|
|
|
factoryCode: session.factoryCode,
|
|
|
|
whCode: session.warehouseCode,
|
|
|
|
loginName: session.loginName,
|
|
|
|
});
|
|
|
|
const locationCodeList = list.map((item: any) => ({
|
|
|
|
label: item.locationCode,
|
|
|
|
value: item.locationCode,
|
|
|
|
}));
|
|
|
|
return { locationCodeList };
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 扫条码
|
|
|
|
*/
|
|
|
|
@Action
|
|
|
|
async tluSubmit(list: any[]) {
|
|
|
|
const obj = {
|
|
|
|
barcode: list[0].barCode,
|
|
|
|
loginName: session.loginName,
|
|
|
|
};
|
|
|
|
let oneMaterielDetail: any = {};
|
|
|
|
const { data }: any = await http.post(url.outbound.stoOutbound.checkScan, obj);
|
|
|
|
console.log('shneme a ', data.records);
|
|
|
|
oneMaterielDetail = data.records[0];
|
|
|
|
data.records[0].materialCode = list[0].productCode;
|
|
|
|
data.records[0].materialDesc = list[0].productDescZh;
|
|
|
|
console.log('aaaaa', oneMaterielDetail);
|
|
|
|
return oneMaterielDetail;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 确认按钮
|
|
|
|
* @param orderNo
|
|
|
|
*/
|
|
|
|
@MutationAction
|
|
|
|
async confirm(list: any[]) {
|
|
|
|
const { code, data } = await http.post(url.outbound.stoOutbound.Bookkeeping, list);
|
|
|
|
console.log('res数据', data, code);
|
|
|
|
// if (code == '1') {
|
|
|
|
// uni.showToast({ icon: 'success', title: msg });
|
|
|
|
// } else {
|
|
|
|
// uni.showToast({ icon: 'none', title: msg });
|
|
|
|
// }
|
|
|
|
const materielList: any = [];
|
|
|
|
return { code, materielList };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default getModule(ReturningModule);
|