|
@@ -4,18 +4,15 @@
|
|
|
@resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
|
|
|
@pagination="pagination" @onReturnSmt="onReturnSmt2" @getSupplierModal="getSupplierModal">
|
|
|
</by-bill>
|
|
|
- <!-- 选择物料 -->
|
|
|
- <productModal ref="product" :mulit="true" @confirm="confirmProduct" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
import api from "@/api/order";
|
|
|
- import productModal from "../orderTask/components/productModal.vue";
|
|
|
import BusinessType from "./components/businessType.vue";
|
|
|
import towInOne from "../warehousing/components/towInOne.vue";
|
|
|
- @Component({ components: { productModal } })
|
|
|
+ @Component
|
|
|
export default class OrderTask extends Vue {
|
|
|
// 左边
|
|
|
tabType : any = 'all';
|
|
@@ -188,8 +185,8 @@
|
|
|
},
|
|
|
{
|
|
|
span: 8,
|
|
|
- label: 'WMS编号',
|
|
|
- prop: 'wmsId',
|
|
|
+ label: '财务编号',
|
|
|
+ prop: 'financeOrderId',
|
|
|
component: 'by-input',
|
|
|
compConfig: {
|
|
|
attr: {
|
|
@@ -203,6 +200,17 @@
|
|
|
prop: 'businessType',
|
|
|
component: BusinessType,
|
|
|
},
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: 'WMS编号',
|
|
|
+ prop: 'wmsId',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ readonly: true,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
],
|
|
|
[
|
|
|
{
|
|
@@ -577,7 +585,14 @@
|
|
|
(this as any).onDelete('all')
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
|
|
|
+ click: () => {
|
|
|
+ (this as any).syncSystem()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
]
|
|
|
},
|
|
|
table: {
|
|
@@ -755,24 +770,25 @@
|
|
|
}, 500)
|
|
|
}
|
|
|
// 引单
|
|
|
- citationOrder(e : any) {
|
|
|
+ citationOrder() {
|
|
|
let parentData : any = (this as any).$refs.bill.getSourceTableSelectData(0);
|
|
|
if (parentData.length <= 0) return this.$message.warning('请选择引单数据');
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.single({ id: parentData[0].id }, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
parentData = res.data ? [res.data] : parentData;
|
|
|
- parentData = parentData.map((item : any, i : any) => {
|
|
|
+ console.log(parentData);
|
|
|
+ parentData = parentData.map((item : any) => {
|
|
|
item.receiveAddress = item.address
|
|
|
item.receive = item.consignee
|
|
|
item.receivePhone = item.phone
|
|
|
- item.outOrderNo = item.orderNumber
|
|
|
- const { ...newData } = item
|
|
|
+ const { financeOrderId, ...newData } = item
|
|
|
return newData
|
|
|
})
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
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;
|
|
@@ -803,13 +819,37 @@
|
|
|
e.totalPrice = e.realityPrice - e.prePrice;
|
|
|
|
|
|
}
|
|
|
+ // 同步出库单到财务系统
|
|
|
+ syncSystem() {
|
|
|
+ let selectData = (this as any).$refs.bill.getTableSelectData('all');
|
|
|
+ if (selectData.length > 0) {
|
|
|
+ if (selectData.length > 1) return this.$message.warning('只能同步一条数据');
|
|
|
+ if (selectData[0].submitState != 1) return this.$message.warning('只能同步已提交数据');
|
|
|
+ this.$confirm('确定同步订单吗', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
+ api.addOutStock({ ids: selectData[0].id }).then((res : any) => {
|
|
|
+ loading.close();
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('同步订单成功');
|
|
|
+ this.getDataList();
|
|
|
+ (this.$refs.bill as any).showTab = 'all';
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
+ }).catch(() => loading.close());
|
|
|
+ }).catch(() => this.$message.info('已取消同步订单'));
|
|
|
+ } else this.$message.warning('请选择同步数据');
|
|
|
+ }
|
|
|
// 保存
|
|
|
onSave(e : any) {
|
|
|
console.log('保存 ==>', this.tabType);
|
|
|
(this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
// 子表数据
|
|
|
- // query.suborderList = this.tableData;
|
|
|
+ console.log(query);
|
|
|
query.purchaseOrderId = query.id;
|
|
|
query.suborderList = (this.$refs.bill as any).getBillTableData(0);
|
|
|
if (query.suborderList.length > 0) {
|
|
@@ -827,6 +867,7 @@
|
|
|
query.suborderList.splice(i, 1)
|
|
|
}
|
|
|
});
|
|
|
+ query.financeOrderId = ""
|
|
|
console.log('出库参数query ==> ', query);
|
|
|
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
@@ -883,13 +924,12 @@
|
|
|
}
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
|
- console.log('编辑this.tabType ==>', this.tabType);
|
|
|
- console.log('编辑 ==>', e);
|
|
|
e = e.row ? e.row : e;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
api.single({ id: e.id }, 'supplyOutOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
let parentData = res.data ? res.data : e;
|
|
|
+ console.log('编辑 ==>', parentData);
|
|
|
this.baseInfo = parentData;
|
|
|
if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
if (parentData.submitState === 1) {
|
|
@@ -926,16 +966,14 @@
|
|
|
skuid: v.materialSku,
|
|
|
})
|
|
|
});
|
|
|
- console.log('array', array);
|
|
|
// 查库存
|
|
|
api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
- console.log(res);
|
|
|
let newData : any = [];
|
|
|
res.data.map((v : any, i : any) => {
|
|
|
newData.push(Object.assign(data[i], v))
|
|
|
})
|
|
|
- console.log('newData', newData);
|
|
|
+ // console.log('newData', newData);
|
|
|
this.tableData = newData;
|
|
|
(this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
|
|
@@ -972,7 +1010,6 @@
|
|
|
skuid: v.materialSku,
|
|
|
})
|
|
|
});
|
|
|
- console.log('array', array);
|
|
|
// 查库存
|
|
|
api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
|
|
|
loading.close();
|
|
@@ -981,7 +1018,6 @@
|
|
|
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(readonly);
|
|
|
(this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
@@ -1023,8 +1059,9 @@
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
+ let id = this.dataId ? this.dataId : this.baseInfo.id;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
- api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
|
|
|
+ api.submitTo({ id: id }, 'supplyOutOrder').then((res : any) => {
|
|
|
loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
@@ -1059,9 +1096,8 @@
|
|
|
type: 'warning',
|
|
|
center: true
|
|
|
}).then(() => {
|
|
|
- let id = this.dataId ? this.dataId : this.baseInfo.id;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
- api.submitTo({ id: id }, 'supplyOutOrder').then((res : any) => {
|
|
|
+ api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
|
|
|
loading.close();
|
|
|
if (res.code === 200) {
|
|
|
this.$message.success('提交成功');
|
|
@@ -1239,48 +1275,6 @@
|
|
|
if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
|
|
|
}
|
|
|
}
|
|
|
- // 确定商品新增
|
|
|
- confirmProduct(e : any) {
|
|
|
- let nowData = (this.$refs.bill as any).getBillTableData(0);
|
|
|
- let names = '';
|
|
|
- if (e.length > 0) {
|
|
|
- for (const item of e) {
|
|
|
- let t = true;
|
|
|
- for (const t_item of nowData) {
|
|
|
- if (item.id == t_item.materialSku) {
|
|
|
- if (!names) {
|
|
|
- names = item.skuTitle
|
|
|
- } else {
|
|
|
- names = names + ',' + item.skuTitle
|
|
|
- }
|
|
|
- t = false;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (t) {
|
|
|
- let obj : any = {};
|
|
|
- obj.materialName = item.skuTitle
|
|
|
- obj.materialId = item.materialId
|
|
|
- obj.prePrice = 0
|
|
|
- obj.unitPrice = item.price
|
|
|
- obj.materialSku = item.id
|
|
|
- obj.unit = item.unit
|
|
|
- obj.unitCode = item.unitCode
|
|
|
- obj.financeSuborderId = item.financialCode
|
|
|
- obj.prePrice = "0"
|
|
|
- obj.isDeleted = 0
|
|
|
- this.tableData.push(obj);
|
|
|
- nowData.push(obj);
|
|
|
- }
|
|
|
- }
|
|
|
- (this.$refs.bill as any).setBillTableValue(nowData, 0);// 设置第1张单据表格数据
|
|
|
- if (names) {
|
|
|
- this.$alert('商品 “' + names + '”已存在!', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
// 单据表格删除
|
|
|
changeTable(item : any) {
|
|
|
this.$confirm('确定删除吗!', '注意', {
|