Ben Lin
2025-03-05 abbc201b41a1a25a19ccf7cff8df633dadcf5d88
src/views/tigerprojects/system/lowcode/entityts/BIZ_MES_WO_BATCH.ts
@@ -4,21 +4,22 @@
 * @version:
 * @Date: 2024-06-19 20:34:27
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-09-11 23:22:41
 * @LastEditTime: 2024-09-29 21:28:37
 */
import { Tag, Tooltip } from 'ant-design-vue';
import { ActionItem, BasicColumn, FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
import { h, unref } from 'vue';
import { getEntity, GetEnum, SaveEntity } from '/@/api/tigerapi/system';
import { h } from 'vue';
import { getEntity, SaveEntity } from '/@/api/tigerapi/system';
import { useLocale } from '/@/locales/useLocale';
import { useModal } from '/@/components/Modal';
import { CustModalParams, FunctionType } from '/@/api/tigerapi/model/systemModel';
import { useForm } from '/@/components/Form';
import { useMessage } from '/@/hooks/web/useMessage';
import { UpdateWoBatchStatus, UpdateWoStatus } from '/@/api/tigerapi/mes/wo';
import { UpdateWoBatchStatus } from '/@/api/tigerapi/mes/wo';
import { useUserStore } from '/@/store/modules/user';
import { formatToDateTime } from '/@/utils/dateUtil';
const { getLocale } = useLocale();
const { createMessage, createErrorModal } = useMessage();
@@ -26,7 +27,7 @@
function _default() {
  const ActionColumn: BasicColumn = {
    width: 160,
    width: 180,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
@@ -161,6 +162,13 @@
        {
          dataIndex: 'ACT_LINE',
          title: '实际线体',
          ifShow: true,
          sorter: true,
          resizable: true,
        },
        {
          dataIndex: 'PLAN_DATE',
          title: '计划日期',
          ifShow: true,
          sorter: true,
          resizable: true,
@@ -346,14 +354,16 @@
      return new Promise((resolve, reject) => {
        try {
          const wo = param.values['mValues'];
          wo.STATUS = wo.STATUS == 3 ? wo.STATUS : 2;
          wo.ACT_LINE = param.values['forminfo'].ACT_LINE;
          SaveEntity(wo, true, 'BIZ_MES_WO_BATCH').then((action) => {
            if (action.IsSuccessed) {
              resolve(action);
            } else {
              reject(action);
            }
          /* 更新工单批次状态 */
         return  UpdateWoBatchStatus({
            UserId: useUserStore().getUserInfo.userId as string,
            WorkOrder: wo.ORDER_NO,
            WoBatch: wo.BATCH_NO,
            ActLine: param.values['forminfo'].ACT_LINE,
            Status: 2,
            RouteStatus: 0,
          }).then((action) => {
            resolve(action);
          });
        } catch {
          reject(false);
@@ -385,12 +395,13 @@
      WoBatch: params['record'].BATCH_NO,
      Status: 4,
      RouteStatus: 0,
      ActLine: ''
    }).then((action) => {
      if (action.IsSuccessed) {
        createMessage.success(t('已暂停'));
        reload();
      } else {
        createMessage.success(t('暂停操作失败'));
        createMessage.success(t(action.Message));
      }
    });
  }
@@ -413,12 +424,13 @@
    }
     /* 更新工单批次状态 */
     UpdateWoBatchStatus({
      UserId: useUserStore().getUserInfo.userId as string,
      WorkOrder: params['record'].ORDER_NO,
      WoBatch: params['record'].BATCH_NO,
      Status: 3,
      RouteStatus: 0,
    }).then((action) => {
       UserId: useUserStore().getUserInfo.userId as string,
       WorkOrder: params['record'].ORDER_NO,
       WoBatch: params['record'].BATCH_NO,
       Status: 3,
       RouteStatus: 0,
       ActLine: ''
     }).then((action) => {
      if (action.IsSuccessed) {
        createMessage.success(t('暂停已取消'));
        reload();
@@ -481,12 +493,17 @@
      WoBatch: params['record'].BATCH_NO,
      Status: 0, //取消下发状态
      RouteStatus: 0,
      ActLine: ''
    }).then((action) => {
      if (action.IsSuccessed) {
        createMessage.success(t('下发已取消'));
        reload();
      } else {
        createMessage.success(t('取消下发操作失败'));
        createErrorModal({
          title: t('警告'),
          content: t(action.Message),
          getContainer: () => document.body,
        });
      }
    });
  }