Commit f550ba14e878191cd87aaae1ad4c8c8c4f549d6e

Authored by 陈鑫涛
1 parent 35db7f1a

卡牌排版

src/components/Common/Typesetting/typesetting.js
... ... @@ -213,9 +213,13 @@ const Typesetting = props => {
213 213 if (iFAngle === 90 || iFAngle === 270 || iSAngle === 90 || iSAngle === 270) {
214 214 jInnerHeight = innerWidth;
215 215 jInnerWidth = innerHeight;
216   - // dSvgBoxHeight = jInnerHeight;
217   - // dSvgBoxWidth = jInnerWidth;
218 216 }
  217 + if (state.selectedNode.sTypeKey === 'kaipai' || state.selectedNode.sTypeKey === 'juantong') {
  218 + jInnerHeight = innerWidth;
  219 + jInnerWidth = innerHeight;
  220 + }
  221 + console.log(state.selectedNode.sTypeKey,'55555');
  222 +
219 223 const innerHeightCombined = isVertical
220 224 ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset + dXBJJ
221 225 : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
... ... @@ -238,33 +242,45 @@ const Typesetting = props => {
238 242 let cols = dSWidthOffsetCombined === 0 ? 0 : Math.floor(outerWidth / dSWidthOffsetCombined);
239 243 const rowsCombined = innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset);
240 244 let rows = rowsCombined === 0 ? 0 : Math.floor(outerHeight / rowsCombined);
241   - let colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined;
242   - while (colsMaxLength >= outerWidth && cols > 0) {
  245 + let colsMaxLength = (cols) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ) + dZBLB + dYBLB;
  246 + while (colsMaxLength >= outerWidth && cols > 0) {
243 247 cols = cols - 1;
244   - colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined;
  248 + colsMaxLength = (cols) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ);
245 249 }
246 250  
247   - let rowsMaxLength = (rows - 1) * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) + innerHeightCombined;
248   - while (rowsMaxLength >= outerHeight && rows > 0) {
  251 + let rowsMaxLength = rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ) + dSBLB + dXBLB ;
  252 + while (rowsMaxLength>= outerHeight && rows > 0) {
249 253 rows = rows - 1;
250   - rowsMaxLength = (rows - 1) * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) + innerHeightCombined;
  254 + rowsMaxLength = rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ) ;
251 255 }
252   - console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeight");
  256 +
  257 + // console.log(cols, rows, outerWidth, outerHeight, colsMaxLength,rowsMaxLength,"cols rows outerWidth outerHeight");
253 258  
254 259 // 最大上机长 上机宽 开料尺寸
255 260 // 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量
256   - const remainingWidth =
257   - outerWidth -
258   - (cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) - boxLengthOffset - (reference ? 0 : dSLengthOffset));
259   - const remainingHeight =
260   - outerHeight -
261   - (rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) - boxWidthOffset - (reference ? 0 : dSWidthOffset));
  261 + const remainingWidth = outerWidth - colsMaxLength
  262 + const remainingHeight = outerHeight - rowsMaxLength
  263 + // const remainingWidth =
  264 + // outerWidth -
  265 + // (cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) - boxLengthOffset - (reference ? 0 : dSLengthOffset));
  266 + // const remainingHeight =
  267 + // outerHeight -
  268 + // (rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) - boxWidthOffset - (reference ? 0 : dSWidthOffset));
262 269 //剩余量能不能放一下单独一个
263   - const commonHeightCheck = remainingHeight > jInnerHeight;
264   - const commonWidthCheck = remainingWidth > jInnerWidth;
  270 + const commonHeightCheck = remainingHeight > jInnerHeight + dXBJJ;
  271 + const commonWidthCheck = remainingWidth > jInnerWidth + dYBJJ ;
265 272 const isCustomized = bAdvancedSetting;
266 273  
267 274 let remaining = isVertical ? commonHeightCheck : commonWidthCheck;
  275 + console.log('剩余长',remainingWidth);
  276 + console.log('剩余高',remainingHeight);
  277 + console.log('剩余长是否放下',commonWidthCheck);
  278 + console.log('剩余高是否放下',commonHeightCheck);
  279 + console.log('剩余是否放下',remaining,cols,rows);
  280 + console.log('剩余 总高 盒高' , outerHeight, rowsCombined);
  281 + console.log('剩余 总长 盒长' , outerWidth, dSWidthOffsetCombined);
  282 + console.log('剩余 根据列排最大长高',colsMaxLength,rowsMaxLength);
  283 +
268 284 // const remaining = false;
269 285 const isOdd = num => {
270 286 return num % 2 !== 0;
... ... @@ -524,8 +540,8 @@ const Typesetting = props => {
524 540 if (reference) {
525 541 // 是否首盒
526 542 // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距
527   - leftPosition = col * innerWidthCombined;
528   - topPosition = rows * innerHeightCombined;
  543 + leftPosition = col * (innerWidthCombined + dYBJJ) + dFLengthOffset;
  544 + topPosition = rows * (innerHeightCombined + dXBJJ) + dFWidthOffset;
529 545 } else {
530 546 leftPosition = col * (innerWidthCombined + dYBJJ);
531 547 topPosition = rows * (innerHeightCombined + dXBJJ);
... ... @@ -567,8 +583,10 @@ const Typesetting = props => {
567 583 const propsDataHeight = Number(propsData.props.style.height.slice(0, -2));
568 584 const propsDataTop = Number(propsData.props.style.top.slice(0, -2));
569 585 // 判断列是否是单独的
570   - const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dSBLB + dXBLB).toFixed(2); // 原纸长
571   - const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dZBLB + dYBLB).toFixed(2);
  586 + console.log(propsDataLeft, propsDataWidth, propsDataHeight, propsDataTop, "propsDataLeft propsDataWidth propsDataHeight propsDataTop");
  587 +
  588 + const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长
  589 + const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB).toFixed(2);
572 590  
573 591 // 计算开数
574 592 let dSinglePQty = isVertical
... ... @@ -689,7 +707,7 @@ const Typesetting = props => {
689 707 Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength) &&
690 708 Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
691 709  
692   - const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
  710 + const isShow = true || slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
693 711 console.log(
694 712 slaveDataDetail?.dMaxLength,
695 713 slaveDataDetail?.dMaxWidth,
... ...