12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574 |
- <template>
- <BasicModal
- v-bind="$attrs"
- @register="registerModal"
- destroyOnClose
- title="推钢室生产原始记录"
- :width="1400"
- :height="930"
- ok-text="打印"
- @ok="onPrint"
- >
- <section
- ref="print"
- style="padding: 10px 10px 0; position: relative; border: 1px solid #c5c5c5; background: #fff; width: 100%; height: 100%"
- id="printBilletSampleCard"
- :key="printKey"
- >
- <div class="ticket next-ticket">
- <div style="text-align: center">
- <p style="font-size: 24px; font-weight: 800; display: inline-block; margin-bottom: 16px; line-height: 30px">
- <span class="ccmno">{{ hostNumber }}</span> #机推钢室生产原始记录
- </p>
- </div>
- <div class="flex ccmno-info" style="line-height: 24px">
- <div class="flex-1"> 班组:<component :is="renderDictTag(shiftInfo.shiftGroup, 'lg_bz')" /> </div>
- <div class="flex-1"> 班次:<component :is="renderDictTag(shiftInfo.shift, 'lg_bb')" /> </div>
- <div class="flex-1 flex"><span> 定尺:</span><a-input v-model:value="mainSize" style="flex: 1" :bordered="false" size="small" /> </div>
- <div class="flex-1" style="text-align: center; font-size: 13px">
- {{ dayjs(curTime).format('YYYY 年 MM 月 DD 日') }}
- </div>
- <div class="flex-1" style="text-align: right; font-size: 12px"> lg/R05 </div>
- </div>
- <a-table :columns="columns" size="small" :data-source="dataSource" bordered :pagination="false">
- <template #summary>
- <a-table-summary-row>
- <a-table-summary-cell :col-span="remakeColSpan" style="text-align: center">备注</a-table-summary-cell>
- <a-table-summary-cell :col-span="sizeColSpan" style="text-align: center"> 定尺 </a-table-summary-cell>
- <a-table-summary-cell :col-span="flowColSpan" style="text-align: center"> 支数(支) </a-table-summary-cell>
- <a-table-summary-cell :col-span="weightColSpan" style="text-align: center"> 产量(吨) </a-table-summary-cell>
- </a-table-summary-row>
- <a-table-summary-row class="summary-row-no-border">
- <a-table-summary-cell :row-span="2" :col-span="remakeColSpan">
- <div class="summary-cell-remark">
- <a-textarea v-model:value="mainRemark" style="min-height: 160px" :bordered="false" />
- </div>
- </a-table-summary-cell>
- <a-table-summary-cell :row-span="1" :col-span="1"> 热送 </a-table-summary-cell>
- <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
- <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
- <div class="title">{{ index }}</div>
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in item">{{ ele.size }}</div>
- </div>
- </div>
- </a-table-summary-cell>
- <a-table-summary-cell :col-span="flowColSpan">
- <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in item">{{ ele.amount }}</div>
- </div>
- </div>
- </a-table-summary-cell>
- <a-table-summary-cell :col-span="weightColSpan">
- <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in item">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
- </div>
- </div>
- </a-table-summary-cell>
- </a-table-summary-row>
- <a-table-summary-row>
- <!-- <a-table-summary-cell :col-span="remakeColSpan">
- <div class="summary-cell-remark"></div>
- </a-table-summary-cell> -->
- <a-table-summary-cell :row-span="1" :col-span="1"> 堆垛 </a-table-summary-cell>
- <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
- <div class="song-items flex">
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in stackingList">{{ ele.size }}</div>
- </div>
- </div>
- </a-table-summary-cell>
- <a-table-summary-cell :col-span="flowColSpan">
- <div class="song-items flex">
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in stackingList">{{ ele.amount }}</div>
- </div>
- </div>
- </a-table-summary-cell>
- <a-table-summary-cell :col-span="weightColSpan">
- <div class="song-items flex">
- <div class="flex flex-col">
- <div class="song-item" v-for="ele in stackingList">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
- </div>
- </div>
- </a-table-summary-cell>
- </a-table-summary-row>
- </template>
- </a-table>
- </div>
- </section>
- <template #appendFooter>
- <a-button @click="openJSModal = true"> 重量计算 </a-button>
- </template>
- </BasicModal>
- <a-modal
- v-model:open="openJSModal"
- title="重量计算"
- centered
- width="600px"
- :zIndex="9999"
- @ok="
- () => {
- openJSModal = false;
- }
- "
- @cancel="
- () => {
- openJSModal = false;
- }
- "
- >
- <div class="flex justify-center items-center" style="margin: 20px; line-height: 40px">
- <a-input-group size="large">
- <a-row :gutter="8">
- <a-col :span="5">
- <a-input type="number" :min="1" v-model:value="weightNum" placeholder="支数" />
- </a-col>
- <a-col :span="1" style="line-height: 40px; text-align: center">*</a-col>
- <a-col :span="5">
- <a-input type="number" v-model:value="sizeNum" placeholder="定尺" />
- </a-col>
- <a-col :span="1" style="line-height: 40px; text-align: center">*</a-col>
- <a-col :span="5">
- <a-input type="number" v-model:value="xiShu" placeholder="请输入比例" />
- </a-col>
- <a-col :span="1" style="line-height: 40px; text-align: center">=</a-col>
- <a-col :span="6" style="line-height: 40px; text-align: center">{{ weightCalc }}</a-col>
- </a-row>
- </a-input-group>
- </div>
- </a-modal>
- <!-- 设置定尺数量的modal -->
- <a-modal v-model:open="openSetSizeNumModal" title="设置定尺数量" centered width="500px" :zIndex="1100" @ok="confirmSetSizeNum">
- <div style="padding: 60px 30px 30px; font-size: 16px" v-if="editSizeNumRecord && editSizeNumRecord.hotChargeLengthArr">
- <div style="margin-bottom: 30px" v-for="(item, index) in editSizeNumRecord.hotChargeLengthArr" :key="index">
- <a-input-number
- size="large"
- v-model:value="item.totalCount"
- :addon-before="headText[item.hotChargeDestination] + ' ' + Number(item.hotChargeLength) / 1000 + 'm'"
- :min="0"
- :step="4"
- @change="
- (value) => {
- if (!value) {
- item.totalCount = 0;
- }
- if (value % 4 !== 0) {
- item.totalCount = value - (value % 4);
- }
- }
- "
- :controls="false"
- ></a-input-number>
- </div>
- <div style="font-size: 16px; color: #f50">注:请输入4或4的倍数.</div>
- </div>
- </a-modal>
- </template>
- <script lang="ts" setup>
- import { ref, computed, h } from 'vue';
- import { BasicModal, useModalInner } from '/@/components/Modal';
- import dayjs from 'dayjs';
- import { printJS } from '/@/hooks/web/usePrintJS';
- import type { TableColumnsType } from 'ant-design-vue';
- import { queryBilletRecordByCcmNo, editBilletRecord } from '../operator.api';
- import { render } from '/@/utils/common/renderUtils';
- import { isArray, isNumber } from '/@/utils/is';
- import Icon from '/@/components/Icon';
- import { Input, Select } from 'ant-design-vue';
- import { throttle } from 'lodash-es';
- import { useMessage } from '/@/hooks/web/useMessage';
- import { initDictOptions } from '/@/utils/dict';
- const { createMessage } = useMessage();
- const printKey = ref(dayjs().unix());
- // 渲染字典标签
- const renderDictTag = (value: string, dictCode: string) => {
- return render.renderDict(value, dictCode);
- };
- // 主机号
- const hostNumber = ref('5');
- const defaultColumns: TableColumnsType = [
- {
- title: '序号',
- width: 40,
- dataIndex: 'SerialNumber',
- align: 'center',
- key: 'SerialNumber',
- },
- {
- title: '炉号',
- dataIndex: 'heatNo',
- width: 80,
- align: 'center',
- key: 'heatNo',
- },
- {
- title: '钢种',
- width: 80,
- align: 'center',
- dataIndex: 'brandNum',
- key: 'brandNum',
- customRender: ({ text }) => {
- return render.renderDict(text, 'billet_spec');
- },
- },
- {
- title: '支数(根)',
- align: 'center',
- width: 570,
- children: [
- {
- title: 'I',
- dataIndex: 'oneFlow',
- key: 'oneFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'II',
- dataIndex: 'twoFlow',
- key: 'twoFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'III',
- dataIndex: 'threeFlow',
- key: 'threeFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'IV',
- dataIndex: 'fourFlow',
- key: 'fourFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'V',
- dataIndex: 'fiveFlow',
- key: 'fiveFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'VI',
- dataIndex: 'sixFlow',
- key: 'sixFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'VII',
- dataIndex: 'sevenFlow',
- key: 'sevenFlow',
- align: 'center',
- width: 40,
- },
- {
- title: 'VIII',
- dataIndex: 'eightFlow',
- key: 'eightFlow',
- align: 'center',
- width: 40,
- },
- {
- title: '合计',
- dataIndex: 'total',
- key: 'total',
- align: 'center',
- width: 40,
- customRender({ text, record }) {
- if (!record.heatNo) {
- return '';
- }
- const allCount = handleTotalSum(record.orgData);
- return h(
- Input,
- { class: 'total-input', size: 'small', bordered: false, value: allCount, onBlur: (e) => handleTotalChange(e, record) },
- ''
- );
- },
- },
- ],
- },
- {
- title: () => {
- return h('div', { style: { position: 'relative' } }, [
- h('span', {}, '棒一'),
- h(
- 'div',
- {
- style: {
- cursor: 'pointer',
- position: 'absolute',
- right: '4px',
- top: '1px',
- },
- class: 'noprint',
- onClick: () => {
- console.log('点击了');
- const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'rollOne');
- let newSize: string | number = '';
- rollOnrColumn.children.push({
- title: () => {
- return h(
- // Select,
- Input,
- {
- // options: sizeListOPtions.value,
- bordered: false,
- // dropdownStyle: {
- // minWidth: '80px',
- // },
- defaultValue: '',
- style: {
- padding: 0,
- textAlign: 'center',
- },
- // onChange: (value) => {
- // newSize = value;
- // },
- onBlur: throttle((e) => {
- if (e.target.value.trim() === '') {
- createMessage.error('请输入定尺');
- return;
- }
- const size = Number(e.target.value.trim());
- if (!isNumber(size)) {
- createMessage.error('请输入数字');
- return;
- }
- newSize = size <= 20 ? size * 1000 : size;
- }, 500),
- },
- ''
- );
- },
- dataIndex: 'newSize',
- key: 'newSize',
- align: 'center',
- width: 40,
- customRender({ text, record }) {
- if (!record.heatNo) {
- return '';
- }
- return h(
- Input,
- { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, newSize) },
- ''
- );
- },
- });
- },
- },
- h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
- ),
- ]);
- },
- width: 40,
- align: 'center',
- dataIndex: 'rollOne',
- key: 'rollOne',
- children: [],
- },
- ];
- const columns = ref<TableColumnsType>(defaultColumns);
- const dataSource = ref<any[]>([]);
- const shiftInfoTxt = ref(['', '']);
- const shiftInfo = ref({ shift: '', shiftGroup: '' });
- const curTime = ref(dayjs().format('YYYY-MM-DD'));
- //表单赋值
- const fetchQueryType = ref(1);
- const fetchChangeShiftId = ref('');
- // 定尺
- const sizeListOPtions = ref([]);
- const [registerModal, { changeOkLoading, changeLoading }] = useModalInner(async (data) => {
- const { ccmNo, shiftText, queryType, curShiftInfo, changeShiftId, time } = data;
- printKey.value = dayjs().unix();
- hostNumber.value = ccmNo;
- fetchQueryType.value = queryType;
- fetchChangeShiftId.value = changeShiftId;
- shiftInfoTxt.value = shiftText.split('-');
- shiftInfo.value = curShiftInfo;
- if (time) {
- curTime.value = time;
- }
- let newSip: any[] = [];
- for (let index = 0; index < 22; index++) {
- newSip.push({
- SerialNumber: index + 1,
- heatNo: '',
- brandNum: '',
- oneFlow: '',
- twoFlow: '',
- threeFlow: '',
- fourFlow: '',
- fiveFlow: '',
- sixFlow: '',
- sevenFlow: '',
- eightFlow: '',
- total: '',
- });
- }
- dataSource.value = [...newSip];
- getHeatList({
- ccmNo,
- queryType,
- changeShiftId,
- });
- // 获取定尺啊
- initDictOptions('lg_dcgg').then((dc) => {
- sizeListOPtions.value = (dc || []).map((item) => {
- return {
- label: Number(item.value) / 1000,
- value: item.value,
- };
- });
- });
- });
- // 字段映射
- const headText = {
- rollClubTwoCount: '二',
- rollClubThreeCount: '三',
- rollClubShippCount: '上',
- roll_club_two: '棒二',
- roll_club_three: '棒三',
- roll_out_shipp: '上若',
- };
- // 备注
- const remakeColSpan = ref(8);
- // 定尺
- const sizeColSpan = ref(2);
- // 支数
- const flowColSpan = ref(2);
- // 产量
- const weightColSpan = ref(4);
- // 热送统计
- const hotSendList = ref<any>({});
- // 堆垛统计
- const stackingList = ref<any>([]);
- // 定尺和备注
- const mainSize = ref('');
- const mainRemark = ref('');
- const getHeatList = async (params) => {
- try {
- changeLoading(true);
- const { billetOriginalProductRecordList, content, sizeInfo } = await queryBilletRecordByCcmNo(params);
- let newArr: any[] = [];
- mainSize.value = sizeInfo;
- mainRemark.value = content;
- if (billetOriginalProductRecordList && Array.isArray(billetOriginalProductRecordList)) {
- // 根据时间排序
- newArr = billetOriginalProductRecordList.sort((a, b) => {
- return dayjs(a.createTime).isBefore(dayjs(b.createTime)) ? -1 : 1;
- });
- let sizeColumn: string | number[] = [];
- let sizeHeadContent = {};
- // 棒一
- const rollOneColumns: TableColumnsType = [];
- const rollOneSize = {};
- // 棒二
- const rollTwoSize = {};
- // 棒三
- const rollThreeSize = {};
- // 上若
- const rollShippSize = {};
- // 堆垛
- const stackingSize = {};
- // 堆垛字段
- let stackLengthColumn: any = {
- title: () => {
- return h('div', { style: { position: 'relative' } }, [
- h('span', {}, '堆垛'),
- h(
- 'div',
- {
- style: {
- cursor: 'pointer',
- position: 'absolute',
- right: '4px',
- top: '1px',
- },
- class: 'noprint',
- onClick: () => {
- const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'stackLength');
- let newSize: string | number = '';
- rollOnrColumn.children.push({
- title: () => {
- return h(
- // Select,
- Input,
- {
- // options: sizeListOPtions.value,
- bordered: false,
- // dropdownStyle: {
- // minWidth: '80px',
- // },
- style: {
- padding: '0px',
- textAlign: 'center',
- },
- defaultValue: ' ',
- // onChange: (value) => {
- // newSize = value;
- // },
- onBlur: throttle((e) => {
- if (e.target.value.trim() === '') {
- createMessage.error('请输入定尺');
- return;
- }
- const size = Number(e.target.value.trim());
- if (!isNumber(size)) {
- createMessage.error('请输入数字');
- return;
- }
- newSize = size <= 20 ? size * 1000 : size;
- }, 500),
- },
- ''
- );
- },
- dataIndex: 'newSize',
- key: 'newSize',
- align: 'center',
- width: 40,
- customRender({ text, record }) {
- if (!record.heatNo) {
- return '';
- }
- return h(
- Input,
- { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, newSize) },
- ''
- );
- },
- });
- },
- },
- h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
- ),
- ]);
- },
- dataIndex: 'stackLength',
- key: 'stackLength',
- width: 40,
- children: [],
- };
- dataSource.value = dataSource.value.map((item, index) => {
- if (!newArr[index]) return item;
- const { hotChargeLength, rollClubOneDetails, stackLength } = newArr[index];
- // 棒一
- let rollOneNum = '';
- let rollOneSizesObj = {};
- // if (hotSend) {
- // const obj = JSON.parse(hotSend);
- // rollOneNum = obj.hotSendTotalCount || '';
- // }
- if (rollClubOneDetails) {
- const obj = JSON.parse(rollClubOneDetails);
- rollOneNum = obj.directRollingTotalCount || '';
- const lengthGroupCount = obj.lengthGroupCount;
- if (lengthGroupCount) {
- // 热送棒一的定尺
- Object.keys(lengthGroupCount).forEach((key) => {
- const column = key;
- const columnKey = column + 'rollOneColumn';
- const findIndex = rollOneColumns.findIndex((item: any) => item.dataIndex === columnKey);
- if (findIndex === -1) {
- rollOneColumns.push({
- title: () => {
- return h('div', { class: 'rollOneColumnWrapper' }, [
- h(
- // Select,
- Input,
- {
- // options: sizeListOPtions.value,
- bordered: false,
- // dropdownStyle: {
- // minWidth: '80px',
- // },
- style: {
- padding: '0px',
- textAlign: 'center',
- },
- defaultValue: Number(column) > 20 ? Number(column) / 1000 : column,
- // onChange: (value) => {
- // switchSizehandler(value, column);
- // },
- onBlur: throttle((e) => {
- const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
- switchSizehandler(value, Number(column));
- }, 500),
- },
- ''
- ),
- h(
- 'div',
- { class: 'noprint', onClick: () => deleteRollOneColumn(column) },
- h(Icon, { icon: 'ant-design:delete-outlined' }, '')
- ),
- ]);
- },
- dataIndex: columnKey,
- key: columnKey,
- align: 'center',
- width: 40,
- customRender({ text, record }) {
- if (!record.heatNo) {
- return '';
- }
- return h(
- Input,
- { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, column) },
- ''
- );
- },
- });
- }
- rollOneSizesObj[columnKey] = lengthGroupCount[key];
- // 如果没有棒一的定尺
- if (!rollOneSize[key]) {
- rollOneSize[key] = {
- size: Number(column) / 1000 + 'm',
- amount: lengthGroupCount[key],
- weight: lengthGroupCount[key] * (Number(column) / 1000) * 0.2265,
- };
- } else {
- rollOneSize[key].amount += lengthGroupCount[key];
- rollOneSize[key].weight += lengthGroupCount[key] * (Number(column) / 1000) * 0.2265;
- }
- });
- }
- }
- // 定尺
- let sizeArr = {};
- if (hotChargeLength) {
- // "[{\"hotChargeLength\":\"11820\",\"hotChargeDestination\":\"roll_club_three\",\"totalWeight\":\"5.3545\",\"totalCount\":2}]"
- const hotChargeArr = JSON.parse(hotChargeLength);
- hotChargeArr.forEach((k) => {
- const sizeFormat = Number(k.hotChargeLength) / 1000;
- if (!sizeArr[sizeFormat + 'Arr']) {
- sizeArr[sizeFormat + 'Arr'] = {};
- }
- sizeColumn.push(sizeFormat);
- // 判断是否有该字段,列头显示
- if (!sizeHeadContent[sizeFormat]) {
- sizeHeadContent[sizeFormat] = [];
- }
- // 热送统计
- // 棒二
- if (k.hotChargeDestination === 'roll_club_two' && k.totalCount > 0) {
- sizeArr[sizeFormat + 'Arr'].rollClubTwoCount = k.totalCount;
- sizeHeadContent[sizeFormat].push('rollClubTwoCount');
- if (!rollTwoSize[k.hotChargeLength]) {
- rollTwoSize[k.hotChargeLength] = {
- size: Number(k.hotChargeLength) / 1000 + 'm',
- amount: k.totalCount,
- weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
- };
- } else {
- rollTwoSize[k.hotChargeLength].amount += k.totalCount;
- rollTwoSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
- }
- }
- // 棒三
- if (k.hotChargeDestination === 'roll_club_three' && k.totalCount > 0) {
- sizeArr[sizeFormat + 'Arr'].rollClubThreeCount = k.totalCount;
- sizeHeadContent[sizeFormat].push('rollClubThreeCount');
- if (!rollThreeSize[k.hotChargeLength]) {
- rollThreeSize[k.hotChargeLength] = {
- size: Number(k.hotChargeLength) / 1000 + 'm',
- amount: k.totalCount,
- weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
- };
- } else {
- rollThreeSize[k.hotChargeLength].amount += k.totalCount;
- rollThreeSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
- }
- }
- // 上若
- if (k.hotChargeDestination === 'roll_out_shipp' && k.totalCount > 0) {
- sizeArr[sizeFormat + 'Arr'].rollClubShippCount = k.totalCount;
- sizeHeadContent[sizeFormat].push('rollClubShippCount');
- if (!rollShippSize[k.hotChargeLength]) {
- rollShippSize[k.hotChargeLength] = {
- size: Number(k.hotChargeLength) / 1000 + 'm',
- amount: k.totalCount,
- weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
- };
- } else {
- rollShippSize[k.hotChargeLength].amount += k.totalCount;
- rollShippSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
- }
- }
- });
- }
- // 堆垛
- let stackSizeData = {};
- if (stackLength) {
- const stackLeghtObj = JSON.parse(stackLength);
- stackLeghtObj.forEach((v) => {
- const sSize = String(v.stackingLength);
- const hasChild = stackLengthColumn.children.findIndex((ele) => ele.dataIndex === sSize + 'stackLength');
- if (hasChild < 0) {
- stackLengthColumn.children.push({
- title: () => {
- return h('div', { class: 'rollOneColumnWrapper' }, [
- h(
- // Select,
- Input,
- {
- // options: sizeListOPtions.value,
- bordered: false,
- // dropdownStyle: {
- // minWidth: '80px',
- // },
- style: {
- padding: '0px',
- textAlign: 'center',
- },
- defaultValue: Number(sSize) > 20 ? Number(sSize) / 1000 : sSize,
- // onChange: (value) => {
- // switchSizehandler(value, column);
- // },
- onBlur: throttle((e) => {
- const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
- switchStackhandler(value, Number(sSize));
- }, 500),
- },
- ''
- ),
- h('div', { class: 'noprint', onClick: () => deleteStackColumn(sSize) }, h(Icon, { icon: 'ant-design:delete-outlined' }, '')),
- ]);
- },
- dataIndex: sSize + 'stackLength',
- key: sSize + 'stackLength',
- width: 40,
- customRender({ text, record }) {
- if (!record.heatNo) {
- return '';
- }
- return h(
- Input,
- { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, sSize) },
- ''
- );
- },
- });
- }
- stackSizeData[sSize + 'stackLength'] = v.stackingCount;
- // 给堆垛添加致谢
- if (!stackingSize[sSize]) {
- stackingSize[sSize] = {
- size: Number(sSize) / 1000 + 'm',
- amount: v.stackingCount,
- weight: v.stackingCount * (Number(sSize) / 1000) * 0.2265,
- };
- } else {
- stackingSize[sSize].amount += v.stackingCount;
- stackingSize[sSize].weight += v.stackingCount * (Number(sSize) / 1000) * 0.2265;
- }
- });
- }
- return {
- ...item,
- heatNo: newArr[index].heatNo,
- brandNum: newArr[index].grade,
- oneFlow: newArr[index].oneStrandSum || '',
- twoFlow: newArr[index].twoStrandSum || '',
- threeFlow: newArr[index].threeStrandSum || '',
- fourFlow: newArr[index].fourStrandSum || '',
- fiveFlow: newArr[index].fiveStrandSum || '',
- sixFlow: newArr[index].sixStrandSum || '',
- sevenFlow: newArr[index].sevenStrandSum || '',
- eightFlow: newArr[index].eightStrandSum || '',
- total: newArr[index].amount || '',
- rollOneOld: rollOneNum,
- ...sizeArr,
- ...rollOneSizesObj,
- ...stackSizeData,
- orgData: newArr[index],
- };
- });
- const otherColumn: TableColumnsType = [...new Set(sizeColumn)].map((item) => {
- return {
- title: () => {
- const subHead = Object.keys(headText)
- .filter((key) => sizeHeadContent[item].includes(key))
- .map((key) => headText[key]);
- return h('div', {}, [h('div', { style: { fontSize: '12px' } }, subHead.join(' / ')), h('div', {}, item)]);
- },
- dataIndex: item,
- key: item,
- align: 'center',
- width: 50,
- customRender: ({ text, record }) => {
- if (record[item + 'Arr']) {
- const subHead = Object.keys(headText)
- .filter((key) => sizeHeadContent[item].includes(key))
- .map((key) => record[item + 'Arr'][key] || '~');
- return h(
- 'div',
- {
- class: 'size-st-num',
- onClick: () => {
- if (subHead.length === 0) return;
- const { orgData } = record;
- if (!orgData || !orgData.hotChargeLength) return;
- const { hotChargeLength } = orgData;
- editSizeNumRecord.value = {
- ...orgData,
- hotChargeLengthArr: JSON.parse(hotChargeLength),
- };
- openSetSizeNumModal.value = true;
- },
- },
- subHead.join('/')
- );
- }
- return '';
- },
- };
- });
- // 添加空白列
- otherColumn.push(stackLengthColumn);
- columns.value = [...defaultColumns, ...otherColumn];
- (columns.value[4] as any).children = rollOneColumns.length ? rollOneColumns : [];
- // if (rollOneColumns.length) {
- // columns.value[4].children = rollOneColumns;
- // } else {
- // columns.value[4].children = [];
- // }
- const allSpan = 12 + rollOneColumns.length + otherColumn.length + stackLengthColumn.children.length;
- remakeColSpan.value = Math.ceil(allSpan / 3);
- const nnColSpan = Math.ceil((allSpan - remakeColSpan.value) / 2);
- const newNNColSpan = nnColSpan % 2 === 0 ? nnColSpan : nnColSpan + 1;
- sizeColSpan.value = newNNColSpan / 2 > 4 ? newNNColSpan / 2 : 4;
- flowColSpan.value = newNNColSpan - sizeColSpan.value;
- weightColSpan.value = allSpan - remakeColSpan.value - newNNColSpan;
- // 热送统计
- if (Object.values(rollOneSize).length) {
- hotSendList.value['一'] = Object.values(rollOneSize);
- }
- if (Object.values(rollTwoSize).length) {
- hotSendList.value['二'] = Object.values(rollTwoSize);
- }
- if (Object.values(rollThreeSize).length) {
- hotSendList.value['三'] = Object.values(rollThreeSize);
- }
- if (Object.values(rollShippSize).length) {
- hotSendList.value['上'] = Object.values(rollShippSize);
- }
- if (Object.values(stackingSize)) {
- stackingList.value = Object.values(stackingSize);
- }
- }
- changeLoading(false);
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- const openJSModal = ref(false);
- const xiShu = ref(0.2265);
- const sizeNum = ref();
- const weightNum = ref();
- // 重量计算按钮
- const weightCalc = computed(() => {
- const w = Number(weightNum.value);
- const x = Number(xiShu.value);
- const s = Number(sizeNum.value);
- if (isNumber(w) && isNumber(x) && isNumber(s)) {
- const r = w * x * s;
- return !isNaN(r) ? r.toFixed(6) : '';
- }
- return '';
- });
- // 修改合计
- const handleTotalChange = throttle((e: any, record) => {
- const val = Number(e.target.value);
- if (!isNumber(val) || val <= 0) {
- createMessage.error('请输入数字');
- return;
- }
- if (record.total !== val) {
- const { orgData } = record;
- handleEdit({
- ...orgData,
- amount: val,
- });
- }
- }, 800);
- // 编辑
- const handleEdit = async (record) => {
- try {
- changeLoading(true);
- await editBilletRecord(record);
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- changeLoading(false);
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- // 修改棒一定尺数量
- const handleSizeChange = throttle((e: any, record, size) => {
- if (!size) {
- createMessage.error('请选择定尺');
- return;
- }
- const val = Number(e.target.value);
- if (!isNumber(val) || val < 0) {
- createMessage.error('请输入大于或等于0的数字');
- return;
- }
- const { orgData } = record;
- const { rollClubOneDetails } = orgData;
- let obj = {
- lengthGroupCount: {},
- directRollingTotalWeight: 0,
- directRollingTotalCount: 0,
- };
- if (rollClubOneDetails) {
- obj = JSON.parse(rollClubOneDetails);
- }
- const lengthGroupCount = obj.lengthGroupCount;
- if (
- lengthGroupCount &&
- ((Object.hasOwn(lengthGroupCount, size) && (val === 0 || lengthGroupCount[size] !== val)) ||
- (!Object.hasOwn(lengthGroupCount, size) && val > 0))
- ) {
- if (val <= 0) {
- delete obj.lengthGroupCount[size];
- } else {
- obj.lengthGroupCount[size] = val;
- }
- const params = {
- ...orgData,
- rollClubOneDetails: JSON.stringify(obj),
- };
- const amount = handleTotalSum(params);
- handleEdit({
- ...params,
- amount,
- });
- }
- }, 800);
- // 计算总数
- const handleTotalSum = (record) => {
- const { rollClubOneDetails, stackLength, hotChargeLength } = record;
- let allCount = 0;
- if (rollClubOneDetails) {
- const sendObj = JSON.parse(rollClubOneDetails);
- if (sendObj.lengthGroupCount) {
- Object.keys(sendObj.lengthGroupCount).forEach((key) => {
- allCount += sendObj.lengthGroupCount[key];
- });
- }
- }
- if (stackLength) {
- const stackObj = JSON.parse(stackLength);
- if (isArray(stackObj)) {
- stackObj.forEach((item) => {
- allCount += item.stackingCount;
- });
- }
- }
- if (hotChargeLength) {
- const chargeObj = JSON.parse(hotChargeLength);
- if (isArray(chargeObj)) {
- chargeObj.forEach((item) => {
- allCount += item.totalCount;
- });
- }
- }
- return allCount;
- };
- // 修改堆垛定尺数量
- const handleStackChange = throttle((e: any, record, size) => {
- if (e.target.value.trim() === '') return;
- if (!size) {
- createMessage.error('请选择定尺');
- return;
- }
- const val = Number(e.target.value);
- if (!isNumber(val)) {
- createMessage.error('请输入大于等于0的数字');
- return;
- }
- const { orgData } = record;
- const { stackLength } = orgData;
- let obj: any[] = [];
- if (stackLength) {
- obj = JSON.parse(stackLength);
- }
- const lengthGroupCount = obj.findIndex((v) => v.stackingLength == size);
- // 计算补的数量是不是4的倍数
- let stackInfo: any = null;
- const buCount = lengthGroupCount > -1 ? val - obj[lengthGroupCount].stackingCount : val;
- if (buCount && buCount > 0) {
- if (buCount % 4 !== 0) {
- createMessage.error('补数量必须是4的倍数');
- return;
- }
- stackInfo = buCount + '-' + size + '-10';
- } else {
- stackInfo = null;
- }
- if (lengthGroupCount === -1) {
- obj.push({
- stackingCount: val,
- stackingLength: size,
- stackingWeight: val * (Number(size) / 1000) * 0.2265,
- });
- } else {
- if (obj[lengthGroupCount].stackingCount === val) return;
- obj[lengthGroupCount].stackingCount = val;
- obj[lengthGroupCount].stackingWeight = val * (Number(size) / 1000) * 0.2265;
- }
- const params = {
- ...orgData,
- stackLength: JSON.stringify(obj),
- stackInfo,
- };
- const amount = handleTotalSum(params);
- handleEdit({
- ...params,
- amount,
- });
- }, 800);
- // 编辑切换定尺
- const switchSizehandler = async (val, oldSize) => {
- try {
- changeLoading(true);
- const fetchArr: any[] = [];
- dataSource.value.forEach((item) => {
- if (item.heatNo && item.orgData) {
- const { rollClubOneDetails } = item.orgData;
- if (rollClubOneDetails) {
- const obj = JSON.parse(rollClubOneDetails);
- if (obj && obj.lengthGroupCount) {
- const lengthGroupCount = obj.lengthGroupCount;
- if (lengthGroupCount[oldSize]) {
- obj.lengthGroupCount[val] = lengthGroupCount[oldSize] + (lengthGroupCount[val] ? lengthGroupCount[val] : 0);
- delete obj.lengthGroupCount[oldSize];
- // 请求push了
- fetchArr.push(
- editBilletRecord({
- ...item.orgData,
- rollClubOneDetails: JSON.stringify(obj),
- })
- );
- }
- }
- }
- }
- });
- if (fetchArr.length > 0) {
- await Promise.all(fetchArr);
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- changeLoading(false);
- }
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- // 堆垛编辑定尺
- const switchStackhandler = async (val, oldSize) => {
- console.log(val, oldSize);
- try {
- changeLoading(true);
- const fetchArr: any[] = [];
- dataSource.value.forEach((item) => {
- if (item.heatNo && item.orgData) {
- const { stackLength } = item.orgData;
- if (stackLength) {
- let obj = stackLength ? JSON.parse(stackLength) : [];
- const oldSizeIndex = obj.findIndex((k) => k.stackingLength === oldSize);
- if (oldSizeIndex > -1) {
- const newSizeIndex = obj.findIndex((k) => k.stackingLength === Number(val));
- if (newSizeIndex > -1) {
- obj[newSizeIndex].stackingCount += obj[oldSizeIndex].stackingCount;
- obj = obj.filter((j) => j.stackingLength !== oldSize);
- } else {
- obj[oldSizeIndex].stackingLength = Number(val);
- }
- // 请求push了
- fetchArr.push(
- editBilletRecord({
- ...item.orgData,
- stackLength: JSON.stringify(obj),
- })
- );
- }
- }
- }
- });
- if (fetchArr.length > 0) {
- await Promise.all(fetchArr);
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- changeLoading(false);
- }
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- // 删除定尺
- const deleteRollOneColumn = async (size) => {
- try {
- changeLoading(true);
- const fetchArr: any[] = [];
- dataSource.value.forEach((item) => {
- if (item.heatNo && item.orgData) {
- const { rollClubOneDetails } = item.orgData;
- if (rollClubOneDetails) {
- const obj = JSON.parse(rollClubOneDetails);
- if (obj && obj.lengthGroupCount) {
- const lengthGroupCount = obj.lengthGroupCount;
- if (lengthGroupCount[size]) {
- delete obj.lengthGroupCount[size];
- // 请求push了
- const params = {
- ...item.orgData,
- rollClubOneDetails: JSON.stringify(obj),
- };
- const amount = handleTotalSum(params);
- fetchArr.push(
- editBilletRecord({
- ...params,
- amount,
- })
- );
- }
- }
- }
- }
- });
- if (fetchArr.length > 0) {
- await Promise.all(fetchArr);
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- changeLoading(false);
- }
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- // 删除堆垛定尺
- const deleteStackColumn = async (size) => {
- try {
- changeLoading(true);
- const fetchArr: any[] = [];
- dataSource.value.forEach((item) => {
- if (item.heatNo && item.orgData) {
- const { stackLength } = item.orgData;
- if (stackLength) {
- const obj = JSON.parse(stackLength);
- const hasStackItem = obj.findIndex((n) => n.stackingLength == size);
- if (hasStackItem > -1) {
- const lengthGroupCount = obj.filter((m) => m.stackingLength != size);
- // 请求push了
- const params = {
- ...item.orgData,
- stackLength: JSON.stringify(lengthGroupCount),
- };
- const amount = handleTotalSum(params);
- fetchArr.push(
- editBilletRecord({
- ...params,
- amount,
- })
- );
- }
- }
- }
- });
- if (fetchArr.length > 0) {
- await Promise.all(fetchArr);
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- }
- changeLoading(false);
- } catch (error) {
- changeLoading(false);
- console.log(error);
- }
- };
- // 编辑目的地定尺数量
- const openSetSizeNumModal = ref(false);
- const editSizeNumRecord = ref<any>({});
- const confirmSetSizeNum = async () => {
- try {
- changeLoading(true);
- const { hotChargeLengthArr } = editSizeNumRecord.value;
- if (!hotChargeLengthArr.length) {
- return;
- }
- const arr = hotChargeLengthArr
- .filter((ele) => ele.totalCount)
- .map((k) => {
- return {
- ...k,
- totalWeight: (k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265).toFixed(4),
- };
- });
- editSizeNumRecord.value.hotChargeLength = arr.length ? JSON.stringify(arr) : null;
- await editBilletRecord({
- ...editSizeNumRecord.value,
- });
- openSetSizeNumModal.value = false;
- await getHeatList({
- ccmNo: hostNumber.value,
- queryType: fetchQueryType.value,
- changeShiftId: fetchChangeShiftId.value,
- });
- changeLoading(false);
- } catch (e) {
- changeLoading(false);
- console.log(e);
- }
- };
- function onPrint() {
- changeOkLoading(true);
- printJS({
- printable: '#printBilletSampleCard',
- type: 'html',
- });
- setTimeout(() => {
- changeOkLoading(false);
- }, 1000);
- }
- </script>
- <style scoped lang="less">
- .ticket {
- max-width: 1400px;
- height: 100%;
- display: flex;
- flex-direction: column;
- .ccmno-info {
- font-family: 'Kingsoft_Cloud_Font';
- }
- .ccmno {
- display: inline-block;
- width: 60px;
- border-bottom: 1px solid black;
- text-align: center;
- }
- .size-items-title {
- font-size: 12px;
- line-height: 32px;
- border-bottom: 1px solid #bfbfbf;
- padding-left: 10px;
- min-width: 100px;
- }
- .size-num-title {
- font-size: 12px;
- line-height: 32px;
- padding-left: 10px;
- }
- .size-items-content {
- height: 32px;
- text-align: center;
- line-height: 32px;
- }
- .size-items-remark {
- width: 100%;
- min-height: 90px;
- flex-wrap: wrap;
- font-family: 'Kingsoft_Cloud_Font';
- align-content: flex-start;
- .size-remark-item {
- width: 50%;
- height: 30px;
- color: #000;
- }
- .size-remark-size {
- display: inline-block;
- width: 80px;
- }
- .size-remark-num {
- display: inline-block;
- width: 80px;
- padding: 0 40px 0 0;
- font-size: 12px;
- }
- }
- .two-num-wrapper {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- z-index: 10;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-end;
- padding-right: 6px;
- }
- .s-txt {
- font-family: 'Kingsoft_Cloud_Font';
- }
- .ant-table-wrapper {
- flex: 1;
- :deep(.ant-spin-nested-loading) {
- min-height: 100%;
- .ant-table {
- border-top: 1px solid rgba(0, 0, 0, 0.6);
- > .ant-table-container {
- border-inline-start: 1px solid rgba(0, 0, 0, 0.6);
- }
- .ant-table-content > table > thead > tr > th,
- .ant-table-tbody > tr > td,
- .ant-table-summary > tr > td {
- padding: 2px;
- border-inline-end: 1px solid rgba(0, 0, 0, 0.6);
- border-bottom: 1px solid rgba(0, 0, 0, 0.6) !important;
- text-align: center;
- position: relative;
- }
- .size-st-wrapper {
- position: absolute;
- top: 1px;
- left: 1px;
- right: 1px;
- bottom: 1px;
- .line {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- width: 100%; /* 等于长方形宽度 */
- height: 100%; /* 等于长方形高度 */
- /* 创建斜线:线性渐变从左上到右下 */
- background: linear-gradient(
- to bottom right,
- transparent 0%,
- transparent calc(50% - 0.5px),
- /* 斜线上方透明 */ rgba(0, 0, 0, 0.6) calc(50% - 0.5px),
- /* 斜线颜色 */ rgba(0, 0, 0, 0.6) calc(50% + 0.5px),
- /* 斜线厚度 */ transparent calc(50% + 0.5px) /* 斜线下方透明 */
- );
- }
- .size-st-item {
- position: absolute;
- top: -4px;
- left: 2px;
- color: #108ee9;
- }
- }
- .size-st-num {
- color: #f50;
- cursor: pointer;
- }
- // 自定义啊
- .total-input {
- width: 100%;
- padding: 0;
- text-align: center;
- cursor: pointer;
- }
- .ant-select {
- width: 100%;
- .ant-select-selector {
- padding: 0;
- .ant-select-selection-item,
- .ant-select-selection-placeholder {
- padding-inline-end: 0;
- }
- }
- .ant-select-arrow {
- display: none;
- }
- }
- .rollOneColumnWrapper {
- position: relative;
- width: 100%;
- height: 100%;
- .noprint {
- position: absolute;
- left: 0;
- top: 0;
- display: none;
- color: #f50;
- cursor: pointer;
- }
- &:hover {
- .noprint {
- display: block;
- }
- }
- }
- }
- }
- .summary-row-no-border {
- td:first-child {
- border-bottom: none !important;
- }
- .song-items {
- width: 100%;
- height: 100%;
- align-items: flex-start;
- justify-content: flex-start;
- .title {
- margin-right: 10px;
- }
- }
- }
- .summary-cell-remark {
- min-height: 70px;
- }
- }
- }
- </style>
- <style lang="less">
- @media print {
- header,
- footer,
- .noprint {
- display: none;
- }
- @page {
- margin-top: 10px; /* 第一页的页眉距离顶部为0 */
- margin-bottom: 0; /* 第一页的页脚距离底部为0 */
- }
- }
- </style>
|