Browse Source

删除平移

zhangafei 1 week ago
parent
commit
19928ac701

+ 1 - 1
src/views/billet/operator/components/car.vue

@@ -265,7 +265,7 @@
     }
   };
 
-  const { start, stop } = useTimeoutFn(getInfo, 10000);
+  const { start, stop } = useTimeoutFn(getInfo, 10000, true);
 
   // 获取堆垛机堆垛信息
   // 获取当前堆垛信息

+ 1 - 1
src/views/billet/operator/components/headTop.vue

@@ -289,7 +289,7 @@
     }
   };
 
-  const { start, stop } = useTimeoutFn(getInfo, 5000);
+  const { start, stop } = useTimeoutFn(getInfo, 5000, true);
 
   // 换炉
   const changeHeatLoading = ref(false);

+ 74 - 50
src/views/billet/operator/components/orgData.vue

@@ -234,8 +234,9 @@
                         id: orgData.id,
                       }).then(() => {
                         getHeatList({
-                          ...props.openData,
-                          hostNumber: hostNumber.value,
+                          ccmNo: hostNumber.value,
+                          queryType: fetchQueryType.value,
+                          changeShiftId: fetchChangeShiftId.value,
                         });
                       });
                     },
@@ -713,6 +714,7 @@
 
         // 热装字段
         let columnsHotCharge: any = getHotColumns();
+        const allSizeArr: any[] = [];
 
         const dataOrgSource = defaultSourceData.map((item, index) => {
           if (!newArr[index]) return item;
@@ -729,6 +731,7 @@
               // 热送棒一的定尺
               Object.keys(lengthGroupCount).forEach((key) => {
                 const column = key;
+                allSizeArr.push(Number(column) / 1000);
                 const columnKey = column + 'rollOneColumn';
                 const findIndex = rollOneColumns.findIndex((item: any) => item.dataIndex === columnKey);
                 if (findIndex === -1) {
@@ -768,6 +771,7 @@
                     },
                     dataIndex: columnKey,
                     key: columnKey,
+                    sortKey: column,
                     align: 'center',
                     width: 80,
                     customRender({ text, record }) {
@@ -811,6 +815,7 @@
             const hotChargeArr = JSON.parse(hotChargeLength);
             hotChargeArr.forEach((k) => {
               const sizeFormat = Number(k.hotChargeLength) / 1000;
+              allSizeArr.push(sizeFormat);
               const dataKey = sizeFormat + k.hotChargeDestination + k.hotChargeBtype;
               sizeArr[dataKey] = k.totalCount;
               // 热送统计
@@ -853,6 +858,7 @@
             stackLeghtObj.forEach((v) => {
               // 初始化堆垛的定尺key
               const sSize = String(v.stackingLength);
+              allSizeArr.push(Number(sSize) / 1000);
               const stackKey = sSize + 'stackLength' + v.stackingBhtcId;
               // 查找某一个堆垛 dataIndex='stackLength' + stackingBhtcId
               const index = stackLengthColumn.findIndex((ele) => ele.dataIndex == 'stackLength' + v.stackingBhtcId);
@@ -895,6 +901,7 @@
                   },
                   dataIndex: stackKey,
                   key: stackKey,
+                  sortKey: sSize,
                   width: 80,
                   customRender({ text, record }) {
                     if (!record.heatNo) {
@@ -980,54 +987,58 @@
                 }
               );
             });
-            const childSizesColumn = hotChargeSizeArr.map((childItem) => {
-              return {
-                title: childItem,
-                dataIndex: `${item}.${childItem}`,
-                key: `${item}.${childItem}`,
-                width: 80,
-                align: 'center',
-                customRender: ({ record }) => {
-                  const hotKey = childItem + item + '0';
-                  const coldKey = childItem + item + '1';
-                  let sizeArr: any = [];
-                  if (record[hotKey] || record[coldKey]) {
-                    sizeArr = [h('div', { class: 'line' }, ''), h('div', { class: 'size-st-item' }, record[hotKey] || '~')];
-                    sizeArr.push(h('div', { class: ' size-st-num' }, record[coldKey] || '~'));
-                  }
-
-                  return h(
-                    'div',
-                    {
-                      class: 'size-st-wrapper',
-                      onClick: () => {
-                        // if (!record[hotKey] && !record[coldKey]) return;
-                        const { orgData } = record;
-                        if (!orgData) return;
-                        const { hotChargeLength } = orgData;
-
-                        const hotChargeInfoArr = hotChargeLength ? JSON.parse(hotChargeLength) : [];
-
-                        const itemsHotArr = niubiGls.map((v) => {
-                          const hasVal = hotChargeInfoArr.find((j) => j.hotChargeLength == v.hotChargeLength && j.hotChargeBtype == v.hotChargeBtype);
-                          return {
-                            ...v,
-                            totalCount: hasVal ? hasVal.totalCount : 0,
-                          };
-                        });
+            const childSizesColumn = hotChargeSizeArr
+              .sort((a, b) => Number(a) * 1000 - Number(b) * 1000)
+              .map((childItem) => {
+                return {
+                  title: childItem,
+                  dataIndex: `${item}.${childItem}`,
+                  key: `${item}.${childItem}`,
+                  width: 80,
+                  align: 'center',
+                  customRender: ({ record }) => {
+                    const hotKey = childItem + item + '0';
+                    const coldKey = childItem + item + '1';
+                    let sizeArr: any = [];
+                    if (record[hotKey] || record[coldKey]) {
+                      sizeArr = [h('div', { class: 'line' }, ''), h('div', { class: 'size-st-item' }, record[hotKey] || '~')];
+                      sizeArr.push(h('div', { class: ' size-st-num' }, record[coldKey] || '~'));
+                    }
 
-                        editSizeNumRecord.value = {
-                          ...orgData,
-                          hotChargeLengthArr: itemsHotArr,
-                        };
-                        openSetSizeNumModal.value = true;
+                    return h(
+                      'div',
+                      {
+                        class: 'size-st-wrapper',
+                        onClick: () => {
+                          // if (!record[hotKey] && !record[coldKey]) return;
+                          const { orgData } = record;
+                          if (!orgData) return;
+                          const { hotChargeLength } = orgData;
+
+                          const hotChargeInfoArr = hotChargeLength ? JSON.parse(hotChargeLength) : [];
+
+                          const itemsHotArr = niubiGls.map((v) => {
+                            const hasVal = hotChargeInfoArr.find(
+                              (j) => j.hotChargeLength == v.hotChargeLength && j.hotChargeBtype == v.hotChargeBtype
+                            );
+                            return {
+                              ...v,
+                              totalCount: hasVal ? hasVal.totalCount : 0,
+                            };
+                          });
+
+                          editSizeNumRecord.value = {
+                            ...orgData,
+                            hotChargeLengthArr: itemsHotArr,
+                          };
+                          openSetSizeNumModal.value = true;
+                        },
                       },
-                    },
-                    sizeArr
-                  );
-                },
-              };
-            });
+                      sizeArr
+                    );
+                  },
+                };
+              });
 
             otherColumnsNums = otherColumnsNums + (childSizesColumn.length ? childSizesColumn.length : 1);
             return {
@@ -1036,9 +1047,19 @@
             };
           });
 
-        columns.value = [...defaultColumns, ...otherColumns, ...stackLengthColumn, ...totalColum];
+        const sortedStackLengthColumn = stackLengthColumn.map((ss) => {
+          return {
+            ...ss,
+            children: ss.children.sort((a, b) => {
+              return Number(a.sortKey) - Number(b.sortKey);
+            }),
+          };
+        });
+        columns.value = [...defaultColumns, ...otherColumns, ...sortedStackLengthColumn, ...totalColum];
         const rollOneIndex = defaultColumns.findIndex((ele: any) => ele.dataIndex === 'rollOne');
-        (columns.value[rollOneIndex] as any).children = rollOneColumns.length ? rollOneColumns : [];
+        (columns.value[rollOneIndex] as any).children = rollOneColumns.length
+          ? rollOneColumns.sort((a: any, b: any) => Number(a.sortKey) - Number(b.sortKey))
+          : [];
 
         // 堆垛的列数量
         const stackColNums = stackLengthColumn.reduce((pre: any, cur: any) => {
@@ -1099,6 +1120,9 @@
           coldSendList.value['付'].forEach((ele) => (allWeight += ele.weight));
         }
 
+        // 查看所有的定尺
+        mainSize.value = sizeInfo || [...new Set(allSizeArr)].join(',');
+
         emits('statistics', {
           chargeList: rollChargeSizeType,
           stackingList: stackingList.value,

+ 5 - 0
src/views/billet/operator/components/orgRecordTable.vue

@@ -0,0 +1,5 @@
+<template>
+  <div class="orgRecordTable"> </div>
+</template>
+<script setup lang="ts"></script>
+<style lang="less" scoped></style>

+ 214 - 54
src/views/billet/operator/components/printOriginalRecords.vue

@@ -11,7 +11,7 @@
   >
     <section
       ref="print"
-      style="padding: 10px 10px 0; position: relative; border: 1px solid #c5c5c5; background: #fff; width: 100%; height: 100%"
+      style="padding: 10px; position: relative; border: 1px solid #c5c5c5; background: #fff; width: 100%; min-height: 100%"
       id="printBilletSampleCard"
       :key="printKey"
     >
@@ -246,7 +246,7 @@
   import dayjs from 'dayjs';
   import { printJS } from '/@/hooks/web/usePrintJS';
   import type { TableColumnsType } from 'ant-design-vue';
-  import { queryBilletRecordByCcmNo, editBilletRecord, addBilletNo, editOriginalProductRecord } from '../operator.api';
+  import { queryBilletRecordByCcmNo, editBilletRecord, addBilletNo, editOriginalProductRecord, deleteBilletRecord } from '../operator.api';
   import { render } from '/@/utils/common/renderUtils';
   import { isArray, isNumber } from '/@/utils/is';
   import Icon from '/@/components/Icon';
@@ -258,11 +258,12 @@
   import { useModal } from '/@/components/Modal';
   import { getMachineConfig, MachineConfigType } from '../../hotDelivery/common.data';
   import { steelPlateFormula } from '../operator.data';
+  import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
 
   // 注册打印送样卡modal
   const [registerPrintModal, { openModal }] = useModal();
 
-  const { createMessage } = useMessage();
+  const { createMessage, createConfirm } = useMessage();
   const printKey = ref(dayjs().unix());
   const isEditAbled = ref(false); // 是否可编辑
   // 渲染字典标签
@@ -278,22 +279,146 @@
       dataIndex: 'SerialNumber',
       align: 'center',
       key: 'SerialNumber',
+      customRender: ({ text, record }) => {
+        if (!record.heatNo) return text;
+        const { orgData } = record;
+        return h(
+          'div',
+          {
+            style: { position: 'relative' },
+          },
+          [
+            h('span', {}, text),
+            h(
+              'div',
+              {
+                class: 'noprint delete-heat',
+                onClick: () => {
+                  console.log('record', orgData);
+                  createConfirm({
+                    iconType: 'warning',
+                    title: '删除确认',
+                    content: `确定删除【${record.heatNo}】吗?删除后无法恢复!`,
+                    onOk: () => {
+                      return deleteBilletRecord({
+                        id: orgData.id,
+                      }).then(() => {
+                        getHeatList({
+                          ccmNo: hostNumber.value,
+                          queryType: fetchQueryType.value,
+                          changeShiftId: fetchChangeShiftId.value,
+                        });
+                      });
+                    },
+                  });
+                },
+              },
+              h(Icon, { icon: 'ant-design:delete-filled', size: '20' }, '')
+            ),
+          ]
+        );
+      },
     },
     {
       title: '炉号',
       dataIndex: 'heatNo',
-      // width: 80,
+      width: 100,
       align: 'center',
       key: 'heatNo',
+      customRender: ({ text, record }) => {
+        if (!record.heatNo) return '';
+        const { orgData } = record;
+        return h(Input, {
+          key: orgData.heatNo + record.keyDate,
+          size: 'small',
+          bordered: false,
+          value: text,
+          onBlur: throttle(
+            (e) => {
+              const v = e.target.value.trim();
+              if (!v || orgData.heatNo === v) return;
+              createConfirm({
+                iconType: 'warning',
+                title: '交班确认',
+                content: `确定修改【${record.heatNo}】吗?`,
+                onOk: () => {
+                  return editBilletRecord({
+                    ...orgData,
+                    heatNo: v,
+                  }).then(() => {
+                    getHeatList({
+                      ccmNo: hostNumber.value,
+                      queryType: fetchQueryType.value,
+                      changeShiftId: fetchChangeShiftId.value,
+                    });
+                  });
+                },
+                onCancel: () => {
+                  getHeatList({
+                    ccmNo: hostNumber.value,
+                    queryType: fetchQueryType.value,
+                    changeShiftId: fetchChangeShiftId.value,
+                  });
+                },
+              });
+            },
+            500,
+            {
+              leading: true,
+              trailing: false,
+            }
+          ),
+        });
+      },
     },
     {
       title: '钢种',
-      // width: 80,
+      width: 100,
       align: 'center',
       dataIndex: 'brandNum',
       key: 'brandNum',
-      customRender: ({ text }) => {
-        return render.renderDict(text, 'billet_spec');
+      customRender: ({ text, record }) => {
+        if (!record.heatNo) return '';
+        const { orgData } = record;
+        return h(
+          JSearchSelect,
+          {
+            key: orgData.heatNo + record.keyDate,
+            type: 'list',
+            bordered: false,
+            size: 'small',
+            value: text,
+            dict: 'billet_spec',
+            onChange: (v) => {
+              createConfirm({
+                iconType: 'warning',
+                title: '交班确认',
+                content: `确定修改【${record.heatNo}】的牌号吗?`,
+                onOk: () => {
+                  return editBilletRecord({
+                    ...orgData,
+                    grade: v,
+                  }).then(() => {
+                    getHeatList({
+                      ccmNo: hostNumber.value,
+                      queryType: fetchQueryType.value,
+                      changeShiftId: fetchChangeShiftId.value,
+                    });
+                  });
+                },
+                onCancel: () => {
+                  getHeatList({
+                    ccmNo: hostNumber.value,
+                    queryType: fetchQueryType.value,
+                    changeShiftId: fetchChangeShiftId.value,
+                  });
+                },
+              });
+            },
+            placeholder: '请选择',
+          },
+          ''
+        );
       },
     },
     // {
@@ -740,6 +865,8 @@
           roll_out_shipp: [],
         };
 
+        const allSizeArr: any[] = [];
+
         const totalRows = getTotalRows();
         dataSource.value = totalRows.map((item, index) => {
           if (!newArr[index]) return item;
@@ -760,6 +887,7 @@
               // 热送棒一的定尺
               Object.keys(lengthGroupCount).forEach((key) => {
                 const column = key;
+                allSizeArr.push(Number(column) / 1000);
                 const columnKey = column + 'rollOneColumn';
                 const findIndex = rollOneColumns.findIndex((item: any) => item.dataIndex === columnKey);
                 if (findIndex === -1) {
@@ -799,6 +927,7 @@
                     },
                     dataIndex: columnKey,
                     key: columnKey,
+                    sortKey: column,
                     align: 'center',
                     width: 100,
                     customRender({ text, record }) {
@@ -838,6 +967,7 @@
             const hotChargeArr = JSON.parse(hotChargeLength);
             hotChargeArr.forEach((k) => {
               const sizeFormat = Number(k.hotChargeLength) / 1000;
+              allSizeArr.push(sizeFormat);
               const dataKey = sizeFormat + k.hotChargeDestination + k.hotChargeBtype;
               sizeArr[dataKey] = k.totalCount;
               // 热送统计
@@ -941,6 +1071,7 @@
             stackLeghtObj.forEach((v) => {
               // 初始化堆垛的定尺key
               const sSize = String(v.stackingLength);
+              allSizeArr.push(Number(sSize) / 1000);
               const stackKey = sSize + 'stackLength' + v.stackingBhtcId;
               // 查找某一个堆垛 dataIndex='stackLength' + stackingBhtcId
               const index = stackLengthColumn.findIndex((ele) => ele.dataIndex == 'stackLength' + v.stackingBhtcId);
@@ -984,6 +1115,7 @@
                   dataIndex: stackKey,
                   key: stackKey,
                   width: 100,
+                  sortKey: sSize,
                   customRender({ text, record }) {
                     if (!record.heatNo) {
                       return '';
@@ -1019,9 +1151,13 @@
             });
           }
 
+          const curTime = new Date().getTime();
+
           return {
             ...item,
+            id: newArr[index].id || curTime,
             heatNo: newArr[index].heatNo,
+            keyDate: curTime,
             brandNum: newArr[index].grade,
             oneFlow: newArr[index].oneStrandSum || '',
             twoFlow: newArr[index].twoStrandSum || '',
@@ -1064,54 +1200,58 @@
                 }
               );
             });
-            const childSizesColumn = hotChargeSizeArr.map((childItem) => {
-              return {
-                title: childItem,
-                dataIndex: `${item}.${childItem}`,
-                key: `${item}.${childItem}`,
-                width: 100,
-                align: 'center',
-                customRender: ({ record }) => {
-                  const hotKey = childItem + item + '0';
-                  const coldKey = childItem + item + '1';
-                  let sizeArr: any = [];
-                  if (record[hotKey] || record[coldKey]) {
-                    sizeArr = [h('div', { class: 'line' }, ''), h('div', { class: 'size-st-item' }, record[hotKey] || '~')];
-                    sizeArr.push(h('div', { class: ' size-st-num' }, record[coldKey] || '~'));
-                  }
+            const childSizesColumn = hotChargeSizeArr
+              .sort((a, b) => Number(a) * 1000 - Number(b) * 1000)
+              .map((childItem) => {
+                return {
+                  title: childItem,
+                  dataIndex: `${item}.${childItem}`,
+                  key: `${item}.${childItem}`,
+                  width: 100,
+                  align: 'center',
+                  customRender: ({ record }) => {
+                    const hotKey = childItem + item + '0';
+                    const coldKey = childItem + item + '1';
+                    let sizeArr: any = [];
+                    if (record[hotKey] || record[coldKey]) {
+                      sizeArr = [h('div', { class: 'line' }, ''), h('div', { class: 'size-st-item' }, record[hotKey] || '~')];
+                      sizeArr.push(h('div', { class: ' size-st-num' }, record[coldKey] || '~'));
+                    }
 
-                  return h(
-                    'div',
-                    {
-                      class: 'size-st-wrapper',
-                      onClick: () => {
-                        // if (!record[hotKey] && !record[coldKey]) return;
-                        const { orgData } = record;
-                        if (!orgData) return;
-                        const { hotChargeLength } = orgData;
-
-                        const hotChargeInfoArr = hotChargeLength ? JSON.parse(hotChargeLength) : [];
-
-                        const itemsHotArr = niubiGls.map((v) => {
-                          const hasVal = hotChargeInfoArr.find((j) => j.hotChargeLength == v.hotChargeLength && j.hotChargeBtype == v.hotChargeBtype);
-                          return {
-                            ...v,
-                            totalCount: hasVal ? hasVal.totalCount : 0,
+                    return h(
+                      'div',
+                      {
+                        class: 'size-st-wrapper',
+                        onClick: () => {
+                          // if (!record[hotKey] && !record[coldKey]) return;
+                          const { orgData } = record;
+                          if (!orgData) return;
+                          const { hotChargeLength } = orgData;
+
+                          const hotChargeInfoArr = hotChargeLength ? JSON.parse(hotChargeLength) : [];
+
+                          const itemsHotArr = niubiGls.map((v) => {
+                            const hasVal = hotChargeInfoArr.find(
+                              (j) => j.hotChargeLength == v.hotChargeLength && j.hotChargeBtype == v.hotChargeBtype
+                            );
+                            return {
+                              ...v,
+                              totalCount: hasVal ? hasVal.totalCount : 0,
+                            };
+                          });
+
+                          editSizeNumRecord.value = {
+                            ...orgData,
+                            hotChargeLengthArr: itemsHotArr,
                           };
-                        });
-
-                        editSizeNumRecord.value = {
-                          ...orgData,
-                          hotChargeLengthArr: itemsHotArr,
-                        };
-                        openSetSizeNumModal.value = true;
+                          openSetSizeNumModal.value = true;
+                        },
                       },
-                    },
-                    sizeArr
-                  );
-                },
-              };
-            });
+                      sizeArr
+                    );
+                  },
+                };
+              });
             otherColumnsNums = otherColumnsNums + (childSizesColumn.length ? childSizesColumn.length : 1);
             return {
               ...hotChargeColumns[item],
@@ -1119,9 +1259,19 @@
             };
           });
 
-        columns.value = [...defaultColumns, ...otherColumns, ...stackLengthColumn, ...totalColum];
+        const sortedStackLengthColumn = stackLengthColumn.map((ss) => {
+          return {
+            ...ss,
+            children: ss.children.sort((a, b) => {
+              return Number(a.sortKey) - Number(b.sortKey);
+            }),
+          };
+        });
+        columns.value = [...defaultColumns, ...otherColumns, ...sortedStackLengthColumn, ...totalColum];
         const rollOneIndex = defaultColumns.findIndex((ele: any) => ele.dataIndex === 'rollOne');
-        (columns.value[rollOneIndex] as any).children = rollOneColumns.length ? rollOneColumns : [];
+        (columns.value[rollOneIndex] as any).children = rollOneColumns.length
+          ? rollOneColumns.sort((a: any, b: any) => Number(a.sortKey) - Number(b.sortKey))
+          : [];
 
         // 堆垛的列数量
         const stackColNums = stackLengthColumn.reduce((pre: any, cur: any) => {
@@ -1182,6 +1332,8 @@
         }
 
         mainRemark.value = `合计:${allWeight.toFixed(3)} t`;
+        // 查看所有的定尺
+        mainSize.value = sizeInfo || [...new Set(allSizeArr)].join(',');
       }
       changeLoading(false);
     } catch (error) {
@@ -1837,6 +1989,14 @@
             position: relative;
           }
 
+          .delete-heat {
+            position: absolute;
+            top: 0;
+            left: -10px;
+            color: #f50;
+            cursor: pointer;
+          }
+
           .size-st-wrapper {
             position: absolute;
             top: 1px;