From 3f3817a39238b262155cd5ec76fa351bb344602d Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 01 一月 2025 21:33:57 +0800 Subject: [PATCH] 打印工单流程卡 --- src/api/tigerapi/mes/mesApi.ts | 1 src/views/components/ImportExcelModal.vue | 18 src/views/tigerprojects/system/lowcode/composition/mainTable.vue | 5 src/views/tigerprojects/system/lowcode/data.ts | 34 + src/api/tigerapi/mes/oper.ts | 43 +- src/api/tigerapi/model/systemModel.ts | 1 src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts | 7 src/api/tigerapi/mes/wo.ts | 22 + src/views/tigerprojects/system/lowcode/detail/index.vue | 10 src/api/tigerapi/model/mesModel.ts | 29 ++ src/utils/is.ts | 4 src/views/tigerprojects/mes/eng/route/index.vue | 27 + .env.development | 4 src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts | 2 src/views/tigerprojects/system/lowcode/detail/detail.vue | 5 src/store/modules/woflowcardprint.ts | 70 +++++ src/views/components/printTemplate1.vue | 185 ++++++++++++++ src/views/tigerprojects/system/lowcode/composition/index.vue | 4 src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts | 19 src/views/tigerprojects/system/lowcode/normal/mainTable.vue | 278 +++++++++++++++++++++ 20 files changed, 695 insertions(+), 73 deletions(-) diff --git a/.env.development b/.env.development index e108cf6..a2ca32b 100644 --- a/.env.development +++ b/.env.development @@ -4,7 +4,7 @@ # @version: # @Date: 2024-06-17 14:51:25 # @LastEditors: Ben Lin - # @LastEditTime: 2024-07-25 10:33:15 + # @LastEditTime: 2024-10-24 14:46:06 ### # Whether to open mock VITE_USE_MOCK = false @@ -21,7 +21,7 @@ # File upload address锛� optional # 鐩存帴IIS鎴栬�呰皟璇曠敤 VITE_GLOB_UPLOAD_URL=http://localhost:9528/api/Base/Upload -VITE_GLOB_DOWNLOAD_URL=http://47.115.28.255:8800/files +VITE_GLOB_DOWNLOAD_URL=http://localhost:8800/files # Interface prefix VITE_GLOB_API_URL_PREFIX = diff --git a/src/api/tigerapi/mes/mesApi.ts b/src/api/tigerapi/mes/mesApi.ts index f3e2209..b6696d1 100644 --- a/src/api/tigerapi/mes/mesApi.ts +++ b/src/api/tigerapi/mes/mesApi.ts @@ -38,4 +38,5 @@ DeleteLabelTemplate = '/MES/DeleteLabelTemplate', AddOrEditLabelVarByWorkOrder = '/MES/AddOrEditLabelVarByWorkOrder', GetLabelVarByWorkOrder = '/MES/GetLabelVarByWorkOrder', + GetWoPickList = '/MES/GetWoPickList', } diff --git a/src/api/tigerapi/mes/oper.ts b/src/api/tigerapi/mes/oper.ts index 6171675..fbd585c 100644 --- a/src/api/tigerapi/mes/oper.ts +++ b/src/api/tigerapi/mes/oper.ts @@ -5,6 +5,7 @@ import { defHttp } from '/@/utils/http/axios'; import { useUserStore } from '../../../store/modules/user'; +const userId = useUserStore().getUserInfo.userId.toString(); /* * 鑾峰彇宸ュ簭鍒嗛〉鍒楄〃 */ @@ -35,8 +36,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'N', IS_REFLOW: 'N', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '1', @@ -50,8 +51,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '2', @@ -65,8 +66,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -80,8 +81,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -95,8 +96,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'N', IS_REFLOW: 'N', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -142,8 +143,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'N', IS_REFLOW: 'N', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '1', @@ -157,8 +158,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '2', @@ -172,8 +173,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -187,8 +188,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'Y', IS_REFLOW: 'Y', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -202,8 +203,8 @@ FACTORY: '楦块箘WMS', IS_FPY: 'N', IS_REFLOW: 'N', - CREATE_USER: useUserStore().getUserInfo.userId, - UPDATE_USER: useUserStore().getUserInfo.userId, + CREATE_USER: userId, + UPDATE_USER: userId, UPDATE_TIME: '2023-02-06', CREATE_TIME: '2023-02-06', OPER_ACTION: '4', @@ -230,7 +231,7 @@ ); } else { params.ID = buildUUID(); //鐢熸垚GUID - params.CREATE_USER = useUserStore().getUserInfo.userId; + params.CREATE_USER = userId; data = await defHttp.post( { url: Api.AddEntity, params: genAction('MES_OPERATION', params) }, { diff --git a/src/api/tigerapi/mes/wo.ts b/src/api/tigerapi/mes/wo.ts index 7a685fe..d0f83bb 100644 --- a/src/api/tigerapi/mes/wo.ts +++ b/src/api/tigerapi/mes/wo.ts @@ -7,6 +7,7 @@ SaveWoBatchInput, BizMesWoInput, BAS_LABEL_VAR_WO, + WoFlowCardPrintJson, } from '../model/mesModel'; import { genAction, Api, genActionPage } from '../system'; import { defHttp } from '/@/utils/http/axios'; @@ -146,3 +147,24 @@ ); return data; }; + +/** + * @desc 鑾峰彇宸ュ崟澶囨枡淇℃伅 + */ +export function GetWoPickList(code: string) { + const params = genAction('', code); + return getPickListApi(params); +} +async function getPickListApi(params: ApiAction<string>) { + const data = await defHttp.post<ApiAction<WoFlowCardPrintJson[]>>( + { + url: mesApi.GetWoPickList, + params, + }, + { + errorMessageMode: 'modal', + isTransformResponse: false, + }, + ); + return data; +} \ No newline at end of file diff --git a/src/api/tigerapi/model/mesModel.ts b/src/api/tigerapi/model/mesModel.ts index 8596d22..1d41e5c 100644 --- a/src/api/tigerapi/model/mesModel.ts +++ b/src/api/tigerapi/model/mesModel.ts @@ -530,11 +530,36 @@ seq: string; isDefault: boolean; level: number; - cust:string; - children: MesRotTree[] + cust: string; + children: MesRotTree[]; } export interface PageRotTree { name: string; treeInfo: MesRotTree[]; } + +export interface WoFlowCardPrintJson { + ID: string; + OrderNo: string; + ItemCode: string; + ItemDesc: string; + SapCode: string; + Model: string; + Qty: number; + Remark: string; + RouteStr: string; + Items: PrintWoPickList[] +} + +export interface PrintWoPickList { + LineNo: number; + SapCode: string; + ItemCode: string; + ItemDesc: string; + PickQty: string; + LineRemark: string; + WhCode: string; + WhCode07: string; + Method: string; +} diff --git a/src/api/tigerapi/model/systemModel.ts b/src/api/tigerapi/model/systemModel.ts index 33296f2..dec756d 100644 --- a/src/api/tigerapi/model/systemModel.ts +++ b/src/api/tigerapi/model/systemModel.ts @@ -380,7 +380,6 @@ EntityJson: string; CheckJson: string; where: string; - typeFullName: string; } export interface ImportInput extends BaseImportInput{ diff --git a/src/store/modules/woflowcardprint.ts b/src/store/modules/woflowcardprint.ts new file mode 100644 index 0000000..55d772b --- /dev/null +++ b/src/store/modules/woflowcardprint.ts @@ -0,0 +1,70 @@ +/* + * @Description: 宸ュ崟娴佺▼鍗tore + * @Author: Ben Lin + * @version: + * @Date: 2024-06-18 15:09:47 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-10-23 22:52:45 + */ +import { defineStore } from 'pinia'; +import { store } from '@/store'; +import { GetWoPickList } from '/@/api/tigerapi/mes/wo'; +import { ActionToJson } from '/@/utils/is'; +import { WoFlowCardPrintJson } from '/@/api/tigerapi/model/mesModel'; + +interface WoFlowcardState { + curPrintInfo: WoFlowCardPrintJson[]; + curOrderNo: string; + curCPInfo: any[]; +} + +export const useWoFlowcardStore = defineStore({ + id: 'app-WoFlowcard', + state: (): WoFlowcardState => ({ + curPrintInfo: [], + curOrderNo: '', + curCPInfo: [], + }), + getters: { + getCurPrintInfo(state): any[] { + return state.curPrintInfo; + }, + getCurOrderNo(state): string { + return state.curOrderNo; + }, + getCurCPInfo(state): any[] { + return state.curCPInfo; + }, + }, + actions: { + setCurPrintInfo(val: any[]) { + this.curPrintInfo = val; + }, + setCurOrderNo(val: string) { + this.curOrderNo = val; + }, + resetState() { + this.curPrintInfo = []; + this.curOrderNo = ''; + this.curCPInfo = []; + }, + /** + * @description: 鑾峰彇宸ュ崟澶囨枡淇℃伅 + * @param {string} tid + * @return {*} + */ + async getWoPickList(code: string) { + this.setCurOrderNo(code); + const d = ActionToJson(await GetWoPickList(code)); + this.setCurPrintInfo(d.Data); + }, + async resetFunc(name, f, ByOrg: boolean) { + + }, + }, +}); + +// Need to be used outside the setup +export function useQueryWithOut() { + return useWoFlowcardStore(store); +} diff --git a/src/utils/is.ts b/src/utils/is.ts index e134a8a..81991ec 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -138,4 +138,8 @@ return false; } +export function ActionToJson(action: any): any { + return JSON.parse(JSON.stringify(action)) +} + diff --git a/src/views/components/ImportExcelModal.vue b/src/views/components/ImportExcelModal.vue index a73fa51..2a938da 100644 --- a/src/views/components/ImportExcelModal.vue +++ b/src/views/components/ImportExcelModal.vue @@ -40,6 +40,7 @@ // import { useLocale } from '/@/locales/useLocale'; import { BasicTable } from '/@/components/Table'; import { ImportExcel, ValidateTableImport } from '/@/api/tigerapi/system'; + import { useUserStore } from '/@/store/modules/user'; const emit = defineEmits(['success', 'register', 'toExcel']); const props = defineProps({ @@ -58,7 +59,7 @@ }); // const { getLocale } = useLocale(); const { t } = useI18n(''); - const { createMessage, createConfirm } = useMessage(); + const { createMessage, createConfirm, createErrorModal } = useMessage(); const tmpHeader = ref([]); const filename = ref(''); const entityName = ref(''); @@ -118,7 +119,7 @@ let dataSource = [] as any[]; results.map((item) => { - let entity = {} as any; + let entity = { AUTH_ORG: useUserStore().userInfo?.orgCode.toString() } as any; baseColumns.value.map((c) => { entity[c['dataIndex']] = item[c['title']]; //c['dataIndex']=='BATCH_NO'?`${item[c['ORDER_NO']]}-01`: item[c['title']]; }); @@ -192,10 +193,10 @@ title: () => h('span', t('瀵煎叆淇℃伅')), content: () => h('span', t('纭鏈変慨鏀圭殑鏁版嵁鏄惁姝g‘锛屾湁寮傚父鐨勬暟鎹棤娉曞鍏�')), onOk: async () => { - const apiAction = await ImportExcel( - entityName.value, - tableListRef.value[0]['dataSource'] as any[], - ); + const apiAction = await ImportExcel(entityName.value, { + EntityJson: JSON.stringify(tableListRef.value[0].dataSource), + typeFullName: typeFullName.value, + }); if (apiAction.IsSuccessed) { closeModal(); createMessage.success(t('瀵煎叆鎴愬姛')); @@ -203,6 +204,11 @@ isUpdate: unref(false), values: { ...values, id: 0 }, }); + } else { + createErrorModal({ + title: t('sys.api.errorTip'), + content: apiAction.Message, + }); } }, }); diff --git a/src/views/components/printTemplate1.vue b/src/views/components/printTemplate1.vue new file mode 100644 index 0000000..ab37505 --- /dev/null +++ b/src/views/components/printTemplate1.vue @@ -0,0 +1,185 @@ +<template> + <div id="print-area"> + <div class="item" v-for="(items, index) in tableData" :key="items.id"> + <div v-if="index == 0"> + <div class="flex relative"> + <div class="head">鎴愬搧鍏ュ簱鍗� </div> + <div class="absolute right-12 m-4 z-2"> + <!-- <QrCode + :value="qrInstoreOrder" + :width="64" + :height="64" + :options="{ margin: 5 }" + ref="qrDiyRef" + /> --> + </div> + </div> + <div style="display: flex; flex-direction: row; height: 30px; margin: 2px"> + <div style="width: 40%"></div> + <div style="width: 17%"></div> + <div style="width: 18%"></div> + <div style="width: 25%">鍏ュ簱鏃ユ湡锛歿{ formatToDate(new Date()) }}</div> + </div> + </div> + <div class="main"> + <table class=" "> + <tr> + <!-- <th class="material_table_td w-1/14">搴忓彿</th> --> + <th class="material_table_td" style="width: 14%">鍏ュ簱鍗曞彿</th> + <th class="material_table_td" style="width: 14%">閿�鍞鍗曞彿</th> + <th class="material_table_td" style="width: 16%">鍖呰宸ュ崟鍙�</th> + <th class="material_table_td" style="width: 16%">鏂欏彿</th> + <th class="material_table_td" style="width: 24%">鎻忚堪</th> + <th class="material_table_td" style="width: 8%">璁″垝鏁伴噺</th> + <th class="material_table_td" style="width: 8%">鍏ュ簱鏁伴噺</th> + </tr> + <tr v-for="(item, indexs) in items.Items.filter((q) => q.STATUS == 'Y')" :key="indexs"> + <!-- <td class="material_table_td"> + {{ Number(indexs) + 1 }} + </td> --> + <td class="instore_td"> + <QrCode + :value="item.ORDER_NO" + :width="70" + :height="70" + :options="{ margin: 1 }" + ref="qrDiyRef" + /> + </td> + <td class="instore_td"> + {{ item.SALES_ORDER }} + </td> + <td class="instore_td"> + {{ item.WORK_ORDER }} + </td> + <td class="instore_td"> + {{ item.ITEM_CODE }} + </td> + <td class="instore_td"> + {{ item.ITEM_NAME }} + </td> + <td class="instore_td"> + {{ item.PLAN_QTY }} + </td> + <td class="instore_td"> + {{ item.SCAN_QTY }} + </td> + </tr> + </table> + </div> + <div style="display: flex; flex-direction: row; height: 30px; margin-bottom: 15px; " v-if="index == Number(tableData?.length) - 1"> + <div style="width: 20%; margin-left: 15px;">鍏ュ簱浜哄憳锛歿{}}</div> + <div style="width: 20%">鐢熶骇涓荤锛歿{}}</div> + <div style="width: 20%">鍝佺纭锛歿{}}</div> + <div style="width: 20%">PMC瀹℃牳锛歿{}}</div> + <div style="width: 20%">浠撳簱绛炬敹锛歿{}}</div> + </div> + <div class="footer flex"> + <div style="width: 40%"></div> + <div style="width: 10%">绗瑊{ index + 1 }}椤�</div> + <div style="width: 10%">鍏眥{ tableData?.length }}椤�</div> + <div style="width: 40%"></div> + </div> + </div> + </div> +</template> +<script lang="ts" setup> + import { ref, toRefs } from 'vue'; + import { QrCode } from '/@/components/Qrcode/index'; + import { formatToDate } from '/@/utils/dateUtil'; + + const props = defineProps({ + tableData: { type: Object as PropType<any[]> }, + qrInstoreOrder: { type: String }, + }); + const { tableData, qrInstoreOrder } = toRefs(props); +</script> +<style lang="scss" scoped> + #print-area { + position: absolute; + inset: 0; + background-color: #fff; + + .item { + display: flex; + flex-direction: column; + // background-color: bisque; + page-break-after: always; + height: 100%; + + .head { + z-index: 1; + width: 100%; + background-color: azure; + font-size: 36px; + font-weight: bold; + line-height: 100px; + text-align: center; + } + + .main { + display: flex; + flex: 1; + // align-items: center; + justify-content: center; + padding: 15px; + + table { + border-collapse: collapse; + } + + table, + th, + td { + border: solid 1px black; + } + + tr > th { + height: 60px; + } + + /* 璁剧疆鏍囬瀛楁瀛椾綋澶у皬 */ + // :deep() { + // .ant-table-tbody > tr > td { + // font-size: 3px; /* 淇敼涓轰綘鎯宠鐨勫瓧浣撳ぇ灏� */ + // line-height: 18px; + // } + + // .ant-table-thead > tr > th { + // line-height: 21px; + // } + + // .ant-table-title { + // font-size: 4px; /* 璁剧疆浣犳兂瑕佺殑瀛椾綋澶у皬 */ + // } + // } + + .instore_td { + border: 1px solid #000; + font-size: 6px; /* 淇敼涓轰綘鎯宠鐨勫瓧浣撳ぇ灏� */ + line-height: 20px; + text-align: center; + word-break: break-all; + } + + .material_table_td { + border: 1px solid #000; + font-size: 6px; /* 淇敼涓轰綘鎯宠鐨勫瓧浣撳ぇ灏� */ + line-height: 20px; + text-align: center; + word-break: break-all; + } + } + + .footer { + display: flex; + margin-bottom: 15px; + background-color: #eee; + font-size: 14px; + // font-weight: bold; + line-height: 100px; + text-align: center; + } + } + } +</style> diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue index 03adab4..3d8a93c 100644 --- a/src/views/tigerprojects/mes/eng/route/index.vue +++ b/src/views/tigerprojects/mes/eng/route/index.vue @@ -359,8 +359,8 @@ if (unref(lf).getNodeIncomingNode(n.id).length == 0) { node.IS_FIRST_NODE = 'Y'; nd.IS_FIRST_NODE = 'Y'; - node.IS_INPUT = 'Y'; - nd.IS_INPUT = 'Y'; + node.IS_INPUT = 'Y'; + nd.IS_INPUT = 'Y'; } currRotData.nodes.push(node); } @@ -427,20 +427,34 @@ }); } else { var hasError = false; + let msg = ''; unref(lf) .getGraphData() .nodes.forEach((n) => { + /* 鍒ゆ柇鏄惁鏈塏ode鏈繛鎺� */ if ( unref(lf).getNodeIncomingEdge(n.id).length == 0 && unref(lf).getNodeOutgoingEdge(n.id).length == 0 ) { hasError = true; + msg = '鏈夎妭鐐规湭杩炵嚎锛岃閲嶆柊璁捐宸ヨ壓璺嚎鍐嶄繚瀛樻暟鎹紒'; + } + if ( + unref(lf) + .getNodeOutgoingNode(n.id) + .some((q) => q.properties.operType == 'End') && + unref(lf) + .getNodeOutgoingNode(n.id) + .some((q) => q.properties.operType != 'End' && q.properties.operType != 'Action') + ) { + hasError = true; + msg = '瀹屽伐鑺傜偣涓嶆槸鍞竴鐨勬渶鍚庤妭鐐癸紝璇烽噸鏂拌璁″伐鑹鸿矾绾垮啀淇濆瓨鏁版嵁锛�'; } }); if (hasError) { createErrorModal({ title: t('璀﹀憡'), - content: t('鏈夎妭鐐规湭杩炵嚎锛岃閲嶆柊璁捐宸ヨ壓璺嚎鍐嶄繚瀛樻暟鎹紒'), + content: t(msg), getContainer: () => document.body, }); } else { @@ -718,7 +732,12 @@ getContainer: () => document.body, }); } else { - if (unref(lf).getNodeIncomingNode(data.nodeModel.id).length == 0) { + if ( + unref(lf).getNodeIncomingNode(data.nodeModel.id).length == 0 && + unref(lf) + .getNodeOutgoingNode(data.nodeModel.id) + .some((q) => q.properties.operType == 'Node') + ) { lf.graphModel.deleteEdgeById(data.edgeModel.id); createErrorModal({ title: t('璀﹀憡'), diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 9ee294e..58504c3 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -83,10 +83,9 @@ import GeneralModal from '/@/views/components/GeneralModal.vue'; import CarGridNav from './CarGridNav.vue'; import Config from './Config.vue'; - import LeftTree from './LeftTree.vue'; import CustModal from '/@/views/components/CustModal.vue'; import { OpenCustModal, initRoute } from '../data'; - import { Ref, VNode, onMounted, provide, ref, unref } from 'vue'; + import { Ref, VNode, defineAsyncComponent, onMounted, provide, ref, unref } from 'vue'; import { FlowChartView } from '/@/components/FlowChart'; import { useRoute } from 'vue-router'; import { BasicForm, useForm } from '/@/components/Form/index'; @@ -98,6 +97,7 @@ defineOptions({ name: '宸ュ崟宸ヨ壓缁戝畾' }); + const LeftTree = defineAsyncComponent(() => import('./LeftTree.vue')); const { notification, createErrorModal } = useMessage(); const go = useGo(); const route = useRoute(); diff --git a/src/views/tigerprojects/system/lowcode/composition/mainTable.vue b/src/views/tigerprojects/system/lowcode/composition/mainTable.vue index e63781f..9d62ea8 100644 --- a/src/views/tigerprojects/system/lowcode/composition/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/composition/mainTable.vue @@ -70,7 +70,7 @@ </template> <script lang="ts" setup> import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue'; - import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; + import { BasicTable, useTable, TableAction, BasicColumn, FormSchema, ActionItem } from '/@/components/Table'; import { BasicForm, useForm } from '/@/components/Form/index'; import { useDrawer } from '/@/components/Drawer'; import GeneralModal from '/@/views/components/GeneralModal.vue'; @@ -298,7 +298,8 @@ }; /* 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽嚜鍔ㄧ敓鎴愭搷浣滃垪涓殑鎸夐挳 */ - const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); + const _actionItem: ActionItem[] = []; + const actionItem = GenerateActionButton(params, buttons, openDrawer, reload, _actionItem); if (isNullOrUnDef(custImport.value['default'])) { return actionItem; } diff --git a/src/views/tigerprojects/system/lowcode/data.ts b/src/views/tigerprojects/system/lowcode/data.ts index 217aaf5..63fe938 100644 --- a/src/views/tigerprojects/system/lowcode/data.ts +++ b/src/views/tigerprojects/system/lowcode/data.ts @@ -259,8 +259,13 @@ * @param {*} params * @return {*} */ -export function GenerateActionButton(params: any, buttons: Ref<[]>, openDrawer: Fn, reload: Fn) { - const actionItem = [] as ActionItem[]; +export function GenerateActionButton( + params: any, + buttons: Ref<[]>, + openDrawer: Fn, + reload: Fn, + actionItem: ActionItem[], +) { buttons.value.map((x) => { if (x['BUTTON_TYPE'] == 1) { let url = ''; @@ -285,14 +290,16 @@ }; } } - actionItem.push({ - icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], - tooltip: _tooltip, - onClick: _click, - color: color, - popConfirm: _popConfirm, - name: x['DO_METHOD'], - }); + if (x['DO_METHOD'] != 'ToPrint') { + actionItem.push({ + icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], + tooltip: _tooltip, + onClick: _click, + color: color, + popConfirm: _popConfirm, + name: x['DO_METHOD'], + }); + } } }); return actionItem; @@ -430,10 +437,13 @@ for (const k in Keys) { if (!isNullOrEmpty(params[Keys[k]]?.length) && isArray(params[Keys[k]])) { if (isTimeViaRegExp8601(params[Keys[k]][0])) { - params[Keys[k]][0] = dateUtil(params[Keys[k]][0]) - params[Keys[k]][1] = dateUtil(params[Keys[k]][1]) + params[Keys[k]][0] = dateUtil(params[Keys[k]][0]); + params[Keys[k]][1] = dateUtil(params[Keys[k]][1]); } } + if (isTimeViaRegExp8601(params[Keys[k]])) { + params[Keys[k]] = dateUtil(params[Keys[k]]); + } } f.setFieldsValue(params); } diff --git a/src/views/tigerprojects/system/lowcode/detail/detail.vue b/src/views/tigerprojects/system/lowcode/detail/detail.vue index 16b0ff6..dd62fa0 100644 --- a/src/views/tigerprojects/system/lowcode/detail/detail.vue +++ b/src/views/tigerprojects/system/lowcode/detail/detail.vue @@ -65,7 +65,7 @@ </template> <script lang="ts" setup> import { Ref, inject, onMounted, ref } from 'vue'; - import { BasicTable, useTable, TableAction } from '/@/components/Table'; + import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicForm, useForm } from '/@/components/Form/index'; import { useDrawer } from '/@/components/Drawer'; import GeneralModal from '/@/views/components/GeneralModal.vue'; @@ -190,7 +190,8 @@ selectVals, colSlots, }; - const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); + const _actionItem: ActionItem[] = []; + const actionItem = GenerateActionButton(params, buttons, openDrawer, reload,_actionItem); if (isNullOrUnDef(custImport.value['default'])) { return actionItem; } diff --git a/src/views/tigerprojects/system/lowcode/detail/index.vue b/src/views/tigerprojects/system/lowcode/detail/index.vue index d801e76..f64f685 100644 --- a/src/views/tigerprojects/system/lowcode/detail/index.vue +++ b/src/views/tigerprojects/system/lowcode/detail/index.vue @@ -20,28 +20,24 @@ <detail :entityName="entityName" /> </Suspense> </div> - <div v-if="currentKey == 'detailsecond'"> - <Suspense></Suspense> - </div> </div> </PageWrapper> </template> <script lang="ts" setup> - import { ref, provide, Ref } from 'vue'; + import { ref, provide, Ref, defineAsyncComponent } from 'vue'; import { useRoute } from 'vue-router'; import { PageWrapper } from '/@/components/Page'; import { useTabs } from '/@/hooks/web/useTabs'; import { Tabs } from 'ant-design-vue'; import { useGo } from '/@/hooks/web/usePage'; import { OpenCustModal, custOnChange } from '../data'; - import detail from './detail.vue'; import { useI18n } from '/@/hooks/web/useI18n'; import { useMessage } from '/@/hooks/web/useMessage'; import { useGlobSetting } from '/@/hooks/setting'; const { t } = useI18n(); - + const detail = defineAsyncComponent(() => import('./detail.vue')); const { createMessage } = useMessage(); const route = useRoute(); // const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); @@ -79,7 +75,7 @@ .then((m) => { const [{ GetHomeUrl }] = m.default(); // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� - go(GetHomeUrl({colSlots:crudColSlots.value})); + go(GetHomeUrl({ colSlots: crudColSlots.value })); }) .catch(() => {}); } catch (e) {} diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts index 209469b..15a035c 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO.ts @@ -49,7 +49,7 @@ switch (fnName) { case 'ImportExcel': action = { - action: 'importModal', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) + action: 'importModal', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) params: { tmpHeader: ['宸ュ崟鍙�', '璁″垝鏃ユ湡', '璁″垝鏁伴噺'] /* 涓嬭浇妯℃澘鐨勬爣棰樺瓧娈� */, filename: '宸ュ崟璁″垝妯℃澘.xlsx' /* 涓嬭浇妯℃澘鐨勬枃浠跺悕 */, @@ -130,9 +130,14 @@ }, }; break; + case 'ToPrint': + action = { + action: 'ToPrint', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) + }; + break; default: action = { - action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) + action: 'drawer', //drawer(鎵撳紑宸︿晶鎶藉眽妗�) | go(璺宠浆鍒版柊鐨勯〉闈�) | modal(鎵撳紑妯℃�佺獥鍙�) | importModal(鎵撳紑瀵煎叆妯℃�佺獥鍙�) | ToPrint(鎵撳嵃鍔熻兘) }; break; } @@ -156,10 +161,9 @@ x.onClick = handleRelease.bind(null, args, params); x.tooltip = '涓嬪彂'; } - // if (x.name == 'handleTemplate') { - // x.onClick = handleTemplate.bind(null, args, params); - // x.tooltip = '妯℃澘缁存姢'; - // } + if (x.name == 'ToPrint') { + x.tooltip = '鎵撳嵃娴佺▼鍗�'; + } }); return data; }, @@ -502,7 +506,8 @@ Name: 'WoRouteBinding', CODE: params['record'].ORDER_NO, Title: `宸ュ崟[${params['record'].ORDER_NO}]宸ヨ壓缁戝畾`, - colSlots: params['colSlots'].value /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */, + colSlots: + params['colSlots'].value /* 琛ㄦ牸鍐呯殑鏌ヨ琛ㄥ崟瀛楁鐨勬彃妲藉垪琛紝涓�鑸敤浜庡脊鍑洪�夋嫨妗嗘寜閽� */, crudColSlots: { BAS_PKG_DTL: ['BAS_LABEL_TEMP1add'], ItemCode: ['BAS_CODE_RULE1add'], diff --git a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts index 86d1c76..b9858c2 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts @@ -167,6 +167,13 @@ resizable: true, }, { + dataIndex: 'PLAN_DATE', + title: '璁″垝鏃ユ湡', + ifShow: true, + sorter: true, + resizable: true, + }, + { dataIndex: 'ACT_START_TIME', title: '瀹為檯寮�濮嬫椂闂�', ifShow: true, diff --git a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts index 1f3b924..e25dfd8 100644 --- a/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts +++ b/src/views/tigerprojects/system/lowcode/entityts/ProdRouteBinding.ts @@ -1872,7 +1872,7 @@ alertConfig: { showAlert: false, message: '閿�鍞鍗曞娉�', - description: WoRecord.SALES_REMARK, + description: '', }, searchInfo: { TABLE_NAME: 'BAS_LABEL_VAR_WO', //瀹炰綋鍚嶇О diff --git a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue index b2920ca..eaf79b4 100644 --- a/src/views/tigerprojects/system/lowcode/normal/mainTable.vue +++ b/src/views/tigerprojects/system/lowcode/normal/mainTable.vue @@ -1,5 +1,15 @@ <template> <div> + <Loading + :loading="compState.loading" + :absolute="compState.absolute" + :theme="compState.theme" + :background="compState.background" + :tip="compState.tip" + /> + <div v-show="false"> + <printTemplate /> + </div> <BasicTable @register="registerTable"> <template #toolbar> <!-- 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽紝鑷姩鐢熸垚 --> @@ -70,8 +80,15 @@ </div> </template> <script lang="ts" setup> - import { Ref, inject, nextTick, onMounted, ref, unref, watch } from 'vue'; - import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; + import { Ref, inject, nextTick, onMounted, reactive, ref, unref, watch } from 'vue'; + import { + BasicTable, + useTable, + TableAction, + BasicColumn, + FormSchema, + ActionItem, + } from '/@/components/Table'; import { BasicForm, useForm } from '/@/components/Form/index'; import { useDrawer } from '/@/components/Drawer'; import GeneralModal from '/@/views/components/GeneralModal.vue'; @@ -94,6 +111,11 @@ import { isFunction } from 'xe-utils'; import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; import { useQueryStore } from '/@/store/modules/queryInpage'; + import printJS, { Configuration } from 'print-js'; + import printTemplate from '/@/views/components/printTemplate.vue'; + import { Loading, useLoading } from '@/components/Loading'; + import { useWoFlowcardStore } from '/@/store/modules/woflowcardprint'; + import { storeToRefs } from 'pinia'; const { t } = useI18n(); const { currentRoute } = useRouter(); @@ -120,6 +142,8 @@ const [registerCust, { openModal: openCustModal }] = useModal(); const [registerCrud, { openModal: openCrudModal }] = useModal(); const [registerImport, { openModal: openImportModal }] = useModal(); + const useWoFlowCard = useWoFlowcardStore(); + const { curPrintInfo } = storeToRefs(useWoFlowCard); const cType = ref(''); const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯 const routeData = ref({ @@ -127,6 +151,142 @@ edges: [], }); const selectVals = ref({}); + const printData = ref<any[]>([]); + const wokerorder = ref(''); + const compState = reactive<{ + absolute?: boolean; + loading?: boolean; + theme?: 'dark' | 'light'; + background?: string; + tip?: string; + }>({ + absolute: false, + loading: false, + theme: 'dark', + background: 'rgba(111,111,111,.7)', + tip: '鍔犺浇涓�...', + }); + const [openFullLoading, closeFullLoading] = useLoading({ + tip: '姝e湪鍔犺浇鎵撳嵃鏁版嵁...', + }); + + printData.value = [ + { + id: '111', + Items: [ + { + ID: 111, + SALES_ORDER: 'YDSO240400482', + ORDER_NO: 'YDRKD241000012', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 112, + SALES_ORDER: 'YDSO240400483', + ORDER_NO: 'YDRKD241000013', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 113, + SALES_ORDER: 'YDSO240400484', + ORDER_NO: 'YDRKD241000014', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 114, + ORDER_NO: 'YDRKD241000015', + SALES_ORDER: 'YDSO240400485', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 115, + ORDER_NO: 'YDRKD241000016', + SALES_ORDER: 'YDSO240400486', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + { + ID: 116, + ORDER_NO: 'YDRKD241000017', + SALES_ORDER: 'YDSO240400487', + WORK_ORDER: 'YDMOB241104737', + ITEM_CODE: '20100705.0102.00', + ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + PLAN_QTY: 100, + SCAN_QTY: 50, + STATUS: 'Y', + }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000018', + // SALES_ORDER: 'YDSO240400488', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000019', + // SALES_ORDER: 'YDSO240400489', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000020', + // SALES_ORDER: 'YDSO240400490', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + // { + // ID: 116, + // ORDER_NO: 'YDRKD241000021', + // SALES_ORDER: 'YDSO240400491', + // WORK_ORDER: 'YDMOB241104737', + // ITEM_CODE: '20100705.0102.00', + // ITEM_NAME: 'YM-DEMS-BD11Q48 AC0-300V AC20mA 鐢佃兘1绾� ', + // PLAN_QTY: 100, + // SCAN_QTY: 50, + // STATUS: 'Y', + // }, + ], + }, + ]; const custImport = ref<any[]>([]); const EntityCustFunction = ref([ { @@ -165,7 +325,7 @@ ? {} : KeyFieldValues(objParams.value['CODE'], objParams.value['ID']); const dtlSlots = ref<any[]>([]); - const ImportTitle = GetTitle && isFunction(GetTitle)? ref(GetTitle().importTitle): ref(''); + const ImportTitle = GetTitle && isFunction(GetTitle) ? ref(GetTitle().importTitle) : ref(''); const useformdata = GetUseForm && isFunction(GetUseForm) ? GetUseForm() : {}; const useFormData = ref<any>(useformdata); /* 鑷畾涔夋ā鎬佺獥鍙d腑琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 */ @@ -316,7 +476,17 @@ }; /* 鏍规嵁鑿滃崟璁剧疆鐨勬寜閽嚜鍔ㄧ敓鎴愭搷浣滃垪涓殑鎸夐挳 */ - const actionItem = GenerateActionButton(params, buttons, openDrawer, reload); + const _actionItem: ActionItem[] = []; + const actionItem = GenerateActionButton(params, buttons, openDrawer, reload, _actionItem); + let _btn = buttons.value.filter((q) => q['BUTTON_TYPE'] == 1 && q['DO_METHOD'] == 'ToPrint'); + if (_btn.length > 0) { + _actionItem.push({ + icon: isNullOrEmpty(_btn[0]['ICON_URL']) ? '' : _btn[0]['ICON_URL'], + tooltip: '鎵撳嵃', + onClick: ToPrint.bind(null, params), + name: _btn[0]['DO_METHOD'], + }); + } if (isNullOrUnDef(custImport.value['default'])) { return actionItem; } @@ -391,6 +561,9 @@ break; case 'importModal' /* 鎵撳紑瀵煎叆Excel妯℃�佺獥鍙� */: openImportModal(true, result.params); + break; + case 'ToPrint': + ToPrint({}); break; } } @@ -554,4 +727,101 @@ function RvItemSuccess(d, u) { RvcloseModal(); } + + function ToPrint(params: {}) { + openFullLoading(); + useWoFlowCard.getWoPickList(params['record']['ORDER_NO']).then((res) => { + const _style = ` + #print-area { + position: absolute; + inset: 0; + background-color: #fff; + + .item { + display: flex; + flex-direction: column; + page-break-after: always; + height: 100%; + + + .head { + z-index: 1; + width: 100%; + background-color: azure; + font-size: 22px; + font-weight: bold; + line-height: 100px; + text-align: center; + } + + .main { + display: flex; + flex: 1; + justify-content: center; + padding: 15px; + + table { + border-collapse: collapse; + width: 100%; + } + + table, + th, + td { + border: solid 1px black; + } + + tr > th { + height: 60px; + } + .instore_td { + border: 1px solid #000; + font-size: 12px; + line-height: 20px; + text-align: center; + word-break: break-all; + } + + .material_table_td { + border: 1px solid #000; + font-size: 14px; + line-height: 20px; + text-align: center; + word-break: break-all; + } + } + + .footer { + display: flex; + margin-bottom: 15px; + background-color: #eee; + font-size: 12px; + line-height: 21px; + text-align: center; + } + } + .line { + width: 100px; /* 绾挎潯鐨勯暱搴� */ + height: 0; + margin: 10px; /* 绾挎潯涓庡叾浠栧厓绱犵殑璺濈 */ + border-top: 1px solid black; /* 绾挎潯鐨勯鑹插拰瀹藉害 */ + } + }`; + + printJS({ + // 闇�瑕佹墦鍗板尯鍩熻缃殑Id + printable: 'print-area', + // 鎵撳嵃绫诲瀷 + type: 'html', + // 榛樿鍊间负800锛屾垜浠妸鎶婅缃负100% + maxWidth: '100%', + // *浠h〃搴旂敤鎵�鏈夋牱寮忥紝榛樿鍊间负null锛屽鏋滀笉璁剧疆锛屾墦鍗扮獥鍙e垯浼氬拷鐣ユ墍鏈夋牱寮� + targetStyles: ['*'], + // font_size: '9pt', + scanStyles: false, + style: `@page {size: auto; margin: 0mm;} html, ${_style}`, + } as unknown as Configuration); + closeFullLoading(); + }); + } </script> -- Gitblit v1.9.3