Merge remote-tracking branch 'origin/master'

highway
Yangwl 12 months ago
commit 05a931c3a5

@ -24,6 +24,10 @@ public interface RemoteSapService {
@PostMapping("/sap/shopOrderSync")
public R<List<SapProOrder>> shopOrderSync(@RequestBody SapShopOrderQuery sapProOrder);
/**传递母订单号和母订单数量**/
@PostMapping("/sap/shopUpdateSync")
public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder);
@PostMapping("/sap/sapRouterSync")
public R<Boolean> sapRouterSync(@RequestBody SapRouterQuery sapRouterQuery);

@ -7,6 +7,7 @@ import com.op.system.api.model.SapProOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -73,6 +74,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("sap bom同步失败" + throwable.getMessage());
}
@Override
public R shopUpdateSync(SapShopOrderQuery sapProOrder) {
return R.fail("sap shopUpdateSync失败" + throwable.getMessage());
}
};
}

@ -1,6 +1,7 @@
package com.op.device.controller;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.service.IDeviceInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -30,4 +31,44 @@ public class DeviceInterfaceController {
return deviceInterfaceService.getRepairWorkOrder();
}
/**
*
* @return
*/
@GetMapping("/getEquipmentInfo")
public AjaxResult getEquipmentInfo() {
return deviceInterfaceService.getEquipmentInfo();
}
/**
* TOP10
* /
* @return
*/
@GetMapping("/getRepairQuantity")
public AjaxResult getRepairQuantity() {
return deviceInterfaceService.getRepairQuantity();
}
/**
* -MTBF top10
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentStability")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentStabilityList(equOperationRecord);
}
/**
*
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentIntactRate")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentIntactRate(equOperationRecord);
}
}

@ -31,6 +31,7 @@ public class DevicePDAController extends BaseController {
/**
* list
*
* @param pdadto
* @return
*/
@ -41,6 +42,7 @@ public class DevicePDAController extends BaseController {
/**
*
*
* @param pdadto
* @return
*/
@ -51,6 +53,7 @@ public class DevicePDAController extends BaseController {
/**
*
*
* @param equOrder
* @return
*/
@ -60,7 +63,8 @@ public class DevicePDAController extends BaseController {
}
/**
*
*
*
* @param equOrder
* @return
*/
@ -70,8 +74,10 @@ public class DevicePDAController extends BaseController {
}
//报修
/**
*
*
* @param equRepairOrder
* @return
*/
@ -81,6 +87,7 @@ public class DevicePDAController extends BaseController {
}
//维修
/**
*
*
@ -143,6 +150,7 @@ public class DevicePDAController extends BaseController {
/**
*
*
* @param equRepairWorkOrder
* @return
*/
@ -159,6 +167,7 @@ public class DevicePDAController extends BaseController {
/**
*
*
* @param pdadto
* @return
*/

@ -95,6 +95,39 @@ public class EquCheckItem extends BaseEntity {
// 更新日期结束
private String updateTimeEnd;
// 检查项工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
private List<EquCheckItemDetail> equCheckItemDetailList;
public List<EquCheckItemDetail> getEquCheckItemDetailList() {

@ -0,0 +1,257 @@
package com.op.device.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* equ_operation_record
*
* @author Open Platform
* @date 2023-11-27
*/
public class EquOperationRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 设备编码 */
@Excel(name = "设备编码")
private String equipmentCode;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 类型(on开机、off关机) */
@Excel(name = "类型(on开机、off关机)")
private String type;
/** 维护类型upkeep保养、repair维修 */
@Excel(name = "维护类型", readConverterExp = "u=pkeep保养、repair维修")
private String maintenanceType;
/** 关联记录id */
@Excel(name = "关联记录id")
private String parentId;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
/** 备用字段1 */
@Excel(name = "备用字段1")
private String attr1;
/** 备用字段2 */
@Excel(name = "备用字段2")
private String attr2;
/** 备用字段3 */
@Excel(name = "备用字段3")
private String attr3;
/** 删除标识 */
private String delFlag;
//MTBF接口字段
//序号
private String serialNumber;
//开机时间
private String onTime;
//故障次数
private String shutDownNumber;
//mtbf
private String mtbf;
//IntactRate 完好设备占比字段
//运行设备
private String operationEquipment;
//故障设备
private String faultEquipment;
//总设备
private String totalEquipment;
//百分比
private String intactRate;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
public String getEquipmentCode() {
return equipmentCode;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getStartTime() {
return startTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getEndTime() {
return endTime;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setMaintenanceType(String maintenanceType) {
this.maintenanceType = maintenanceType;
}
public String getMaintenanceType() {
return maintenanceType;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getParentId() {
return parentId;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
//虚拟字段 序号
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getSerialNumber() {
return serialNumber;
}
//开机时间
public void setOnTime(String onTime) {
this.onTime = onTime;
}
public String getOnTime() {
return onTime;
}
//故障次数
public void setShutDownNumber(String shutDownNumber) {
this.shutDownNumber = shutDownNumber;
}
public String getShutDownNumber() {
return shutDownNumber;
}
//mtbf
public void setMtbf(String mtbf) {
this.mtbf = mtbf;
}
public String getMtbf() {
return mtbf;
}
//运行设备
public void setOperationEquipment(String operationEquipment) {
this.operationEquipment = operationEquipment;
}
public String getOperationEquipment() {
return operationEquipment;
}
//故障设备
public void setFaultEquipment(String faultEquipment) {
this.faultEquipment = faultEquipment;
}
public String getFaultEquipment() {
return faultEquipment;
}
//总设备
public void setTotalEquipment(String totalEquipment) {
this.totalEquipment = totalEquipment;
}
public String getTotalEquipment() {
return totalEquipment;
}
//完好率
public void setIntactRate(String intactRate) {
this.intactRate = intactRate;
}
public String getIntactRate() {
return intactRate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("equipmentCode", getEquipmentCode())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("type", getType())
.append("maintenanceType", getMaintenanceType())
.append("parentId", getParentId())
.append("factoryCode", getFactoryCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -72,6 +72,16 @@ public class EquOrderDetail extends BaseEntity {
private List<EquOrderStandard> standardList;
private String itemTools;
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public List<EquOrderStandard> getStandardList() {
return standardList;
}

@ -80,6 +80,16 @@ public class EquPlanDetail extends BaseEntity {
// 主计划code
private String planCode;
private String itemTools;
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public String getPlanCode() {
return planCode;
}

@ -78,6 +78,26 @@ public class EquPlanStandard extends BaseEntity {
private Boolean showFlag;
private String itemMethod;
private String itemTools;
public String getItemMethod() {
return itemMethod;
}
public void setItemMethod(String itemMethod) {
this.itemMethod = itemMethod;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public Boolean getShowFlag() {
return showFlag;
}

@ -0,0 +1,647 @@
package com.op.device.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* mes_report_work
*
* @author Open Platform
* @date 2023-08-24
*/
public class MesReportWork extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 记录id */
private String id;
/** 报工单编号 */
@Excel(name = "报工单编号")
private String reportCode;
/** 报工类型报工类型SELF自行报工、UNI统一报工 */
@Excel(name = "报工类型报工类型SELF上位机报工、UNI系统报工")
private String reportType;
/** 生产工单编码 */
@Excel(name = "生产工单编码")
private String workorderCode;
/** 产品编码 */
@Excel(name = "产品编码")
private String productCode;
/** 产品名称 */
@Excel(name = "产品名称")
private String productName;
/** 规格型号 */
@Excel(name = "规格型号")
private String spec;
/** 单位 */
@Excel(name = "单位")
private String unit;
/** 排产数量 */
@Excel(name = "排产数量")
private BigDecimal quantity;
private BigDecimal quantitySplit;
/** 本次报工数量 */
@Excel(name = "本次报工数量")
private BigDecimal quantityFeedback;
/** 合格数量 */
//@Excel(name = "合格数量")
private BigDecimal quantityQualified;
/** 不合格数量 */
//@Excel(name = "不合格数量")
private BigDecimal quantityUnqualified;
/** 报工人员 */
@Excel(name = "报工人员")
private String userName;
/** 人员名称 */
@Excel(name = "人员名称")
private String nickName;
/** 报工途径PAD、MOBILE、PC */
//@Excel(name = "报工途径PAD、MOBILE、PC")
private String feedbackChannel;
/** 报工时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报工时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date feedbackTime;
/** 录入人员 */
@Excel(name = "录入人员")
private String recordUser;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 工时 */
@Excel(name = "工时")
private Long workTime;
@Excel(name = "用人")
private Long useMan;
/** 线体编码 */
@Excel(name = "线体编码")
private String machineCode;
/** 线体名称 */
@Excel(name = "线体名称")
private String machineName;
/** 班组编码 */
@Excel(name = "班组编码")
private String teamCode;
/** 班次编码 */
@Excel(name = "班次编码")
private String shiftCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "SAP报工时间")
private Date uploadTime;
@Excel(name = "SAP报工状态0待报工1成功2失败")
private String uploadStatus;
@Excel(name = "SAP报工信息")
private String uploadMsg;
/** 预留字段1 */
//@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
//@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
//@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
//@Excel(name = "预留字段4")
private String attr4;
@Excel(name = "计划生产日期")
private String productDate;
private String productDateStart;
private String productDateEnd;
@Excel(name = "订单编号")
private String orderCode;
@Excel(name = "规格型号")
private String productSpc;
@Excel(name = "工序名称")
private String processName;
@Excel(name = "工序编码")
private String processCode;
private String factoryCode;
private String factoryName;
private String carCode;
private String carName;
private String workorderCodeSap;
private String routeCode;
private String sac1;
private String sac2;
private String sac3;
private String sac4;
private String sac5;
private String sac6;
private String prodType;
private String createTimeStart;
private String createTimeEnd;
private String feedbackTimeStart;
private String feedbackTimeEnd;
private String batch;
private String endReport;
public String getEndReport() {
return endReport;
}
public void setEndReport(String endReport) {
this.endReport = endReport;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
public Long getUseMan() {
return useMan;
}
public void setUseMan(Long useMan) {
this.useMan = useMan;
}
public BigDecimal getQuantitySplit() {
return quantitySplit;
}
public void setQuantitySplit(BigDecimal quantitySplit) {
this.quantitySplit = quantitySplit;
}
public String getFeedbackTimeStart() {
return feedbackTimeStart;
}
public void setFeedbackTimeStart(String feedbackTimeStart) {
this.feedbackTimeStart = feedbackTimeStart;
}
public String getFeedbackTimeEnd() {
return feedbackTimeEnd;
}
public void setFeedbackTimeEnd(String feedbackTimeEnd) {
this.feedbackTimeEnd = feedbackTimeEnd;
}
public String getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(String createTimeStart) {
this.createTimeStart = createTimeStart;
}
public String getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(String createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public String getProdType() {
return prodType;
}
public void setProdType(String prodType) {
this.prodType = prodType;
}
public String getWorkorderCodeSap() {
return workorderCodeSap;
}
public void setWorkorderCodeSap(String workorderCodeSap) {
this.workorderCodeSap = workorderCodeSap;
}
public String getRouteCode() {
return routeCode;
}
public void setRouteCode(String routeCode) {
this.routeCode = routeCode;
}
public String getSac1() {
return sac1;
}
public void setSac1(String sac1) {
this.sac1 = sac1;
}
public String getSac2() {
return sac2;
}
public void setSac2(String sac2) {
this.sac2 = sac2;
}
public String getSac3() {
return sac3;
}
public void setSac3(String sac3) {
this.sac3 = sac3;
}
public String getSac4() {
return sac4;
}
public void setSac4(String sac4) {
this.sac4 = sac4;
}
public String getSac5() {
return sac5;
}
public void setSac5(String sac5) {
this.sac5 = sac5;
}
public String getSac6() {
return sac6;
}
public void setSac6(String sac6) {
this.sac6 = sac6;
}
public Date getUploadTime() {
return uploadTime;
}
public void setUploadTime(Date uploadTime) {
this.uploadTime = uploadTime;
}
public String getUploadStatus() {
return uploadStatus;
}
public void setUploadStatus(String uploadStatus) {
this.uploadStatus = uploadStatus;
}
public String getUploadMsg() {
return uploadMsg;
}
public void setUploadMsg(String uploadMsg) {
this.uploadMsg = uploadMsg;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getCarName() {
return carName;
}
public void setCarName(String carName) {
this.carName = carName;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProductDateStart() {
return productDateStart;
}
public void setProductDateStart(String productDateStart) {
this.productDateStart = productDateStart;
}
public String getProductDateEnd() {
return productDateEnd;
}
public void setProductDateEnd(String productDateEnd) {
this.productDateEnd = productDateEnd;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public String getReportType() {
return reportType;
}
public void setReportCode(String reportCode) {
this.reportCode = reportCode;
}
public String getReportCode() {
return reportCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getSpec() {
return spec;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getUnit() {
return unit;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantityFeedback(BigDecimal quantityFeedback) {
this.quantityFeedback = quantityFeedback;
}
public BigDecimal getQuantityFeedback() {
return quantityFeedback;
}
public void setQuantityQualified(BigDecimal quantityQualified) {
this.quantityQualified = quantityQualified;
}
public BigDecimal getQuantityQualified() {
return quantityQualified;
}
public void setQuantityUnqualified(BigDecimal quantityUnqualified) {
this.quantityUnqualified = quantityUnqualified;
}
public BigDecimal getQuantityUnqualified() {
return quantityUnqualified;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserName() {
return userName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getNickName() {
return nickName;
}
public void setFeedbackChannel(String feedbackChannel) {
this.feedbackChannel = feedbackChannel;
}
public String getFeedbackChannel() {
return feedbackChannel;
}
public void setFeedbackTime(Date feedbackTime) {
this.feedbackTime = feedbackTime;
}
public Date getFeedbackTime() {
return feedbackTime;
}
public void setRecordUser(String recordUser) {
this.recordUser = recordUser;
}
public String getRecordUser() {
return recordUser;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setWorkTime(Long workTime) {
this.workTime = workTime;
}
public Long getWorkTime() {
return workTime;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public String getMachineCode() {
return machineCode;
}
public void setMachineName(String machineName) {
this.machineName = machineName;
}
public String getMachineName() {
return machineName;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getTeamCode() {
return teamCode;
}
public void setShiftCode(String shiftCode) {
this.shiftCode = shiftCode;
}
public String getShiftCode() {
return shiftCode;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public String getProductDate() {
return productDate;
}
public void setProductDate(String productDate) {
this.productDate = productDate;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getProductSpc() {
return productSpc;
}
public void setProductSpc(String productSpc) {
this.productSpc = productSpc;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("reportType", getReportType())
.append("reportCode", getReportCode())
.append("workorderCode", getWorkorderCode())
.append("productCode", getProductCode())
.append("productName", getProductName())
.append("spec", getSpec())
.append("unit", getUnit())
.append("quantity", getQuantity())
.append("quantityFeedback", getQuantityFeedback())
.append("quantityQualified", getQuantityQualified())
.append("quantityUnqualified", getQuantityUnqualified())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("feedbackChannel", getFeedbackChannel())
.append("feedbackTime", getFeedbackTime())
.append("recordUser", getRecordUser())
.append("status", getStatus())
.append("remark", getRemark())
.append("workTime", getWorkTime())
.append("machineCode", getMachineCode())
.append("machineName", getMachineName())
.append("teamCode", getTeamCode())
.append("shiftCode", getShiftCode())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

@ -62,6 +62,39 @@ public class EquCheckItemDTO {
// 设备编码list
private List<String> equipmentCodeList;
// 检查工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public List<String> getEquipmentCodeList() {
return equipmentCodeList;
}

@ -46,6 +46,39 @@ public class EquCheckItemVO {
// 设备编码
private String equipmentCode;
// 检查工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public String getEquipmentName() {
return equipmentName;
}

@ -0,0 +1,75 @@
package com.op.device.domain.vo;
// 设备信息VO、设备维修质量VO
public class IEquipmentVO {
// 设备名称
private String equipmentName;
// 设备编码
private String equipmentCode;
// 所在部门
private String department;
// 设备故障率
private Double failureRate;
// 设备有效利用率
private Double utilizationRatio;
// 设备维修质量
private Double rapairQuantity;
// 设备状态
private String equipmentStatus;
public String getEquipmentStatus() {
return equipmentStatus;
}
public void setEquipmentStatus(String equipmentStatus) {
this.equipmentStatus = equipmentStatus;
}
public Double getRapairQuantity() {
return rapairQuantity;
}
public void setRapairQuantity(Double rapairQuantity) {
this.rapairQuantity = rapairQuantity;
}
public String getEquipmentName() {
return equipmentName;
}
public void setEquipmentName(String equipmentName) {
this.equipmentName = equipmentName;
}
public String getEquipmentCode() {
return equipmentCode;
}
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public Double getFailureRate() {
return failureRate;
}
public void setFailureRate(Double failureRate) {
this.failureRate = failureRate;
}
public Double getUtilizationRatio() {
return utilizationRatio;
}
public void setUtilizationRatio(Double utilizationRatio) {
this.utilizationRatio = utilizationRatio;
}
}

@ -1,6 +1,77 @@
package com.op.device.domain.vo;
import java.util.Date;
// 看板维修工单返回VO
public class IRepairWorkOrderVO {
// 设备名称
private String equipmentName;
// 设备编码
private String equipmentCode;
// 故障描述
private String workFaultDesc;
// 维修班组
private String teamName;
// 是否立即维修
private String workHandle;
// 计划维修时间
private Date workPlanTime;
// 设备位置
private String equipmentLocation;
public String getEquipmentName() {
return equipmentName;
}
public void setEquipmentName(String equipmentName) {
this.equipmentName = equipmentName;
}
public String getEquipmentCode() {
return equipmentCode;
}
public void setEquipmentCode(String equipmentCode) {
this.equipmentCode = equipmentCode;
}
public String getWorkFaultDesc() {
return workFaultDesc;
}
public void setWorkFaultDesc(String workFaultDesc) {
this.workFaultDesc = workFaultDesc;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getWorkHandle() {
return workHandle;
}
public void setWorkHandle(String workHandle) {
this.workHandle = workHandle;
}
public Date getWorkPlanTime() {
return workPlanTime;
}
public void setWorkPlanTime(Date workPlanTime) {
this.workPlanTime = workPlanTime;
}
public String getEquipmentLocation() {
return equipmentLocation;
}
public void setEquipmentLocation(String equipmentLocation) {
this.equipmentLocation = equipmentLocation;
}
}

@ -0,0 +1,40 @@
package com.op.device.mapper;
import com.op.device.domain.EquOperationRecord;
import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.MesReportWork;
import com.op.device.domain.vo.IEquipmentVO;
import com.op.device.domain.vo.IRepairWorkOrderVO;
import java.util.List;
public interface DeviceInterfaceMapper {
/**
* -
* @return
*/
List<IRepairWorkOrderVO> selectEquRepairWorkOrderList();
/**
*
* @return
*/
List<IEquipmentVO> selectEquipmentList();
/**
*
* @return
*/
List<IEquipmentVO> selectRepairEquipmentList();
/**
* code
* quantity quantityFeedback
* @param equipmentCode
* @return
*/
MesReportWork selectReportWorkByEquipmentCode(String equipmentCode);
List<EquRepairWorkOrder> selectRepairRecordByEquipmentCode(String equipmentCode);
}

@ -62,5 +62,4 @@ public interface EquEquipmentMapper {
//查询设备类型
List<EquEquipment> getEquipmentTypeList(EquEquipment equEquipment);
}

@ -0,0 +1,74 @@
package com.op.device.mapper;
import java.util.List;
import com.op.device.domain.EquOperationRecord;
/**
* Mapper
*
* @author Open Platform
* @date 2023-11-27
*/
public interface EquOperationRecordMapper {
/**
*
*
* @param id
* @return
*/
public EquOperationRecord selectEquOperationRecordById(String id);
/**
*
*
* @param equOperationRecord
* @return
*/
public List<EquOperationRecord> selectEquOperationRecordList(EquOperationRecord equOperationRecord);
/**
*
*
* @param equOperationRecord
* @return
*/
public int insertEquOperationRecord(EquOperationRecord equOperationRecord);
/**
*
*
* @param equOperationRecord
* @return
*/
public int updateEquOperationRecord(EquOperationRecord equOperationRecord);
/**
*
*
* @param id
* @return
*/
public int deleteEquOperationRecordById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteEquOperationRecordByIds(String[] ids);
/**
*
* @param equipmentCode
* @return
*/
List<EquOperationRecord> selectEquOperationRecordByEquipmentCode(String equipmentCode);
//设备稳定性 MTBF设备平均故障间隔
List<EquOperationRecord> getMTBFList(EquOperationRecord equOperationRecord);
//设备完好率
EquOperationRecord getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -1,6 +1,7 @@
package com.op.device.service;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
/**
*
@ -12,4 +13,30 @@ public interface IDeviceInterfaceService {
* @return
*/
AjaxResult getRepairWorkOrder();
/**
*
* @return
*/
AjaxResult getEquipmentInfo();
/**
* TOP10
* @return
*/
AjaxResult getRepairQuantity();
/**
* MTBF /
* @return
*/
AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord);
/**
*
* /
* @param equOperationRecord
* @return
*/
AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -16,12 +16,14 @@ public interface IDevicePDAService {
/**
* list
*
* @return
*/
AjaxResult getTodayTask(PDADTO pdadto);
/**
*
*
* @param pdadto
* @return
*/
@ -29,37 +31,45 @@ public interface IDevicePDAService {
/**
*
*
* @param equOrder
* @return
*/
AjaxResult getInspectionOrderInfo(EquOrder equOrder);
/**
*
*
*
* @param equOrder
* @return
*/
AjaxResult updateInspectionRecord(EquOrder equOrder);
//报修
/**
*
*
* @param equRepairOrder
* @return
*/
public AjaxResult addRepairRecord(EquRepairOrder equRepairOrder);
//维修
/**
*
*
* @param equRepairWorkOrder
* @return
*/
public AjaxResult getMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder);
//班组
/**
*
*
* @param equTeamUser
* @return
*/
@ -67,6 +77,7 @@ public interface IDevicePDAService {
/**
*
*
* @param equRepairWorkOrder
* @return
*/
@ -74,6 +85,7 @@ public interface IDevicePDAService {
/**
*
*
* @param equipmentId
* @return
*/
@ -81,6 +93,7 @@ public interface IDevicePDAService {
/**
*
*
* @param workId
* @return
*/
@ -88,6 +101,7 @@ public interface IDevicePDAService {
/**
*
*
* @param equRepairWorkOrder
* @return
*/
@ -101,6 +115,7 @@ public interface IDevicePDAService {
/**
*
*
* @param pdadto
* @return
*/

@ -2,13 +2,25 @@ package com.op.device.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.MesReportWork;
import com.op.device.mapper.EquEquipmentMapper;
import com.op.device.domain.vo.IEquipmentVO;
import com.op.device.domain.vo.IRepairWorkOrderVO;
import com.op.device.mapper.DeviceInterfaceMapper;
import com.op.device.mapper.EquOperationRecordMapper;
import com.op.device.mapper.EquRepairWorkOrderMapper;
import com.op.device.service.IDeviceInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import static com.op.common.core.web.domain.AjaxResult.success;
@ -20,19 +32,178 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
@Autowired
private EquRepairWorkOrderMapper equRepairWorkOrderMapper;
@Autowired
private DeviceInterfaceMapper deviceInterfaceMapper;
@Autowired
private EquOperationRecordMapper equOperationRecordMapper;
/**
*
*
*
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getRepairWorkOrder() {
// 获取待维修的工单
EquRepairWorkOrder workTemp = new EquRepairWorkOrder();
workTemp.setWorkStatus("0");
List<EquRepairWorkOrder> workOrderList = equRepairWorkOrderMapper.selectEquRepairWorkOrderList(workTemp);
// EquRepairWorkOrder workOrder = equRepairWorkOrderMapper.selectWaitingWorkOrder();
return success(workOrderList);
List<IRepairWorkOrderVO> workOrderVOList = deviceInterfaceMapper.selectEquRepairWorkOrderList();
for (IRepairWorkOrderVO orderVO : workOrderVOList) {
if (orderVO.getWorkHandle().equals("0")) {
orderVO.setWorkHandle("立即");
} else {
orderVO.setWorkHandle("计划");
}
}
return success(workOrderVOList);
}
/**
*
* :/
* /
*
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentInfo() {
// 获取所有设备信息
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList();
for (IEquipmentVO equipmentVO : equipmentVOList) {
// 设备状态
if (equipmentVO.getEquipmentStatus().equals("1")) {
equipmentVO.setEquipmentStatus("正常");
} else {
equipmentVO.setEquipmentStatus("停用");
}
/* 停机故障率逻辑 */
long totalTime = 0L;// 运行总时间
long downTime = 0L;// 停机时间
// 通过设备编码获取运行记录中的运行记录List
List<EquOperationRecord> operationRecordList = equOperationRecordMapper.selectEquOperationRecordByEquipmentCode(equipmentVO.getEquipmentCode());
if (operationRecordList.size() != 0) {
for (EquOperationRecord operationRecord : operationRecordList) {
// 运行时间差值
long diffTime = operationRecord.getEndTime().getTime() - operationRecord.getStartTime().getTime();
// 开机运行时间运行总时间累加
if (operationRecord.getType().equals("on")) {
totalTime += diffTime;
}
// 维修停机时间累加(故障)
if (operationRecord.getMaintenanceType().equals("repair")) {
downTime += diffTime;
}
}
// 设置停机故障率
if (downTime == 0L) {
// 如果未查到该设备停机故障时间
equipmentVO.setFailureRate(0D);
} else {
// 计算故障停机率(设备停机时间总和/一定时间内运行总时间(年))
double failureRate = downTime / totalTime;
equipmentVO.setFailureRate(failureRate);
}
}
/* 设备有效利用率逻辑(每月) */
// 查询该设备下报工单信息(年月日可在该sql中修改)
MesReportWork reportWork = deviceInterfaceMapper.selectReportWorkByEquipmentCode(equipmentVO.getEquipmentCode());
if (reportWork != null) {
BigDecimal theoryQuantity = reportWork.getQuantity();// 理论产量
BigDecimal actualQuantity = reportWork.getQuantityFeedback();// 实际产量
// 计算该设备有效利用率(实际产量/理论产量)
BigDecimal utilizationRatio = actualQuantity.divide(theoryQuantity, 2, BigDecimal.ROUND_HALF_UP);
equipmentVO.setUtilizationRatio(utilizationRatio.doubleValue());
} else {
// 如果未查到该信息则默认设置为0
equipmentVO.setUtilizationRatio(0D);
}
}
return success(equipmentVOList);
}
/**
* TOP10
* /
*
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getRepairQuantity() {
// 获取维修工单中的设备列表
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList();
for (IEquipmentVO equipmentVO : equipmentVOList) {
// 通过该设备code获取设备维修记录(只获取开始时间、结束时间)
List<EquRepairWorkOrder> workOrderList = deviceInterfaceMapper.selectRepairRecordByEquipmentCode(equipmentVO.getEquipmentCode());
if (workOrderList.size() != 0) {
Long runTime = 0l;
for (EquRepairWorkOrder workOrder : workOrderList) {
// 维修时间差值
long diffTime = workOrder.getWorkEndTime().getTime() - workOrder.getWorkStartTime().getTime();
// 累加时间
runTime += diffTime;
}
// 计算维修质量(故障时间(小时)/故障次数)
long rapairQuantity = runTime / 3600000 / workOrderList.size();
equipmentVO.setRapairQuantity(Double.valueOf(rapairQuantity));
} else {
// 没有该记录则默认为0
equipmentVO.setRapairQuantity(0D);
}
}
// 排序TOP10
// 假数据
// Random random = new Random();
// List<IEquipmentVO> test = new ArrayList<>();
// for (int i = 0 ; i < 30 ; i++) {
// IEquipmentVO vo = new IEquipmentVO();
// vo.setRapairQuantity(random.nextDouble());
// test.add(vo);
// }
// 按照raparQuantity字段进行排序并使用subList获取前10个结果
List<IEquipmentVO> top10 = equipmentVOList.stream()
.sorted(Comparator.comparingDouble(IEquipmentVO::getRapairQuantity)) // 排序
.limit(10) // 限制结果数量为10
.collect(Collectors.toList()); // 将结果收集到List中
return success(top10);
}
/**
* -MTBF top10
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
List<EquOperationRecord> equipmentList = equOperationRecordMapper.getMTBFList(equOperationRecord);
return success(equipmentList);
}
/**
*
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
EquOperationRecord equipmentIntactRate = equOperationRecordMapper.getEquipmentIntactRate(equOperationRecord);
return success(equipmentIntactRate);
}
}

@ -56,7 +56,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@Autowired
private EquEquipmentMapper equEquipmentMapper;
@Autowired
private EquSpareApplyMapper equSpareApplyMapper;
private EquSpareApplyMapper equSpareApplyMapper;
@Autowired
private EquFileMapper equFileMapper;
@ -165,7 +165,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
/**
*
*
*
* @param equOrder
* @return
@ -178,11 +178,11 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
if (equOrder.getRepairCode() != null) {
if (!equOrder.getRepairCode().isEmpty()) {
EquRepairOrder repairOrder = equRepairOrderMapper.selectEquRepairOrderByRepairCode(equOrder.getRepairCode());
if (repairOrder==null) {
return error(500,"未查询到报修单信息!");
}else {
if (!repairOrder.getOrderStatus().equals("待审核")){
return error(500,"报修单已审核,不可修改记录!");
if (repairOrder == null) {
return error(500, "未查询到报修单信息!");
} else {
if (!repairOrder.getOrderStatus().equals("待审核")) {
return error(500, "报修单已审核,不可修改记录!");
}
}
}
@ -228,7 +228,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
hasError = true;
standard.setDetailReach("0");
}
}else {
} else {
// 未达标
standard.setErrorFlag("0");
if (standard.getDetailReach().equals("0")) {
@ -255,10 +255,10 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
boolean checkRepair = false;
if (equOrder.getRepairCode() == null){
if (equOrder.getRepairCode() == null) {
checkRepair = true;
}else {
if (equOrder.getRepairCode().isEmpty()){
} else {
if (equOrder.getRepairCode().isEmpty()) {
checkRepair = true;
}
}
@ -270,7 +270,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
String equipmentCode = equOrder.getEquipmentCode();
//报修单号
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
//在主表中存入报修单号信息
equOrder.setRepairCode(equRepairOrder.getOrderCode());
@ -289,19 +289,19 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairOrder.setOrderConnection(equTeamUserList.getPhonenumber());
equRepairOrder.setOrderRepairmanName(equTeamUserList.getNickName());
// 报修来源
if (equOrder.getPlanType().equals("inspection")){
if (equOrder.getPlanType().equals("inspection")) {
equRepairOrder.setOrderSource("巡检");
}
if (equOrder.getPlanType().equals("spotInspection")){
if (equOrder.getPlanType().equals("spotInspection")) {
equRepairOrder.setOrderSource("点检");
}
if (equOrder.getPlanType().equals("maintenance")){
if (equOrder.getPlanType().equals("maintenance")) {
equRepairOrder.setOrderSource("保养");
}
equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
}
@ -344,8 +344,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
//////////////////////报修
/**
*
*
*
* @param equRepairOrder
* @return
@ -362,7 +363,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
String equipmentCode = equRepairOrder.getEquipmentCode();
//报修单号
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
equRepairOrder.setOrderCode("BX" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
equRepairOrder.setOrderRepairmanCode(SecurityUtils.getUsername());
@ -370,7 +371,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
//删除照片 不需要清照片 因为是新增
@ -435,6 +436,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
/**
*
* TODO
*
* @param pdadto
* @return
*/
@ -490,6 +493,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
return error();
}
}
/**
*
*
@ -520,7 +524,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
//不停机 那么实际停机开始时间和实际停机结束时间都没有
//如果停机 那么实际停机时间就是传入的时间
equRepairWorkOrder.setWorkStartTime(DateUtils.getNowDate());
if(equRepairWorkOrder.getWorkDownMachine().equals("1")){
if (equRepairWorkOrder.getWorkDownMachine().equals("1")) {
equRepairWorkOrder.setActualDownStartTime(DateUtils.getNowDate());
}
equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername());
@ -535,8 +539,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
/**
*
*
* @param equipmentId
* @return
*/
@ -544,8 +546,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName")
public AjaxResult selectEquEquipmentByEquEquipmentId(Long equipmentId) {
try {
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId);
return success(list);
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId);
return success(list);
} catch (Exception e) {
return error();
}
@ -561,43 +563,43 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName")
public AjaxResult selectPdaRepairWorkOrderDetails(String workId) {
try {
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(workId);
//查询对应检查项信息
EquOrder equOrder = new EquOrder();
equOrder.setWorkCode(list.getWorkCode());
//检查项
List<EquOrder> checkLists = equOrderMapper.selectCheckListByWorkCode(equOrder);
//每个检查项对应的检测标准
for(EquOrder equOrder1 :checkLists){
EquOrderStandard equOrderStandard = new EquOrderStandard();
equOrderStandard.setOrderCode(equOrder1.getOrderCode());
equOrderStandard.setParentCode(equOrder1.getId());
List<EquOrderStandard> standardLists = equOrderStandardMapper.selectPdaEquOrderList(equOrderStandard);
for(EquOrderStandard standardList :standardLists){
//每个检查标准里面的照片
List<BaseFileData> files = equOrderStandardMapper.getBaseFileBatch(standardList.getId());
if (!CollectionUtils.isEmpty(files)) {
standardList.setPicturePaths(files);
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(workId);
//查询对应检查项信息
EquOrder equOrder = new EquOrder();
equOrder.setWorkCode(list.getWorkCode());
//检查项
List<EquOrder> checkLists = equOrderMapper.selectCheckListByWorkCode(equOrder);
//每个检查项对应的检测标准
for (EquOrder equOrder1 : checkLists) {
EquOrderStandard equOrderStandard = new EquOrderStandard();
equOrderStandard.setOrderCode(equOrder1.getOrderCode());
equOrderStandard.setParentCode(equOrder1.getId());
List<EquOrderStandard> standardLists = equOrderStandardMapper.selectPdaEquOrderList(equOrderStandard);
for (EquOrderStandard standardList : standardLists) {
//每个检查标准里面的照片
List<BaseFileData> files = equOrderStandardMapper.getBaseFileBatch(standardList.getId());
if (!CollectionUtils.isEmpty(files)) {
standardList.setPicturePaths(files);
}
standardList.setDetailReach(standardList.getRepairReach());
standardList.setActualValue(standardList.getRepairValue());
}
standardList.setDetailReach(standardList.getRepairReach());
standardList.setActualValue(standardList.getRepairValue());
equOrder1.setStandardList(standardLists);
}
equOrder1.setStandardList(standardLists);
}
list.setDetailList(checkLists);
//备件申领单
EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder();
equRepairWorkOrder.setWorkCode(list.getWorkCode());
List<EquSpareApply> applyLists = equSpareApplyMapper.selectRepairSparePartsRecord(equRepairWorkOrder);
list.setApplyList(applyLists);
//文件
List<BaseFileData> files = equRepairWorkOrderMapper.getBaseFileBatch(workId);
if (!CollectionUtils.isEmpty(files)) {
list.setFiles(files);
}
return success(list);
list.setDetailList(checkLists);
//备件申领单
EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder();
equRepairWorkOrder.setWorkCode(list.getWorkCode());
List<EquSpareApply> applyLists = equSpareApplyMapper.selectRepairSparePartsRecord(equRepairWorkOrder);
list.setApplyList(applyLists);
//文件
List<BaseFileData> files = equRepairWorkOrderMapper.getBaseFileBatch(workId);
if (!CollectionUtils.isEmpty(files)) {
list.setFiles(files);
}
return success(list);
} catch (Exception e) {
return error();
}
@ -612,114 +614,114 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@Override
@DS("#header.poolName")
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
//判断是否停机
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
if(list.getWorkDownMachine().equals("1")){
//维修结束时间、维修真正停机时间
equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate());
}
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
//更新每一项点检/巡检检查项信息
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
for(EquOrder checkList:checkLists){
checkList.setUpdateBy(SecurityUtils.getUsername());
checkList.setUpdateTime(DateUtils.getNowDate());
List<EquOrderStandard> standardLists = checkList.getStandardList();
for(EquOrderStandard standardList :standardLists){
//先删除每个检查项标准图片
equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId());
//图片
if (StringUtils.isNotEmpty(standardList.getPicturePath())) {
String[] ids = standardList.getPicturePath().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(standardList.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
//维修后
file.setImageType("4");
files.add(file);
}
equOrderStandardMapper.insertBaseFileBatch(files);
//判断是否停机
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
if (list.getWorkDownMachine().equals("1")) {
//维修结束时间、维修真正停机时间
equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate());
}
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
//更新每一项点检/巡检检查项信息
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
for (EquOrder checkList : checkLists) {
checkList.setUpdateBy(SecurityUtils.getUsername());
checkList.setUpdateTime(DateUtils.getNowDate());
List<EquOrderStandard> standardLists = checkList.getStandardList();
for (EquOrderStandard standardList : standardLists) {
//先删除每个检查项标准图片
equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId());
//图片
if (StringUtils.isNotEmpty(standardList.getPicturePath())) {
String[] ids = standardList.getPicturePath().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(standardList.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
//维修后
file.setImageType("4");
files.add(file);
}
standardList.setRepairReach(standardList.getDetailReach());
standardList.setRepairValue(standardList.getActualValue());
standardList.setUpdateTime(DateUtils.getNowDate());
standardList.setUpdateBy(SecurityUtils.getUsername());
equOrderStandardMapper.updateActualValues(standardList);
equOrderStandardMapper.insertBaseFileBatch(files);
}
equOrderMapper.updateEquOrder(checkList);
standardList.setRepairReach(standardList.getDetailReach());
standardList.setRepairValue(standardList.getActualValue());
standardList.setUpdateTime(DateUtils.getNowDate());
standardList.setUpdateBy(SecurityUtils.getUsername());
equOrderStandardMapper.updateActualValues(standardList);
}
equOrderMapper.updateEquOrder(checkList);
}
//新建申领单
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
for(EquSpareApply equSpareApply:equSpareApplies){
//生成领料单code
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10);
//十五位单号
equSpareApply.setApplyCode("AW" + code + serialNum);
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
//备品备件规格型号!!!!!
//新建申领单
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
for (EquSpareApply equSpareApply : equSpareApplies) {
//生成领料单code
String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber());
String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10);
//十五位单号
equSpareApply.setApplyCode("AW" + code + serialNum);
equSpareApply.setApplyId(IdUtils.fastSimpleUUID());
//备品备件规格型号!!!!!
// equSpareApply.setSpareModel(equSpareApply.getS);
equSpareApply.setSpareCode(equSpareApply.getMaterialCode());
equSpareApply.setSpareName(equSpareApply.getMaterialDesc());
equSpareApply.setApplyPeople(SecurityUtils.getUsername());
equSpareApply.setCreateBy(SecurityUtils.getUsername());
equSpareApply.setCreateTime(DateUtils.getNowDate());
equSpareApply.setApplyTime(DateUtils.getNowDate());
equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode());
equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode());
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
//更新完备品申领单后,更新库存
SparePartsLedger sparePartsLedger = new SparePartsLedger();
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
BigDecimal applyNum = equSpareApply.getSpareQuantity();
BigDecimal amount = equSpareApply.getAmount();
sparePartsLedger.setAmount(amount.subtract(applyNum));
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
}
equSpareApply.setSpareCode(equSpareApply.getMaterialCode());
equSpareApply.setSpareName(equSpareApply.getMaterialDesc());
equSpareApply.setApplyPeople(SecurityUtils.getUsername());
equSpareApply.setCreateBy(SecurityUtils.getUsername());
equSpareApply.setCreateTime(DateUtils.getNowDate());
equSpareApply.setApplyTime(DateUtils.getNowDate());
equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode());
equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode());
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
equSpareApplyMapper.insertEquSpareApply(equSpareApply);
//更新完备品申领单后,更新库存
SparePartsLedger sparePartsLedger = new SparePartsLedger();
sparePartsLedger.setStorageId(equSpareApply.getStorageId());
BigDecimal applyNum = equSpareApply.getSpareQuantity();
BigDecimal amount = equSpareApply.getAmount();
sparePartsLedger.setAmount(amount.subtract(applyNum));
sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger);
}
//图片
//先删除每个维修工单对应图片
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
String[] ids = equRepairWorkOrder.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(equRepairWorkOrder.getWorkId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
//维修后
file.setImageType("4");
files.add(file);
}
equRepairWorkOrderMapper.insertBaseFileBatch(files);
//图片
//先删除每个维修工单对应图片
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
String[] ids = equRepairWorkOrder.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(equRepairWorkOrder.getWorkId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
//维修后
file.setImageType("4");
files.add(file);
}
//维修人:当前登录人
//维修状态
equRepairWorkOrder.setWorkStatus("1");
//维修结束时间
equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername());
equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername());
equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate());
equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
//需要更新设备状态????这里没做
return success("提交成功,维修完成!");
equRepairWorkOrderMapper.insertBaseFileBatch(files);
}
//维修人:当前登录人
//维修状态
equRepairWorkOrder.setWorkStatus("1");
//维修结束时间
equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername());
equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername());
equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate());
equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder);
//需要更新设备状态????这里没做
return success("提交成功,维修完成!");
}
/**

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.device.mapper.DeviceInterfaceMapper">
<select id="selectEquRepairWorkOrderList" resultType="com.op.device.domain.vo.IRepairWorkOrderVO">
select be.equipment_name AS "equipmentName",
wo.equipment_code AS "equipmentCode",
wo.work_fault_desc AS "workFaultDesc",
et.team_name AS "teamName",
wo.work_handle AS "workHandle",
wo.work_plan_time AS "workPlanTime",
be.equipment_location AS "equipmentLocation"
from equ_repair_work_order wo
left join base_equipment be
on wo.equipment_code = be.equipment_code
left join equ_team et
on wo.work_team = et.team_code
where wo.work_status = '0'
</select>
<select id="selectEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO">
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName'
from base_equipment be
where be.equipment_code in (select wo.equipment_code
from equ_repair_work_order wo
where wo.del_flag = '0'
and wo.work_status = '1'
GROUP BY wo.equipment_code)
</select>
<select id="selectRepairEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO">
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName'
from base_equipment be
where be.equipment_code in (select wo.equipment_code
from equ_repair_work_order wo
where wo.del_flag = '0'
and wo.work_status = '1'
GROUP BY wo.equipment_code)
</select>
<select id="selectReportWorkByEquipmentCode" resultType="com.op.device.domain.MesReportWork">
select SUM(mrw.quantity) AS "quantity",
SUM(mrw.quantity_feedback) AS "quantityFeedback"
from mes_report_work mrw
where mrw.del_flag = '0'
and mrw.status = 'PREPARE'
and mrw.machine_code = #{equipmentCode}
and mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE())
</select>
<select id="selectRepairRecordByEquipmentCode" resultType="com.op.device.domain.EquRepairWorkOrder">
select wo.work_start_time AS "workStartTime", wo.work_end_time AS "workEndTime"
from equ_repair_work_order wo
where wo.del_flag = '0'
and wo.equipment_code = #{equipmentCode}
and wo.work_status = '1'
</select>
</mapper>

@ -21,10 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="itemTools" column="item_tools" />
<result property="itemLoop" column="item_loop" />
<result property="itemLoopType" column="item_loop_type" />
</resultMap>
<sql id="selectEquCheckItemVo">
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by from equ_check_item
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by ,item_tools ,item_loop,item_loop_type from equ_check_item
</sql>
<select id="selectEquCheckItemList" parameterType="EquCheckItem" resultMap="EquCheckItemResult">
@ -41,6 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="itemLoop != null and itemLoop != ''"> and item_loop = #{itemLoop}</if>
<if test="itemLoopType != null and itemLoopType != ''"> and item_loop_type = #{itemLoopType}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools like concat('%', #{itemTools}, '%')</if>
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
@ -100,6 +106,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="itemTools != null and itemTools != ''">item_tools,</if>
<if test="itemLoop != null and itemLoop != ''">item_loop,</if>
<if test="itemLoopType != null and itemLoopType != ''">item_loop_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">#{itemId},</if>
@ -118,6 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="itemTools != null and itemTools != ''">#{itemTools},</if>
<if test="itemLoop != null and itemLoop != ''">#{itemLoop},</if>
<if test="itemLoopType != null and itemLoopType != ''">#{itemLoopType},</if>
</trim>
</insert>
@ -139,6 +151,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</if>
<if test="itemLoop != null and itemLoop != ''">item_loop = #{itemLoop},</if>
<if test="itemLoopType != null and itemLoopType != ''">item_loop_type = #{itemLoopType},</if>
</trim>
where item_id = #{itemId} and del_flag = '0'
</update>

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.device.mapper.EquOperationRecordMapper">
<resultMap type="EquOperationRecord" id="EquOperationRecordResult">
<result property="id" column="id"/>
<result property="equipmentCode" column="equipment_code"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="type" column="type"/>
<result property="maintenanceType" column="maintenance_type"/>
<result property="parentId" column="parent_id"/>
<result property="factoryCode" column="factory_code"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectEquOperationRecordVo">
select id,
equipment_code,
start_time,
end_time,
type,
maintenance_type,
parent_id,
factory_code,
attr1,
attr2,
attr3,
del_flag,
create_by,
create_time,
update_by,
update_time
from equ_operation_record
</sql>
<select id="selectEquOperationRecordList" parameterType="EquOperationRecord" resultMap="EquOperationRecordResult">
<include refid="selectEquOperationRecordVo"/>
<where>
<if test="equipmentCode != null and equipmentCode != ''">and equipment_code = #{equipmentCode}</if>
<if test="startTime != null ">and start_time = #{startTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="maintenanceType != null and maintenanceType != ''">and maintenance_type = #{maintenanceType}</if>
<if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''">and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''">and attr3 = #{attr3}</if>
</where>
</select>
<select id="selectEquOperationRecordById" parameterType="String" resultMap="EquOperationRecordResult">
<include refid="selectEquOperationRecordVo"/>
where id = #{id}
</select>
<select id="selectEquOperationRecordByEquipmentCode" resultType="com.op.device.domain.EquOperationRecord">
select eor.start_time AS "startTime",
eor.end_time AS "endTime",
eor.maintenance_type AS "maintenanceType",
eor.type AS "type"
from equ_operation_record eor
where eor.del_flag = '0'
and eor.end_time is not null
and eor.equipment_code = #{equipmentCode}
</select>
<insert id="insertEquOperationRecord" parameterType="EquOperationRecord">
insert into equ_operation_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="equipmentCode != null">equipment_code,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="type != null">type,</if>
<if test="maintenanceType != null">maintenance_type,</if>
<if test="parentId != null">parent_id,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="equipmentCode != null">#{equipmentCode},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="type != null">#{type},</if>
<if test="maintenanceType != null">#{maintenanceType},</if>
<if test="parentId != null">#{parentId},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEquOperationRecord" parameterType="EquOperationRecord">
update equ_operation_record
<trim prefix="SET" suffixOverrides=",">
<if test="equipmentCode != null">equipment_code = #{equipmentCode},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="type != null">type = #{type},</if>
<if test="maintenanceType != null">maintenance_type = #{maintenanceType},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEquOperationRecordById" parameterType="String">
delete
from equ_operation_record
where id = #{id}
</delete>
<delete id="deleteEquOperationRecordByIds" parameterType="String">
delete from equ_operation_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!--设备稳定性 MTBF-->
<select id="getMTBFList" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
select
row_number() over (ORDER BY sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END) DESC) AS serialNumber,
eor.equipment_code AS equipmentCode,
sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END ) AS onTime,
sum(CASE WHEN eor.type = 'off' THEN 1 ELSE 0 END) AS shutDownNumber,
cast(sum(CASE WHEN eor.type = 'on' THEN datediff(minute, eor.start_time,eor.end_time)*1.0/60 ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END)as decimal(10,2)) as mtbf
from equ_operation_record eor
left join base_equipment be on eor.equipment_code = be.equipment_code
where be.status = '1'
and be.del_flag = '0'
and eor.start_time is not null
and eor.end_time is not null
GROUP BY eor.equipment_code
ORDER BY onTime desc
</select>
<!--完好设备占比-->
<select id="getEquipmentIntactRate" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
SELECT
SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment,
SUM(CASE WHEN equipment_status = '0' or equipment_status = '0' THEN 1 Else 0 END) AS faultEquipment,
COUNT(*) AS totalEquipment,
CONCAT(cast(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100/COUNT(*)as decimal(10,2)),'%') AS intactRate
FROM base_equipment
WHERE del_flag = '0' AND status = '1'
</select>
</mapper>

@ -23,12 +23,13 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="itemTools" column="item_tools" />
</resultMap>
<sql id="selectEquOrderDetailVo">
select id, code, order_code, parent_code, item_code, item_name, item_method,
item_type, item_type_name, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
create_by, create_time, update_by, update_time,item_tools
from equ_order_detail
</sql>
@ -47,6 +48,7 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools = #{itemTools}</if>
and del_flag = '0'
</where>
</select>
@ -87,6 +89,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="itemTools != null">item_tools,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -107,6 +110,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="itemTools != null">#{itemTools},</if>
</trim>
</insert>
<insert id="insertEquOrderDetails">
@ -115,7 +119,7 @@
id, order_code,
item_code, item_name, item_method,
item_type, item_type_name, factory_code, del_flag,
create_by, create_time
create_by, create_time,item_tools
)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
@ -123,7 +127,7 @@
#{item.id},#{item.parentCode},
#{item.itemCode},#{item.itemName},#{item.itemMethod},
#{item.itemType},#{item.itemTypeName},#{item.factoryCode},#{item.delFlag},
#{item.createBy},#{item.createTime}
#{item.createBy},#{item.createTime},#{itemTools}
)
</foreach>
@ -141,6 +145,7 @@
<if test="itemType != null">item_type = #{itemType},</if>
<if test="itemTypeName != null">item_type_name = #{itemTypeName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>

@ -25,12 +25,13 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="itemTools" column="item_tools" />
</resultMap>
<sql id="selectEquPlanDetailVo">
select id, code, plan_id,plan_code, parent_code, item_code, item_name, item_method, item_type,
item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
create_by, create_time, update_by, update_time,item_tools
from equ_plan_detail
</sql>
@ -51,6 +52,7 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools = #{itemTools}</if>
and del_flag = '0'
</where>
ORDER BY item_name
@ -94,6 +96,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="itemTools != null">item_tools,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -116,6 +119,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="itemTools != null">#{itemTools},</if>
</trim>
</insert>
@ -141,6 +145,7 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="itemTools != null">item_tools = #{itemTools},</if>
</trim>
where id = #{id} and del_flag = '0'
</update>

@ -108,4 +108,6 @@ public interface MesReportWorkMapper {
List<EquEquipmentDTO> getMesListEquip(EquEquipmentDTO qo);
List<ProOrderWorkorder> getBatchList(ProOrderWorkorder proOrderWorkorder);
List<String> getSapWorkOrder(String workorderCode);
}

@ -336,8 +336,12 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
){
logger.info("工单请求关闭调用remoteSapService.sapCloseOrder,参数:"+work.getWorkorderCodeSap());
//工单完成,关闭工单
R r2= remoteSapService.sapCloseOrder(work.getWorkorderCodeSap());
logger.info("工单"+work.getWorkorderCodeSap()+"sap关闭"+r2.getCode()+",返回信息:"+r2.getMsg());
List<String> sapWorkOrders = mesReportWorkMapper.getSapWorkOrder(work.getWorkorderCode());//根据belong_work_order找到所有要关闭的虚拟工单
for(String sapWorkOrder:sapWorkOrders){
R r2= remoteSapService.sapCloseOrder(sapWorkOrder);
logger.info("工单"+work.getWorkorderCode()+",sapworkorder:"+sapWorkOrder+",sap关闭"+r.getCode()+",返回信息:"+r.getMsg());
}
work.setStatus("w3");
work.setUpdateTime(DateUtils.getNowDate());
//pro_work_order status->w3报工--belong_work_order

@ -248,40 +248,40 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
//报工
public void reportWorkByFactory(String poolName) {
MesReportWork mesReportWork = new MesReportWork();
mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
mesReportWork.setProdType("prod");
List<MesReportWork> reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork);
for(MesReportWork work:reportWorks) {
SapRFW sapRFW = new SapRFW();
sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号
sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量
SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改
ltgs.setConf_activity1(work.getSac1());//人工
ltgs.setConf_activity2(work.getSac2());
ltgs.setConf_activity3(work.getSac3());
ltgs.setConf_activity4(work.getSac4());
ltgs.setConf_activity5(work.getSac5());
ltgs.setConf_activity6(work.getSac6());
SapRFW.lt_hw lthw = sapRFW.getLt_hw();//MES生产订单报工货物移动修改
lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO;
lthw.setMaterial(work.getProcessCode());
R r = remoteSapService.sapRFWOrder(sapRFW);
//上传成功更改mes_report_work状态
if (r.getCode() == 200) {
work.setUploadStatus("1");
} else {
work.setUploadStatus("2");
work.setUploadMsg(r.getMsg());
}
work.setUploadTime(DateUtils.getNowDate());
mesReportWorkMapper.updateSyncSapStatus(work);
//关闭订单
remoteSapService.sapCloseOrder(work.getOrderCode());
//pro_work_order status->w4报工
work.setStatus("w4");
work.setUpdateTime(DateUtils.getNowDate());
mesReportWorkMapper.updateWorkOrderStatus(work);
}
// mesReportWork.setUploadStatus("1");//除了1报工成功的都需要报工
// mesReportWork.setProdType("prod");
// List<MesReportWork> reportWorks = mesReportWorkMapper.getReportWorkList(mesReportWork);
// for(MesReportWork work:reportWorks) {
// SapRFW sapRFW = new SapRFW();
// sapRFW.setAufnr(work.getWorkorderCodeSap());//虚拟工单号
// sapRFW.setGamng(work.getQuantityFeedback().toString());//报工数量
// SapRFW.lt_gs ltgs = sapRFW.getLt_gs();//生产订单报工工时修改
// ltgs.setConf_activity1(work.getSac1());//人工
// ltgs.setConf_activity2(work.getSac2());
// ltgs.setConf_activity3(work.getSac3());
// ltgs.setConf_activity4(work.getSac4());
// ltgs.setConf_activity5(work.getSac5());
// ltgs.setConf_activity6(work.getSac6());
// SapRFW.lt_hw lthw = sapRFW.getLt_hw();//MES生产订单报工货物移动修改
// lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO;
// lthw.setMaterial(work.getProcessCode());
// R r = remoteSapService.sapRFWOrder(sapRFW);
// //上传成功更改mes_report_work状态
// if (r.getCode() == 200) {
// work.setUploadStatus("1");
// } else {
// work.setUploadStatus("2");
// work.setUploadMsg(r.getMsg());
// }
// work.setUploadTime(DateUtils.getNowDate());
// mesReportWorkMapper.updateSyncSapStatus(work);
// //关闭订单
// remoteSapService.sapCloseOrder(work.getOrderCode());
// //pro_work_order status->w4报工
// work.setStatus("w4");
// work.setUpdateTime(DateUtils.getNowDate());
// mesReportWorkMapper.updateWorkOrderStatus(work);
// }
}
public static void main(String args[]) {
List<SapMaterialPreparation> list = new ArrayList<>();

@ -443,6 +443,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where powb.del_flag = '0' and pow.del_flag = '0'
and pow.workorder_code = #{workorderCode}
</select>
<select id="getSapWorkOrder" resultType="java.lang.String">
select workorder_code_sap from pro_order_workorder
where belong_work_order = #{workorderCode} and del_flag = '0' and parent_order = '0'
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work

@ -41,5 +41,7 @@ public interface OpenMapper {
ProOrderWorkorderDTO getOrderByCode(String workorderCode);
List<WCSDTO> getLGInfo(WCSDTO wcsDTO);
List<String> getSapWorkOrder(String workorderCode);
}

@ -204,9 +204,13 @@ public class OpenServiceImpl implements OpenService {
"1".equals(work.getEndReport())//最终报工标识
){
logger.info("工单请求关闭调用remoteSapService.sapCloseOrder,参数:"+work.getWorkorderCodeSap());
//工单完成,关闭工单
R rclose = remoteSapService.sapCloseOrder(work.getWorkorderCodeSap());
logger.info("工单"+work.getWorkorderCodeSap()+"sap关闭"+r.getCode()+",返回信息:"+r.getMsg());
//工单完成,关闭母工单
List<String> sapWorkOrders = openMapper.getSapWorkOrder(work.getWorkorderCode());//根据belong_work_order找到所有要关闭的虚拟工单
for(String sapWorkOrder:sapWorkOrders){
R rclose = remoteSapService.sapCloseOrder(sapWorkOrder);
logger.info("工单"+work.getWorkorderCode()+",sapworkorder:"+sapWorkOrder+",sap关闭"+r.getCode()+",返回信息:"+r.getMsg());
}
work.setStatus("w3");
work.setUpdateTime(DateUtils.getNowDate());
//pro_work_order status->w3报工--belong_work_order
@ -222,19 +226,6 @@ public class OpenServiceImpl implements OpenService {
return openMapper.getLGInfo(wcsDTO);
}
// //根据工单子单编码获取最顶级订单的母单
// private ProOrderWorkorderDTO getTopOrder(String workorderCode) {
// //pro_order_workorder
// ProOrderWorkorderDTO topOrder = openMapper.getOrderByCode(workorderCode);
// while (!"0".equals(topOrder.getParentOrder()) && StringUtils.isNotEmpty(topOrder.getParentOrder())) {
// //pro_order_workorder
// topOrder = openMapper.getOrderByCode(topOrder.getParentOrder());
// }
// return topOrder;
// }
public static void main(String args[]){
DateTimeFormatter ymdhms = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate today = LocalDate.now();

@ -122,5 +122,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join pro_order_workorder pow on pw.workorder_id = pow.workorder_id
where CONVERT(varchar(10),plan_time, 120) = #{reqTime}
</select>
<select id="getSapWorkOrder" resultType="java.lang.String">
select workorder_code_sap from pro_order_workorder
where belong_work_order = #{workorderCode} and del_flag = '0' and parent_order = '0'
</select>
</mapper>

@ -1,5 +1,6 @@
package com.op.plan.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
@ -279,6 +280,20 @@ public class ProOrderServiceImpl implements IProOrderService {
if("0".equals(workOrder.getParentOrder())){
//20231127,加入belongWorkOrder概念
belongWorkOrder = workOrder.getWorkorderCode();
//推送sap订单更新信息
SapShopOrderQuery sapChange = new SapShopOrderQuery();
sapChange.setAufnr(proOrder.getOrderCode());//母订单号
BigDecimal newSapQuantityNum = new BigDecimal(proOrder.getQuantity())
.subtract(new BigDecimal(proOrder.getQuantitySplit()));
sapChange.setQuantity(newSapQuantityNum.toString());//母订单新数量
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更:修改前"+proOrder.getQuantity()+","+
",已拆数量"+proOrder.getQuantitySplit()+","+
"给sap汇报数量"+newSapQuantityNum.toString());
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg());
}
workOrder.setBelongWorkOrder(belongWorkOrder);
@ -507,9 +522,6 @@ public class ProOrderServiceImpl implements IProOrderService {
failOrder = proOrder.getOrderCode();
logger.info("=======订单"+failOrder+"同步失败");
}
// else {//关闭订单
// remoteSapService.sapCloseOrder(proOrder.getOrderCode());
// }
}
return failOrder;
}

@ -23,6 +23,7 @@ import com.op.system.api.domain.dto.MesPrepareDTO;
import com.op.system.api.domain.dto.MesPrepareDetailDTO;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapMaterialPreparation;
import com.op.system.api.domain.sap.SapShopOrderQuery;
import net.bytebuddy.matcher.FilterableList;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang.StringUtils;
@ -36,6 +37,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -264,7 +266,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
whiteOrder.setUpdateBy(SecurityUtils.getUsername());
whiteOrder.setUpdateTime(DateUtils.getNowDate());
return proOrderWorkorderMapper.updateWhiteWorkOrder(whiteOrder);
proOrderWorkorderMapper.updateWhiteWorkOrder(whiteOrder);
} else if (whiteOrder != null && !"white".equals(whiteOrder.getProdType())) {
List<String> wids = new ArrayList<>();//一起下发用
List<String> wcodes = new ArrayList<>();//领料单用
@ -292,6 +294,8 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
//顺序母子
Collections.reverse(wids);
Collections.reverse(wcodes);
Collections.reverse(ordercodes);
sapList = new ArrayList<>();
SapCreateOrder sap = new SapCreateOrder();
sap.setWerks(whiteOrder.getFactoryCode());//工厂编码
@ -344,17 +348,17 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
//获取领料单
this.getMesPrepare(returnCodes,wcodes);
//关闭订单//订单的订单编码
for(String orderCode:ordercodes){
R closeR= remoteSapService.sapCloseOrder(orderCode);
logger.info(workorderId+"下发工单后关闭母订单"+orderCode+":"+closeR.getMsg());
}
//关闭订单子订单会自动关闭//订单的订单编码
//for(String orderCode:ordercodes){
R closeR= remoteSapService.sapCloseOrder(ordercodes.get(0));
logger.info(workorderId+"下发工单后关闭母订单"+ordercodes.get(0)+":"+closeR.getMsg());
//}
//下达工单
String[] idsArrayAll = (String[])wids.toArray(new String[wids.size()]);
return proOrderWorkorderMapper.downWorkorders(idsArrayAll);
proOrderWorkorderMapper.downWorkorders(idsArrayAll);
}
}
return 0;
return 1;
}
//子查父递归
@ -759,6 +763,23 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
Long conver = 1L;
int index = workOrderList.size();
while (run) {
if(StringUtils.isBlank(proOrder.getParentOrder())){
//推送sap订单更新信息
SapShopOrderQuery sapChange = new SapShopOrderQuery();
sapChange.setAufnr(proOrder.getOrderCode());//母订单号
BigDecimal newSapQuantityNum = new BigDecimal(proOrder.getQuantity())
.subtract(new BigDecimal(proOrder.getAtrr1()));
sapChange.setQuantity(newSapQuantityNum.toString());//母订单新数量
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更:修改前"+proOrder.getQuantity()+","+
"已拆数量"+proOrder.getAtrr1()+","+
"给sap汇报数量"+newSapQuantityNum.toString());
R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据
logger.info("母订单"+proOrder.getOrderCode()+
"订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg());
}
// 获得对应工单
ProOrderWorkorder proOrderWorkorder = workOrderList.get(--index);
// 更新订单

@ -2,18 +2,18 @@ package com.op.quality.controller;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.service.IQcCheckTaskProduceService;
import com.op.quality.service.IQcCheckTaskWarehousingService;
import com.op.quality.service.IQcCheckTypeService;
import com.op.quality.service.QcProCheckService;
import com.op.quality.service.*;
import com.op.system.api.RemoteMesService;
import com.op.system.api.domain.dto.WCSDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -40,6 +40,9 @@ public class QuaController extends BaseController {
@Autowired
private IQcCheckTypeService qcCheckTypeService;
@Autowired
private IQcCheckTaskIncomeService qcCheckTaskIncomeService;
@PostMapping("/saveQcProCheck")
public R<Boolean> saveQcProCheck(@RequestBody QcProCheck qcProCheck) {
DynamicDataSourceContextHolder.push("ds_"+qcProCheck.getFactoryCode());
@ -177,10 +180,37 @@ public class QuaController extends BaseController {
*/
@GetMapping(value = "getCheckTaskList")
public AjaxResult getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome) {
// if(StringUtils.isBlank(qcCheckType.getFactoryCode())){
// return error("[factoryCode]不能为空");
// }
// return success(qcCheckTypeService.getCheckType(qcCheckType));
return null;
if(StringUtils.isBlank(qcCheckTaskIncome.getFactoryCode())){
return error("[factoryCode]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskIncome.getCheckType())){
return error("[checkType]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskIncome.getCheckManCode())){
return error("[checkManCode]不能为空");
}
return success(qcProCheckService.getCheckTaskList(qcCheckTaskIncome));
}
/**
*
*/
@GetMapping(value = "getCheckTaskDetailList")
public AjaxResult getCheckTaskDetailList(QcCheckTaskDetail qcCheckTaskDetail) {
if(StringUtils.isBlank(qcCheckTaskDetail.getFactoryCode())){
return error("[factoryCode]不能为空");
}
if(StringUtils.isBlank(qcCheckTaskDetail.getBelongTo())){
return error("[belongTo]不能为空");
}
return success(qcProCheckService.getCheckTaskDetailList(qcCheckTaskDetail));
}
/**检测结果提交**/
@PostMapping("/commitCheckResults")
public AjaxResult commitCheckResults(@RequestBody List<QcCheckTaskDetail> details) {
if(CollectionUtils.isEmpty(details)){
return error("[List<QcCheckTaskDetail>]不能为空");
}
return toAjax(qcCheckTaskIncomeService.commitCheckResults(details));
}
}

@ -25,7 +25,7 @@ public class QcCheckTaskIncome extends BaseEntity {
private String checkNo;
/** 来料批次号 */
@Excel(name = "来料批次号")
@Excel(name = "批次号")
private String incomeBatchNo;
/** 订单号 */

@ -58,7 +58,7 @@ public class QcCheckTaskWarehousing extends BaseEntity {
/** 来料时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "来料时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date incomeTime;
/** 检测地点 */

@ -8,6 +8,7 @@ import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcSupplier;
import com.op.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -74,4 +75,8 @@ public interface QcCheckTaskIncomeMapper {
int getTodayMaxNum(QcCheckTaskIncome qcCheckTaskIncome);
List<QcCheckTaskDetail> getCkeckProjectList(QcCheckTaskDetail qcCheckTaskDetail);
int updateQcCheckTask(QcCheckTaskIncome qcCheckTask);
int updateQcCheckTaskDetails(@Param("list") List<QcCheckTaskDetail> details);
}

@ -2,6 +2,7 @@ package com.op.quality.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.domain.R;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcProCheck;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -34,4 +35,6 @@ public interface QcProCheckMapper {
List<QcProCheck> getEquipmentList(QcProCheck qcProCheck);
List<QcProCheck> getDictList(QcProCheck qcProCheck);
List<QcCheckTaskIncome> getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome);
}

@ -76,5 +76,8 @@ public interface IQcCheckTaskIncomeService {
int commitCheckResult(QcCheckTaskIncome qcCheckTaskIncome);
int commitCheckResults(List<QcCheckTaskDetail> details);
List<QcDefectType> getDefectList(QcDefectType qcDefectType);
}

@ -1,6 +1,8 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckType;
/**
@ -61,4 +63,6 @@ public interface IQcCheckTypeService {
List<QcCheckType> getCheckType(QcCheckType qcCheckType);
List<QcCheckType> getTopTaskInfo(QcCheckType qcCheckType);
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import com.op.common.core.domain.R;
//import com.op.quality.domain.BaseFile;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTypeProject;
import com.op.quality.domain.QcProCheck;
@ -30,4 +31,7 @@ public interface QcProCheckService {
List<QcProCheck> getDictList(QcProCheck qcProCheck);
List<QcCheckTaskIncome> getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome);
List<QcCheckTaskDetail > getCheckTaskDetailList(QcCheckTaskDetail qcCheckTaskDetail);
}

@ -6,6 +6,7 @@ import java.util.List;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
@ -13,6 +14,8 @@ import com.op.quality.domain.*;
import com.op.quality.mapper.*;
import com.op.quality.service.IQcCheckTaskProduceService;
import com.op.system.api.domain.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.service.IQcCheckTaskIncomeService;
@ -31,6 +34,7 @@ import javax.servlet.http.HttpServletRequest;
*/
@Service
public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper;
@ -190,8 +194,8 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
return qcCheckTaskIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@Override
@DS("master")
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckTaskIncomeMapper.getQcListUser(sysUser);
}
@ -285,4 +289,54 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
return qcCheckUnqualifiedMapper.getDefectList(qcDefectType);
}
@Override
public int commitCheckResults(List<QcCheckTaskDetail> details) {
DynamicDataSourceContextHolder.push("ds_"+details.get(0).getFactoryCode());
Date nowTime = DateUtils.getNowDate();
String factoryCode = details.get(0).getFactoryCode();
String updateBy = details.get(0).getUpdateBy();
String belongId = details.get(0).getBelongTo();
//默认合格
String result = "Y";
for(QcCheckTaskDetail detail:details){
if("N".equals(detail.getStatus())){
result = "N";//不合格
break;
}
}
int n = 0;
QcCheckTaskIncome qcCheckTask = new QcCheckTaskIncome();
qcCheckTask.setUpdateBy(updateBy);
qcCheckTask.setRecordId(belongId);
qcCheckTask.setCheckResult("2");//检测状态0待检测1检测中2检测完成
qcCheckTask.setUpdateTime(nowTime);
qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格
/**qc_check_task**/
n = qcCheckTaskIncomeMapper.updateQcCheckTask(qcCheckTask);
logger.info("qc_check_task:"+n);
/**更新qc_check_task_detail**/
for(QcCheckTaskDetail detail:details){
}
n= qcCheckTaskIncomeMapper.updateQcCheckTaskDetails(details);;
logger.info("更新qc_check_task_detail:"+n);
//不合格处理
if("N".equals(result)){
// QcCheckUnqualified unqualified = new QcCheckUnqualified();
// unqualified.setId(IdUtils.fastSimpleUUID());
// unqualified.setTaskId(qcCheckTaskIncome.getRecordId());
// unqualified.setCreateTime(DateUtils.getNowDate());
// unqualified.setCreateBy(qcCheckTaskIncome.getUpdateBy());
// unqualified.setFactoryCode(factoryCode);
// unqualified.setType(qcCheckTaskIncome.getCheckType());
// /**qc_check_unqualified**/
// qcCheckUnqualifiedMapper.insertQcCheckUnqualified(unqualified);
}
return n ;
}
}

@ -2,6 +2,7 @@ package com.op.quality.service.serviceImpl;
import com.alibaba.fastjson2.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
@ -176,8 +177,8 @@ public class QcCheckReportIncomeServiceImpl implements IQcCheckReportIncomeServi
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@Override
@DS("master")
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);
}

@ -178,7 +178,7 @@ public class QcCheckReportProduceServiceImpl implements IQcCheckReportProduceSer
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@DS("master")
@Override
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);

@ -178,7 +178,7 @@ public class QcCheckReportProductServiceImpl implements IQcCheckReportProductSer
return qcCheckReportIncomeMapper.getQcListSupplier(qcSupplier);
}
//在公共库里不需要切库
@DS("master")
@Override
public List<SysUser> getQcListUser(SysUser sysUser) {
return qcCheckReportIncomeMapper.getQcListUser(sysUser);

@ -8,6 +8,7 @@ import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.QcCheckTaskDetail;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckTypeProject;
import com.op.quality.domain.QcProCheck;
import com.op.quality.mapper.QcCheckTaskIncomeMapper;
@ -114,4 +115,16 @@ public class QcProCheckServiceImpl implements QcProCheckService {
return qcProCheckMapper.getDictList(qcProCheck);
}
@Override
public List<QcCheckTaskIncome> getCheckTaskList(QcCheckTaskIncome qcCheckTaskIncome) {
DynamicDataSourceContextHolder.push("ds_"+qcCheckTaskIncome.getFactoryCode());
return qcProCheckMapper.getCheckTaskList(qcCheckTaskIncome);
}
@Override
public List<QcCheckTaskDetail> getCheckTaskDetailList(QcCheckTaskDetail qcCheckTaskDetail) {
DynamicDataSourceContextHolder.push("ds_"+qcCheckTaskDetail.getFactoryCode());
return qcCheckTaskIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
}
}

@ -131,12 +131,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
td.create_time createTime,
td.update_by updateBy,
td.update_time updateTime,
td.update_time updateTime,
td.belong_to belongTo,
qctp.upper_diff upperDiff,
qctp.down_diff downDiff,
qctp.sample
from qc_check_task_detail td
left join qc_check_type_project qctp on td.type_project_id = qctp.id
where td.belong_to = #{belongTo}
where td.belong_to = #{belongTo} and td.del_flag='0' and qctp.del_flag = '0'
</select>
<insert id="insertQcCheckTaskIncome" parameterType="QcCheckTaskIncome">
@ -242,6 +244,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where record_id = #{recordId}
</update>
<update id="updateQcCheckTask">
update qc_check_task
set
check_status = #{checkStatus},
<if test="checkTime != null">check_time = #{checkTime},</if>
check_result = #{checkResult},
update_by = #{updateBy},
update_time = #{updateTime}
where record_id = #{recordId}
</update>
<update id="updateQcCheckTaskDetails">
<foreach collection="list" item="item" separator=";">
update qc_check_task_detail
set
zh_desc = #{item.name1},
contact_phone = #{item.telf1},
address = #{item.stras},
factory_code = #{item.bukrs},
create_time= #{item.erdat},
update_time = #{item.erdat}
where
supplier_code = #{item.lifnr}
</foreach>
</update>
<delete id="deleteQcCheckTaskIncomeByRecordId" parameterType="String">
delete from qc_check_task where record_id = #{recordId}

@ -35,7 +35,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<collection property="fileList" column="id" select="queryImg"></collection>
</resultMap>
<resultMap type="QcCheckTaskIncome" id="QcCheckTaskIncomeResult">
<result property="recordId" column="record_id" />
<result property="checkNo" column="check_no" />
<result property="incomeBatchNo" column="income_batch_no" />
<result property="orderNo" column="order_no" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="quality" column="quality" />
<result property="noOkQuality" column="noOk_quality" />
<result property="unit" column="unit" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="incomeTime" column="income_time" />
<result property="checkLoc" column="check_loc" />
<result property="checkStatus" column="check_status" />
<result property="checkManCode" column="check_man_code" />
<result property="checkManName" column="check_man_name" />
<result property="checkTime" column="check_time" />
<result property="checkResult" column="check_result" />
<result property="status" column="status" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="factoryCode" column="factory_code" />
<result property="delFlag" column="del_flag" />
<result property="checkType" column="check_type" />
</resultMap>
<sql id="selectQuaVo">
select id,rfid,factory_id,factory_code,order_id,machine_id,bad_meg,product_id,isqua,file_id,attr1,attr2,
attr3,attr4,create_by,create_time,update_by,update_time,order_code,machine_code,
@ -212,4 +243,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_dict_data
where dict_type = #{equipmentTypeCode}
</select>
<select id="getCheckTaskList" resultMap="QcCheckTaskIncomeResult">
select qct.record_id, qct.check_no, qct.income_batch_no, qct.order_no,
qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc,
qct.check_status, qct.check_man_code,qct.check_man_name, qct.check_time, qct.check_result,
qct.status,qct.create_by,qct.create_time
from qc_check_task qct
<where>
and qct.del_flag = '0'
<if test="checkType != null and checkType != ''"> and qct.check_type = #{checkType}</if>
<if test="checkManCode != null and checkManCode != ''"> and qct.check_man_code = #{checkManCode}</if>
</where>
order by qct.create_time desc
</select>
</mapper>

@ -7,7 +7,10 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.ExcelCol;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.common.security.utils.SecurityUtils;
import com.op.system.api.domain.SysUser;
import com.op.wms.domain.EquSpareEquipment;
import com.op.wms.domain.WmsSparePartsLedger;
import com.op.wms.service.IBaseEquipmentService;
@ -114,7 +117,6 @@ public class BaseEquipmentController extends BaseController {
/**
*
*/
// @RequiresPermissions("wms:equipment:getEquipmentTypeList")
@GetMapping("/getEquipmentTypeList")
public TableDataInfo getEquipmentTypeList(BaseEquipment baseEquipment) {
List<BaseEquipment> list = baseEquipmentService.getEquipmentTypeList(baseEquipment);
@ -125,8 +127,8 @@ public class BaseEquipmentController extends BaseController {
*
*/
@GetMapping("/getSparePartsList")
public TableDataInfo getSparePartsList(BaseEquipment baseEquipment) {
List<WmsSparePartsLedger> list = baseEquipmentService.getSparePartsList(baseEquipment);
public TableDataInfo getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger) {
List<WmsSparePartsLedger> list = baseEquipmentService.getSparePartsList(wmsSparePartsLedger);
return getDataTable(list);
}
@ -218,4 +220,14 @@ public class BaseEquipmentController extends BaseController {
return baseEquipmentService.importFile(orderList);
}
/**
*
*/
@RequiresPermissions("wms:equipment:edit")
@Log(title = "修改设备状态", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody BaseEquipment baseEquipment) {
return toAjax(baseEquipmentService.updateBaseEquipmentStatus(baseEquipment));
}
}

@ -61,7 +61,7 @@ public class BaseEquipment extends BaseEntity {
private String workshopName;
/** 设备状态 */
@Excel(name = "设备状态")
@Excel(name = "设备是否启用")
private String status;
/** 预留字段1 */
@ -207,6 +207,10 @@ public class BaseEquipment extends BaseEntity {
@Excel(name = "工厂号")
private String factoryCode;
/** 设备状态 */
@Excel(name = "设备状态")
private String equipmentStatus;
private String imageFileList;
private String barCodeFileList;
@ -619,6 +623,14 @@ public class BaseEquipment extends BaseEntity {
return factoryCode;
}
//设备状态
public void setEquipmentStatus(String equipmentStatus) {
this.equipmentStatus = equipmentStatus;
}
public String getEquipmentStatus() {
return equipmentStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -81,7 +81,7 @@ public interface BaseEquipmentMapper {
Long getEquipmentId(String equipmentCode);
//查询备件
List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment);
List<WmsSparePartsLedger> getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger);
//绑定备品备件
public int bindSpareParts(EquSpareEquipment equSpareEquipment);
@ -107,4 +107,7 @@ public interface BaseEquipmentMapper {
//设备
BaseEquipment selectExistByEquipmentCode(String equipmentCode);
//更新设备状态
Integer updateBaseEquipmentStatus(BaseEquipment baseEquipment);
}

@ -69,11 +69,14 @@ public interface IBaseEquipmentService {
List<BaseEquipment> getEquipmentTypeList(BaseEquipment baseEquipment);
//查询设备备品备件
List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment);
List<WmsSparePartsLedger> getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger);
//查询设备备品备件右侧列表
public List<EquSpareEquipment> getRightSparePartsList(BaseEquipment baseEquipment);
//导入设备基础数据文件
AjaxResult importFile(List<BaseEquipment> equipmentList);
//更改设备状态
int updateBaseEquipmentStatus(BaseEquipment baseEquipment);
}

@ -372,8 +372,8 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
*/
@Override
@DS("#header.poolName")
public List<WmsSparePartsLedger> getSparePartsList(BaseEquipment baseEquipment) {
return baseEquipmentMapper.getSparePartsList(baseEquipment);
public List<WmsSparePartsLedger> getSparePartsList(WmsSparePartsLedger wmsSparePartsLedger) {
return baseEquipmentMapper.getSparePartsList(wmsSparePartsLedger);
}
/**
@ -481,4 +481,19 @@ public class BaseEquipmentServiceImpl implements IBaseEquipmentService {
return failEquipment;
}
/**
*
*
* @param baseEquipment
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseEquipmentStatus(BaseEquipment baseEquipment) {
baseEquipment.setUpdateBy(SecurityUtils.getUsername());
baseEquipment.setUpdateTime(DateUtils.getNowDate());
Integer list = baseEquipmentMapper.updateBaseEquipmentStatus(baseEquipment);
return list;
}
}

@ -47,6 +47,7 @@
<result property="sapAsset" column="sap_asset" />
<result property="equipmentHead" column="equipment_head" />
<result property="factoryCode" column="factory_code" />
<result property="equipmentStatus" column="equipment_status" />
</resultMap>
<resultMap type="WmsSparePartsLedger" id="WmsSparePartsLedgerResult">
@ -159,7 +160,9 @@
asset_head,
fixed_asset_code,
department,
equipment_head
equipment_head,
factory_code,
equipment_status
from base_equipment
</sql>
@ -201,6 +204,7 @@
<if test="department != null and department != ''"> and department = #{department}</if>
<if test="sapAsset != null and sapAsset != ''"> and sap_asset = #{sapAsset}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="equipmentStatus != null and equipmentStatus != ''"> and equipment_status = #{equipmentStatus}</if>
and del_flag ='0'
</where>
</select>
@ -254,6 +258,7 @@
<if test="sapAsset != null">sap_asset,</if>
<if test="equipmentHead != null">equipment_head,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="equipmentStatus != null">equipment_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
@ -296,6 +301,7 @@
<if test="sapAsset != null">#{sapAsset},</if>
<if test="equipmentHead != null">#{equipmentHead},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="equipmentStatus != null">equipmentStatus,</if>
</trim>
</insert>
@ -342,6 +348,7 @@
<if test="sapAsset != null">sap_asset = #{sapAsset},</if>
<if test="equipmentHead != null">equipment_head = #{equipmentHead},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="equipmentStatus != null">equipment_status = #{equipmentStatus},</if>
</trim>
where equipment_id = #{equipmentId}
</update>
@ -514,4 +521,12 @@
and del_flag ='0'
</select>
<update id="updateBaseEquipmentStatus" parameterType="BaseEquipment">
update base_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status = #{status},</if>
</trim>
where equipment_id = #{equipmentId}
</update>
</mapper>
Loading…
Cancel
Save