orgData.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776
  1. <template>
  2. <a-spin :spinning="isSpinning" wrapperClassName="orgData-info-spin">
  3. <div class="ticket next-ticket">
  4. <div style="text-align: center; position: relative">
  5. <div class="noprint" style="position: absolute">
  6. <a-button type="primary" @click="addHeatNo">添加炉号</a-button>
  7. </div>
  8. <p style="font-size: 24px; font-weight: 800; display: inline-block; margin-bottom: 16px; line-height: 30px">
  9. <span class="ccmno">{{ hostNumber }}</span> #机推钢室生产原始记录
  10. </p>
  11. </div>
  12. <div class="flex ccmno-info" style="line-height: 24px">
  13. <div class="flex-1"> 班组:<component :is="renderDictTag(shiftInfo.shiftGroup, 'lg_bz')" /> </div>
  14. <div class="flex-1"> 班次:<component :is="renderDictTag(shiftInfo.shift, 'lg_bb')" /> </div>
  15. <div class="flex-1 flex"
  16. ><span> 定尺:</span
  17. ><a-input v-model:value="mainSize" @blur="handleSizeBlur" style="flex: 1; margin-top: -4px" :bordered="false" size="small" />
  18. </div>
  19. <div class="flex-1" style="text-align: center">
  20. {{ dayjs(curTime).format('YYYY 年 MM 月 DD 日') }}
  21. </div>
  22. <div class="flex-1" style="text-align: right"> lg/R05 </div>
  23. </div>
  24. <a-table :columns="columns" size="small" :data-source="dataSource" bordered :pagination="false">
  25. <template #summary>
  26. <a-table-summary-row>
  27. <a-table-summary-cell :col-span="remakeColSpan" style="text-align: center">备注</a-table-summary-cell>
  28. <a-table-summary-cell :col-span="sizeColSpan" style="text-align: center"> 定尺 </a-table-summary-cell>
  29. <a-table-summary-cell :col-span="flowColSpan" style="text-align: center"> 支数(支) </a-table-summary-cell>
  30. <a-table-summary-cell :col-span="weightColSpan" style="text-align: center"> 产量(吨) </a-table-summary-cell>
  31. </a-table-summary-row>
  32. <a-table-summary-row class="summary-row-no-border">
  33. <a-table-summary-cell :row-span="2" :col-span="remakeColSpan">
  34. <div class="summary-cell-remark">
  35. <a-textarea v-model:value="mainRemark" @blur="handleRemarkBlur" style="min-height: 160px" :bordered="false" />
  36. </div>
  37. </a-table-summary-cell>
  38. <a-table-summary-cell :row-span="1" :col-span="1"> 热送 </a-table-summary-cell>
  39. <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
  40. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  41. <div class="title">{{ index }}</div>
  42. <div class="flex flex-col">
  43. <div class="song-item" v-for="ele in item">{{ ele.size }}</div>
  44. </div>
  45. </div>
  46. </a-table-summary-cell>
  47. <a-table-summary-cell :col-span="flowColSpan">
  48. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  49. <div class="flex flex-col">
  50. <div class="song-item" v-for="ele in item">{{ ele.amount }}</div>
  51. </div>
  52. </div>
  53. </a-table-summary-cell>
  54. <a-table-summary-cell :col-span="weightColSpan">
  55. <div class="song-items flex" v-for="(item, index) in hotSendList" :key="index">
  56. <div class="flex flex-col">
  57. <div class="song-item" v-for="ele in item">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
  58. </div>
  59. </div>
  60. </a-table-summary-cell>
  61. </a-table-summary-row>
  62. <a-table-summary-row>
  63. <a-table-summary-cell :row-span="1" :col-span="1"> 堆垛 </a-table-summary-cell>
  64. <a-table-summary-cell :row-span="1" :col-span="sizeColSpan - 1">
  65. <div class="song-items flex">
  66. <div class="flex flex-col">
  67. <div class="song-item" v-for="ele in stackingList">{{ ele.size }}</div>
  68. </div>
  69. </div>
  70. <div class="song-items flex" v-for="(item, index) in coldSendList" :key="index">
  71. <div class="title" style="margin-right: 10px; color: #108ee9">{{ index }}</div>
  72. <div class="flex flex-col">
  73. <div class="song-item" v-for="ele in item">{{ ele.size }}</div>
  74. </div>
  75. </div>
  76. </a-table-summary-cell>
  77. <a-table-summary-cell :col-span="flowColSpan">
  78. <div class="song-items flex">
  79. <div class="flex flex-col">
  80. <div class="song-item" v-for="ele in stackingList">{{ ele.amount }}</div>
  81. </div>
  82. </div>
  83. <div class="song-items flex" v-for="(item, index) in coldSendList" :key="index">
  84. <div class="flex flex-col">
  85. <div class="song-item" v-for="ele in item">{{ ele.amount }}</div>
  86. </div>
  87. </div>
  88. </a-table-summary-cell>
  89. <a-table-summary-cell :col-span="weightColSpan">
  90. <div class="song-items flex">
  91. <div class="flex flex-col">
  92. <div class="song-item" v-for="ele in stackingList">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
  93. </div>
  94. </div>
  95. <div class="song-items flex" v-for="(item, index) in coldSendList" :key="index">
  96. <div class="flex flex-col">
  97. <div class="song-item" v-for="ele in item">{{ ele.weight ? ele.weight.toFixed(3) : '' }} t</div>
  98. </div>
  99. </div>
  100. </a-table-summary-cell>
  101. </a-table-summary-row>
  102. </template>
  103. </a-table>
  104. </div>
  105. </a-spin>
  106. <!-- 设置定尺数量的modal -->
  107. <a-modal v-model:open="openSetSizeNumModal" title="设置定尺数量" centered width="500px" :zIndex="1100" @ok="confirmSetSizeNum">
  108. <div style="padding: 60px 30px 30px; font-size: 16px" v-if="editSizeNumRecord && editSizeNumRecord.hotChargeLengthArr">
  109. <div style="margin-bottom: 30px" v-for="(item, index) in editSizeNumRecord.hotChargeLengthArr" :key="index">
  110. <a-input-number
  111. size="large"
  112. v-model:value="item.totalCount"
  113. :min="0"
  114. :step="1"
  115. @change="
  116. (value) => {
  117. if (!value) {
  118. item.totalCount = 0;
  119. }
  120. // if (value % 4 !== 0) {
  121. // item.totalCount = value - (value % 4);
  122. // }
  123. }
  124. "
  125. :controls="false"
  126. >
  127. <template #addonBefore>
  128. <div :style="{ color: item.hotChargeBtype === '0' ? '#f50' : '#108ee9' }">
  129. {{
  130. headText[item.hotChargeDestination] +
  131. ' ' +
  132. Number(item.hotChargeLength) / 1000 +
  133. 'm ' +
  134. ' ' +
  135. (item.hotChargeBtype === '0' ? '热' : '冷')
  136. }}
  137. </div>
  138. </template>
  139. </a-input-number>
  140. </div>
  141. <div style="font-size: 16px; color: #f50">注:请输入大于等于0的数.</div>
  142. </div>
  143. </a-modal>
  144. <!-- 新增炉号 -->
  145. <a-modal v-model:open="openNewHeatNo" title="新增炉次" centered width="500px" :zIndex="1000" @ok="confirmAddHeatNo">
  146. <div style="padding: 60px 30px 30px; font-size: 16px">
  147. <a-input size="large" v-model:value="newHeatNo"></a-input>
  148. </div>
  149. </a-modal>
  150. </template>
  151. <script setup lang="ts">
  152. import { ref, computed, h, onMounted } from 'vue';
  153. import dayjs from 'dayjs';
  154. import type { TableColumnsType } from 'ant-design-vue';
  155. import { queryBilletRecordByCcmNo, editBilletRecord, addBilletNo, editOriginalProductRecord } from '../operator.api';
  156. import { render } from '/@/utils/common/renderUtils';
  157. import { isArray, isNumber } from '/@/utils/is';
  158. import Icon from '/@/components/Icon';
  159. import { Input, Select } from 'ant-design-vue';
  160. import { throttle } from 'lodash-es';
  161. import { useMessage } from '/@/hooks/web/useMessage';
  162. import { initDictOptions } from '/@/utils/dict';
  163. import { useTimeoutFn } from '/@/hooks/core/useTimeout';
  164. const emits = defineEmits(['statistics']);
  165. const { createMessage } = useMessage();
  166. const printKey = ref(dayjs().unix());
  167. const props = defineProps({
  168. openData: {
  169. type: Object,
  170. default: () => {},
  171. },
  172. });
  173. // 渲染字典标签
  174. const renderDictTag = (value: string, dictCode: string) => {
  175. return render.renderDict(value, dictCode);
  176. };
  177. // 主机号
  178. const hostNumber = ref('5');
  179. const defaultColumns: TableColumnsType = [
  180. {
  181. title: '序号',
  182. width: 40,
  183. dataIndex: 'SerialNumber',
  184. align: 'center',
  185. key: 'SerialNumber',
  186. },
  187. {
  188. title: '炉号',
  189. dataIndex: 'heatNo',
  190. // width: 80,
  191. align: 'center',
  192. key: 'heatNo',
  193. },
  194. {
  195. title: '钢种',
  196. // width: 80,
  197. align: 'center',
  198. dataIndex: 'brandNum',
  199. key: 'brandNum',
  200. customRender: ({ text }) => {
  201. return render.renderDict(text, 'billet_spec');
  202. },
  203. },
  204. {
  205. title: () => {
  206. return h('div', { style: { position: 'relative' } }, [
  207. h('span', {}, '棒一'),
  208. h(
  209. 'div',
  210. {
  211. style: {
  212. cursor: 'pointer',
  213. position: 'absolute',
  214. right: '4px',
  215. top: '1px',
  216. },
  217. class: 'noprint',
  218. onClick: () => {
  219. console.log('点击了');
  220. const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'rollOne');
  221. let newSize: string | number = '';
  222. rollOnrColumn.children.push({
  223. title: () => {
  224. return h(
  225. // Select,
  226. Input,
  227. {
  228. // options: sizeListOPtions.value,
  229. bordered: false,
  230. // dropdownStyle: {
  231. // minWidth: '80px',
  232. // },
  233. defaultValue: '',
  234. style: {
  235. padding: 0,
  236. textAlign: 'center',
  237. },
  238. // onChange: (value) => {
  239. // newSize = value;
  240. // },
  241. onBlur: throttle((e) => {
  242. if (e.target.value.trim() === '') {
  243. createMessage.error('请输入定尺');
  244. return;
  245. }
  246. const size = Number(e.target.value.trim());
  247. if (!isNumber(size)) {
  248. createMessage.error('请输入数字');
  249. return;
  250. }
  251. newSize = size <= 20 ? size * 1000 : size;
  252. }, 500),
  253. },
  254. ''
  255. );
  256. },
  257. dataIndex: 'newSize',
  258. key: 'newSize',
  259. align: 'center',
  260. // width: 100,
  261. customRender({ text, record }) {
  262. if (!record.heatNo) {
  263. return '';
  264. }
  265. return h(
  266. Input,
  267. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, newSize) },
  268. ''
  269. );
  270. },
  271. });
  272. },
  273. },
  274. h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
  275. ),
  276. ]);
  277. },
  278. width: 80,
  279. align: 'center',
  280. dataIndex: 'rollOne',
  281. key: 'rollOne',
  282. children: [],
  283. },
  284. ];
  285. const totalColum: TableColumnsType = [
  286. {
  287. title: '合计',
  288. dataIndex: 'total',
  289. key: 'total',
  290. align: 'center',
  291. // width: 100,
  292. customRender({ text, record }) {
  293. if (!record.heatNo) {
  294. return '';
  295. }
  296. const allCount = handleTotalSum(record.orgData);
  297. return h(Input, { class: 'total-input', size: 'small', bordered: false, value: allCount, onBlur: (e) => handleTotalChange(e, record) }, '');
  298. },
  299. },
  300. ];
  301. const columns = ref<TableColumnsType>(defaultColumns);
  302. const dataSource = ref<any[]>([]);
  303. const shiftInfoTxt = ref(['', '']);
  304. const shiftInfo = ref({ shift: '', shiftGroup: '' });
  305. const curTime = ref(dayjs().format('YYYY-MM-DD'));
  306. //表单赋值
  307. const fetchQueryType = ref(1);
  308. const fetchChangeShiftId = ref('');
  309. // 定尺
  310. const sizeListOPtions = ref([]);
  311. const isSpinning = ref(false);
  312. // 字段映射
  313. const headText = {
  314. rollClubTwoCount: '二',
  315. rollClubThreeCount: '三',
  316. rollClubShippCount: '上',
  317. roll_club_two: '棒二',
  318. roll_club_three: '棒三',
  319. roll_out_shipp: '上若',
  320. };
  321. const changeLoading = (b) => {
  322. isSpinning.value = b;
  323. };
  324. const { start, stop } = useTimeoutFn(() => {
  325. getHeatList(
  326. {
  327. ccmNo: hostNumber.value,
  328. queryType: fetchQueryType.value,
  329. changeShiftId: fetchChangeShiftId.value,
  330. },
  331. true
  332. );
  333. }, 60000);
  334. onMounted(() => {
  335. initData(props.openData);
  336. });
  337. let newSip: any[] = [];
  338. for (let index = 0; index < 22; index++) {
  339. newSip.push({
  340. SerialNumber: index + 1,
  341. heatNo: '',
  342. brandNum: '',
  343. oneFlow: '',
  344. twoFlow: '',
  345. threeFlow: '',
  346. fourFlow: '',
  347. fiveFlow: '',
  348. sixFlow: '',
  349. sevenFlow: '',
  350. eightFlow: '',
  351. total: '',
  352. });
  353. }
  354. const defaultSourceData = newSip;
  355. const initData = async (data) => {
  356. const { ccmNo, shiftText, queryType, curShiftInfo, changeShiftId, time } = data;
  357. printKey.value = dayjs().unix();
  358. hostNumber.value = ccmNo;
  359. fetchQueryType.value = queryType;
  360. fetchChangeShiftId.value = changeShiftId;
  361. shiftInfoTxt.value = shiftText.split('-');
  362. shiftInfo.value = curShiftInfo;
  363. if (time) {
  364. curTime.value = time;
  365. }
  366. dataSource.value = [...newSip];
  367. getHeatList(
  368. {
  369. ccmNo,
  370. queryType,
  371. changeShiftId,
  372. },
  373. true
  374. );
  375. // 获取定尺啊
  376. initDictOptions('lg_dcgg').then((dc) => {
  377. sizeListOPtions.value = (dc || []).map((item) => {
  378. return {
  379. label: Number(item.value) / 1000,
  380. value: item.value,
  381. };
  382. });
  383. });
  384. };
  385. // 备注
  386. const remakeColSpan = ref(8);
  387. // 定尺
  388. const sizeColSpan = ref(2);
  389. // 支数
  390. const flowColSpan = ref(2);
  391. // 产量
  392. const weightColSpan = ref(4);
  393. // 热送统计
  394. const hotSendList = ref<any>({});
  395. // 冷装统计
  396. const coldSendList = ref<any>({});
  397. // 堆垛统计
  398. const stackingList = ref<any>([]);
  399. // 定尺和备注
  400. const mainOrgSize = ref('');
  401. const mainSize = ref('');
  402. const mainOrgRemark = ref('');
  403. const mainRemark = ref('');
  404. const getHeatList = async (params, isInit?: boolean) => {
  405. if (isInit !== true) {
  406. setTimeout(() => {
  407. getHeatListCopy(params);
  408. }, 800);
  409. } else {
  410. return getHeatListCopy(params);
  411. }
  412. };
  413. const getHeatListCopy = async (params) => {
  414. try {
  415. stop();
  416. changeLoading(true);
  417. const { billetOriginalProductRecordList, content, sizeInfo } = await queryBilletRecordByCcmNo(params);
  418. let newArr: any[] = [];
  419. mainOrgSize.value = sizeInfo || '';
  420. mainSize.value = sizeInfo || '';
  421. mainRemark.value = content || '';
  422. mainOrgRemark.value = content || '';
  423. if (billetOriginalProductRecordList && Array.isArray(billetOriginalProductRecordList)) {
  424. // 根据时间排序
  425. newArr = billetOriginalProductRecordList.sort((a, b) => {
  426. return dayjs(a.createTime).isBefore(dayjs(b.createTime)) ? -1 : 1;
  427. });
  428. // 棒一
  429. const rollOneColumns: TableColumnsType = [];
  430. const rollOneSize = {};
  431. // 棒二
  432. const rollTwoSize = {};
  433. // 棒三
  434. const rollThreeSize = {};
  435. // 上若
  436. const rollShippSize = {};
  437. // 冷装
  438. const rollTwoColdSize = {};
  439. const rollThreeColdSize = {};
  440. const rollShippColdSize = {};
  441. // 装车按热装和冷装分组
  442. const rollChargeSizeType = {
  443. '0': {},
  444. '1': {},
  445. };
  446. // 堆垛
  447. const stackingSize = {};
  448. // 堆垛字段
  449. let stackLengthColumn: any = {
  450. title: () => {
  451. return h('div', { style: { position: 'relative' } }, [
  452. h('span', {}, '堆垛'),
  453. h(
  454. 'div',
  455. {
  456. style: {
  457. cursor: 'pointer',
  458. position: 'absolute',
  459. right: '4px',
  460. top: '1px',
  461. },
  462. class: 'noprint',
  463. onClick: () => {
  464. const rollOnrColumn: any = columns.value.find((item: any) => item.dataIndex === 'stackLength');
  465. let newSize: string | number = '';
  466. rollOnrColumn.children.push({
  467. title: () => {
  468. return h(
  469. // Select,
  470. Input,
  471. {
  472. // options: sizeListOPtions.value,
  473. bordered: false,
  474. // dropdownStyle: {
  475. // minWidth: '80px',
  476. // },
  477. style: {
  478. padding: '0px',
  479. textAlign: 'center',
  480. },
  481. defaultValue: ' ',
  482. // onChange: (value) => {
  483. // newSize = value;
  484. // },
  485. onBlur: throttle((e) => {
  486. if (e.target.value.trim() === '') {
  487. createMessage.error('请输入定尺');
  488. return;
  489. }
  490. const size = Number(e.target.value.trim());
  491. if (!isNumber(size)) {
  492. createMessage.error('请输入数字');
  493. return;
  494. }
  495. newSize = size <= 20 ? size * 1000 : size;
  496. }, 500),
  497. },
  498. ''
  499. );
  500. },
  501. dataIndex: 'newSize',
  502. key: 'newSize',
  503. align: 'center',
  504. // width: 100,
  505. customRender({ text, record }) {
  506. if (!record.heatNo) {
  507. return '';
  508. }
  509. return h(
  510. Input,
  511. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, newSize) },
  512. ''
  513. );
  514. },
  515. });
  516. },
  517. },
  518. h(Icon, { icon: 'ant-design:plus-square-outlined' }, '')
  519. ),
  520. ]);
  521. },
  522. dataIndex: 'stackLength',
  523. key: 'stackLength',
  524. width: 120,
  525. children: [],
  526. };
  527. const hotChargeColumns: any = {
  528. // 棒二字段
  529. roll_club_two: {
  530. title: '棒二',
  531. dataIndex: 'roll_club_two',
  532. key: 'roll_club_two',
  533. // width: 100,
  534. children: [],
  535. },
  536. // 棒三字段
  537. roll_club_three: {
  538. title: '棒三',
  539. dataIndex: 'roll_club_three',
  540. key: 'roll_club_three',
  541. // width: 100,
  542. children: [],
  543. },
  544. // 上若字段
  545. roll_out_shipp: {
  546. title: '上若',
  547. dataIndex: 'roll_out_shipp',
  548. key: 'roll_out_shipp',
  549. // width: 100,
  550. children: [],
  551. },
  552. };
  553. // 热装字段
  554. let columnsHotCharge: any = {
  555. roll_club_two: [],
  556. roll_club_three: [],
  557. roll_out_shipp: [],
  558. };
  559. const dataOrgSource = defaultSourceData.map((item, index) => {
  560. if (!newArr[index]) return item;
  561. const { hotChargeLength, rollClubOneDetails, stackLength } = newArr[index];
  562. // 棒一
  563. let rollOneNum = '';
  564. let rollOneSizesObj = {};
  565. // if (hotSend) {
  566. // const obj = JSON.parse(hotSend);
  567. // rollOneNum = obj.hotSendTotalCount || '';
  568. // }
  569. if (rollClubOneDetails) {
  570. const obj = JSON.parse(rollClubOneDetails);
  571. rollOneNum = obj.directRollingTotalCount || '';
  572. const lengthGroupCount = obj.lengthGroupCount;
  573. if (lengthGroupCount) {
  574. // 热送棒一的定尺
  575. Object.keys(lengthGroupCount).forEach((key) => {
  576. const column = key;
  577. const columnKey = column + 'rollOneColumn';
  578. const findIndex = rollOneColumns.findIndex((item: any) => item.dataIndex === columnKey);
  579. if (findIndex === -1) {
  580. rollOneColumns.push({
  581. title: () => {
  582. return h('div', { class: 'rollOneColumnWrapper' }, [
  583. h(
  584. // Select,
  585. Input,
  586. {
  587. // options: sizeListOPtions.value,
  588. bordered: false,
  589. // dropdownStyle: {
  590. // minWidth: '80px',
  591. // },
  592. style: {
  593. padding: '0px',
  594. textAlign: 'center',
  595. },
  596. defaultValue: Number(column) > 20 ? Number(column) / 1000 : column,
  597. // onChange: (value) => {
  598. // switchSizehandler(value, column);
  599. // },
  600. onBlur: throttle((e) => {
  601. const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
  602. switchSizehandler(value, Number(column));
  603. }, 500),
  604. },
  605. ''
  606. ),
  607. h(
  608. 'div',
  609. { class: 'noprint', onClick: () => deleteRollOneColumn(column) },
  610. h(Icon, { icon: 'ant-design:delete-outlined' }, '')
  611. ),
  612. ]);
  613. },
  614. dataIndex: columnKey,
  615. key: columnKey,
  616. align: 'center',
  617. width: 80,
  618. customRender({ text, record }) {
  619. if (!record.heatNo) {
  620. return '';
  621. }
  622. return h(
  623. Input,
  624. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleSizeChange(e, record, column) },
  625. ''
  626. );
  627. },
  628. });
  629. }
  630. rollOneSizesObj[columnKey] = lengthGroupCount[key];
  631. // 如果没有棒一的定尺
  632. if (!rollOneSize[key]) {
  633. rollOneSize[key] = {
  634. size: Number(column) / 1000 + 'm',
  635. amount: lengthGroupCount[key],
  636. weight: lengthGroupCount[key] * (Number(column) / 1000) * 0.2265,
  637. };
  638. } else {
  639. rollOneSize[key].amount += lengthGroupCount[key];
  640. rollOneSize[key].weight += lengthGroupCount[key] * (Number(column) / 1000) * 0.2265;
  641. }
  642. });
  643. }
  644. }
  645. // 热装
  646. let sizeArr = {};
  647. if (hotChargeLength) {
  648. // "[{\"hotChargeLength\":\"11820\",\"hotChargeDestination\":\"roll_club_three\",\"totalWeight\":\"74.9624\",\"hotChargeBtype\":\"0\",\"totalCount\":28}]"
  649. const hotChargeArr = JSON.parse(hotChargeLength);
  650. hotChargeArr.forEach((k) => {
  651. const sizeFormat = Number(k.hotChargeLength) / 1000;
  652. const dataKey = sizeFormat + k.hotChargeDestination + k.hotChargeBtype;
  653. sizeArr[dataKey] = k.totalCount;
  654. // 热送统计
  655. // 棒二
  656. if (k.hotChargeDestination === 'roll_club_two' && k.totalCount > 0) {
  657. // 添加定尺
  658. columnsHotCharge.roll_club_two.push(sizeFormat);
  659. if (k.hotChargeBtype === '0') {
  660. if (!rollTwoSize[k.hotChargeLength]) {
  661. rollTwoSize[k.hotChargeLength] = {
  662. type: k.hotChargeBtype,
  663. size: Number(k.hotChargeLength) / 1000 + 'm',
  664. amount: k.totalCount,
  665. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  666. };
  667. } else {
  668. rollTwoSize[k.hotChargeLength].amount += k.totalCount;
  669. rollTwoSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  670. }
  671. } else {
  672. if (!rollTwoColdSize[k.hotChargeLength]) {
  673. rollTwoColdSize[k.hotChargeLength] = {
  674. type: k.hotChargeBtype,
  675. size: Number(k.hotChargeLength) / 1000 + 'm',
  676. amount: k.totalCount,
  677. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  678. };
  679. } else {
  680. rollTwoColdSize[k.hotChargeLength].amount += k.totalCount;
  681. rollTwoColdSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  682. }
  683. }
  684. }
  685. // 棒三
  686. if (k.hotChargeDestination === 'roll_club_three' && k.totalCount > 0) {
  687. // 添加定尺
  688. columnsHotCharge.roll_club_three.push(sizeFormat);
  689. if (k.hotChargeBtype === '0') {
  690. if (!rollThreeSize[k.hotChargeLength]) {
  691. rollThreeSize[k.hotChargeLength] = {
  692. type: k.hotChargeBtype,
  693. size: Number(k.hotChargeLength) / 1000 + 'm',
  694. amount: k.totalCount,
  695. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  696. };
  697. } else {
  698. rollThreeSize[k.hotChargeLength].amount += k.totalCount;
  699. rollThreeSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  700. }
  701. } else {
  702. if (!rollThreeColdSize[k.hotChargeLength]) {
  703. rollThreeColdSize[k.hotChargeLength] = {
  704. type: k.hotChargeBtype,
  705. size: Number(k.hotChargeLength) / 1000 + 'm',
  706. amount: k.totalCount,
  707. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  708. };
  709. } else {
  710. rollThreeColdSize[k.hotChargeLength].amount += k.totalCount;
  711. rollThreeColdSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  712. }
  713. }
  714. }
  715. // 上若
  716. if (k.hotChargeDestination === 'roll_out_shipp' && k.totalCount > 0) {
  717. // 添加定尺
  718. columnsHotCharge.roll_out_shipp.push(sizeFormat);
  719. if (k.hotChargeBtype === '0') {
  720. if (!rollShippSize[k.hotChargeLength]) {
  721. rollShippSize[k.hotChargeLength] = {
  722. type: k.hotChargeBtype,
  723. size: Number(k.hotChargeLength) / 1000 + 'm',
  724. amount: k.totalCount,
  725. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  726. };
  727. } else {
  728. rollShippSize[k.hotChargeLength].amount += k.totalCount;
  729. rollShippSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  730. }
  731. } else {
  732. if (!rollShippColdSize[k.hotChargeLength]) {
  733. rollShippColdSize[k.hotChargeLength] = {
  734. type: k.hotChargeBtype,
  735. size: Number(k.hotChargeLength) / 1000 + 'm',
  736. amount: k.totalCount,
  737. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  738. };
  739. } else {
  740. rollShippColdSize[k.hotChargeLength].amount += k.totalCount;
  741. rollShippColdSize[k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  742. }
  743. }
  744. }
  745. // 热装按类型分组,分热装和冷装
  746. if (!rollChargeSizeType[k.hotChargeBtype][k.hotChargeLength]) {
  747. rollChargeSizeType[k.hotChargeBtype][k.hotChargeLength] = {
  748. size: sizeFormat + 'm',
  749. amount: k.totalCount,
  750. weight: k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265,
  751. };
  752. } else {
  753. rollChargeSizeType[k.hotChargeBtype][k.hotChargeLength].amount += k.totalCount;
  754. rollChargeSizeType[k.hotChargeBtype][k.hotChargeLength].weight += k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265;
  755. }
  756. });
  757. }
  758. // 堆垛
  759. let stackSizeData = {};
  760. if (stackLength) {
  761. const stackLeghtObj = JSON.parse(stackLength);
  762. stackLeghtObj.forEach((v) => {
  763. const sSize = String(v.stackingLength);
  764. const hasChild = stackLengthColumn.children.findIndex((ele) => ele.dataIndex === sSize + 'stackLength');
  765. if (hasChild < 0) {
  766. stackLengthColumn.children.push({
  767. title: () => {
  768. return h('div', { class: 'rollOneColumnWrapper' }, [
  769. h(
  770. // Select,
  771. Input,
  772. {
  773. // options: sizeListOPtions.value,
  774. bordered: false,
  775. // dropdownStyle: {
  776. // minWidth: '80px',
  777. // },
  778. style: {
  779. padding: '0px',
  780. textAlign: 'center',
  781. },
  782. defaultValue: Number(sSize) > 20 ? Number(sSize) / 1000 : sSize,
  783. // onChange: (value) => {
  784. // switchSizehandler(value, column);
  785. // },
  786. onBlur: throttle((e) => {
  787. const value = Number(e.target.value) < 20 ? Number(e.target.value) * 1000 : Number(e.target.value);
  788. switchStackhandler(value, Number(sSize));
  789. }, 500),
  790. },
  791. ''
  792. ),
  793. h('div', { class: 'noprint', onClick: () => deleteStackColumn(sSize) }, h(Icon, { icon: 'ant-design:delete-outlined' }, '')),
  794. ]);
  795. },
  796. dataIndex: sSize + 'stackLength',
  797. key: sSize + 'stackLength',
  798. width: 80,
  799. customRender({ text, record }) {
  800. if (!record.heatNo) {
  801. return '';
  802. }
  803. return h(
  804. Input,
  805. { class: 'total-input', size: 'small', bordered: false, value: text, onBlur: (e) => handleStackChange(e, record, sSize) },
  806. ''
  807. );
  808. },
  809. });
  810. }
  811. stackSizeData[sSize + 'stackLength'] = v.stackingCount;
  812. // 给堆垛添加致谢
  813. if (!stackingSize[sSize]) {
  814. stackingSize[sSize] = {
  815. size: Number(sSize) / 1000 + 'm',
  816. amount: v.stackingCount,
  817. weight: v.stackingCount * (Number(sSize) / 1000) * 0.2265,
  818. };
  819. } else {
  820. stackingSize[sSize].amount += v.stackingCount;
  821. stackingSize[sSize].weight += v.stackingCount * (Number(sSize) / 1000) * 0.2265;
  822. }
  823. });
  824. }
  825. return {
  826. ...item,
  827. heatNo: newArr[index].heatNo,
  828. brandNum: newArr[index].grade,
  829. oneFlow: newArr[index].oneStrandSum || '',
  830. twoFlow: newArr[index].twoStrandSum || '',
  831. threeFlow: newArr[index].threeStrandSum || '',
  832. fourFlow: newArr[index].fourStrandSum || '',
  833. fiveFlow: newArr[index].fiveStrandSum || '',
  834. sixFlow: newArr[index].sixStrandSum || '',
  835. sevenFlow: newArr[index].sevenStrandSum || '',
  836. eightFlow: newArr[index].eightStrandSum || '',
  837. total: newArr[index].amount || '',
  838. rollOneOld: rollOneNum,
  839. ...sizeArr,
  840. ...rollOneSizesObj,
  841. ...stackSizeData,
  842. orgData: newArr[index],
  843. };
  844. });
  845. let otherColumnsNums = 0;
  846. const otherColumns = Object.keys(columnsHotCharge)
  847. .filter((item) => columnsHotCharge[item].length)
  848. .map((item) => {
  849. const hotChargeSizeArr = [...new Set(columnsHotCharge[item])];
  850. const niubiGls: any[] = [];
  851. hotChargeSizeArr.forEach((ele) => {
  852. niubiGls.push(
  853. {
  854. hotChargeLength: Number(ele) * 1000,
  855. hotChargeDestination: item,
  856. totalWeight: 0,
  857. hotChargeBtype: '0',
  858. totalCount: 0,
  859. },
  860. {
  861. hotChargeLength: Number(ele) * 1000,
  862. hotChargeDestination: item,
  863. totalWeight: 0,
  864. hotChargeBtype: '1',
  865. totalCount: 0,
  866. }
  867. );
  868. });
  869. const childSizesColumn = hotChargeSizeArr.map((childItem) => {
  870. return {
  871. title: childItem,
  872. dataIndex: `${item}.${childItem}`,
  873. key: `${item}.${childItem}`,
  874. width: 80,
  875. align: 'center',
  876. customRender: ({ record }) => {
  877. const hotKey = childItem + item + '0';
  878. const coldKey = childItem + item + '1';
  879. let sizeArr: any = [];
  880. if (record[hotKey] || record[coldKey]) {
  881. sizeArr = [h('div', { class: 'line' }, ''), h('div', { class: 'size-st-item' }, record[hotKey] || '~')];
  882. sizeArr.push(h('div', { class: ' size-st-num' }, record[coldKey] || '~'));
  883. }
  884. return h(
  885. 'div',
  886. {
  887. class: 'size-st-wrapper',
  888. onClick: () => {
  889. // if (!record[hotKey] && !record[coldKey]) return;
  890. const { orgData } = record;
  891. if (!orgData) return;
  892. const { hotChargeLength } = orgData;
  893. const hotChargeInfoArr = hotChargeLength ? JSON.parse(hotChargeLength) : [];
  894. const itemsHotArr = niubiGls.map((v) => {
  895. const hasVal = hotChargeInfoArr.find((j) => j.hotChargeLength == v.hotChargeLength && j.hotChargeBtype == v.hotChargeBtype);
  896. return {
  897. ...v,
  898. totalCount: hasVal ? hasVal.totalCount : 0,
  899. };
  900. });
  901. editSizeNumRecord.value = {
  902. ...orgData,
  903. hotChargeLengthArr: itemsHotArr,
  904. };
  905. openSetSizeNumModal.value = true;
  906. },
  907. },
  908. sizeArr
  909. );
  910. },
  911. };
  912. });
  913. otherColumnsNums = otherColumnsNums + (childSizesColumn.length ? childSizesColumn.length : 1);
  914. return {
  915. ...hotChargeColumns[item],
  916. children: childSizesColumn,
  917. };
  918. });
  919. columns.value = [...defaultColumns, ...otherColumns, ...[stackLengthColumn], ...totalColum];
  920. const rollOneIndex = defaultColumns.findIndex((ele: any) => ele.dataIndex === 'rollOne');
  921. (columns.value[rollOneIndex] as any).children = rollOneColumns.length ? rollOneColumns : [];
  922. // 计算列,合并
  923. const allSpan =
  924. 4 +
  925. (rollOneColumns.length ? rollOneColumns.length : 1) +
  926. otherColumnsNums +
  927. (stackLengthColumn.children.length ? stackLengthColumn.children.length : 1);
  928. remakeColSpan.value = Math.ceil(allSpan / 3);
  929. const nnColSpan = Math.ceil((allSpan - remakeColSpan.value) / 2);
  930. const newNNColSpan = nnColSpan % 2 === 0 ? nnColSpan : nnColSpan + 1;
  931. sizeColSpan.value = newNNColSpan / 2 > 4 ? 4 : newNNColSpan / 2;
  932. flowColSpan.value = newNNColSpan - sizeColSpan.value;
  933. weightColSpan.value = allSpan - remakeColSpan.value - newNNColSpan;
  934. let allWeight = 0;
  935. // 热送统计
  936. if (Object.values(rollOneSize).length) {
  937. hotSendList.value['一'] = Object.values(rollOneSize);
  938. hotSendList.value['一'].forEach((ele) => (allWeight += ele.weight));
  939. }
  940. if (Object.values(rollTwoSize).length) {
  941. hotSendList.value['二'] = Object.values(rollTwoSize);
  942. hotSendList.value['二'].forEach((ele) => (allWeight += ele.weight));
  943. }
  944. if (Object.values(rollThreeSize).length) {
  945. hotSendList.value['三'] = Object.values(rollThreeSize);
  946. hotSendList.value['三'].forEach((ele) => (allWeight += ele.weight));
  947. }
  948. if (Object.values(rollShippSize).length) {
  949. hotSendList.value['上'] = Object.values(rollShippSize);
  950. hotSendList.value['上'].forEach((ele) => (allWeight += ele.weight));
  951. }
  952. if (Object.values(stackingSize)) {
  953. stackingList.value = Object.values(stackingSize);
  954. stackingList.value.forEach((ele) => (allWeight += ele.weight));
  955. }
  956. // 冷装统计
  957. if (Object.values(rollTwoColdSize).length) {
  958. coldSendList.value['二'] = Object.values(rollTwoColdSize);
  959. coldSendList.value['二'].forEach((ele) => (allWeight += ele.weight));
  960. }
  961. if (Object.values(rollThreeColdSize).length) {
  962. coldSendList.value['三'] = Object.values(rollThreeColdSize);
  963. coldSendList.value['三'].forEach((ele) => (allWeight += ele.weight));
  964. }
  965. if (Object.values(rollShippColdSize).length) {
  966. coldSendList.value['上'] = Object.values(rollShippColdSize);
  967. coldSendList.value['上'].forEach((ele) => (allWeight += ele.weight));
  968. }
  969. emits('statistics', {
  970. chargeList: rollChargeSizeType,
  971. stackingList: stackingList.value,
  972. hotSendList: hotSendList.value['一'],
  973. });
  974. mainRemark.value = `合计:${allWeight.toFixed(3)} t`;
  975. dataSource.value = dataOrgSource;
  976. }
  977. start();
  978. changeLoading(false);
  979. } catch (error) {
  980. start();
  981. changeLoading(false);
  982. console.log(error);
  983. }
  984. };
  985. const openJSModal = ref(false);
  986. const xiShu = ref(0.2265);
  987. const sizeNum = ref();
  988. const weightNum = ref();
  989. // 重量计算按钮
  990. const weightCalc = computed(() => {
  991. const w = Number(weightNum.value);
  992. const x = Number(xiShu.value);
  993. const s = Number(sizeNum.value);
  994. if (isNumber(w) && isNumber(x) && isNumber(s)) {
  995. const r = w * x * s;
  996. return !isNaN(r) ? r.toFixed(6) : '';
  997. }
  998. return '';
  999. });
  1000. // 修改合计
  1001. const handleTotalChange = throttle((e: any, record) => {
  1002. const val = Number(e.target.value);
  1003. if (!isNumber(val) || val < 0) {
  1004. createMessage.error('请输入大于0数字');
  1005. return;
  1006. }
  1007. const { orgData } = record;
  1008. if (Number(orgData.amount) != val) {
  1009. handleEdit({
  1010. ...orgData,
  1011. amount: val,
  1012. });
  1013. }
  1014. }, 800);
  1015. // 编辑
  1016. const handleEdit = async (record) => {
  1017. try {
  1018. changeLoading(true);
  1019. await editBilletRecord(record);
  1020. await getHeatList({
  1021. ccmNo: hostNumber.value,
  1022. queryType: fetchQueryType.value,
  1023. changeShiftId: fetchChangeShiftId.value,
  1024. });
  1025. changeLoading(false);
  1026. } catch (error) {
  1027. changeLoading(false);
  1028. console.log(error);
  1029. }
  1030. };
  1031. // 修改棒一定尺数量
  1032. const handleSizeChange = throttle((e: any, record, size) => {
  1033. if (!size) {
  1034. createMessage.error('请选择定尺');
  1035. return;
  1036. }
  1037. const val = Number(e.target.value);
  1038. if (!isNumber(val) || val < 0) {
  1039. createMessage.error('请输入大于或等于0的数字');
  1040. return;
  1041. }
  1042. const { orgData } = record;
  1043. const { rollClubOneDetails } = orgData;
  1044. let obj = {
  1045. lengthGroupCount: {},
  1046. directRollingTotalWeight: 0,
  1047. directRollingTotalCount: 0,
  1048. };
  1049. if (rollClubOneDetails) {
  1050. obj = JSON.parse(rollClubOneDetails);
  1051. }
  1052. const lengthGroupCount = obj.lengthGroupCount;
  1053. if (
  1054. lengthGroupCount &&
  1055. ((Object.hasOwn(lengthGroupCount, size) && (val === 0 || lengthGroupCount[size] !== val)) ||
  1056. (!Object.hasOwn(lengthGroupCount, size) && val > 0))
  1057. ) {
  1058. if (val <= 0) {
  1059. delete obj.lengthGroupCount[size];
  1060. } else {
  1061. obj.lengthGroupCount[size] = val;
  1062. }
  1063. const params = {
  1064. ...orgData,
  1065. rollClubOneDetails: JSON.stringify(obj),
  1066. };
  1067. const amount = handleTotalSum(params);
  1068. handleEdit({
  1069. ...params,
  1070. amount,
  1071. });
  1072. }
  1073. }, 800);
  1074. // 计算总数
  1075. const handleTotalSum = (record) => {
  1076. const { rollClubOneDetails, stackLength, hotChargeLength } = record;
  1077. let allCount = 0;
  1078. if (rollClubOneDetails) {
  1079. const sendObj = JSON.parse(rollClubOneDetails);
  1080. if (sendObj.lengthGroupCount) {
  1081. Object.keys(sendObj.lengthGroupCount).forEach((key) => {
  1082. allCount += sendObj.lengthGroupCount[key];
  1083. });
  1084. }
  1085. }
  1086. if (stackLength) {
  1087. const stackObj = JSON.parse(stackLength);
  1088. if (isArray(stackObj)) {
  1089. stackObj.forEach((item) => {
  1090. allCount += item.stackingCount;
  1091. });
  1092. }
  1093. }
  1094. if (hotChargeLength) {
  1095. const chargeObj = JSON.parse(hotChargeLength);
  1096. if (isArray(chargeObj)) {
  1097. chargeObj.forEach((item) => {
  1098. allCount += item.totalCount;
  1099. });
  1100. }
  1101. }
  1102. return allCount;
  1103. };
  1104. // 修改堆垛定尺数量
  1105. const handleStackChange = throttle((e: any, record, size) => {
  1106. if (e.target.value.trim() === '') return;
  1107. if (!size) {
  1108. createMessage.error('请选择定尺');
  1109. return;
  1110. }
  1111. const val = Number(e.target.value);
  1112. if (!isNumber(val)) {
  1113. createMessage.error('请输入大于等于0的数字');
  1114. return;
  1115. }
  1116. const { orgData } = record;
  1117. const { stackLength } = orgData;
  1118. let obj: any[] = [];
  1119. if (stackLength) {
  1120. obj = JSON.parse(stackLength);
  1121. }
  1122. const lengthGroupCount = obj.findIndex((v) => v.stackingLength == size);
  1123. // 计算补的数量是不是4的倍数
  1124. let stackInfo: any = null;
  1125. // const buCount = lengthGroupCount > -1 ? val - obj[lengthGroupCount].stackingCount : val;
  1126. if (val && val > 0) {
  1127. if (val % 4 !== 0) {
  1128. createMessage.error('补数量必须是4的倍数');
  1129. return;
  1130. }
  1131. stackInfo = val + '-' + size + '-10';
  1132. } else {
  1133. stackInfo = null;
  1134. }
  1135. if (lengthGroupCount === -1) {
  1136. obj.push({
  1137. stackingCount: val,
  1138. stackingLength: size,
  1139. stackingWeight: val * (Number(size) / 1000) * 0.2265,
  1140. });
  1141. } else {
  1142. if (obj[lengthGroupCount].stackingCount === val) return;
  1143. obj[lengthGroupCount].stackingCount = val;
  1144. obj[lengthGroupCount].stackingWeight = val * (Number(size) / 1000) * 0.2265;
  1145. }
  1146. const params = {
  1147. ...orgData,
  1148. stackLength: JSON.stringify(obj),
  1149. stackInfo,
  1150. };
  1151. const amount = handleTotalSum(params);
  1152. handleEdit({
  1153. ...params,
  1154. amount,
  1155. });
  1156. }, 800);
  1157. // 编辑切换定尺
  1158. const switchSizehandler = async (val, oldSize) => {
  1159. try {
  1160. if (val == oldSize) return;
  1161. changeLoading(true);
  1162. const fetchArr: any[] = [];
  1163. dataSource.value.forEach((item) => {
  1164. if (item.heatNo && item.orgData) {
  1165. const { rollClubOneDetails } = item.orgData;
  1166. if (rollClubOneDetails) {
  1167. const obj = JSON.parse(rollClubOneDetails);
  1168. if (obj && obj.lengthGroupCount) {
  1169. const lengthGroupCount = obj.lengthGroupCount;
  1170. if (lengthGroupCount[oldSize]) {
  1171. obj.lengthGroupCount[val] = lengthGroupCount[oldSize] + (lengthGroupCount[val] ? lengthGroupCount[val] : 0);
  1172. delete obj.lengthGroupCount[oldSize];
  1173. // 请求push了
  1174. fetchArr.push(
  1175. editBilletRecord({
  1176. ...item.orgData,
  1177. rollClubOneDetails: JSON.stringify(obj),
  1178. })
  1179. );
  1180. }
  1181. }
  1182. }
  1183. }
  1184. });
  1185. if (fetchArr.length > 0) {
  1186. await Promise.all(fetchArr);
  1187. await getHeatList({
  1188. ccmNo: hostNumber.value,
  1189. queryType: fetchQueryType.value,
  1190. changeShiftId: fetchChangeShiftId.value,
  1191. });
  1192. changeLoading(false);
  1193. }
  1194. } catch (error) {
  1195. changeLoading(false);
  1196. console.log(error);
  1197. }
  1198. };
  1199. // 堆垛编辑定尺
  1200. const switchStackhandler = async (val, oldSize) => {
  1201. try {
  1202. if (val === oldSize) return;
  1203. changeLoading(true);
  1204. const fetchArr: any[] = [];
  1205. dataSource.value.forEach((item) => {
  1206. if (item.heatNo && item.orgData) {
  1207. const { stackLength } = item.orgData;
  1208. if (stackLength) {
  1209. let obj = stackLength ? JSON.parse(stackLength) : [];
  1210. const oldSizeIndex = obj.findIndex((k) => k.stackingLength === oldSize);
  1211. if (oldSizeIndex > -1) {
  1212. const newSizeIndex = obj.findIndex((k) => k.stackingLength === Number(val));
  1213. if (newSizeIndex > -1) {
  1214. obj[newSizeIndex].stackingCount += obj[oldSizeIndex].stackingCount;
  1215. obj = obj.filter((j) => j.stackingLength !== oldSize);
  1216. } else {
  1217. obj[oldSizeIndex].stackingLength = Number(val);
  1218. }
  1219. // 请求push了
  1220. fetchArr.push(
  1221. editBilletRecord({
  1222. ...item.orgData,
  1223. stackLength: JSON.stringify(obj),
  1224. })
  1225. );
  1226. }
  1227. }
  1228. }
  1229. });
  1230. if (fetchArr.length > 0) {
  1231. await Promise.all(fetchArr);
  1232. await getHeatList({
  1233. ccmNo: hostNumber.value,
  1234. queryType: fetchQueryType.value,
  1235. changeShiftId: fetchChangeShiftId.value,
  1236. });
  1237. changeLoading(false);
  1238. }
  1239. } catch (error) {
  1240. changeLoading(false);
  1241. console.log(error);
  1242. }
  1243. };
  1244. // 删除定尺
  1245. const deleteRollOneColumn = async (size) => {
  1246. try {
  1247. changeLoading(true);
  1248. const fetchArr: any[] = [];
  1249. dataSource.value.forEach((item) => {
  1250. if (item.heatNo && item.orgData) {
  1251. const { rollClubOneDetails } = item.orgData;
  1252. if (rollClubOneDetails) {
  1253. const obj = JSON.parse(rollClubOneDetails);
  1254. if (obj && obj.lengthGroupCount) {
  1255. const lengthGroupCount = obj.lengthGroupCount;
  1256. if (lengthGroupCount[size]) {
  1257. delete obj.lengthGroupCount[size];
  1258. // 请求push了
  1259. const params = {
  1260. ...item.orgData,
  1261. rollClubOneDetails: JSON.stringify(obj),
  1262. };
  1263. const amount = handleTotalSum(params);
  1264. fetchArr.push(
  1265. editBilletRecord({
  1266. ...params,
  1267. amount,
  1268. })
  1269. );
  1270. }
  1271. }
  1272. }
  1273. }
  1274. });
  1275. if (fetchArr.length > 0) {
  1276. await Promise.all(fetchArr);
  1277. await getHeatList({
  1278. ccmNo: hostNumber.value,
  1279. queryType: fetchQueryType.value,
  1280. changeShiftId: fetchChangeShiftId.value,
  1281. });
  1282. changeLoading(false);
  1283. }
  1284. } catch (error) {
  1285. changeLoading(false);
  1286. console.log(error);
  1287. }
  1288. };
  1289. // 删除堆垛定尺
  1290. const deleteStackColumn = async (size) => {
  1291. try {
  1292. changeLoading(true);
  1293. const fetchArr: any[] = [];
  1294. dataSource.value.forEach((item) => {
  1295. if (item.heatNo && item.orgData) {
  1296. const { stackLength } = item.orgData;
  1297. if (stackLength) {
  1298. const obj = JSON.parse(stackLength);
  1299. const hasStackItem = obj.findIndex((n) => n.stackingLength == size);
  1300. if (hasStackItem > -1) {
  1301. const lengthGroupCount = obj.filter((m) => m.stackingLength != size);
  1302. // 请求push了
  1303. const params = {
  1304. ...item.orgData,
  1305. stackLength: JSON.stringify(lengthGroupCount),
  1306. };
  1307. const amount = handleTotalSum(params);
  1308. fetchArr.push(
  1309. editBilletRecord({
  1310. ...params,
  1311. amount,
  1312. })
  1313. );
  1314. }
  1315. }
  1316. }
  1317. });
  1318. if (fetchArr.length > 0) {
  1319. await Promise.all(fetchArr);
  1320. await getHeatList({
  1321. ccmNo: hostNumber.value,
  1322. queryType: fetchQueryType.value,
  1323. changeShiftId: fetchChangeShiftId.value,
  1324. });
  1325. }
  1326. changeLoading(false);
  1327. } catch (error) {
  1328. changeLoading(false);
  1329. console.log(error);
  1330. }
  1331. };
  1332. // 编辑目的地定尺数量
  1333. const openSetSizeNumModal = ref(false);
  1334. const editSizeNumRecord = ref<any>({});
  1335. const confirmSetSizeNum = async () => {
  1336. try {
  1337. changeLoading(true);
  1338. const { hotChargeLengthArr } = editSizeNumRecord.value;
  1339. if (!hotChargeLengthArr.length) {
  1340. return;
  1341. }
  1342. const arr = hotChargeLengthArr
  1343. .filter((ele) => ele.totalCount)
  1344. .map((k) => {
  1345. return {
  1346. ...k,
  1347. totalWeight: (k.totalCount * (Number(k.hotChargeLength) / 1000) * 0.2265).toFixed(4),
  1348. };
  1349. });
  1350. editSizeNumRecord.value.hotChargeLength = arr.length ? JSON.stringify(arr) : null;
  1351. await editBilletRecord({
  1352. ...editSizeNumRecord.value,
  1353. });
  1354. openSetSizeNumModal.value = false;
  1355. await getHeatList({
  1356. ccmNo: hostNumber.value,
  1357. queryType: fetchQueryType.value,
  1358. changeShiftId: fetchChangeShiftId.value,
  1359. });
  1360. changeLoading(false);
  1361. } catch (e) {
  1362. changeLoading(false);
  1363. console.log(e);
  1364. }
  1365. };
  1366. // 确定修改定尺
  1367. const handleSizeBlur = throttle((e) => {
  1368. if (mainOrgSize.value.trim() === e.target.value.trim()) return;
  1369. handleEditShiftInfo({
  1370. id: fetchChangeShiftId.value,
  1371. sizeInfo: e.target.value,
  1372. });
  1373. }, 500);
  1374. // 修改备注
  1375. const handleRemarkBlur = throttle((e) => {
  1376. if (mainOrgRemark.value.trim() === e.target.value.trim()) return;
  1377. handleEditShiftInfo({
  1378. id: fetchChangeShiftId.value,
  1379. content: e.target.value,
  1380. });
  1381. }, 500);
  1382. // 编辑定尺和备注
  1383. const handleEditShiftInfo = async (params) => {
  1384. try {
  1385. changeLoading(true);
  1386. await editOriginalProductRecord(params);
  1387. await getHeatList({
  1388. ccmNo: hostNumber.value,
  1389. queryType: fetchQueryType.value,
  1390. changeShiftId: fetchChangeShiftId.value,
  1391. });
  1392. changeLoading(false);
  1393. } catch (e) {
  1394. console.log(e);
  1395. changeLoading(false);
  1396. }
  1397. };
  1398. // 添加炉次
  1399. const newHeatNo = ref('');
  1400. const openNewHeatNo = ref(false);
  1401. const addHeatNo = () => {
  1402. newHeatNo.value = '';
  1403. openNewHeatNo.value = true;
  1404. };
  1405. const confirmAddHeatNo = async () => {
  1406. try {
  1407. if (!newHeatNo.value) {
  1408. createMessage.error('请输入炉次号');
  1409. return;
  1410. }
  1411. changeLoading(true);
  1412. await addBilletNo({
  1413. ccmNo: hostNumber.value,
  1414. heatNo: newHeatNo.value,
  1415. });
  1416. openNewHeatNo.value = false;
  1417. await getHeatList({
  1418. ccmNo: hostNumber.value,
  1419. queryType: fetchQueryType.value,
  1420. changeShiftId: fetchChangeShiftId.value,
  1421. });
  1422. changeLoading(false);
  1423. } catch (e) {
  1424. console.log(e);
  1425. changeLoading(false);
  1426. }
  1427. };
  1428. </script>
  1429. <style lang="less" scoped>
  1430. .orgData-info-spin {
  1431. height: 100%;
  1432. overflow: auto;
  1433. padding: 6px;
  1434. background: #01396c;
  1435. color: rgba(255, 255, 255, 0.8);
  1436. border-radius: 6px;
  1437. }
  1438. .ticket {
  1439. max-width: 1400px;
  1440. height: 100%;
  1441. display: flex;
  1442. flex-direction: column;
  1443. .ccmno-info {
  1444. font-family: 'Kingsoft_Cloud_Font';
  1445. font-size: 20px;
  1446. .ant-input {
  1447. color: rgba(255, 255, 255, 0.8);
  1448. font-size: 20px;
  1449. }
  1450. }
  1451. .ccmno {
  1452. display: inline-block;
  1453. width: 60px;
  1454. border-bottom: 1px solid rgb(218, 218, 218);
  1455. text-align: center;
  1456. }
  1457. .size-items-title {
  1458. font-size: 12px;
  1459. line-height: 32px;
  1460. border-bottom: 1px solid #bfbfbf;
  1461. padding-left: 10px;
  1462. min-width: 100px;
  1463. }
  1464. .size-num-title {
  1465. font-size: 12px;
  1466. line-height: 32px;
  1467. padding-left: 10px;
  1468. }
  1469. .size-items-content {
  1470. height: 32px;
  1471. text-align: center;
  1472. line-height: 32px;
  1473. }
  1474. .size-items-remark {
  1475. width: 100%;
  1476. min-height: 90px;
  1477. flex-wrap: wrap;
  1478. font-family: 'Kingsoft_Cloud_Font';
  1479. align-content: flex-start;
  1480. .size-remark-item {
  1481. width: 50%;
  1482. height: 30px;
  1483. color: #000;
  1484. }
  1485. .size-remark-size {
  1486. display: inline-block;
  1487. width: 80px;
  1488. }
  1489. .size-remark-num {
  1490. display: inline-block;
  1491. width: 80px;
  1492. padding: 0 40px 0 0;
  1493. font-size: 12px;
  1494. }
  1495. }
  1496. .two-num-wrapper {
  1497. position: absolute;
  1498. left: 0;
  1499. top: 0;
  1500. width: 100%;
  1501. height: 100%;
  1502. z-index: 10;
  1503. display: flex;
  1504. flex-direction: column;
  1505. justify-content: center;
  1506. align-items: flex-end;
  1507. padding-right: 6px;
  1508. }
  1509. .s-txt {
  1510. font-family: 'Kingsoft_Cloud_Font';
  1511. }
  1512. .ant-table-wrapper {
  1513. flex: 1;
  1514. :deep(.ant-spin-nested-loading) {
  1515. min-height: 100%;
  1516. .ant-table {
  1517. font-size: 20px;
  1518. border-top: 1px solid rgba(184, 184, 184, 0.6);
  1519. > .ant-table-container {
  1520. border-inline-start: 1px solid rgba(184, 184, 184, 0.6);
  1521. }
  1522. .ant-table-content > table > thead > tr > th,
  1523. .ant-table-tbody > tr > td,
  1524. .ant-table-summary > tr > td {
  1525. padding: 2px;
  1526. border-inline-end: 1px solid rgba(184, 184, 184, 0.6);
  1527. border-bottom: 1px solid rgba(184, 184, 184, 0.6) !important;
  1528. text-align: center;
  1529. position: relative;
  1530. background: #01396c;
  1531. color: rgba(255, 255, 255, 0.8);
  1532. }
  1533. .size-st-wrapper {
  1534. position: absolute;
  1535. top: 1px;
  1536. left: 1px;
  1537. right: 1px;
  1538. bottom: 1px;
  1539. font-weight: 600;
  1540. cursor: pointer;
  1541. overflow: hidden;
  1542. .line {
  1543. // content: '';
  1544. // position: absolute;
  1545. // top: 0;
  1546. // left: 0;
  1547. // width: 100%; /* 等于长方形宽度 */
  1548. // height: 100%; /* 等于长方形高度 */
  1549. // /* 创建斜线:线性渐变从左上到右下 */
  1550. // background: linear-gradient(
  1551. // to bottom right,
  1552. // transparent 0%,
  1553. // transparent calc(50% - 0.5px),
  1554. // /* 斜线上方透明 */ rgba(0, 0, 0, 0.6) calc(50% - 0.5px),
  1555. // /* 斜线颜色 */ rgba(0, 0, 0, 0.6) calc(50% + 0.5px),
  1556. // /* 斜线厚度 */ transparent calc(50% + 0.5px) /* 斜线下方透明 */
  1557. // );
  1558. position: absolute;
  1559. left: -5px;
  1560. top: 50%;
  1561. width: 110%;
  1562. border-bottom: 1px solid rgba(231, 230, 230, 0.6);
  1563. transform: rotate(165deg);
  1564. }
  1565. .size-st-item {
  1566. position: absolute;
  1567. top: -4px;
  1568. left: 2px;
  1569. color: #f50;
  1570. }
  1571. }
  1572. .size-st-num {
  1573. color: #108ee9;
  1574. cursor: pointer;
  1575. position: absolute;
  1576. right: 1px;
  1577. bottom: -4px;
  1578. }
  1579. // 自定义啊
  1580. .total-input {
  1581. width: 100%;
  1582. padding: 0;
  1583. text-align: center;
  1584. cursor: pointer;
  1585. font-size: 20px;
  1586. }
  1587. .ant-select {
  1588. width: 100%;
  1589. .ant-select-selector {
  1590. padding: 0;
  1591. .ant-select-selection-item,
  1592. .ant-select-selection-placeholder {
  1593. padding-inline-end: 0;
  1594. }
  1595. }
  1596. .ant-select-arrow {
  1597. display: none;
  1598. }
  1599. }
  1600. .rollOneColumnWrapper {
  1601. position: relative;
  1602. width: 100%;
  1603. height: 100%;
  1604. .noprint {
  1605. position: absolute;
  1606. left: 0;
  1607. top: 0;
  1608. display: none;
  1609. color: #f50;
  1610. cursor: pointer;
  1611. }
  1612. &:hover {
  1613. .noprint {
  1614. display: block;
  1615. }
  1616. }
  1617. }
  1618. .ant-input {
  1619. color: rgba(255, 255, 255, 0.8);
  1620. font-size: 20px;
  1621. }
  1622. }
  1623. }
  1624. .summary-row-no-border {
  1625. td:first-child {
  1626. border-bottom: none !important;
  1627. }
  1628. .song-items {
  1629. width: 100%;
  1630. height: 100%;
  1631. align-items: flex-start;
  1632. justify-content: flex-start;
  1633. .title {
  1634. margin-right: 10px;
  1635. color: #f50;
  1636. }
  1637. }
  1638. }
  1639. .summary-cell-remark {
  1640. min-height: 70px;
  1641. }
  1642. }
  1643. }
  1644. </style>