Quellcode durchsuchen

feat:表格合并

hmc vor 1 Jahr
Ursprung
Commit
227c30bb24

+ 8 - 8
zkqy-custom-business/src/main/java/com/zkqy/business/domain/DetailsOfTheRefuelingPlan.java

@@ -26,7 +26,7 @@ public class DetailsOfTheRefuelingPlan extends BaseEntity
 
     /** 机台号 */
     @Excel(name = "机台号")
-    private Long machineId;
+    private String machineId;
 
     /** 生产色号 */
     @Excel(name = "生产色号")
@@ -98,16 +98,16 @@ public class DetailsOfTheRefuelingPlan extends BaseEntity
     {
         return timestampRandomCode;
     }
-    public void setMachineId(Long machineId) 
-    {
-        this.machineId = machineId;
-    }
 
-    public Long getMachineId() 
-    {
+    public String getMachineId() {
         return machineId;
     }
-    public void setCurrentColorCode(String currentColorCode) 
+
+    public void setMachineId(String machineId) {
+        this.machineId = machineId;
+    }
+
+    public void setCurrentColorCode(String currentColorCode)
     {
         this.currentColorCode = currentColorCode;
     }

+ 3 - 3
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/AmmunitionPlanInformationIntermediateTableRVo.java

@@ -54,7 +54,7 @@ public class AmmunitionPlanInformationIntermediateTableRVo {
 
 
     //待生产列表
-    private Map<String,String> listOfPendingProduction;
+    private String listOfPendingProduction;
 
     public String getMachineId() {
         return machineId;
@@ -152,11 +152,11 @@ public class AmmunitionPlanInformationIntermediateTableRVo {
         this.djNumber = djNumber;
     }
 
-    public Map<String, String> getListOfPendingProduction() {
+    public String getListOfPendingProduction() {
         return listOfPendingProduction;
     }
 
-    public void setListOfPendingProduction(Map<String, String> listOfPendingProduction) {
+    public void setListOfPendingProduction(String listOfPendingProduction) {
         this.listOfPendingProduction = listOfPendingProduction;
     }
 }

+ 15 - 10
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/AmmunitionPlanInformationIntermediateTableServiceImpl.java

@@ -99,8 +99,8 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
         //循环固定死的产线
         productionLines.stream().forEach(item -> {
             //拿到了某个车间的所有产线
-            AmmunitionPlanInformationIntermediateTableRVo rs=new AmmunitionPlanInformationIntermediateTableRVo();
-            rs.setMachineId(item.getProductionLineNo());//产线号
+            AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
+            rs1.setMachineId(item.getProductionLineNo());//产线号
             //所有的计划都属于这个产线、所以不能根据产线去查,计划详情
             //先根据产线号去查询计划信息
             AmmunitionPlanInformationIntermediateTable ammunitionPlanInformationIntermediateTable=new AmmunitionPlanInformationIntermediateTable();
@@ -108,18 +108,22 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
             //拿到了所有的计划随机码 一个产线对应许多的随机码
             List<AmmunitionPlanInformationIntermediateTable> ammunitionPlanInformationIntermediateTables = ammunitionPlanInformationIntermediateTableMapper.selectAmmunitionPlanInformationIntermediateTableList(ammunitionPlanInformationIntermediateTable);
             if(ammunitionPlanInformationIntermediateTables.size()>0){
-                //查询当前随机码对应计划详情
+                //循环的是随机码
                 ammunitionPlanInformationIntermediateTables.stream().forEach(it->{
+                    //=====
+                    AmmunitionPlanInformationIntermediateTableRVo rs=new AmmunitionPlanInformationIntermediateTableRVo();
+                    rs.setMachineId(item.getProductionLineNo());//产线号
+                    //=====
                     DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan=new DetailsOfTheRefuelingPlan();
                     detailsOfTheRefuelingPlan.setTimestampRandomCode(it.getTimestampRandomCode());//计划随机码
                     detailsOfTheRefuelingPlan.setPlanStatus("0");//状态是未完成的 ---先查询A面的查出来放一块
-                    detailsOfTheRefuelingPlan.setProductType("A面");
+                    //查询的是计划信息列表
                     List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan);
                     //构造一个合适的对象放到 list
                     if(detailsOfTheRefuelingPlans.size()>0){
                         //第一不部分的构造数据
                         rs.setCurrentColorCode(detailsOfTheRefuelingPlans.get(0).getCurrentColorCode());//色号
-                        rs.setCurrentColorCode(detailsOfTheRefuelingPlans.get(0).getCurrentSpecification());//生产规格
+                        rs.setCurrentSpecification(detailsOfTheRefuelingPlans.get(0).getCurrentSpecification());//生产规格
                         rs.setCurrentLotNumber(detailsOfTheRefuelingPlans.get(0).getCurrentLotNumber().toString());//生产批号
                         rs.setCurrentSpindleCount(detailsOfTheRefuelingPlans.get(0).getCurrentSpindleCount());//锭数
                         rs.setStartTime(detailsOfTheRefuelingPlans.get(0).getStartTime());//上机时间
@@ -131,24 +135,25 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
                             rs.setDjCurrentColorCode(detailsOfTheRefuelingPlans.get(1).getCurrentColorCode());//色号
                             rs.setDjCurrentSpecification(detailsOfTheRefuelingPlans.get(1).getCurrentSpecification());//生产规格
                             rs.setDjNumber(detailsOfTheRefuelingPlans.get(1).getNumber());//数量
-                            rs.setCurrentLotNumber(detailsOfTheRefuelingPlans.get(1).getCurrentLotNumber().toString());//批号
+                            rs.setDjCurrentLotNumber(detailsOfTheRefuelingPlans.get(1).getCurrentLotNumber().toString());//批号
                         }
                         if(detailsOfTheRefuelingPlans.size()>=3){
                             String combinedCodes = detailsOfTheRefuelingPlans.stream()
                                     .skip(2) // 排除前两个元素
                                     .map(plan -> plan.getCurrentColorCode()+ plan.getCurrentLotNumber()) // 将色号和批号拼接成字符串
                                     .collect(Collectors.joining(","));
-                            HashMap hashMap=new HashMap();
-                            hashMap.put(it.getTimestampRandomCode(),combinedCodes);
-                            rs.setListOfPendingProduction(hashMap);
+//                            HashMap hashMap=new HashMap();
+//                            hashMap.put(it.getTimestampRandomCode(),combinedCodes);
+                            rs.setListOfPendingProduction(combinedCodes);
                         }
                     }
                     //把计划对象添加进去
                     list.add(rs);
                 });
             }else {
-                list.add(rs);
+                list.add(rs1);
             }
+
         });
         return list;
     }

+ 0 - 1
zkqy-custom-business/src/main/resources/mapper/business/DetailsOfTheRefuelingPlanMapper.xml

@@ -38,7 +38,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="number != null  and number != ''"> and `number` = #{number}</if>
             <if test="productType != null  and productType != ''"> and `productType` = #{productType}</if>
         </where>
---         group by machineId,productType
     </select>
     
     <select id="selectDetailsOfTheRefuelingPlanById" parameterType="Long" resultMap="DetailsOfTheRefuelingPlanResult">

+ 47 - 63
zkqy-ui/src/views/orderMange/planTable/index.vue

@@ -6,11 +6,10 @@
         <el-table
           :data="tableData"
           ref="tableRef"
-          :span-method="objectSpanMethod"
-          border style="margin-bottom: 10px" >
-          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" min-width="110.5"></el-table-column>
+          :span-method="objectSpanMethod">
+          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" ></el-table-column>
+          <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center"></el-table-column>
           <el-table-column label="在机产品" header-align="center">
-            <el-table-column prop="productType"  label="产品类别" header-align="center" align="center" min-width="110.5"></el-table-column>
             <el-table-column prop="currentColorCode" label="色号" header-align="center" align="center"></el-table-column>
             <el-table-column prop="currentSpecification" label="规格" header-align="center" align="center"></el-table-column>
             <el-table-column prop="currentLotNumber" label="批号" header-align="center" align="center"></el-table-column>
@@ -24,21 +23,21 @@
             <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>
             <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>
           </el-table-column>
-          <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center" min-width="300"></el-table-column>
-          <el-table-column   fixed="right" label="操作" header-align="center" align="center"  min-width="120">
-            <template slot-scope="scope">
-              <el-dropdown>
-                <el-button type="primary">
-                  操作
-                  <i class="el-icon-arrow-down el-icon--right"></i>
-                </el-button>
-                <el-dropdown-menu slot="dropdown">
-                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>
-                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>
-                </el-dropdown-menu>
-              </el-dropdown>
-            </template>
-          </el-table-column>
+          <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center" min-width="250"></el-table-column>
+<!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" min-width="120">-->
+<!--            <template slot-scope="scope">-->
+<!--              <el-dropdown>-->
+<!--                <el-button type="primary">-->
+<!--                  操作-->
+<!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--                </el-button>-->
+<!--                <el-dropdown-menu slot="dropdown">-->
+<!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+<!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+<!--                </el-dropdown-menu>-->
+<!--              </el-dropdown>-->
+<!--            </template>-->
+<!--          </el-table-column>-->
         </el-table>
         <!--弹窗-->
 
@@ -145,6 +144,7 @@ export default {
       },
       previousMachineId: undefined,
       currentRowspan: 1,
+      prevRow: {},
       tableData2: [{
         currentColorCode: '001浅绿',
         currentSpecification: '15/36',
@@ -179,70 +179,52 @@ export default {
     getAmmunitionPlanInfo() {
       ammunitionPlanInfo(this.queryParams).then((response) => {
         this.tableData = response.data
-        console.log(response.data)
+        // console.log(response.data)
       });
     },
+    //合并单元格
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      // if (columnIndex === 0) {
+      // // 初始化 previousMachineId 和 currentRowspan,确保首次执行时能正确赋值
+      // if (rowIndex === 0) {
+      //   this.previousMachineId = row.machineId;
+      //   this.currentRowspan = 1;
+      //   return { rowspan: this.currentRowspan, colspan: 1 };
+      // }
       //
-      //   if (rowIndex % 2 === 0) {
-      //     return {
-      //       rowspan: 2,
-      //       colspan: 1
-      //     };
+      // // 第0列并且上一行的 machineId 存在
+      // if (columnIndex === 0 && this.previousMachineId != undefined) {
+      //   if (row.machineId === this.previousMachineId) {
+      //     this.currentRowspan++;
+      //     return { rowspan: this.currentRowspan, colspan: 1 };
       //   } else {
-      //     return {
-      //       rowspan: 0,
-      //       colspan: 0
-      //     };
+      //     // 当 machineId 不同时,更新 previousMachineId 和重置 currentRowspan
+      //     this.previousMachineId = row.machineId;
+      //     this.currentRowspan = 1;
+      //     return { rowspan: this.currentRowspan, colspan: 1 };
       //   }
       // }
-      if (columnIndex === 0 && this.previousMachineId !== undefined) {
-        // 比较当前行的machineId是否与上一行相同
-        if (row.machineId === this.previousMachineId) {
-          // 内容相同,跨行
-          this.currentRowspan++;
-          return {
-            rowspan: this.currentRowspan,
-            colspan: 1
-          };
-        } else {
-          // 内容不同,重置跨行计数
-          this.currentRowspan = 1;
-          this.previousMachineId = row.machineId;
-          return {
-            rowspan: 1,
-            colspan: 1
-          };
-        }
-      } else {
-        // 非第一列或者第一次渲染,初始化状态
-        this.previousMachineId = row.machineId;
-        this.currentRowspan = 1;
-        return {
-          rowspan: 1,
-          colspan: 1
-        };
-      }
+      //
+      // // 如果 columnIndex 不为 0,理论上不应该走到这里,因为只在第一列进行比较和合并
+      // // 但为了确保代码完整性,仍保留之前的返回逻辑
+      // return {
+      //   rowspan: this.currentRowspan,
+      //   colspan: 1
+      // };
     },
     //待投产的产品数据
     getProductsInfo() {
       getProductsInfo().then((response) => {
         this.productsInfo = response.data;
         this.productsInfo.forEach(item => {
-          // item.lotNumber == null ? item.lotNumber = "24-1" : item.lotNumber;
           item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
         });
-        console.log(this.productsInfo)
       })
     },
     //下拉框数据改变查询色号批号信息
     selectedChangeDate(row,selectedProduct) {
       //选择的那个销售产品
-      // console.log(row,selectedProduct)
       this.product = this.productsInfo.find(product => product.id === selectedProduct);
       this.form.product=selectedProduct;
-      // console.log(this.product)
       //通过母粒编码查询到对应的母粒信息
       let queryParams = {
         "materielCode": this.product.colourNumber
@@ -251,7 +233,6 @@ export default {
       getMaterielInfo(queryParams).then((response) => {
         if (response.data!=null) {
           this.materiel = response.data;
-          console.log(this.materiel.materieEncoding)
           //色号
           row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
           //批次
@@ -373,7 +354,10 @@ export default {
       this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
       this.lastEditLine = this.tableData2.length - 1
     },
-  }
+  },
+  computed: {
+
+  },
 }
 </script>