This commit is contained in:
2021-06-04 17:04:03 +00:00
parent 3f49fec705
commit 0ddd0a1c13

View File

@@ -378,10 +378,53 @@ export default {
}
},
methods: {
doRequest(){
doRequest() {
//todo: remove the requestAmountViz and error on edit of partid, warehouse or quantity to prevent ordering the wrong part here if they click on the button after editing those things
const requestQuantity = this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].requestAmountViz;
if (requestQuantity != null && requestQuantity > 0) {
//change the partquantity
this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].quantity =
this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex]
.quantity - requestQuantity;
//add a request record
this.value.items[this.activeWoItemIndex].partRequests.push({
id: 0,
concurrency: 0,
partId: this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].partId,
partViz: this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].partViz,
partWarehouseId: this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].partWarehouseId,
partWarehouseViz: this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].partWarehouseViz,
quantity: requestQuantity,
isDirty: true,
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
uid: Date.now() //used for error tracking / display
});
this.$emit("change");
//clear the error but leave dirty
this.value.items[this.activeWoItemIndex].parts[
this.activeItemIndex
].requestAmountViz = null;
this.fieldValueChanged(`Items[${this.activeWoItemIndex}].parts[
${this.activeItemIndex}
].quantity`);
//let user save it
}
},
warehouseChange(newName) {