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.
194 lines
4.7 KiB
TypeScript
194 lines
4.7 KiB
TypeScript
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[] = [];
|
|
|
|
//条码扫描的返回的结果
|
|
oneMaterielDetail: any = {};
|
|
/**
|
|
* 订单号查询结果
|
|
*/
|
|
orderInInfo: OrderInInfo = new OrderInInfo();
|
|
//记账按钮的code码
|
|
code = "";
|
|
/**
|
|
* 查询月台列表
|
|
*/
|
|
@MutationAction
|
|
async queryReturningTypeList() {
|
|
const list: [] = await http.post(url.outbound.stoOutbound.yuetaiType, {
|
|
factoryCode: session.factoryCode,
|
|
whCode: session.warehouseCode,
|
|
loginName: session.loginName,
|
|
});
|
|
const returningTypeList = list.map((item: any) => ({
|
|
label: item.dockName,
|
|
value: item.dockCode,
|
|
}));
|
|
return { returningTypeList };
|
|
}
|
|
|
|
/**
|
|
* 查询订单号
|
|
* @param orderNo
|
|
*/
|
|
@MutationAction
|
|
async queryOrderInInfo(nxOutCode: string) {
|
|
const result = await http.post(url.outbound.stoOutbound.info, {
|
|
nxOutCode,
|
|
deleteFlag: 2,
|
|
finalState: 3,
|
|
loginName: session.loginName,
|
|
});
|
|
let stoAmount = 0;
|
|
result.data.records.forEach((item: any) => {
|
|
stoAmount += item.orderAmount;
|
|
});
|
|
const materielList = result.data.records.map((item: any) => ({
|
|
label: item.materialCode,
|
|
value: item.stoItem,
|
|
...item,
|
|
}));
|
|
console.log("materielList", materielList);
|
|
if (result.data.records[0]) {
|
|
result.data.records[0].stoAmount = stoAmount;
|
|
}
|
|
const orderInInfo = result.data.records[0] || {};
|
|
return { orderInInfo, materielList };
|
|
}
|
|
/**
|
|
* 查询订单号
|
|
* @param nxOutCode
|
|
*/
|
|
@MutationAction
|
|
async findProdInfoByDN(nxOutCode: string) {
|
|
const result = await http.post(url.outbound.stoOutbound.findProdInfoByDN, {
|
|
nxOutCode,
|
|
loginName: session.loginName,
|
|
factoryCode: session.factoryCode,
|
|
});
|
|
let stoAmount = 0;
|
|
result.data.forEach((item: any) => {
|
|
stoAmount += item.orderAmount;
|
|
});
|
|
const materielList = result.data.map((item: any) => ({
|
|
label: item.materialCode,
|
|
value: item.stoItem,
|
|
...item,
|
|
}));
|
|
console.log("materielList", materielList);
|
|
if (result.data[0]) {
|
|
result.data[0].stoAmount = stoAmount;
|
|
}
|
|
const orderInInfo = result.data[0] || {};
|
|
return { orderInInfo, materielList };
|
|
}
|
|
|
|
/**
|
|
* 扫条码
|
|
*/
|
|
@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;
|
|
}
|
|
/**
|
|
* 扫条码
|
|
*/
|
|
@Action
|
|
async getMaterialByCode(list: any = {}) {
|
|
let oneMaterielDetail: any = {};
|
|
const { data }: any = await http.post(
|
|
url.outbound.stoOutbound.getMaterialByCode,
|
|
list
|
|
);
|
|
oneMaterielDetail = data.records[0];
|
|
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 };
|
|
}
|
|
/**
|
|
* 确认按钮
|
|
* @param orderNo
|
|
*/
|
|
@MutationAction
|
|
async confirmMove(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);
|