Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -17,10 +17,36 @@ public class ApsQuickSheetSaveReq {
|
||||
private Long lineId;
|
||||
private String lineName;
|
||||
private String planCode;
|
||||
private String planType;
|
||||
private String scheduler;
|
||||
private String remark;
|
||||
|
||||
private String bizSeqNo;
|
||||
private String orderCode;
|
||||
private String contractCode;
|
||||
private String customerName;
|
||||
private String salesman;
|
||||
|
||||
private String productName;
|
||||
private String productMaterial;
|
||||
private String coatingG;
|
||||
private String productWidth;
|
||||
private String rollingThick;
|
||||
private String markCoatThick;
|
||||
private String tonSteelLengthRange;
|
||||
private String planQty;
|
||||
private String planWeight;
|
||||
private String surfaceTreatment;
|
||||
private String widthReq;
|
||||
private String usageReq;
|
||||
private String postProcess;
|
||||
private String nextProcess;
|
||||
private String sampleReq;
|
||||
|
||||
private String rawManufacturer;
|
||||
private String rawMaterial;
|
||||
private String rawThick;
|
||||
private String rawWidth;
|
||||
private String rawMaterialId;
|
||||
private String rawCoilNos;
|
||||
private String rawLocation;
|
||||
@@ -28,7 +54,6 @@ public class ApsQuickSheetSaveReq {
|
||||
private String rawEdgeReq;
|
||||
private String rawCoatingType;
|
||||
private String rawNetWeight;
|
||||
private String planQty;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,36 @@ public class ApsQuickSheetEntity {
|
||||
private Long lineId;
|
||||
private String lineName;
|
||||
private String planCode;
|
||||
private String planType;
|
||||
private String scheduler;
|
||||
private String remark;
|
||||
|
||||
private String bizSeqNo;
|
||||
private String orderCode;
|
||||
private String contractCode;
|
||||
private String customerName;
|
||||
private String salesman;
|
||||
|
||||
private String productName;
|
||||
private String productMaterial;
|
||||
private BigDecimal coatingG;
|
||||
private BigDecimal productWidth;
|
||||
private BigDecimal rollingThick;
|
||||
private BigDecimal markCoatThick;
|
||||
private String tonSteelLengthRange;
|
||||
private BigDecimal planQty;
|
||||
private BigDecimal planWeight;
|
||||
private String surfaceTreatment;
|
||||
private String widthReq;
|
||||
private String usageReq;
|
||||
private String postProcess;
|
||||
private String nextProcess;
|
||||
private String sampleReq;
|
||||
|
||||
private String rawManufacturer;
|
||||
private String rawMaterial;
|
||||
private BigDecimal rawThick;
|
||||
private BigDecimal rawWidth;
|
||||
private String rawMaterialId;
|
||||
private String rawCoilNos;
|
||||
private String rawLocation;
|
||||
@@ -24,7 +50,6 @@ public class ApsQuickSheetEntity {
|
||||
private String rawEdgeReq;
|
||||
private String rawCoatingType;
|
||||
private BigDecimal rawNetWeight;
|
||||
private BigDecimal planQty;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
private String createBy;
|
||||
|
||||
@@ -8,13 +8,40 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class ApsQuickSheetRowVo {
|
||||
private Long quickSheetId;
|
||||
private java.time.LocalDate planDate;
|
||||
private Long lineId;
|
||||
private String lineName;
|
||||
private String planCode;
|
||||
private String planType;
|
||||
private String scheduler;
|
||||
private String remark;
|
||||
|
||||
private String bizSeqNo;
|
||||
private String orderCode;
|
||||
private String contractCode;
|
||||
private String customerName;
|
||||
private String salesman;
|
||||
|
||||
private String productName;
|
||||
private String productMaterial;
|
||||
private BigDecimal coatingG;
|
||||
private BigDecimal productWidth;
|
||||
private BigDecimal rollingThick;
|
||||
private BigDecimal markCoatThick;
|
||||
private String tonSteelLengthRange;
|
||||
private BigDecimal planQty;
|
||||
private BigDecimal planWeight;
|
||||
private String surfaceTreatment;
|
||||
private String widthReq;
|
||||
private String usageReq;
|
||||
private String postProcess;
|
||||
private String nextProcess;
|
||||
private String sampleReq;
|
||||
|
||||
private String rawManufacturer;
|
||||
private String rawMaterial;
|
||||
private BigDecimal rawThick;
|
||||
private BigDecimal rawWidth;
|
||||
private String rawMaterialId;
|
||||
private String rawCoilNos;
|
||||
private String rawLocation;
|
||||
@@ -22,7 +49,6 @@ public class ApsQuickSheetRowVo {
|
||||
private String rawEdgeReq;
|
||||
private String rawCoatingType;
|
||||
private BigDecimal rawNetWeight;
|
||||
private BigDecimal planQty;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
|
||||
@@ -1,73 +1,111 @@
|
||||
package com.klp.aps.mapper;
|
||||
|
||||
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
|
||||
import com.klp.aps.domain.dto.ApsQuickSheetQueryReq;
|
||||
import com.klp.aps.domain.vo.ApsQuickSheetRowVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public interface ApsQuickSheetMapper {
|
||||
|
||||
List<ApsQuickSheetRowVo> selectList(ApsQuickSheetQueryReq req);
|
||||
|
||||
@Select("SELECT COUNT(1) FROM aps_quick_sheet WHERE del_flag = 0 AND plan_date = #{planDate}")
|
||||
int countToday(@Param("planDate") java.time.LocalDate planDate);
|
||||
int countToday(@Param("planDate") LocalDate planDate);
|
||||
|
||||
@Select("SELECT quick_sheet_id FROM aps_quick_sheet WHERE plan_code = #{planCode} AND del_flag = 0 LIMIT 1")
|
||||
Long selectIdByPlanCode(@Param("planCode") String planCode);
|
||||
|
||||
@org.apache.ibatis.annotations.Insert("INSERT INTO aps_quick_sheet (line_id, line_name, plan_date, plan_code, order_code, customer_name, salesman, product_name, raw_material_id, raw_coil_nos, raw_location, raw_packaging, raw_edge_req, raw_coating_type, raw_net_weight, plan_qty, start_time, end_time, create_by, update_by, create_time, update_time, del_flag) "
|
||||
+ "VALUES (#{lineId}, #{lineName}, #{planDate}, #{planCode}, #{orderCode}, #{customerName}, #{salesman}, #{productName}, #{rawMaterialId}, #{rawCoilNos}, #{rawLocation}, #{rawPackaging}, #{rawEdgeReq}, #{rawCoatingType}, #{rawNetWeight}, #{planQty}, #{startTime}, #{endTime}, #{createBy}, #{updateBy}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0)")
|
||||
int insertRow(@Param("lineId") Long lineId,
|
||||
@Param("lineName") String lineName,
|
||||
@Param("planDate") java.time.LocalDate planDate,
|
||||
@Param("planDate") LocalDate planDate,
|
||||
@Param("planCode") String planCode,
|
||||
@Param("planType") String planType,
|
||||
@Param("scheduler") String scheduler,
|
||||
@Param("remark") String remark,
|
||||
@Param("bizSeqNo") String bizSeqNo,
|
||||
@Param("orderCode") String orderCode,
|
||||
@Param("contractCode") String contractCode,
|
||||
@Param("customerName") String customerName,
|
||||
@Param("salesman") String salesman,
|
||||
@Param("productName") String productName,
|
||||
@Param("productMaterial") String productMaterial,
|
||||
@Param("coatingG") BigDecimal coatingG,
|
||||
@Param("productWidth") BigDecimal productWidth,
|
||||
@Param("rollingThick") BigDecimal rollingThick,
|
||||
@Param("markCoatThick") BigDecimal markCoatThick,
|
||||
@Param("tonSteelLengthRange") String tonSteelLengthRange,
|
||||
@Param("planQty") BigDecimal planQty,
|
||||
@Param("planWeight") BigDecimal planWeight,
|
||||
@Param("surfaceTreatment") String surfaceTreatment,
|
||||
@Param("widthReq") String widthReq,
|
||||
@Param("usageReq") String usageReq,
|
||||
@Param("postProcess") String postProcess,
|
||||
@Param("nextProcess") String nextProcess,
|
||||
@Param("sampleReq") String sampleReq,
|
||||
@Param("rawManufacturer") String rawManufacturer,
|
||||
@Param("rawMaterial") String rawMaterial,
|
||||
@Param("rawThick") BigDecimal rawThick,
|
||||
@Param("rawWidth") BigDecimal rawWidth,
|
||||
@Param("rawMaterialId") String rawMaterialId,
|
||||
@Param("rawCoilNos") String rawCoilNos,
|
||||
@Param("rawLocation") String rawLocation,
|
||||
@Param("rawPackaging") String rawPackaging,
|
||||
@Param("rawEdgeReq") String rawEdgeReq,
|
||||
@Param("rawCoatingType") String rawCoatingType,
|
||||
@Param("rawNetWeight") java.math.BigDecimal rawNetWeight,
|
||||
@Param("planQty") java.math.BigDecimal planQty,
|
||||
@Param("startTime") java.time.LocalDateTime startTime,
|
||||
@Param("endTime") java.time.LocalDateTime endTime,
|
||||
@Param("rawNetWeight") BigDecimal rawNetWeight,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("createBy") String createBy,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
@org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET line_id = #{lineId}, line_name = #{lineName}, plan_code = #{planCode}, order_code = #{orderCode}, customer_name = #{customerName}, salesman = #{salesman}, product_name = #{productName}, raw_material_id = #{rawMaterialId}, raw_coil_nos = #{rawCoilNos}, raw_location = #{rawLocation}, raw_packaging = #{rawPackaging}, raw_edge_req = #{rawEdgeReq}, raw_coating_type = #{rawCoatingType}, raw_net_weight = #{rawNetWeight}, plan_qty = #{planQty}, start_time = #{startTime}, end_time = #{endTime}, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}")
|
||||
int updateRow(@Param("id") Long id,
|
||||
@Param("lineId") Long lineId,
|
||||
@Param("lineName") String lineName,
|
||||
@Param("planCode") String planCode,
|
||||
@Param("planType") String planType,
|
||||
@Param("scheduler") String scheduler,
|
||||
@Param("remark") String remark,
|
||||
@Param("bizSeqNo") String bizSeqNo,
|
||||
@Param("orderCode") String orderCode,
|
||||
@Param("contractCode") String contractCode,
|
||||
@Param("customerName") String customerName,
|
||||
@Param("salesman") String salesman,
|
||||
@Param("productName") String productName,
|
||||
@Param("productMaterial") String productMaterial,
|
||||
@Param("coatingG") BigDecimal coatingG,
|
||||
@Param("productWidth") BigDecimal productWidth,
|
||||
@Param("rollingThick") BigDecimal rollingThick,
|
||||
@Param("markCoatThick") BigDecimal markCoatThick,
|
||||
@Param("tonSteelLengthRange") String tonSteelLengthRange,
|
||||
@Param("planQty") BigDecimal planQty,
|
||||
@Param("planWeight") BigDecimal planWeight,
|
||||
@Param("surfaceTreatment") String surfaceTreatment,
|
||||
@Param("widthReq") String widthReq,
|
||||
@Param("usageReq") String usageReq,
|
||||
@Param("postProcess") String postProcess,
|
||||
@Param("nextProcess") String nextProcess,
|
||||
@Param("sampleReq") String sampleReq,
|
||||
@Param("rawManufacturer") String rawManufacturer,
|
||||
@Param("rawMaterial") String rawMaterial,
|
||||
@Param("rawThick") BigDecimal rawThick,
|
||||
@Param("rawWidth") BigDecimal rawWidth,
|
||||
@Param("rawMaterialId") String rawMaterialId,
|
||||
@Param("rawCoilNos") String rawCoilNos,
|
||||
@Param("rawLocation") String rawLocation,
|
||||
@Param("rawPackaging") String rawPackaging,
|
||||
@Param("rawEdgeReq") String rawEdgeReq,
|
||||
@Param("rawCoatingType") String rawCoatingType,
|
||||
@Param("rawNetWeight") java.math.BigDecimal rawNetWeight,
|
||||
@Param("planQty") java.math.BigDecimal planQty,
|
||||
@Param("startTime") java.time.LocalDateTime startTime,
|
||||
@Param("endTime") java.time.LocalDateTime endTime,
|
||||
@Param("rawNetWeight") BigDecimal rawNetWeight,
|
||||
@Param("startTime") LocalDateTime startTime,
|
||||
@Param("endTime") LocalDateTime endTime,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
@org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}")
|
||||
int deleteRow(@Param("id") Long id, @Param("updateBy") String updateBy);
|
||||
|
||||
@org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}")
|
||||
int softDelete(@Param("id") Long id,
|
||||
@Param("updateBy") String updateBy);
|
||||
|
||||
@org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}")
|
||||
int deleteById(@Param("id") Long id, @Param("updateBy") String updateBy);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,36 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
Long lineId = row.getLineId();
|
||||
String lineName = row.getLineName();
|
||||
String planCode = row.getPlanCode();
|
||||
String planType = row.getPlanType();
|
||||
String scheduler = row.getScheduler();
|
||||
String remark = row.getRemark();
|
||||
|
||||
String bizSeqNo = row.getBizSeqNo();
|
||||
String orderCode = row.getOrderCode();
|
||||
String contractCode = row.getContractCode();
|
||||
String customerName = row.getCustomerName();
|
||||
String salesman = row.getSalesman();
|
||||
|
||||
String productName = row.getProductName();
|
||||
String productMaterial = row.getProductMaterial();
|
||||
BigDecimal coatingG = parseQty(row.getCoatingG());
|
||||
BigDecimal productWidth = parseQty(row.getProductWidth());
|
||||
BigDecimal rollingThick = parseQty(row.getRollingThick());
|
||||
BigDecimal markCoatThick = parseQty(row.getMarkCoatThick());
|
||||
String tonSteelLengthRange = row.getTonSteelLengthRange();
|
||||
BigDecimal planQty = parseQty(row.getPlanQty());
|
||||
BigDecimal planWeight = parseQty(row.getPlanWeight());
|
||||
String surfaceTreatment = row.getSurfaceTreatment();
|
||||
String widthReq = row.getWidthReq();
|
||||
String usageReq = row.getUsageReq();
|
||||
String postProcess = row.getPostProcess();
|
||||
String nextProcess = row.getNextProcess();
|
||||
String sampleReq = row.getSampleReq();
|
||||
|
||||
String rawManufacturer = row.getRawManufacturer();
|
||||
String rawMaterial = row.getRawMaterial();
|
||||
BigDecimal rawThick = parseQty(row.getRawThick());
|
||||
BigDecimal rawWidth = parseQty(row.getRawWidth());
|
||||
String rawMaterialId = row.getRawMaterialId();
|
||||
String rawCoilNos = row.getRawCoilNos();
|
||||
String rawLocation = row.getRawLocation();
|
||||
@@ -50,15 +76,23 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
String rawEdgeReq = row.getRawEdgeReq();
|
||||
String rawCoatingType = row.getRawCoatingType();
|
||||
BigDecimal rawNetWeight = parseQty(row.getRawNetWeight());
|
||||
BigDecimal planQty = parseQty(row.getPlanQty());
|
||||
LocalDateTime startTime = parseTime(row.getStartTime());
|
||||
LocalDateTime endTime = parseTime(row.getEndTime());
|
||||
|
||||
boolean hasAny = lineId != null || isNotBlank(lineName) || isNotBlank(planCode) || isNotBlank(orderCode)
|
||||
|| isNotBlank(customerName) || isNotBlank(salesman) || isNotBlank(productName)
|
||||
boolean hasAny = lineId != null || isNotBlank(lineName) || isNotBlank(planCode) || isNotBlank(planType)
|
||||
|| isNotBlank(scheduler) || isNotBlank(remark)
|
||||
|| isNotBlank(bizSeqNo) || isNotBlank(orderCode) || isNotBlank(contractCode)
|
||||
|| isNotBlank(customerName) || isNotBlank(salesman)
|
||||
|| isNotBlank(productName) || isNotBlank(productMaterial)
|
||||
|| coatingG != null || productWidth != null || rollingThick != null || markCoatThick != null
|
||||
|| isNotBlank(tonSteelLengthRange) || planQty != null || planWeight != null
|
||||
|| isNotBlank(surfaceTreatment) || isNotBlank(widthReq) || isNotBlank(usageReq)
|
||||
|| isNotBlank(postProcess) || isNotBlank(nextProcess) || isNotBlank(sampleReq)
|
||||
|| isNotBlank(rawManufacturer) || isNotBlank(rawMaterial)
|
||||
|| rawThick != null || rawWidth != null
|
||||
|| isNotBlank(rawMaterialId) || isNotBlank(rawCoilNos) || isNotBlank(rawLocation)
|
||||
|| isNotBlank(rawPackaging) || isNotBlank(rawEdgeReq) || isNotBlank(rawCoatingType)
|
||||
|| rawNetWeight != null || planQty != null || startTime != null || endTime != null;
|
||||
|| rawNetWeight != null || startTime != null || endTime != null;
|
||||
if (!hasAny) {
|
||||
continue;
|
||||
}
|
||||
@@ -66,11 +100,23 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
if (!isNotBlank(planCode)) {
|
||||
planCode = buildPlanCode();
|
||||
}
|
||||
quickSheetMapper.insertRow(lineId, lineName, LocalDate.now(), planCode, orderCode, customerName, salesman, productName,
|
||||
rawMaterialId, rawCoilNos, rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight, planQty, startTime, endTime, operator, operator);
|
||||
quickSheetMapper.insertRow(lineId, lineName, LocalDate.now(), planCode, planType, scheduler, remark,
|
||||
bizSeqNo, orderCode, contractCode, customerName, salesman,
|
||||
productName, productMaterial, coatingG, productWidth, rollingThick, markCoatThick,
|
||||
tonSteelLengthRange, planQty, planWeight, surfaceTreatment, widthReq, usageReq,
|
||||
postProcess, nextProcess, sampleReq,
|
||||
rawManufacturer, rawMaterial, rawThick, rawWidth, rawMaterialId, rawCoilNos,
|
||||
rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight,
|
||||
startTime, endTime, operator, operator);
|
||||
} else {
|
||||
quickSheetMapper.updateRow(id, lineId, lineName, planCode, orderCode, customerName, salesman, productName,
|
||||
rawMaterialId, rawCoilNos, rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight, planQty, startTime, endTime, operator);
|
||||
quickSheetMapper.updateRow(id, lineId, lineName, planCode, planType, scheduler, remark,
|
||||
bizSeqNo, orderCode, contractCode, customerName, salesman,
|
||||
productName, productMaterial, coatingG, productWidth, rollingThick, markCoatThick,
|
||||
tonSteelLengthRange, planQty, planWeight, surfaceTreatment, widthReq, usageReq,
|
||||
postProcess, nextProcess, sampleReq,
|
||||
rawManufacturer, rawMaterial, rawThick, rawWidth, rawMaterialId, rawCoilNos,
|
||||
rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight,
|
||||
startTime, endTime, operator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +151,7 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
title.setHeightInPoints(36f);
|
||||
org.apache.poi.ss.usermodel.Cell t0 = title.createCell(0);
|
||||
t0.setCellValue("快速排产表(Excel录入)");
|
||||
sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 14));
|
||||
sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 39));
|
||||
|
||||
org.apache.poi.ss.usermodel.CellStyle titleStyle = wb.createCellStyle();
|
||||
titleStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER);
|
||||
@@ -117,9 +163,12 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
t0.setCellStyle(titleStyle);
|
||||
|
||||
String[] headers = new String[]{
|
||||
"产线", "计划号", "订单号", "客户", "业务员", "产品",
|
||||
"原料钢卷", "原料卷号", "钢卷位置", "包装要求", "切边要求", "镀层种类",
|
||||
"原料净重", "计划数量", "开始时间", "结束时间"
|
||||
"产线", "排产日期", "排产单号", "排产类型", "排产人", "修改人", "备注",
|
||||
"内容序号", "销售内容", "订单合同号", "客户", "业务员",
|
||||
"成品名称", "材质", "镀层g", "成品宽度", "轧制厚度", "标丝厚度", "吨钢长度区间m",
|
||||
"数量", "重量", "表面处理", "切边要求", "宽度要求", "用途", "后处理", "下工序", "取样",
|
||||
"厂家", "原料信息", "原料厚度mm", "宽度mm", "原料钢卷", "原料卷号", "钢卷位置", "包装要求", "镀层种类", "原料净重",
|
||||
"开始时间", "结束时间"
|
||||
};
|
||||
org.apache.poi.ss.usermodel.Row head = sheet.createRow(r++);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
@@ -131,19 +180,46 @@ public class ApsQuickSheetServiceImpl implements ApsQuickSheetService {
|
||||
org.apache.poi.ss.usermodel.Row rr = sheet.createRow(r++);
|
||||
int cc = 0;
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getLineName(), row.getLineId()));
|
||||
rr.createCell(cc++).setCellValue(row.getPlanDate() == null ? "" : row.getPlanDate().toString());
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getPlanCode(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getPlanType(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getScheduler(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRemark(), ""));
|
||||
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getBizSeqNo(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getOrderCode(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getContractCode(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getCustomerName(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getSalesman(), ""));
|
||||
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getProductName(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getProductMaterial(), ""));
|
||||
rr.createCell(cc++).setCellValue(row.getCoatingG() == null ? "" : row.getCoatingG().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getProductWidth() == null ? "" : row.getProductWidth().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getRollingThick() == null ? "" : row.getRollingThick().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getMarkCoatThick() == null ? "" : row.getMarkCoatThick().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getTonSteelLengthRange(), ""));
|
||||
rr.createCell(cc++).setCellValue(row.getPlanQty() == null ? "" : row.getPlanQty().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getPlanWeight() == null ? "" : row.getPlanWeight().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getSurfaceTreatment(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getWidthReq(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawEdgeReq(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getUsageReq(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getPostProcess(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getNextProcess(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getSampleReq(), ""));
|
||||
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawManufacturer(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterial(), ""));
|
||||
rr.createCell(cc++).setCellValue(row.getRawThick() == null ? "" : row.getRawThick().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getRawWidth() == null ? "" : row.getRawWidth().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawMaterialId(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawCoilNos(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawLocation(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawPackaging(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawEdgeReq(), ""));
|
||||
rr.createCell(cc++).setCellValue(nvl(row.getRawCoatingType(), ""));
|
||||
rr.createCell(cc++).setCellValue(row.getRawNetWeight() == null ? "" : row.getRawNetWeight().toPlainString());
|
||||
rr.createCell(cc++).setCellValue(row.getPlanQty() == null ? "" : row.getPlanQty().toPlainString());
|
||||
|
||||
rr.createCell(cc++).setCellValue(row.getStartTime() == null ? "" : row.getStartTime().toString());
|
||||
rr.createCell(cc++).setCellValue(row.getEndTime() == null ? "" : row.getEndTime().toString());
|
||||
}
|
||||
|
||||
@@ -7,13 +7,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectList" parameterType="com.klp.aps.domain.dto.ApsQuickSheetQueryReq" resultType="com.klp.aps.domain.vo.ApsQuickSheetRowVo">
|
||||
SELECT
|
||||
quick_sheet_id AS quickSheetId,
|
||||
plan_date AS planDate,
|
||||
line_id AS lineId,
|
||||
line_name AS lineName,
|
||||
plan_code AS planCode,
|
||||
plan_type AS planType,
|
||||
scheduler,
|
||||
remark,
|
||||
biz_seq_no AS bizSeqNo,
|
||||
order_code AS orderCode,
|
||||
contract_code AS contractCode,
|
||||
customer_name AS customerName,
|
||||
salesman,
|
||||
product_name AS productName,
|
||||
product_material AS productMaterial,
|
||||
coating_g AS coatingG,
|
||||
product_width AS productWidth,
|
||||
rolling_thick AS rollingThick,
|
||||
mark_coat_thick AS markCoatThick,
|
||||
ton_steel_length_range AS tonSteelLengthRange,
|
||||
plan_qty AS planQty,
|
||||
plan_weight AS planWeight,
|
||||
surface_treatment AS surfaceTreatment,
|
||||
width_req AS widthReq,
|
||||
usage_req AS usageReq,
|
||||
post_process AS postProcess,
|
||||
next_process AS nextProcess,
|
||||
sample_req AS sampleReq,
|
||||
raw_manufacturer AS rawManufacturer,
|
||||
raw_material AS rawMaterial,
|
||||
raw_thick AS rawThick,
|
||||
raw_width AS rawWidth,
|
||||
raw_material_id AS rawMaterialId,
|
||||
raw_coil_nos AS rawCoilNos,
|
||||
raw_location AS rawLocation,
|
||||
@@ -21,7 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
raw_edge_req AS rawEdgeReq,
|
||||
raw_coating_type AS rawCoatingType,
|
||||
raw_net_weight AS rawNetWeight,
|
||||
plan_qty AS planQty,
|
||||
start_time AS startTime,
|
||||
end_time AS endTime
|
||||
FROM aps_quick_sheet
|
||||
@@ -41,4 +64,113 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY quick_sheet_id DESC
|
||||
</select>
|
||||
|
||||
<select id="countToday" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM aps_quick_sheet
|
||||
WHERE del_flag = 0
|
||||
AND plan_date = #{planDate}
|
||||
</select>
|
||||
|
||||
<select id="selectIdByPlanCode" resultType="long">
|
||||
SELECT quick_sheet_id
|
||||
FROM aps_quick_sheet
|
||||
WHERE plan_code = #{planCode}
|
||||
AND del_flag = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertRow">
|
||||
INSERT INTO aps_quick_sheet (
|
||||
line_id, line_name, plan_date, plan_code, plan_type, scheduler, remark,
|
||||
biz_seq_no, order_code, contract_code, customer_name, salesman,
|
||||
product_name, product_material, coating_g, product_width, rolling_thick, mark_coat_thick,
|
||||
ton_steel_length_range, plan_qty, plan_weight, surface_treatment, width_req, usage_req,
|
||||
post_process, next_process, sample_req,
|
||||
raw_manufacturer, raw_material, raw_thick, raw_width, raw_material_id, raw_coil_nos,
|
||||
raw_location, raw_packaging, raw_edge_req, raw_coating_type, raw_net_weight,
|
||||
start_time, end_time,
|
||||
create_by, update_by, create_time, update_time, del_flag
|
||||
) VALUES (
|
||||
#{lineId}, #{lineName}, #{planDate}, #{planCode}, #{planType}, #{scheduler}, #{remark},
|
||||
#{bizSeqNo}, #{orderCode}, #{contractCode}, #{customerName}, #{salesman},
|
||||
#{productName}, #{productMaterial}, #{coatingG}, #{productWidth}, #{rollingThick}, #{markCoatThick},
|
||||
#{tonSteelLengthRange}, #{planQty}, #{planWeight}, #{surfaceTreatment}, #{widthReq}, #{usageReq},
|
||||
#{postProcess}, #{nextProcess}, #{sampleReq},
|
||||
#{rawManufacturer}, #{rawMaterial}, #{rawThick}, #{rawWidth}, #{rawMaterialId}, #{rawCoilNos},
|
||||
#{rawLocation}, #{rawPackaging}, #{rawEdgeReq}, #{rawCoatingType}, #{rawNetWeight},
|
||||
#{startTime}, #{endTime},
|
||||
#{createBy}, #{updateBy}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateRow">
|
||||
UPDATE aps_quick_sheet
|
||||
SET line_id = #{lineId},
|
||||
line_name = #{lineName},
|
||||
plan_code = #{planCode},
|
||||
plan_type = #{planType},
|
||||
scheduler = #{scheduler},
|
||||
remark = #{remark},
|
||||
biz_seq_no = #{bizSeqNo},
|
||||
order_code = #{orderCode},
|
||||
contract_code = #{contractCode},
|
||||
customer_name = #{customerName},
|
||||
salesman = #{salesman},
|
||||
product_name = #{productName},
|
||||
product_material = #{productMaterial},
|
||||
coating_g = #{coatingG},
|
||||
product_width = #{productWidth},
|
||||
rolling_thick = #{rollingThick},
|
||||
mark_coat_thick = #{markCoatThick},
|
||||
ton_steel_length_range = #{tonSteelLengthRange},
|
||||
plan_qty = #{planQty},
|
||||
plan_weight = #{planWeight},
|
||||
surface_treatment = #{surfaceTreatment},
|
||||
width_req = #{widthReq},
|
||||
usage_req = #{usageReq},
|
||||
post_process = #{postProcess},
|
||||
next_process = #{nextProcess},
|
||||
sample_req = #{sampleReq},
|
||||
raw_manufacturer = #{rawManufacturer},
|
||||
raw_material = #{rawMaterial},
|
||||
raw_thick = #{rawThick},
|
||||
raw_width = #{rawWidth},
|
||||
raw_material_id = #{rawMaterialId},
|
||||
raw_coil_nos = #{rawCoilNos},
|
||||
raw_location = #{rawLocation},
|
||||
raw_packaging = #{rawPackaging},
|
||||
raw_edge_req = #{rawEdgeReq},
|
||||
raw_coating_type = #{rawCoatingType},
|
||||
raw_net_weight = #{rawNetWeight},
|
||||
start_time = #{startTime},
|
||||
end_time = #{endTime},
|
||||
update_by = #{updateBy},
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
WHERE quick_sheet_id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteRow">
|
||||
UPDATE aps_quick_sheet
|
||||
SET del_flag = 1,
|
||||
update_by = #{updateBy},
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
WHERE quick_sheet_id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="softDelete">
|
||||
UPDATE aps_quick_sheet
|
||||
SET del_flag = 1,
|
||||
update_by = #{updateBy},
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
WHERE quick_sheet_id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteById">
|
||||
UPDATE aps_quick_sheet
|
||||
SET del_flag = 1,
|
||||
update_by = #{updateBy},
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
WHERE quick_sheet_id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<el-button size="small" type="primary" icon="el-icon-finished" :loading="saving" @click="saveAll">保存</el-button>
|
||||
<el-button size="small" icon="el-icon-plus" @click="addRow">新增行</el-button>
|
||||
<el-button size="small" icon="el-icon-download" @click="exportCsv">导出</el-button>
|
||||
<el-button size="small" icon="el-icon-setting" @click="columnSettingVisible = true">列设置</el-button>
|
||||
<el-date-picker
|
||||
v-model="filter.range"
|
||||
type="daterange"
|
||||
@@ -34,39 +35,31 @@
|
||||
|
||||
<div class="sheet-body">
|
||||
<el-table
|
||||
ref="quickSheetTable"
|
||||
v-loading="loading"
|
||||
:data="displayRows"
|
||||
border
|
||||
size="mini"
|
||||
class="excel-table"
|
||||
>
|
||||
<el-table-column label="序号" width="60" align="center">
|
||||
<el-table-column label="序号" width="60" align="center" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
{{ ((pager.pageNum - 1) * pager.pageSize) + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-for="col in flatColumns"
|
||||
v-for="(col, colIndex) in displayColumns"
|
||||
:key="col.prop || col.label"
|
||||
:label="col.label"
|
||||
:prop="col.prop"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:align="col.align || 'center'"
|
||||
:fixed="fixedProps.includes(col.prop) ? 'left' : false"
|
||||
:show-overflow-tooltip="col.showOverflowTooltip !== false"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<template v-if="col.prop === 'rawMaterialId'">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
class="coil-picker-btn"
|
||||
@click="openCoilPicker(scope.row)"
|
||||
>
|
||||
{{ scope.row.rawCoilNos || '选择原料钢卷' }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else-if="isTimeField(col.prop)">
|
||||
<template v-if="isTimeField(col.prop)">
|
||||
<el-date-picker
|
||||
v-model="scope.row[col.prop]"
|
||||
type="datetime"
|
||||
@@ -75,6 +68,8 @@
|
||||
style="width: 100%"
|
||||
@change="onCellChange(scope.row)"
|
||||
@input="onCellChange(scope.row)"
|
||||
@keydown.native.enter.prevent="focusNextCell(scope.$index, colIndex, 'down')"
|
||||
@keydown.native.tab.prevent="focusNextCell(scope.$index, colIndex, 'right')"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -86,6 +81,8 @@
|
||||
:fetch-suggestions="queryLineHistory"
|
||||
@select="onLineHistorySelect(scope.row)"
|
||||
@input="onLineHistoryInput(scope.row)"
|
||||
@keydown.native.enter.prevent="focusNextCell(scope.$index, colIndex, 'down')"
|
||||
@keydown.native.tab.prevent="focusNextCell(scope.$index, colIndex, 'right')"
|
||||
/>
|
||||
<el-input
|
||||
v-else
|
||||
@@ -93,6 +90,8 @@
|
||||
size="mini"
|
||||
clearable
|
||||
@input="onCellChange(scope.row)"
|
||||
@keydown.native.enter.prevent="focusNextCell(scope.$index, colIndex, 'down')"
|
||||
@keydown.native.tab.prevent="focusNextCell(scope.$index, colIndex, 'right')"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
@@ -118,102 +117,57 @@
|
||||
<div v-if="missingRows.length" class="missing-tip">
|
||||
<div v-for="msg in missingRows" :key="msg" class="missing-item">{{ msg }}</div>
|
||||
</div>
|
||||
<el-dialog title="选择原料钢卷" :visible.sync="coilPicker.visible" width="1280px" append-to-body>
|
||||
<el-form :inline="true" size="small" class="coil-picker-form">
|
||||
<el-form-item label="库区">
|
||||
<el-select v-model="coilPicker.selectedWarehouseId" clearable filterable placeholder="全部库区" style="width: 220px" @change="onCoilFilterChange">
|
||||
<el-option
|
||||
v-for="w in coilPicker.warehouseOptions"
|
||||
:key="w.actualWarehouseId"
|
||||
:label="w.actualWarehouseName"
|
||||
:value="w.actualWarehouseId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="入场钢卷号">
|
||||
<el-input v-model="coilPicker.enterCoilNo" clearable placeholder="支持模糊" style="width: 170px" @keyup.enter.native="searchCoils" />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号">
|
||||
<el-input v-model="coilPicker.currentCoilNo" clearable placeholder="支持模糊" style="width: 170px" @keyup.enter.native="searchCoils" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家">
|
||||
<el-input v-model="coilPicker.manufacturer" clearable placeholder="支持模糊" style="width: 170px" @keyup.enter.native="searchCoils" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="mini" type="primary" @click="searchCoils">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-drawer
|
||||
title="列设置"
|
||||
:visible.sync="columnSettingVisible"
|
||||
direction="rtl"
|
||||
size="55%"
|
||||
append-to-body
|
||||
@open="resetColumnDraft">
|
||||
<div class="col-setting-body">
|
||||
<div class="col-setting-toolbar">
|
||||
<el-button size="mini" @click="restoreDefaultColumns">恢复默认</el-button>
|
||||
<el-button size="mini" @click="resetColumnDraft">重置</el-button>
|
||||
<el-button size="mini" type="primary" @click="saveColumnSettings">保存</el-button>
|
||||
</div>
|
||||
|
||||
<div class="coil-stack-wrap" v-loading="coilPicker.loading">
|
||||
<el-empty v-if="!coilColumnKeys.length" description="暂无可选原料钢卷" :image-size="60" />
|
||||
<div v-else class="coil-bird-wrap">
|
||||
<div class="coil-legend">
|
||||
<span class="legend-item"><i class="dot layer1" />一层</span>
|
||||
<span class="legend-item"><i class="dot layer2" />二层</span>
|
||||
<span class="legend-item"><i class="dot occupied" />已占用</span>
|
||||
</div>
|
||||
<div class="coil-grid-scroll">
|
||||
<div class="coil-col-ruler">
|
||||
<div class="ruler-empty" />
|
||||
<div v-for="col in coilColumnKeys" :key="`ruler-${col}`" class="ruler-col">{{ col }}</div>
|
||||
<div class="col-section">
|
||||
<div class="col-section-title">固定列(最多5列)</div>
|
||||
<draggable v-model="fixedColumnList" handle=".drag-handle" animation="200" class="col-setting-grid">
|
||||
<div v-for="item in fixedColumnList" :key="`fixed-${item.prop}`" class="col-setting-item">
|
||||
<i class="el-icon-rank drag-handle" />
|
||||
<span class="col-label">{{ item.label }}</span>
|
||||
<el-button type="text" size="mini" @click="removeFromFixed(item.prop)">移除</el-button>
|
||||
</div>
|
||||
<div class="coil-grid-main">
|
||||
<div class="coil-row-ruler">
|
||||
<div v-for="row in coilMaxRow" :key="`row-${row}`" class="ruler-row">{{ row }}</div>
|
||||
</div>
|
||||
<div class="coil-grid-columns">
|
||||
<div v-for="col in coilColumnKeys" :key="`col-${col}`" class="coil-col-pair">
|
||||
<div class="coil-layer">
|
||||
<div
|
||||
v-for="row in coilMaxRow"
|
||||
:key="`l1-${col}-${row}`"
|
||||
class="coil-cell layer1"
|
||||
:class="{ occupied: !!(getCoilCell(col, row, 1) && getCoilCell(col, row, 1).rawMaterialId) }"
|
||||
@click="selectCoilCell(col, row, 1)"
|
||||
>
|
||||
<template v-if="getCoilCell(col, row, 1)">
|
||||
<div class="line1" :title="getCoilCell(col, row, 1).rawLocation">{{ getCoilCell(col, row, 1).rawLocation }}</div>
|
||||
<div class="line2" :title="getCoilCell(col, row, 1).rawMaterialCode">{{ getCoilCell(col, row, 1).rawMaterialCode || '-' }}</div>
|
||||
</template>
|
||||
<template v-else>-</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coil-layer layer2-shift">
|
||||
<div
|
||||
v-for="row in (coilMaxRow - 1)"
|
||||
:key="`l2-${col}-${row}`"
|
||||
class="coil-cell layer2"
|
||||
:class="{ occupied: !!(getCoilCell(col, row, 2) && getCoilCell(col, row, 2).rawMaterialId) }"
|
||||
@click="selectCoilCell(col, row, 2)"
|
||||
>
|
||||
<template v-if="getCoilCell(col, row, 2)">
|
||||
<div class="line1" :title="getCoilCell(col, row, 2).rawLocation">{{ getCoilCell(col, row, 2).rawLocation }}</div>
|
||||
<div class="line2" :title="getCoilCell(col, row, 2).rawMaterialCode">{{ getCoilCell(col, row, 2).rawMaterialCode || '-' }}</div>
|
||||
</template>
|
||||
<template v-else>-</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
|
||||
<div class="col-section">
|
||||
<div class="col-section-title">其他列</div>
|
||||
<draggable v-model="normalColumnList" handle=".drag-handle" animation="200" class="col-setting-grid">
|
||||
<div v-for="item in normalColumnList" :key="`normal-${item.prop}`" class="col-setting-item">
|
||||
<i class="el-icon-rank drag-handle" />
|
||||
<span class="col-label">{{ item.label }}</span>
|
||||
<el-button type="text" size="mini" @click="addToFixed(item.prop)">加入固定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coil-picker-foot">共 {{ coilPicker.total || 0 }} 条钢卷(按库位分布展示)</div>
|
||||
</el-dialog>
|
||||
</el-drawer>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchQuickSheetList, fetchQuickSheetPreset, saveQuickSheet, exportQuickSheet, deleteQuickSheetRow } from '@/api/aps/quickSheet'
|
||||
import { listProductionLine } from '@/api/wms/productionLine'
|
||||
import { getMaterialCoilLocationGrid } from '@/api/wms/coil'
|
||||
import { treeActualWarehouseTwoLevel } from '@/api/wms/actualWarehouse'
|
||||
import { getTemplateByKey } from './sheets/templates'
|
||||
import { saveAs } from 'file-saver'
|
||||
import draggable from 'vuedraggable'
|
||||
|
||||
export default {
|
||||
name: 'ApsQuickSheet',
|
||||
components: { draggable },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -231,18 +185,10 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 25
|
||||
},
|
||||
coilPicker: {
|
||||
visible: false,
|
||||
loading: false,
|
||||
currentRow: null,
|
||||
selectedWarehouseId: undefined,
|
||||
enterCoilNo: '',
|
||||
currentCoilNo: '',
|
||||
manufacturer: '',
|
||||
warehouseOptions: [],
|
||||
coilGrid: {},
|
||||
total: 0
|
||||
}
|
||||
columnSettingVisible: false,
|
||||
columnSettingList: [],
|
||||
fixedColumnList: [],
|
||||
normalColumnList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -258,7 +204,23 @@ export default {
|
||||
})
|
||||
}
|
||||
loop(this.currentTemplate.columns || [])
|
||||
return res
|
||||
return res.filter(c => c && c.prop)
|
||||
},
|
||||
displayColumns() {
|
||||
const setting = this.columnSettingList || []
|
||||
const hasSetting = setting.length > 0
|
||||
const base = this.flatColumns
|
||||
|
||||
const selected = hasSetting
|
||||
? setting.filter(i => i.visible).map(i => base.find(c => c.prop === i.prop)).filter(Boolean)
|
||||
: base
|
||||
|
||||
const selectedSet = new Set(selected.map(c => c.prop))
|
||||
const rest = base.filter(c => !selectedSet.has(c.prop))
|
||||
return [...selected, ...rest]
|
||||
},
|
||||
fixedProps() {
|
||||
return (this.columnSettingList || []).filter(i => i.visible && i.fixed).map(i => i.prop).slice(0, 5)
|
||||
},
|
||||
displayRows() {
|
||||
const [startAfter, endBefore] = this.filter.range || []
|
||||
@@ -288,35 +250,53 @@ export default {
|
||||
},
|
||||
missingRows() {
|
||||
return this.collectMissing(this.displayRows)
|
||||
},
|
||||
coilColumnKeys() {
|
||||
const keys = Object.keys(this.coilPicker.coilGrid || {})
|
||||
return keys.map(v => Number(v)).filter(v => !Number.isNaN(v)).sort((a, b) => a - b)
|
||||
},
|
||||
coilMaxRow() {
|
||||
let max = 0
|
||||
Object.values(this.coilPicker.coilGrid || {}).forEach(col => {
|
||||
const l1 = col.layer1 || []
|
||||
const l2 = col.layer2 || []
|
||||
;[...l1, ...l2].forEach(item => {
|
||||
const row = Number(item._row || 0)
|
||||
if (row > max) max = row
|
||||
})
|
||||
})
|
||||
return max || 1
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const today = new Date()
|
||||
const start = `${today.getFullYear()}-${`${today.getMonth() + 1}`.padStart(2, '0')}-${`${today.getDate()}`.padStart(2, '0')}`
|
||||
this.filter.range = [start, '']
|
||||
this.initColumnSettings()
|
||||
this.loadRows()
|
||||
this.loadLines()
|
||||
window.addEventListener('keydown', this.handleGlobalKeydown)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.autoSaveTimer) clearTimeout(this.autoSaveTimer)
|
||||
this.persistColumnSettings()
|
||||
window.removeEventListener('keydown', this.handleGlobalKeydown)
|
||||
},
|
||||
methods: {
|
||||
handleGlobalKeydown(e) {
|
||||
const isMac = /Mac|iPod|iPhone|iPad/.test(navigator.userAgent)
|
||||
const ctrlOrCmd = isMac ? e.metaKey : e.ctrlKey
|
||||
if (ctrlOrCmd && (e.key === 's' || e.key === 'S')) {
|
||||
e.preventDefault()
|
||||
this.saveAll(false)
|
||||
}
|
||||
},
|
||||
focusNextCell(visibleRowIndex, colIndex, direction) {
|
||||
const pageStart = (this.pager.pageNum - 1) * this.pager.pageSize
|
||||
const targetRow = direction === 'down' ? visibleRowIndex + 1 : visibleRowIndex
|
||||
const targetCol = direction === 'right' ? colIndex + 1 : colIndex
|
||||
if (targetCol >= this.displayColumns.length) return
|
||||
|
||||
const globalRowIndex = pageStart + targetRow
|
||||
if (globalRowIndex >= this.rows.length) {
|
||||
this.rows.push(this.buildEmptyRow())
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
const wrappers = this.$el.querySelectorAll('.excel-table .el-table__body-wrapper tbody tr')
|
||||
const tr = wrappers[targetRow]
|
||||
if (!tr) return
|
||||
const tds = tr.querySelectorAll('td')
|
||||
const td = tds[targetCol + 1]
|
||||
if (!td) return
|
||||
const input = td.querySelector('input, textarea, .el-input__inner')
|
||||
if (input) input.focus()
|
||||
})
|
||||
},
|
||||
async loadLines() {
|
||||
const res = await listProductionLine({ pageNum: 1, pageSize: 1000 })
|
||||
this.lineOptions = res.rows || []
|
||||
@@ -359,133 +339,6 @@ export default {
|
||||
this.markDirty(targetRow)
|
||||
this.scheduleAutoSave()
|
||||
},
|
||||
async loadWarehouseOptions() {
|
||||
const res = await treeActualWarehouseTwoLevel()
|
||||
const tree = res.data || []
|
||||
const leaf = []
|
||||
tree.forEach(p => {
|
||||
;(p.children || []).forEach(c => {
|
||||
leaf.push({
|
||||
actualWarehouseId: c.actualWarehouseId,
|
||||
actualWarehouseName: `${p.actualWarehouseName || ''}/${c.actualWarehouseName || ''}`
|
||||
})
|
||||
})
|
||||
})
|
||||
this.coilPicker.warehouseOptions = leaf
|
||||
},
|
||||
async loadCoilsByWarehouse() {
|
||||
if (!this.coilPicker.selectedWarehouseId) {
|
||||
this.coilPicker.coilGrid = {}
|
||||
this.coilPicker.total = 0
|
||||
return
|
||||
}
|
||||
this.coilPicker.loading = true
|
||||
try {
|
||||
const gridRes = await getMaterialCoilLocationGrid({
|
||||
itemType: 'raw_material',
|
||||
actualWarehouseId: this.coilPicker.selectedWarehouseId,
|
||||
enterCoilNo: this.coilPicker.enterCoilNo || undefined,
|
||||
currentCoilNo: this.coilPicker.currentCoilNo || undefined,
|
||||
manufacturer: this.coilPicker.manufacturer || undefined
|
||||
})
|
||||
const data = gridRes.data || {}
|
||||
const warehouses = data.warehouses || []
|
||||
const coils = (data.coils || []).map(item => ({
|
||||
rawMaterialId: item.coilId,
|
||||
rawMaterialCode: item.currentCoilNo || item.enterCoilNo || item.coilNo || '',
|
||||
rawMaterialName: item.itemName || item.materialName || '',
|
||||
specification: item.specification || '',
|
||||
coilWeight: item.netWeight,
|
||||
packageType: item.packagingRequirement || item.packageType,
|
||||
edgeType: item.trimmingRequirement || item.edgeType,
|
||||
zincLayer: item.coatingType || item.zincLayer,
|
||||
surfaceTreatmentDesc: item.surfaceTreatmentDesc,
|
||||
actualWarehouseId: item.actualWarehouseId,
|
||||
actualWarehouseName: item.actualWarehouseName || '未分配库位',
|
||||
rawLocation: item.actualWarehouseName || '未分配库位'
|
||||
}))
|
||||
this.coilPicker.total = coils.length
|
||||
const coilByWarehouseId = {}
|
||||
coils.forEach(c => {
|
||||
if (c.actualWarehouseId && !coilByWarehouseId[c.actualWarehouseId]) {
|
||||
coilByWarehouseId[c.actualWarehouseId] = c
|
||||
}
|
||||
})
|
||||
const grid = {}
|
||||
warehouses.forEach(w => {
|
||||
const code = String(w.actualWarehouseCode || '')
|
||||
const m = code.match(/^([A-Za-z0-9]{3})([^-]+)-(\d{2})-(\d+)$/)
|
||||
if (!m) return
|
||||
const col = Number(m[2])
|
||||
const row = Number(m[3])
|
||||
const layer = Number(m[4])
|
||||
if (!grid[col]) grid[col] = { layer1: [], layer2: [] }
|
||||
const coil = coilByWarehouseId[w.actualWarehouseId] || null
|
||||
const cell = {
|
||||
_col: col,
|
||||
_row: row,
|
||||
_layer: layer,
|
||||
actualWarehouseId: w.actualWarehouseId,
|
||||
actualWarehouseCode: w.actualWarehouseCode,
|
||||
rawLocation: w.actualWarehouseName || w.actualWarehouseCode,
|
||||
...(coil || {})
|
||||
}
|
||||
if (layer === 1) grid[col].layer1.push(cell)
|
||||
else if (layer === 2) grid[col].layer2.push(cell)
|
||||
})
|
||||
Object.keys(grid).forEach(k => {
|
||||
grid[k].layer1.sort((a, b) => Number(a._row) - Number(b._row))
|
||||
grid[k].layer2.sort((a, b) => Number(a._row) - Number(b._row))
|
||||
})
|
||||
this.coilPicker.coilGrid = grid
|
||||
} finally {
|
||||
this.coilPicker.loading = false
|
||||
}
|
||||
},
|
||||
searchCoils() {
|
||||
this.loadCoilsByWarehouse()
|
||||
},
|
||||
onCoilFilterChange() {
|
||||
this.loadCoilsByWarehouse()
|
||||
},
|
||||
openCoilPicker(row) {
|
||||
this.coilPicker.currentRow = row
|
||||
this.coilPicker.visible = true
|
||||
this.loadWarehouseOptions().then(() => {
|
||||
if (!this.coilPicker.selectedWarehouseId && this.coilPicker.warehouseOptions.length) {
|
||||
this.coilPicker.selectedWarehouseId = this.coilPicker.warehouseOptions[0].actualWarehouseId
|
||||
}
|
||||
this.loadCoilsByWarehouse()
|
||||
})
|
||||
},
|
||||
getCoilCell(col, row, layer) {
|
||||
const c = this.coilPicker.coilGrid[col]
|
||||
if (!c) return null
|
||||
const list = layer === 1 ? (c.layer1 || []) : (c.layer2 || [])
|
||||
return list.find(i => Number(i._row) === Number(row)) || null
|
||||
},
|
||||
selectCoilCell(col, row, layer) {
|
||||
const item = this.getCoilCell(col, row, layer)
|
||||
if (!item) return
|
||||
if (!item.rawMaterialId) {
|
||||
this.$message.warning('该库位当前无钢卷')
|
||||
return
|
||||
}
|
||||
this.pickRawMaterial(item)
|
||||
},
|
||||
pickRawMaterial(item) {
|
||||
const row = this.coilPicker.currentRow
|
||||
if (!row) return
|
||||
this.$set(row, 'rawMaterialId', item.rawMaterialId)
|
||||
this.$set(row, 'rawCoilNos', item.rawMaterialCode || '')
|
||||
this.$set(row, 'rawNetWeight', item.coilWeight != null ? item.coilWeight : '')
|
||||
this.$set(row, 'rawPackaging', item.packageType || '')
|
||||
this.$set(row, 'rawEdgeReq', item.edgeType || '')
|
||||
this.$set(row, 'rawCoatingType', item.zincLayer || item.surfaceTreatmentDesc || '')
|
||||
this.$set(row, 'rawLocation', item.rawLocation || '')
|
||||
this.coilPicker.visible = false
|
||||
this.onCellChange(row)
|
||||
},
|
||||
onCellChange(row) {
|
||||
if (row && !this.rows.includes(row)) {
|
||||
this.rows.push(row)
|
||||
@@ -540,6 +393,91 @@ export default {
|
||||
isTimeField(prop) {
|
||||
return prop === 'startTime' || prop === 'endTime'
|
||||
},
|
||||
isLeadingColumn(col) {
|
||||
if (!col || !col.prop) return false
|
||||
return this.leadingPropsByRole.includes(col.prop)
|
||||
},
|
||||
initColumnSettings() {
|
||||
const key = this.getColumnSettingKey()
|
||||
const stored = localStorage.getItem(key)
|
||||
const base = this.flatColumns.map((col, idx) => ({ prop: col.prop, label: col.label, visible: true, fixed: idx < 5 }))
|
||||
if (!stored) {
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
return
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(stored)
|
||||
if (!Array.isArray(parsed)) {
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
return
|
||||
}
|
||||
const savedProps = parsed.map(i => i.prop)
|
||||
const extras = base.filter(i => !savedProps.includes(i.prop))
|
||||
this.columnSettingList = [...parsed.filter(i => base.some(b => b.prop === i.prop)).map(i => {
|
||||
const match = base.find(b => b.prop === i.prop)
|
||||
return { ...match, visible: i.visible !== false, fixed: i.fixed === true }
|
||||
}), ...extras]
|
||||
this.resetColumnDraft()
|
||||
} catch (e) {
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
}
|
||||
},
|
||||
resetColumnDraft() {
|
||||
const fixed = (this.columnSettingList || []).filter(i => i.visible && i.fixed).slice(0, 5)
|
||||
const normal = (this.columnSettingList || []).filter(i => !i.fixed || !i.visible)
|
||||
this.fixedColumnList = fixed.map(i => ({ ...i, visible: true, fixed: true }))
|
||||
this.normalColumnList = normal.map(i => ({ ...i, fixed: false }))
|
||||
},
|
||||
saveColumnSettings() {
|
||||
const fixed = (this.fixedColumnList || []).map(i => ({ ...i, visible: true, fixed: true }))
|
||||
const normal = (this.normalColumnList || []).map(i => ({ ...i, fixed: false }))
|
||||
this.columnSettingList = [...fixed, ...normal]
|
||||
this.persistColumnSettings()
|
||||
this.columnSettingVisible = false
|
||||
this.pager.pageNum = 1
|
||||
this.loadRows().finally(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.quickSheetTable && this.$refs.quickSheetTable.doLayout && this.$refs.quickSheetTable.doLayout()
|
||||
})
|
||||
})
|
||||
},
|
||||
addToFixed(prop) {
|
||||
if ((this.fixedColumnList || []).length >= 5) {
|
||||
this.$message.warning('固定列最多5列')
|
||||
return
|
||||
}
|
||||
const idx = this.normalColumnList.findIndex(i => i.prop === prop)
|
||||
if (idx < 0) return
|
||||
const item = this.normalColumnList.splice(idx, 1)[0]
|
||||
this.fixedColumnList.push({ ...item, visible: true, fixed: true })
|
||||
},
|
||||
removeFromFixed(prop) {
|
||||
const idx = this.fixedColumnList.findIndex(i => i.prop === prop)
|
||||
if (idx < 0) return
|
||||
const item = this.fixedColumnList.splice(idx, 1)[0]
|
||||
this.normalColumnList.unshift({ ...item, fixed: false })
|
||||
},
|
||||
persistColumnSettings() {
|
||||
const key = this.getColumnSettingKey()
|
||||
const payload = (this.columnSettingList || []).map(item => ({
|
||||
prop: item.prop,
|
||||
label: item.label,
|
||||
visible: item.visible !== false,
|
||||
fixed: item.fixed === true
|
||||
}))
|
||||
localStorage.setItem(key, JSON.stringify(payload))
|
||||
},
|
||||
restoreDefaultColumns() {
|
||||
const base = this.flatColumns.map((col, idx) => ({ prop: col.prop, label: col.label, visible: true, fixed: idx < 5 }))
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
},
|
||||
getColumnSettingKey() {
|
||||
return `apsQuickSheetColumns_${this.templateKey}`
|
||||
},
|
||||
markDirty(row) {
|
||||
if (!row) return
|
||||
if (!row._tmpId) row._tmpId = Math.random().toString(36).slice(2)
|
||||
@@ -596,15 +534,6 @@ export default {
|
||||
this.saving = false
|
||||
}
|
||||
},
|
||||
addRow() {
|
||||
this.rows.push(this.buildEmptyRow())
|
||||
if (this.rows.length < this.pager.pageSize) {
|
||||
this.rows = this.rows.concat(this.buildEmptyRows(this.pager.pageSize - this.rows.length))
|
||||
}
|
||||
},
|
||||
onFilterChange() {
|
||||
this.pager.pageNum = 1
|
||||
},
|
||||
exportCsv() {
|
||||
this.loading = true
|
||||
exportQuickSheet()
|
||||
@@ -716,33 +645,55 @@ export default {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.coil-picker-btn {
|
||||
padding: 0;
|
||||
.col-setting-body {
|
||||
padding: 12px;
|
||||
height: calc(100% - 12px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.col-setting-toolbar {
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.col-section {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.col-section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.col-setting-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.col-setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
margin-bottom: 0;
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.col-setting-item:hover {
|
||||
border-color: #d9ecff;
|
||||
background: #f5faff;
|
||||
}
|
||||
|
||||
.drag-handle {
|
||||
cursor: move;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.coil-bird-wrap { border: 1px solid #ebeef5; border-radius: 6px; padding: 8px; }
|
||||
.coil-legend { display: flex; gap: 14px; font-size: 12px; color: #606266; margin-bottom: 8px; }
|
||||
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
|
||||
.dot.layer1 { background: #fff3e0; border: 1px solid #f5d7a1; }
|
||||
.dot.layer2 { background: #e8f5e9; border: 1px solid #b7ddb9; }
|
||||
.dot.occupied { background: #f6f8fb; border: 1px solid #d7dde5; }
|
||||
.coil-grid-scroll { overflow: auto; max-height: 460px; }
|
||||
.coil-col-ruler { display: flex; min-width: max-content; }
|
||||
.ruler-empty { width: 28px; flex: none; }
|
||||
.ruler-col { width: 138px; text-align: center; font-size: 12px; color: #606266; }
|
||||
.coil-grid-main { display: flex; min-width: max-content; }
|
||||
.coil-row-ruler { width: 28px; display: flex; flex-direction: column; }
|
||||
.ruler-row { height: 56px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #909399; }
|
||||
.coil-grid-columns { display: flex; gap: 8px; }
|
||||
.coil-col-pair { display: grid; grid-template-columns: 1fr 1fr; width: 180px; border: 1px solid #eef2f7; border-radius: 4px; overflow: visible; }
|
||||
.coil-layer { display: flex; flex-direction: column; }
|
||||
.coil-layer.layer2-shift { margin-top: 28px; }
|
||||
.coil-cell { height: 56px; border-bottom: 1px solid #eef2f7; border-right: 1px solid #eef2f7; padding: 4px; font-size: 11px; color: #909399; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
|
||||
.coil-cell.layer1 { background: #fff3e0; color: #e67e22; }
|
||||
.coil-cell.layer2 { background: #e8f5e9; color: #2e8b57; border-right: none; }
|
||||
.coil-cell.occupied { font-weight: 600; }
|
||||
.coil-cell .line1 { width: 100%; font-size: 11px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.coil-cell .line2 { width: 100%; font-size: 11px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.coil-picker-foot { margin-top: 8px; text-align: right; color: #909399; font-size: 12px; }
|
||||
</style>
|
||||
|
||||
@@ -18,31 +18,34 @@
|
||||
</el-select>
|
||||
<el-input v-model="filter.customer" size="small" clearable placeholder="客户" style="width: 160px" @input="onFilterChange" />
|
||||
<el-button size="small" icon="el-icon-refresh" @click="loadRows">刷新</el-button>
|
||||
<el-button size="small" icon="el-icon-setting" @click="columnSettingVisible = true">列设置</el-button>
|
||||
<el-button size="small" icon="el-icon-download" @click="exportExcel">导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sheet-body">
|
||||
<el-table
|
||||
ref="quickSheetPreviewTable"
|
||||
v-loading="loading"
|
||||
:data="displayRows"
|
||||
border
|
||||
size="mini"
|
||||
class="excel-table"
|
||||
>
|
||||
<el-table-column label="序号" width="60" align="center">
|
||||
<el-table-column label="序号" width="60" align="center" fixed="left">
|
||||
<template slot-scope="scope">
|
||||
{{ ((pager.pageNum - 1) * pager.pageSize) + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-for="col in flatColumns"
|
||||
v-for="col in displayColumns"
|
||||
:key="col.prop || col.label"
|
||||
:label="col.label"
|
||||
:prop="col.prop"
|
||||
:width="col.width"
|
||||
:min-width="col.minWidth"
|
||||
:align="col.align || 'center'"
|
||||
:fixed="fixedProps.includes(col.prop) ? 'left' : false"
|
||||
:show-overflow-tooltip="col.showOverflowTooltip !== false"
|
||||
/>
|
||||
</el-table>
|
||||
@@ -57,6 +60,44 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
title="列设置"
|
||||
:visible.sync="columnSettingVisible"
|
||||
direction="rtl"
|
||||
size="55%"
|
||||
append-to-body
|
||||
@open="resetColumnDraft">
|
||||
<div class="col-setting-body">
|
||||
<div class="col-setting-toolbar">
|
||||
<el-button size="mini" @click="restoreDefaultColumns">恢复默认</el-button>
|
||||
<el-button size="mini" @click="resetColumnDraft">重置</el-button>
|
||||
<el-button size="mini" type="primary" @click="saveColumnSettings">保存</el-button>
|
||||
</div>
|
||||
|
||||
<div class="col-section">
|
||||
<div class="col-section-title">固定列(最多5列)</div>
|
||||
<draggable v-model="fixedColumnList" handle=".drag-handle" animation="200" class="col-setting-grid">
|
||||
<div v-for="item in fixedColumnList" :key="`fixed-${item.prop}`" class="col-setting-item">
|
||||
<i class="el-icon-rank drag-handle" />
|
||||
<span class="col-label">{{ item.label }}</span>
|
||||
<el-button type="text" size="mini" @click="removeFromFixed(item.prop)">移除</el-button>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
|
||||
<div class="col-section">
|
||||
<div class="col-section-title">其他列</div>
|
||||
<draggable v-model="normalColumnList" handle=".drag-handle" animation="200" class="col-setting-grid">
|
||||
<div v-for="item in normalColumnList" :key="`normal-${item.prop}`" class="col-setting-item">
|
||||
<i class="el-icon-rank drag-handle" />
|
||||
<span class="col-label">{{ item.label }}</span>
|
||||
<el-button type="text" size="mini" @click="addToFixed(item.prop)">加入固定</el-button>
|
||||
</div>
|
||||
</draggable>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -65,9 +106,11 @@ import { fetchQuickSheetList, exportQuickSheet } from '@/api/aps/quickSheet'
|
||||
import { listProductionLine } from '@/api/wms/productionLine'
|
||||
import { getTemplateByKey } from './sheets/templates'
|
||||
import { saveAs } from 'file-saver'
|
||||
import draggable from 'vuedraggable'
|
||||
|
||||
export default {
|
||||
name: 'ApsQuickSheetPreview',
|
||||
components: { draggable },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -81,7 +124,11 @@ export default {
|
||||
pager: {
|
||||
pageNum: 1,
|
||||
pageSize: 25
|
||||
}
|
||||
},
|
||||
columnSettingVisible: false,
|
||||
columnSettingList: [],
|
||||
fixedColumnList: [],
|
||||
normalColumnList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -97,7 +144,23 @@ export default {
|
||||
})
|
||||
}
|
||||
loop(this.currentTemplate.columns || [])
|
||||
return res
|
||||
return res.filter(c => c && c.prop)
|
||||
},
|
||||
displayColumns() {
|
||||
const setting = this.columnSettingList || []
|
||||
const hasSetting = setting.length > 0
|
||||
const base = this.flatColumns
|
||||
|
||||
const selected = hasSetting
|
||||
? setting.filter(i => i.visible).map(i => base.find(c => c.prop === i.prop)).filter(Boolean)
|
||||
: base
|
||||
|
||||
const selectedSet = new Set(selected.map(c => c.prop))
|
||||
const rest = base.filter(c => !selectedSet.has(c.prop))
|
||||
return [...selected, ...rest]
|
||||
},
|
||||
fixedProps() {
|
||||
return (this.columnSettingList || []).filter(i => i.visible && i.fixed).map(i => i.prop).slice(0, 5)
|
||||
},
|
||||
filteredRows() {
|
||||
const [startAfter, endBefore] = this.filter.range || []
|
||||
@@ -129,10 +192,99 @@ export default {
|
||||
const today = new Date()
|
||||
const start = `${today.getFullYear()}-${`${today.getMonth() + 1}`.padStart(2, '0')}-${`${today.getDate()}`.padStart(2, '0')}`
|
||||
this.filter.range = [start, '']
|
||||
this.initColumnSettings()
|
||||
this.loadRows()
|
||||
this.loadLines()
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.persistColumnSettings()
|
||||
},
|
||||
methods: {
|
||||
initColumnSettings() {
|
||||
const key = this.getColumnSettingKey()
|
||||
const stored = localStorage.getItem(key)
|
||||
const base = this.flatColumns.map((col, idx) => ({ prop: col.prop, label: col.label, visible: true, fixed: idx < 5 }))
|
||||
if (!stored) {
|
||||
this.columnSettingList = base
|
||||
return
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(stored)
|
||||
if (!Array.isArray(parsed)) {
|
||||
this.columnSettingList = base
|
||||
return
|
||||
}
|
||||
const map = new Map(parsed.map(item => [item.prop, item]))
|
||||
const merged = base.map(item => {
|
||||
const saved = map.get(item.prop)
|
||||
return saved ? { ...item, visible: saved.visible !== false } : item
|
||||
})
|
||||
const savedProps = parsed.map(i => i.prop)
|
||||
const extras = base.filter(i => !savedProps.includes(i.prop))
|
||||
this.columnSettingList = [...parsed.filter(i => base.some(b => b.prop === i.prop)).map(i => {
|
||||
const match = base.find(b => b.prop === i.prop)
|
||||
return { ...match, visible: i.visible !== false, fixed: i.fixed === true }
|
||||
}), ...extras]
|
||||
this.resetColumnDraft()
|
||||
} catch (e) {
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
}
|
||||
},
|
||||
resetColumnDraft() {
|
||||
const fixed = (this.columnSettingList || []).filter(i => i.visible && i.fixed).slice(0, 5)
|
||||
const normal = (this.columnSettingList || []).filter(i => !i.fixed || !i.visible)
|
||||
this.fixedColumnList = fixed.map(i => ({ ...i, visible: true, fixed: true }))
|
||||
this.normalColumnList = normal.map(i => ({ ...i, visible: true, fixed: false }))
|
||||
},
|
||||
saveColumnSettings() {
|
||||
const fixed = (this.fixedColumnList || []).map(i => ({ ...i, visible: true, fixed: true }))
|
||||
const normal = (this.normalColumnList || []).map(i => ({ ...i, fixed: false }))
|
||||
this.columnSettingList = [...fixed, ...normal]
|
||||
this.persistColumnSettings()
|
||||
this.columnSettingVisible = false
|
||||
this.pager.pageNum = 1
|
||||
this.loadRows().finally(() => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.quickSheetPreviewTable && this.$refs.quickSheetPreviewTable.doLayout && this.$refs.quickSheetPreviewTable.doLayout()
|
||||
})
|
||||
})
|
||||
},
|
||||
addToFixed(prop) {
|
||||
if ((this.fixedColumnList || []).length >= 5) {
|
||||
this.$message.warning('固定列最多5列')
|
||||
return
|
||||
}
|
||||
const idx = (this.normalColumnList || []).findIndex(i => i.prop === prop)
|
||||
if (idx < 0) return
|
||||
const item = this.normalColumnList.splice(idx, 1)[0]
|
||||
this.fixedColumnList.push({ ...item, fixed: true, visible: true })
|
||||
},
|
||||
removeFromFixed(prop) {
|
||||
const idx = (this.fixedColumnList || []).findIndex(i => i.prop === prop)
|
||||
if (idx < 0) return
|
||||
const item = this.fixedColumnList.splice(idx, 1)[0]
|
||||
this.normalColumnList.push({ ...item, fixed: false, visible: true })
|
||||
},
|
||||
persistColumnSettings() {
|
||||
const key = this.getColumnSettingKey()
|
||||
const payload = (this.columnSettingList || []).map(item => ({
|
||||
prop: item.prop,
|
||||
label: item.label,
|
||||
visible: item.visible !== false,
|
||||
fixed: item.fixed === true
|
||||
}))
|
||||
localStorage.setItem(key, JSON.stringify(payload))
|
||||
},
|
||||
restoreDefaultColumns() {
|
||||
const base = this.flatColumns.map((col, idx) => ({ prop: col.prop, label: col.label, visible: true, fixed: idx < 5 }))
|
||||
this.columnSettingList = base
|
||||
this.resetColumnDraft()
|
||||
this.persistColumnSettings()
|
||||
},
|
||||
getColumnSettingKey() {
|
||||
return 'apsQuickSheetPreviewColumns_unified'
|
||||
},
|
||||
async loadLines() {
|
||||
const res = await listProductionLine({ pageNum: 1, pageSize: 1000 })
|
||||
this.lineOptions = res.rows || []
|
||||
@@ -222,4 +374,55 @@ export default {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.col-setting-body {
|
||||
padding: 12px;
|
||||
height: calc(100% - 12px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.col-setting-toolbar {
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.col-section {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.col-section-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.col-setting-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.col-setting-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
margin-bottom: 0;
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.col-setting-item:hover {
|
||||
border-color: #d9ecff;
|
||||
background: #f5faff;
|
||||
}
|
||||
|
||||
.drag-handle {
|
||||
cursor: move;
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,21 +16,47 @@ export const APS_SHEET_TEMPLATES = [
|
||||
name: '统一排产表',
|
||||
columns: [
|
||||
{ label: '产线', prop: 'lineName', minWidth: 140 },
|
||||
{ label: '计划号', prop: 'planCode', minWidth: 140 },
|
||||
{ label: '订单号', prop: 'orderCode', minWidth: 140 },
|
||||
{ label: '排产单号', prop: 'planCode', minWidth: 140 },
|
||||
{ label: '排产类型', prop: 'planType', width: 100 },
|
||||
{ label: '排产人', prop: 'scheduler', width: 100 },
|
||||
{ label: '修改人', prop: 'updateBy', width: 100 },
|
||||
{ label: '备注', prop: 'remark', minWidth: 160 },
|
||||
|
||||
{ label: '内容序号', prop: 'bizSeqNo', width: 110 },
|
||||
{ label: '销售内容', prop: 'orderCode', minWidth: 140 },
|
||||
{ label: '订单合同号', prop: 'contractCode', minWidth: 140 },
|
||||
{ label: '客户', prop: 'customerName', minWidth: 140 },
|
||||
{ label: '业务员', prop: 'salesman', width: 100 },
|
||||
{ label: '产品', prop: 'productName', minWidth: 140 },
|
||||
|
||||
{ label: '成品名称', prop: 'productName', minWidth: 140 },
|
||||
{ label: '材质', prop: 'productMaterial', width: 100 },
|
||||
{ label: '镀层g', prop: 'coatingG', width: 90, align: 'right' },
|
||||
{ label: '成品宽度', prop: 'productWidth', width: 100, align: 'right' },
|
||||
{ label: '扎制厚度', prop: 'rollingThick', width: 100, align: 'right' },
|
||||
{ label: '标丝厚度', prop: 'markCoatThick', width: 100, align: 'right' },
|
||||
{ label: '吨钢长度区间m', prop: 'tonSteelLengthRange', minWidth: 130 },
|
||||
{ label: '数量', prop: 'planQty', width: 90, align: 'right' },
|
||||
{ label: '重量', prop: 'planWeight', width: 100, align: 'right' },
|
||||
{ label: '表面处理', prop: 'surfaceTreatment', width: 110 },
|
||||
{ label: '切边要求', prop: 'widthReq', width: 110 },
|
||||
{ label: '宽度要求', prop: 'rawEdgeReq', width: 110 },
|
||||
{ label: '用途', prop: 'usageReq', width: 100 },
|
||||
{ label: '后处理', prop: 'postProcess', width: 100 },
|
||||
{ label: '下工序', prop: 'nextProcess', width: 100 },
|
||||
{ label: '取样', prop: 'sampleReq', width: 90 },
|
||||
{ label: '开始时间', prop: 'startTime', width: 170 },
|
||||
{ label: '结束时间', prop: 'endTime', width: 170 },
|
||||
|
||||
{ label: '厂家', prop: 'rawManufacturer', width: 100 },
|
||||
{ label: '原料信息', prop: 'rawMaterial', minWidth: 140 },
|
||||
{ label: '原料厚度mm', prop: 'rawThick', width: 110, align: 'right' },
|
||||
{ label: '宽度mm', prop: 'rawWidth', width: 100, align: 'right' },
|
||||
{ label: '原料钢卷', prop: 'rawMaterialId', minWidth: 220 },
|
||||
{ label: '原料卷号', prop: 'rawCoilNos', minWidth: 220 },
|
||||
{ label: '钢卷位置', prop: 'rawLocation', minWidth: 140 },
|
||||
{ label: '包装要求', prop: 'rawPackaging', minWidth: 140 },
|
||||
{ label: '切边要求', prop: 'rawEdgeReq', minWidth: 120 },
|
||||
{ label: '镀层种类', prop: 'rawCoatingType', width: 110 },
|
||||
{ label: '原料净重', prop: 'rawNetWeight', width: 110, align: 'right' },
|
||||
{ label: '计划数量', prop: 'planQty', width: 100, align: 'right' },
|
||||
{ label: '开始时间', prop: 'startTime', width: 170 },
|
||||
{ label: '结束时间', prop: 'endTime', width: 170 }
|
||||
{ label: '原料净重', prop: 'rawNetWeight', width: 110, align: 'right' }
|
||||
],
|
||||
summary: { sumFields: ['planQty', 'rawNetWeight'] }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user