This commit is contained in:
@@ -405,32 +405,6 @@ function initNavPanel() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//RESTOCK REQUIRED
|
|
||||||
if (
|
|
||||||
useInventory &&
|
|
||||||
window.$gz.role.canOpen(window.$gz.type.WorkOrderItemPartRequest)
|
|
||||||
) {
|
|
||||||
sub.push({
|
|
||||||
title: "PurchaseOrderUIRestockList",
|
|
||||||
icon: "$ayiClipboardList",
|
|
||||||
route: "/inv-part-restocks",
|
|
||||||
key: key++
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//PART REQUESTS
|
|
||||||
if (
|
|
||||||
useInventory &&
|
|
||||||
window.$gz.role.canOpen(window.$gz.type.WorkOrderItemPartRequest)
|
|
||||||
) {
|
|
||||||
sub.push({
|
|
||||||
title: "WorkOrderItemPartRequestList",
|
|
||||||
icon: "$ayiParachuteBox",
|
|
||||||
route: "/inv-part-requests",
|
|
||||||
key: key++
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//PART ASSEMBLIES
|
//PART ASSEMBLIES
|
||||||
if (window.$gz.role.canOpen(window.$gz.type.PartAssembly)) {
|
if (window.$gz.role.canOpen(window.$gz.type.PartAssembly)) {
|
||||||
sub.push({
|
sub.push({
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ export default {
|
|||||||
"Tags",
|
"Tags",
|
||||||
"Tag",
|
"Tag",
|
||||||
"Customize",
|
"Customize",
|
||||||
"ObjectCustomFieldCustomGrid",
|
"ObjectCustomFieldCustomGrid", //<---wtf? Is this being used?
|
||||||
"RowsPerPage",
|
"RowsPerPage",
|
||||||
"PageOfPageText",
|
"PageOfPageText",
|
||||||
"Loading",
|
"Loading",
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
<template>
|
|
||||||
<v-expansion-panel v-if="available() == true">
|
|
||||||
<v-expansion-panel-header
|
|
||||||
disable-icon-rotate
|
|
||||||
expand-icon="$ayiTruckLoading"
|
|
||||||
>{{ $ay.t("Order restock items") }}</v-expansion-panel-header
|
|
||||||
>
|
|
||||||
<v-expansion-panel-content>
|
|
||||||
<v-row>
|
|
||||||
<v-col cols="12">
|
|
||||||
PurchaseOrderUICopyToPurchaseOrder po selector (variant open ones only
|
|
||||||
or maybe they type the number???) or create new here
|
|
||||||
{{ dataListSelection }}
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-btn icon @click="goHelp()"><v-icon>$ayiQuestionCircle</v-icon></v-btn>
|
|
||||||
<v-btn
|
|
||||||
:disabled="!canDoAction()"
|
|
||||||
color="blue darken-1"
|
|
||||||
text
|
|
||||||
@click="doAction()"
|
|
||||||
:loading="jobActive"
|
|
||||||
>{{ $ay.t("StartJob") }}</v-btn
|
|
||||||
>
|
|
||||||
</v-expansion-panel-content>
|
|
||||||
</v-expansion-panel>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
async created() {
|
|
||||||
let vm = this;
|
|
||||||
await fetchTranslatedText(vm);
|
|
||||||
|
|
||||||
if (vm.dataListSelection.ObjectType != 0) {
|
|
||||||
vm.rights = window.$gz.role.getRights(vm.dataListSelection.ObjectType);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: () => ({
|
|
||||||
jobActive: false,
|
|
||||||
rights: window.$gz.role.defaultRightsObject()
|
|
||||||
}),
|
|
||||||
methods: {
|
|
||||||
goHelp() {
|
|
||||||
window.open(this.$store.state.helpUrl + "ay-ex-restock-po", "_blank");
|
|
||||||
},
|
|
||||||
available() {
|
|
||||||
return (
|
|
||||||
this.dataListSelection.ObjectType ==
|
|
||||||
window.$gz.type.PartInventoryRestock
|
|
||||||
);
|
|
||||||
},
|
|
||||||
canDoAction() {
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
async doAction() {
|
|
||||||
let vm = this;
|
|
||||||
//probably dont' need a prompt, can always delete off po anyway to reverse this
|
|
||||||
// let dialogResult = await window.$gz.dialog.confirmGeneric(
|
|
||||||
// "EraseMultipleObjectsWarning",
|
|
||||||
// "error"
|
|
||||||
// );
|
|
||||||
// if (dialogResult == false) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//Clear any possible prior errors
|
|
||||||
vm.$emit("ext-show-job-log", "clear");
|
|
||||||
|
|
||||||
//do the batch action
|
|
||||||
let url = "purchase-order/batch-add-restock";
|
|
||||||
let body = this.dataListSelection;
|
|
||||||
|
|
||||||
try {
|
|
||||||
//call api route
|
|
||||||
let jobId = await window.$gz.api.upsert(url, body);
|
|
||||||
if (jobId.error) {
|
|
||||||
//throw new Error(jobId.error);
|
|
||||||
throw new Error(window.$gz.errorHandler.errorToString(jobId, vm));
|
|
||||||
}
|
|
||||||
jobId = jobId.jobId; //it's in a sub key
|
|
||||||
//indicate loading by setting on button
|
|
||||||
vm.jobActive = true;
|
|
||||||
|
|
||||||
/* /// <summary>
|
|
||||||
/// Job status for opsjobs
|
|
||||||
/// </summary>
|
|
||||||
public enum JobStatus : int
|
|
||||||
{
|
|
||||||
Absent=0,
|
|
||||||
Sleeping = 1,
|
|
||||||
Running = 2,
|
|
||||||
Completed = 3,
|
|
||||||
Failed = 4
|
|
||||||
} */
|
|
||||||
let jobStatus = 1;
|
|
||||||
//get status
|
|
||||||
|
|
||||||
while (vm.jobActive == true) {
|
|
||||||
await window.$gz.util.sleepAsync(1000);
|
|
||||||
//check if done
|
|
||||||
jobStatus = await window.$gz.api.get(
|
|
||||||
`job-operations/status/${jobId}`
|
|
||||||
);
|
|
||||||
if (jobStatus.error) {
|
|
||||||
throw new Error(
|
|
||||||
window.$gz.errorHandler.errorToString(jobStatus, vm)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
jobStatus = jobStatus.data;
|
|
||||||
if (jobStatus == 4 || jobStatus == 0) {
|
|
||||||
if (jobStatus == 4) {
|
|
||||||
//emit job id and event to parent for log viewing
|
|
||||||
vm.$emit("ext-show-job-log", jobId);
|
|
||||||
}
|
|
||||||
throw new Error("Job failed");
|
|
||||||
}
|
|
||||||
if (jobStatus == 3) {
|
|
||||||
vm.jobActive = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Here if it's completed successfully
|
|
||||||
window.$gz.eventBus.$emit("notify-success", vm.$ay.t("JobCompleted"));
|
|
||||||
vm.$emit("ext-close-refresh");
|
|
||||||
} catch (error) {
|
|
||||||
vm.jobActive = false;
|
|
||||||
|
|
||||||
//window.$gz.errorHandler.handleFormError(error, vm);
|
|
||||||
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
dataListSelection: { type: Object, default: null }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Ensures UI translated text is available
|
|
||||||
//
|
|
||||||
async function fetchTranslatedText(vm) {
|
|
||||||
await window.$gz.translation.cacheTranslations([
|
|
||||||
"PurchaseOrderUICopyToPurchaseOrder"
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
@ext-show-job-log="handleError($event)"
|
@ext-show-job-log="handleError($event)"
|
||||||
:data-list-selection="dataListSelection"
|
:data-list-selection="dataListSelection"
|
||||||
/>
|
/>
|
||||||
<ExtensionRestockPo :data-list-selection="dataListSelection" />
|
|
||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
@@ -43,13 +42,12 @@
|
|||||||
import ExtensionTags from "./extension-tags-control.vue";
|
import ExtensionTags from "./extension-tags-control.vue";
|
||||||
import ExtensionExport from "./extension-export-control.vue";
|
import ExtensionExport from "./extension-export-control.vue";
|
||||||
import ExtensionDelete from "./extension-delete-control.vue";
|
import ExtensionDelete from "./extension-delete-control.vue";
|
||||||
import ExtensionRestockPo from "./extension-restock-po-control.vue";
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ExtensionTags,
|
ExtensionTags,
|
||||||
ExtensionExport,
|
ExtensionExport,
|
||||||
ExtensionDelete,
|
ExtensionDelete
|
||||||
ExtensionRestockPo
|
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
await initForm(this);
|
await initForm(this);
|
||||||
|
|||||||
@@ -454,18 +454,18 @@ export default new Router({
|
|||||||
component: () =>
|
component: () =>
|
||||||
import(/* webpackChunkName: "inv" */ "./views/inv-part-adjustment.vue")
|
import(/* webpackChunkName: "inv" */ "./views/inv-part-adjustment.vue")
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: "/inv-part-requests",
|
// path: "/inv-part-requests",
|
||||||
name: "inv-part-requests",
|
// name: "inv-part-requests",
|
||||||
component: () =>
|
// component: () =>
|
||||||
import(/* webpackChunkName: "inv" */ "./views/inv-part-requests.vue")
|
// import(/* webpackChunkName: "inv" */ "./views/inv-part-requests.vue")
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
path: "/inv-part-restocks",
|
// path: "/inv-part-restocks",
|
||||||
name: "inv-part-restocks",
|
// name: "inv-part-restocks",
|
||||||
component: () =>
|
// component: () =>
|
||||||
import(/* webpackChunkName: "inv" */ "./views/inv-part-restocks.vue")
|
// import(/* webpackChunkName: "inv" */ "./views/inv-part-restocks.vue")
|
||||||
},
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/inv-purchase-orders",
|
path: "/inv-purchase-orders",
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<template>
|
|
||||||
<UnderConstruction data-cy="underconstruction" />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import UnderConstruction from "../components/underconstruction.vue";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
UnderConstruction
|
|
||||||
},
|
|
||||||
beforeCreate() {
|
|
||||||
window.$gz.eventBus.$emit("menu-change", {
|
|
||||||
isMain: true,
|
|
||||||
icon: "$ayiParachuteBox",
|
|
||||||
title: "WorkOrderItemPartRequestList",
|
|
||||||
helpUrl: "inv-part-requests"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
|
||||||
<gz-extensions
|
|
||||||
:aya-type="ayType"
|
|
||||||
:selected-items="selectedItems"
|
|
||||||
ref="extensions"
|
|
||||||
>
|
|
||||||
</gz-extensions>
|
|
||||||
<gz-data-table
|
|
||||||
ref="gzdatatable"
|
|
||||||
form-key="part-restocks"
|
|
||||||
data-list-key="PartRestockDataList"
|
|
||||||
:show-select="rights.read"
|
|
||||||
:reload="reload"
|
|
||||||
@selection-change="handleSelected"
|
|
||||||
data-cy="partRestocksTable"
|
|
||||||
>
|
|
||||||
</gz-data-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const FORM_KEY = "part-restocks";
|
|
||||||
export default {
|
|
||||||
created() {
|
|
||||||
this.rights = window.$gz.role.getRights(
|
|
||||||
window.$gz.type.PartInventoryRestock
|
|
||||||
);
|
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
|
||||||
generateMenu(this);
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
rights: window.$gz.role.defaultRightsObject(),
|
|
||||||
ayType: window.$gz.type.PartInventoryRestock,
|
|
||||||
selectedItems: [],
|
|
||||||
reload: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleSelected(selected) {
|
|
||||||
this.selectedItems = selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function clickHandler(menuItem) {
|
|
||||||
if (!menuItem) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
|
||||||
if (m.owner == FORM_KEY && !m.disabled) {
|
|
||||||
switch (m.key) {
|
|
||||||
case "extensions":
|
|
||||||
let res = await m.vm.$refs.extensions.open(
|
|
||||||
m.vm.$refs.gzdatatable.getDataListSelection(
|
|
||||||
window.$gz.type.PartInventoryRestock
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (res && res.refresh == true) {
|
|
||||||
m.vm.reload = !m.vm.reload;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "report":
|
|
||||||
if (m.id != null) {
|
|
||||||
//last report selected is in m.id
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: {
|
|
||||||
recordid: m.id,
|
|
||||||
ayatype: window.$gz.type.PartInventoryRestock
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
//general report selector chosen
|
|
||||||
|
|
||||||
let res = await m.vm.$refs.reportSelector.open(
|
|
||||||
m.vm.$refs.gzdatatable.getDataListSelection(
|
|
||||||
window.$gz.type.PartInventoryRestock
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
//if null for no selection
|
|
||||||
//just bail out
|
|
||||||
if (res == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//persist last report selected
|
|
||||||
window.$gz.form.setLastReport(FORM_KEY, res);
|
|
||||||
|
|
||||||
//Now open the report viewer...
|
|
||||||
m.vm.$router.push({
|
|
||||||
name: "ay-report",
|
|
||||||
params: {
|
|
||||||
recordid: res.id,
|
|
||||||
ayatype: window.$gz.type.PartInventoryRestock
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
window.$gz.eventBus.$emit(
|
|
||||||
"notify-warning",
|
|
||||||
FORM_KEY + "::context click: [" + m.key + "]"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
function generateMenu(vm) {
|
|
||||||
let menuOptions = {
|
|
||||||
isMain: true,
|
|
||||||
icon: "$ayiClipboardList",
|
|
||||||
title: "PurchaseOrderUIRestockList",
|
|
||||||
helpUrl: "inv-part-restocks",
|
|
||||||
menuItems: [],
|
|
||||||
formData: {
|
|
||||||
ayaType: window.$gz.type.PartInventoryRestock
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//REPORTS
|
|
||||||
//Report not Print, print is a further option
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Report",
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
|
|
||||||
//get last report selected
|
|
||||||
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
|
||||||
if (lastReport != null) {
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: lastReport.name,
|
|
||||||
icon: "$ayiFileAlt",
|
|
||||||
key: FORM_KEY + ":report:" + lastReport.id,
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
menuOptions.menuItems.push({
|
|
||||||
title: "Extensions",
|
|
||||||
icon: "$ayiPuzzlePiece",
|
|
||||||
key: FORM_KEY + ":extensions",
|
|
||||||
vm: vm
|
|
||||||
});
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1383,6 +1383,14 @@ async function clickHandler(menuItem) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "restocklist":
|
||||||
|
alert("stub: restocklist");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "requestlist":
|
||||||
|
alert("under construction: MIGRATE_OUTSTANDING workorderitempartrequest");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
"notify-warning",
|
"notify-warning",
|
||||||
@@ -1469,6 +1477,24 @@ function generateMenu(vm) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm.rights.change) {
|
||||||
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
||||||
|
|
||||||
|
menuOptions.menuItems.push({
|
||||||
|
title: "PurchaseOrderUIRestockList",
|
||||||
|
icon: "$ayiClipboardList",
|
||||||
|
key: FORM_KEY + ":restocklist",
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
|
||||||
|
//MIGRATE_OUTSTANDING workorderitempartrequest awaiting
|
||||||
|
menuOptions.menuItems.push({
|
||||||
|
title: "WorkOrderItemPartRequestList",
|
||||||
|
icon: "$ayiParachuteBox",
|
||||||
|
key: FORM_KEY + ":requestlist",
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
}
|
||||||
menuOptions.menuItems.push({ divider: true, inset: false });
|
menuOptions.menuItems.push({ divider: true, inset: false });
|
||||||
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||||
@@ -1538,6 +1564,8 @@ async function fetchTranslatedText(vm) {
|
|||||||
"Receive",
|
"Receive",
|
||||||
"JobCompleted",
|
"JobCompleted",
|
||||||
"ConfirmUpdatePartCost",
|
"ConfirmUpdatePartCost",
|
||||||
|
"PurchaseOrderUIRestockList",
|
||||||
|
"WorkOrderItemPartRequestList",
|
||||||
"PurchaseOrderCustom1",
|
"PurchaseOrderCustom1",
|
||||||
"PurchaseOrderCustom2",
|
"PurchaseOrderCustom2",
|
||||||
"PurchaseOrderCustom3",
|
"PurchaseOrderCustom3",
|
||||||
@@ -1609,5 +1637,35 @@ async function fetchTranslatedText(vm) {
|
|||||||
hasVendorNumber: true,
|
hasVendorNumber: true,
|
||||||
hasUnreceived: true
|
hasUnreceived: true
|
||||||
}
|
}
|
||||||
};*/
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//RESTOCK REQUIRED
|
||||||
|
if (
|
||||||
|
useInventory &&
|
||||||
|
window.$gz.role.canOpen(window.$gz.type.WorkOrderItemPartRequest)
|
||||||
|
) {
|
||||||
|
sub.push({
|
||||||
|
title: "PurchaseOrderUIRestockList",
|
||||||
|
icon: "$ayiClipboardList",
|
||||||
|
route: "/inv-part-restocks",
|
||||||
|
key: key++
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//PART REQUESTS
|
||||||
|
if (
|
||||||
|
useInventory &&
|
||||||
|
window.$gz.role.canOpen(window.$gz.type.WorkOrderItemPartRequest)
|
||||||
|
) {
|
||||||
|
sub.push({
|
||||||
|
title: "WorkOrderItemPartRequestList",
|
||||||
|
icon: "$ayiParachuteBox",
|
||||||
|
route: "/inv-part-requests",
|
||||||
|
key: key++
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user