|
@@ -12,6 +12,7 @@
|
|
|
import api from "@/api/order";
|
|
|
import BusinessType from "./components/businessType.vue";
|
|
|
import towInOne from "../warehousing/components/towInOne.vue";
|
|
|
+ import stockLook from "./components/stockLook.vue";
|
|
|
@Component
|
|
|
export default class OrderTask extends Vue {
|
|
|
// 左边
|
|
@@ -239,12 +240,18 @@
|
|
|
},
|
|
|
columns:
|
|
|
[{
|
|
|
- width: 278,
|
|
|
+ width: 200,
|
|
|
title: '物料名称',
|
|
|
field: 'materialName',
|
|
|
+ fixed: 'left'
|
|
|
},
|
|
|
{
|
|
|
- width: 200,
|
|
|
+ width: 70,
|
|
|
+ title: '库存查看',
|
|
|
+ component: stockLook,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 80,
|
|
|
title: '财务编号',
|
|
|
field: 'financeSuborderId',
|
|
|
},
|
|
@@ -258,22 +265,22 @@
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 70,
|
|
|
title: '单位',
|
|
|
field: 'unit',
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ width: 70,
|
|
|
title: '单位编码',
|
|
|
field: 'unitCode',
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 80,
|
|
|
title: '库存',
|
|
|
field: 'inventory',
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 90,
|
|
|
title: '数量',
|
|
|
field: 'number',
|
|
|
component: 'by-input',
|
|
@@ -286,17 +293,17 @@
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 80,
|
|
|
title: '应出数量',
|
|
|
field: 'deliveryNumber',
|
|
|
},
|
|
|
{
|
|
|
- width: 110,
|
|
|
+ width: 80,
|
|
|
title: '出库数量',
|
|
|
field: 'outNumber',
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 90,
|
|
|
title: '单价',
|
|
|
field: 'unitPrice',
|
|
|
component: 'by-input',
|
|
@@ -308,17 +315,17 @@
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 80,
|
|
|
title: '优惠金额',
|
|
|
field: 'prePrice',
|
|
|
},
|
|
|
{
|
|
|
- width: 100,
|
|
|
+ width: 90,
|
|
|
title: '合计金额',
|
|
|
field: 'totalPrice',
|
|
|
},
|
|
|
{
|
|
|
- width: 90,
|
|
|
+ width: 70,
|
|
|
title: '操作',
|
|
|
action: true,
|
|
|
plugins: [{
|
|
@@ -364,14 +371,24 @@
|
|
|
tools: {
|
|
|
search: true,
|
|
|
refresh: true
|
|
|
- }
|
|
|
+ },
|
|
|
+ customTools: [
|
|
|
+ {
|
|
|
+ name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
|
|
|
+ click: () => {
|
|
|
+ (this as any).syncSystem()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
},
|
|
|
table: {
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
seq: true,
|
|
|
align: 'left',
|
|
|
- checkbox: true
|
|
|
+ checkbox: true,
|
|
|
+ triggerRowCheck: 'row'
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
@@ -475,7 +492,8 @@
|
|
|
size: 'mini',
|
|
|
seq: true,
|
|
|
align: 'left',
|
|
|
- checkbox: true
|
|
|
+ checkbox: true,
|
|
|
+ triggerRowCheck: 'row'
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
@@ -600,7 +618,8 @@
|
|
|
size: 'mini',
|
|
|
seq: true,
|
|
|
align: 'left',
|
|
|
- checkbox: true
|
|
|
+ checkbox: true,
|
|
|
+ triggerRowCheck: 'row'
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
@@ -699,9 +718,7 @@
|
|
|
table: {
|
|
|
attr: {
|
|
|
size: 'mini',
|
|
|
- seq: true,
|
|
|
align: 'left',
|
|
|
- checkbox: true
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
@@ -777,7 +794,6 @@
|
|
|
api.single({ id: parentData[0].id }, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
parentData = res.data ? [res.data] : parentData;
|
|
|
- console.log(parentData);
|
|
|
parentData = parentData.map((item : any) => {
|
|
|
item.receiveAddress = item.address
|
|
|
item.receive = item.consignee
|
|
@@ -786,15 +802,14 @@
|
|
|
return newData
|
|
|
})
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ parentData[0].suborderList = parentData[0].suborderList.filter((v : any) => (v.number - v.outNumber) > 0);
|
|
|
parentData[0].suborderList.map((v : any) => {
|
|
|
v.deliveryNumber = v.number - v.outNumber;
|
|
|
- console.log(v.deliveryNumber);
|
|
|
if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
|
|
|
});
|
|
|
this.tableData = parentData[0].suborderList;
|
|
|
billConfig.tool.tools = { save: true, smt: true };
|
|
|
// console.log('this.tableData ==> ', this.tableData);
|
|
|
- // billConfig.tool.tools = { save: true };
|
|
|
this.isAdd = true;
|
|
|
(this.$refs.bill as any).showTab = 'bill';
|
|
|
loading.close();
|
|
@@ -821,10 +836,10 @@
|
|
|
}
|
|
|
// 同步出库单到财务系统
|
|
|
syncSystem() {
|
|
|
- let selectData = (this as any).$refs.bill.getTableSelectData('all');
|
|
|
+ let selectData = (this as any).$refs.bill.getTableSelectData(this.tabType);
|
|
|
if (selectData.length > 0) {
|
|
|
if (selectData.length > 1) return this.$message.warning('只能同步一条数据');
|
|
|
- if (selectData[0].submitState != 1) return this.$message.warning('只能同步已提交数据');
|
|
|
+ // if (selectData[0].submitState != 1) return this.$message.warning('只能同步已提交数据');
|
|
|
this.$confirm('确定同步订单吗', '注意', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -836,8 +851,7 @@
|
|
|
loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('同步订单成功');
|
|
|
- this.getDataList();
|
|
|
- (this.$refs.bill as any).showTab = 'all';
|
|
|
+ this.clickTab(this.tabType);
|
|
|
} else this.$message.error(res.msg)
|
|
|
}).catch(() => loading.close());
|
|
|
}).catch(() => this.$message.info('已取消同步订单'));
|
|
@@ -902,7 +916,7 @@
|
|
|
}
|
|
|
// 切换tab栏
|
|
|
clickTab(e : any) {
|
|
|
- console.log('切换tab ==> ', e);
|
|
|
+ // console.log('切换tab ==> ', e);
|
|
|
this.tabType = e;
|
|
|
(this.$refs.bill as any).showTab = e;
|
|
|
// submitState: 提交状态
|
|
@@ -954,34 +968,42 @@
|
|
|
}]
|
|
|
})
|
|
|
};
|
|
|
- billConfig.form.attr.readonly = false; // 设置只读
|
|
|
- billConfig.tool.tools = { save: true, };
|
|
|
- if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
|
|
|
- let data : any = parentData.suborderList;
|
|
|
- let array : any = [];
|
|
|
- data.map((v : any) => {
|
|
|
- v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
|
|
|
- array.push({
|
|
|
- storidId: v.storingLocationId,
|
|
|
- skuid: v.materialSku,
|
|
|
- })
|
|
|
- });
|
|
|
- // 查库存
|
|
|
- api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- let newData : any = [];
|
|
|
- res.data.map((v : any, i : any) => {
|
|
|
- newData.push(Object.assign(data[i], v))
|
|
|
- })
|
|
|
- // console.log('newData', newData);
|
|
|
- this.tableData = newData;
|
|
|
- (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
- (this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
|
|
|
- (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
|
|
|
- this.isAdd = false;
|
|
|
- this.dataId = '';
|
|
|
- (this.$refs.bill as any).showTab = 'bill';
|
|
|
- loading.close();
|
|
|
+ billConfig.tool.tools = { save: true, smt: true };
|
|
|
+ // 查销售订单数据
|
|
|
+ api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
|
|
|
+ if (val.code === 200) {
|
|
|
+ parentData.suborderList.map((v : any, i : any) => {
|
|
|
+ v.outNumber = val.data.suborderList[i].outNumber;
|
|
|
+ v.prePrice = val.data.suborderList[i].prePrice;
|
|
|
+ });
|
|
|
+ let data : any = parentData.suborderList;
|
|
|
+ let array : any = [];
|
|
|
+ data.map((v : any) => {
|
|
|
+ v.deliveryNumber = v.number - v.outNumber;
|
|
|
+ if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
|
|
|
+ v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
|
|
|
+ array.push({
|
|
|
+ storidId: v.storingLocationId,
|
|
|
+ skuid: v.materialSku,
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // 查库存
|
|
|
+ api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ let newData : any = [];
|
|
|
+ res.data.map((v : any, i : any) => {
|
|
|
+ newData.push(Object.assign(data[i], v))
|
|
|
+ })
|
|
|
+ this.tableData = newData;
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
+ this.dataId = '';
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ loading.close();
|
|
|
+ } else loading.close();
|
|
|
+ }).catch(() => loading.close());
|
|
|
} else loading.close();
|
|
|
}).catch(() => loading.close());
|
|
|
} else {
|
|
@@ -993,38 +1015,46 @@
|
|
|
}
|
|
|
// 设置只读
|
|
|
setReadonly(e : any) {
|
|
|
+ let parentData : any = e;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
readonly.form.attr.readonly = true; // 设置只读
|
|
|
readonly.tool.tools = {};
|
|
|
if (this.tabType != 'recycleBin') {
|
|
|
- if (e.submitState === 1) readonly.tool.tools = { returnSmt: true };
|
|
|
+ if (parentData.submitState === 1) readonly.tool.tools = { returnSmt: true };
|
|
|
}
|
|
|
readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
|
|
|
- let data = e.suborderList;
|
|
|
- let array : any = [];
|
|
|
- data.map((v : any) => {
|
|
|
- v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
|
|
|
- array.push({
|
|
|
- storidId: v.storingLocationId,
|
|
|
- skuid: v.materialSku,
|
|
|
- })
|
|
|
- });
|
|
|
- // 查库存
|
|
|
- api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
- loading.close();
|
|
|
- if (res.code === 200) {
|
|
|
- let newData : any = []
|
|
|
- res.data.map((v : any, i : any) => {
|
|
|
- newData.push(Object.assign(data[i], v))
|
|
|
- })
|
|
|
- this.tableData = newData;
|
|
|
- (this.$refs.bill as any).setBillConfig(readonly);
|
|
|
- (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
|
- (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
|
|
|
- this.isAdd = false;
|
|
|
- (this.$refs.bill as any).showTab = 'bill';
|
|
|
- }
|
|
|
+ api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
|
|
|
+ if (val.code === 200) {
|
|
|
+ parentData.suborderList.map((v : any, i : any) => {
|
|
|
+ v.prePrice = val.data.suborderList[i].prePrice;
|
|
|
+ });
|
|
|
+ let data = parentData.suborderList;
|
|
|
+ let array : any = [];
|
|
|
+ data.map((v : any) => {
|
|
|
+ v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
|
|
|
+ array.push({
|
|
|
+ storidId: v.storingLocationId,
|
|
|
+ skuid: v.materialSku,
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // 查库存
|
|
|
+ api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ let newData : any = []
|
|
|
+ res.data.map((v : any, i : any) => {
|
|
|
+ newData.push(Object.assign(data[i], v))
|
|
|
+ })
|
|
|
+ this.tableData = newData;
|
|
|
+ (this.$refs.bill as any).setBillConfig(readonly);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
+ loading.close();
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ } else loading.close();
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ } else loading.close();
|
|
|
}).catch(() => loading.close());
|
|
|
}
|
|
|
// 工具栏提交
|