change - 设备台账

master
yinq 8 months ago
parent 1852055580
commit 2da89fdb62

@ -100,4 +100,13 @@ public class BaseDeviceLedgerController extends BaseController {
public AjaxResult remove(@PathVariable Long[] objIds) { public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(baseDeviceLedgerService.deleteBaseDeviceLedgerByObjIds(objIds)); return toAjax(baseDeviceLedgerService.deleteBaseDeviceLedgerByObjIds(objIds));
} }
/**
*
* @return
*/
@GetMapping("/getDeviceCode")
public AjaxResult getDeviceCode() {
return success(baseDeviceLedgerService.getDeviceCode());
}
} }

@ -47,9 +47,9 @@ public class BaseDeviceLedger extends BaseEntity {
private String deviceType; private String deviceType;
/** /**
* * IP
*/ */
@Excel(name = "设备位置") @Excel(name = "IP地址")
private String deviceAddress; private String deviceAddress;
/** /**
@ -78,11 +78,16 @@ public class BaseDeviceLedger extends BaseEntity {
private Date enableDate; private Date enableDate;
/** /**
* * 线
*/ */
@Excel(name = "所属工位")
private String productLineCode; private String productLineCode;
/**
* 线
*/
@Excel(name = "所属产线")
private String productLineName;
/** /**
* *
*/ */
@ -127,10 +132,60 @@ public class BaseDeviceLedger extends BaseEntity {
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime; private Date updatedTime;
/**
*
*/
@Excel(name = "班组编号")
private String teamCode;
/**
*
*/
@Excel(name = "班组名称")
private String teamName;
/**
*
*/
@Excel(name = "资产编号")
private String assetCode;
public String getAssetCode() {
return assetCode;
}
public void setAssetCode(String assetCode) {
this.assetCode = assetCode;
}
public String getFactoryName() { public String getFactoryName() {
return factoryName; return factoryName;
} }
public String getProductLineName() {
return productLineName;
}
public void setProductLineName(String productLineName) {
this.productLineName = productLineName;
}
public String getTeamCode() {
return teamCode;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public void setFactoryName(String factoryName) { public void setFactoryName(String factoryName) {
this.factoryName = factoryName; this.factoryName = factoryName;
} }

@ -58,4 +58,10 @@ public interface BaseDeviceLedgerMapper
* @return * @return
*/ */
public int deleteBaseDeviceLedgerByObjIds(Long[] objIds); public int deleteBaseDeviceLedgerByObjIds(Long[] objIds);
/**
*
* @return
*/
public String getDeviceCode();
} }

@ -58,4 +58,10 @@ public interface IBaseDeviceLedgerService
* @return * @return
*/ */
public int deleteBaseDeviceLedgerByObjId(Long objId); public int deleteBaseDeviceLedgerByObjId(Long objId);
/**
*
* @return
*/
public String getDeviceCode();
} }

@ -90,4 +90,22 @@ public class BaseDeviceLedgerServiceImpl implements IBaseDeviceLedgerService
{ {
return baseDeviceLedgerMapper.deleteBaseDeviceLedgerByObjId(objId); return baseDeviceLedgerMapper.deleteBaseDeviceLedgerByObjId(objId);
} }
/**
*
* @return
*/
@Override
public String getDeviceCode() {
String deviceCode = baseDeviceLedgerMapper.getDeviceCode();
String numericPart = deviceCode.substring(1);
// 将数字部分转换为整数并加1
int incrementedNumber = Integer.parseInt(numericPart) + 1;
// 格式化加1后的数字部分确保总长度为5位
String formattedNumber = String.format("%05d", incrementedNumber);
// 拼接 'E' 和格式化后的数字部分
String newDeviceCode = "E" + formattedNumber;
return newDeviceCode;
}
} }

@ -23,109 +23,129 @@
<result property="updatedBy" column="updated_by"/> <result property="updatedBy" column="updated_by"/>
<result property="updatedTime" column="updated_time"/> <result property="updatedTime" column="updated_time"/>
<result property="factoryCode" column="factory_code"/> <result property="factoryCode" column="factory_code"/>
<result property="teamCode" column="TEAM_CODE"/>
<result property="teamName" column="TEAM_NAME"/>
<result property="assetCode" column="ASSET_CODE"/>
<result property="productLineName" column="PRODUCT_LINE_NAME"/>
</resultMap> </resultMap>
<sql id="selectBaseDeviceLedgerVo"> <sql id="selectBaseDeviceLedgerVo">
select obj_id, select dl.OBJ_ID,
device_code, dl.DEVICE_CODE,
device_name, dl.DEVICE_NAME,
device_model, dl.DEVICE_MODEL,
device_type, dl.DEVICE_TYPE,
device_address, dl.DEVICE_ADDRESS,
device_status, dl.DEVICE_STATUS,
used_department, dl.USED_DEPARTMENT,
cost_center, dl.COST_CENTER,
manufacturer, dl.MANUFACTURER,
enable_date, dl.ENABLE_DATE,
product_line_code, dl.PRODUCT_LINE_CODE,
factory_code, dl.IS_FLAG,
is_flag, dl.CREATED_BY,
created_by, dl.CREATED_TIME,
created_time, dl.UPDATED_BY,
updated_by, dl.UPDATED_TIME,
updated_time dl.FACTORY_CODE,
from base_deviceledger dl.TEAM_CODE,
CASE
WHEN te.TEAM_NAME IS NOT NULL THEN SUBSTR(te.TEAM_NAME, 1, LENGTH(te.TEAM_NAME) - 3) || '班组'
END TEAM_NAME,
dl.ASSET_CODE,
pl.PRODUCT_LINE_NAME
from base_deviceledger dl
left join BASE_PRODUCTLINE pl on pl.PRODUCT_LINE_CODE = dl.PRODUCT_LINE_CODE
left join BASE_TEAMMEMBERS te on te.TEAM_CODE = dl.TEAM_CODE
</sql> </sql>
<select id="selectBaseDeviceLedgerList" parameterType="BaseDeviceLedger" resultMap="BaseDeviceLedgerResult"> <select id="selectBaseDeviceLedgerList" parameterType="BaseDeviceLedger" resultMap="BaseDeviceLedgerResult">
<include refid="selectBaseDeviceLedgerVo"/> <include refid="selectBaseDeviceLedgerVo"/>
<where> <where>
<if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if> <if test="deviceCode != null and deviceCode != ''">and dl.device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''">and device_name like concat(concat('%', #{deviceName}), <if test="deviceName != null and deviceName != ''">and dl.device_name like concat(concat('%', #{deviceName}),
'%') '%')
</if> </if>
<if test="deviceModel != null and deviceModel != ''">and device_model = #{deviceModel}</if> <if test="deviceModel != null and deviceModel != ''">and dl.device_model = #{deviceModel}</if>
<if test="deviceType != null ">and device_type = #{deviceType}</if> <if test="deviceType != null ">and dl.device_type = #{deviceType}</if>
<if test="deviceAddress != null and deviceAddress != ''">and device_address = #{deviceAddress}</if> <if test="deviceAddress != null and deviceAddress != ''">and dl.device_address = #{deviceAddress}</if>
<if test="deviceStatus != null ">and device_status = #{deviceStatus}</if> <if test="deviceStatus != null ">and dl.device_status = #{deviceStatus}</if>
<if test="usedDepartment != null and usedDepartment != ''">and used_department = #{usedDepartment}</if> <if test="usedDepartment != null and usedDepartment != ''">and dl.used_department = #{usedDepartment}</if>
<if test="productLineCode != null and productLineCode != ''">and product_line_code = #{productLineCode} <if test="productLineCode != null and productLineCode != ''">and dl.product_line_code = #{productLineCode}
</if> </if>
<if test="isFlag != null ">and is_flag = #{isFlag}</if> <if test="isFlag != null ">and dl.is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if> <if test="teamCode != null and teamCode != ''">and dl.TEAM_CODE = #{teamCode}</if>
<if test="createdTime != null ">and created_time = #{createdTime}</if> <if test="createdTime != null ">and dl.created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if> <if test="updatedBy != null and updatedBy != ''">and dl.updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if> <if test="updatedTime != null ">and dl.updated_time = #{updatedTime}</if>
</where> </where>
order by device_code order by dl.PRODUCT_LINE_CODE,device_code
</select> </select>
<select id="selectBaseDeviceLedgerByObjId" parameterType="Long" resultMap="BaseDeviceLedgerResult"> <select id="selectBaseDeviceLedgerByObjId" parameterType="Long" resultMap="BaseDeviceLedgerResult">
<include refid="selectBaseDeviceLedgerVo"/> <include refid="selectBaseDeviceLedgerVo"/>
where obj_id = #{objId} where dl.obj_id = #{objId}
</select>
<select id="getDeviceCode" resultType="java.lang.String">
SELECT MAX(DEVICE_CODE) DEVICE_CODE
from base_deviceledger
</select> </select>
<insert id="insertBaseDeviceLedger" parameterType="BaseDeviceLedger"> <insert id="insertBaseDeviceledger" parameterType="BaseDeviceledger">
<selectKey keyProperty="objId" resultType="long" order="BEFORE"> <selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_base_deviceledger.NEXTVAL as objId FROM DUAL SELECT seq_base_deviceledger.NEXTVAL as objId FROM DUAL
</selectKey> </selectKey>
insert into base_deviceledger insert into base_deviceledger
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if> <if test="objId != null">obj_id,</if>
<if test="deviceCode != null">device_code,</if> <if test="deviceCode != null and deviceCode != ''">device_code,</if>
<if test="deviceName != null">device_name,</if> <if test="deviceName != null">device_name,</if>
<if test="deviceModel != null">device_model,</if> <if test="deviceModel != null">device_model,</if>
<if test="deviceType != null">device_type,</if> <if test="deviceType != null">device_type,</if>
<if test="deviceAddress != null">device_address,</if> <if test="deviceAddress != null">device_address,</if>
<if test="deviceStatus != null">device_status,</if> <if test="deviceStatus != null">device_status,</if>
<if test="usedDepartment != null">used_department,</if> <if test="usedDepartment != null">used_department,</if>
<if test="productLineCode != null">product_line_code,</if>
<if test="costCenter != null">cost_center,</if> <if test="costCenter != null">cost_center,</if>
<if test="manufacturer != null">manufacturer,</if> <if test="manufacturer != null">manufacturer,</if>
<if test="enableDate != null">enable_date,</if> <if test="enableDate != null">enable_date,</if>
<if test="factoryCode != null">factory_code,</if> <if test="productLineCode != null">product_line_code,</if>
<if test="isFlag != null">is_flag,</if> <if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if> <if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if> <if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if> <if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if> <if test="updatedTime != null">updated_time,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="teamCode != null">team_code,</if>
<if test="assetCode != null">asset_code,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if> <if test="objId != null">#{objId},</if>
<if test="deviceCode != null">#{deviceCode},</if> <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
<if test="deviceName != null">#{deviceName},</if> <if test="deviceName != null">#{deviceName},</if>
<if test="deviceModel != null">#{deviceModel},</if> <if test="deviceModel != null">#{deviceModel},</if>
<if test="deviceType != null">#{deviceType},</if> <if test="deviceType != null">#{deviceType},</if>
<if test="deviceAddress != null">#{deviceAddress},</if> <if test="deviceAddress != null">#{deviceAddress},</if>
<if test="deviceStatus != null">#{deviceStatus},</if> <if test="deviceStatus != null">#{deviceStatus},</if>
<if test="usedDepartment != null">#{usedDepartment},</if> <if test="usedDepartment != null">#{usedDepartment},</if>
<if test="productLineCode != null">#{productLineCode},</if>
<if test="costCenter != null">#{costCenter},</if> <if test="costCenter != null">#{costCenter},</if>
<if test="manufacturer != null">#{manufacturer},</if> <if test="manufacturer != null">#{manufacturer},</if>
<if test="enableDate != null">#{enableDate},</if> <if test="enableDate != null">#{enableDate},</if>
<if test="factoryCode != null">#{factoryCode},</if> <if test="productLineCode != null">#{productLineCode},</if>
<if test="isFlag != null">#{isFlag},</if> <if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if> <if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if> <if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if> <if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if> <if test="updatedTime != null">#{updatedTime},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="assetCode != null">#{assetCode},</if>
</trim> </trim>
</insert> </insert>
<update id="updateBaseDeviceLedger" parameterType="BaseDeviceLedger"> <update id="updateBaseDeviceledger" parameterType="BaseDeviceledger">
update base_deviceledger update base_deviceledger
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null">device_code = #{deviceCode},</if> <if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
<if test="deviceName != null">device_name = #{deviceName},</if> <if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceModel != null">device_model = #{deviceModel},</if> <if test="deviceModel != null">device_model = #{deviceModel},</if>
<if test="deviceType != null">device_type = #{deviceType},</if> <if test="deviceType != null">device_type = #{deviceType},</if>
@ -136,12 +156,14 @@
<if test="manufacturer != null">manufacturer = #{manufacturer},</if> <if test="manufacturer != null">manufacturer = #{manufacturer},</if>
<if test="enableDate != null">enable_date = #{enableDate},</if> <if test="enableDate != null">enable_date = #{enableDate},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</if> <if test="productLineCode != null">product_line_code = #{productLineCode},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if> <if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if> <if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if> <if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if> <if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if> <if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="assetCode != null">asset_code = #{assetCode},</if>
</trim> </trim>
where obj_id = #{objId} where obj_id = #{objId}
</update> </update>

@ -192,26 +192,28 @@
ORDER BY DEFECT_NUMBER DESC ORDER BY DEFECT_NUMBER DESC
</select> </select>
<select id="qualityIssuesReportList" resultType="com.aucma.report.domain.QualityIssuesReport" parameterType="java.util.HashMap"> <select id="qualityIssuesReportList" resultType="com.aucma.report.domain.QualityIssuesReport" parameterType="java.util.HashMap">
SELECT ZSD.FACTORY_NAME,
ZSD.PRODUCT_LINE_CODE,
ZSD.PRODUCT_LINE_NAME,
ZSD.MATERIAL_MODEL,
ZSD.QUALITY_DEFECT_CODE,
ZSD.QUALITY_DEFECT_NAME,
COUNT(*) Q_SUM,
TO_CHAR(ROUND(COUNT(*) / OS.OFFLINE_NUM * 100, 2), 'FM99990.00') || '%' OFFLINE_NUM
FROM (
SELECT BF.FACTORY_NAME, SELECT BF.FACTORY_NAME,
PL2.PRODUCT_LINE_CODE, PL2.PRODUCT_LINE_CODE,
PL2.PRODUCT_LINE_NAME, PL2.PRODUCT_LINE_NAME,
GET_MATERIAL_TYPE(RQI.MATERIAL_NAME) MATERIAL_MODEL, GET_MATERIAL_TYPE(RQI.MATERIAL_NAME) MATERIAL_MODEL,
RQI.BAR_CODE,
RQI.QUALITY_DEFECT_CODE, RQI.QUALITY_DEFECT_CODE,
QI.QUALITY_DEFECT_NAME, QI.QUALITY_DEFECT_NAME
COUNT(*) Q_SUM,
TO_CHAR(ROUND(COUNT(*) / OS.OFFLINE_NUM * 100, 2), 'FM99990.00') || '%' OFFLINE_NUM
FROM REPORT_QUALITY_INSPECTION RQI FROM REPORT_QUALITY_INSPECTION RQI
LEFT JOIN BASE_PRODUCTLINE PL on RQI.STATION_CODE = PL.PRODUCT_LINE_CODE LEFT JOIN BASE_PRODUCTLINE PL on RQI.STATION_CODE = PL.PRODUCT_LINE_CODE
LEFT JOIN BASE_PRODUCTLINE PL2 on PL2.PRODUCT_LINE_CODE = PL.PARENT_ID LEFT JOIN BASE_PRODUCTLINE PL2 on PL2.PRODUCT_LINE_CODE = PL.PARENT_ID
LEFT JOIN BASE_FACTORY BF on BF.FACTORY_CODE = PL.PLANT_CODE LEFT JOIN BASE_FACTORY BF on BF.FACTORY_CODE = PL.PLANT_CODE
LEFT JOIN BASE_QUALITY_INSPECTION_ITEM QI on QI.QUALITY_DEFECT_CODE = RQI.QUALITY_DEFECT_CODE LEFT JOIN BASE_QUALITY_INSPECTION_ITEM QI on QI.QUALITY_DEFECT_CODE = RQI.QUALITY_DEFECT_CODE
CROSS JOIN (SELECT COUNT(*) OFFLINE_NUM WHERE RQI.TREATMENT_MEASURE = '1'
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
WHERE TO_CHAR(PRODUCT_SCANTIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
) OS
WHERE RQI.QUALITY_DEFECT_CODE IS NOT NULL
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''"> <if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime} AND TO_CHAR(RQI.INSPECTOR_TIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if> </if>
@ -221,10 +223,19 @@
<if test="MATERIAL_MODEL != null and MATERIAL_MODEL != ''"> <if test="MATERIAL_MODEL != null and MATERIAL_MODEL != ''">
AND RQI.MATERIAL_NAME LIKE '%' || #{MATERIAL_MODEL} || '%' AND RQI.MATERIAL_NAME LIKE '%' || #{MATERIAL_MODEL} || '%'
</if> </if>
GROUP BY BF.FACTORY_NAME, PL2.PRODUCT_LINE_CODE, PL2.PRODUCT_LINE_NAME, GET_MATERIAL_TYPE(RQI.MATERIAL_NAME), GROUP BY BF.FACTORY_NAME, PL2.PRODUCT_LINE_CODE, PL2.PRODUCT_LINE_NAME,
RQI.QUALITY_DEFECT_CODE, GET_MATERIAL_TYPE(RQI.MATERIAL_NAME),
QI.QUALITY_DEFECT_NAME, OS.OFFLINE_NUM RQI.BAR_CODE, RQI.QUALITY_DEFECT_CODE, QI.QUALITY_DEFECT_NAME
ORDER BY PL2.PRODUCT_LINE_CODE, Q_SUM DESC ) ZSD
CROSS JOIN (SELECT COUNT(*) OFFLINE_NUM
FROM C##AUCMA_SCADA.PRODUCT_OFFLINE
<if test="beginBeginTime != null and beginBeginTime != '' and endBeginTime != null and endBeginTime != ''">
WHERE TO_CHAR(PRODUCT_SCANTIME, 'YYYY-MM-DD HH24:MI:SS') BETWEEN #{beginBeginTime} AND #{endBeginTime}
</if>
) OS
GROUP BY ZSD.FACTORY_NAME, ZSD.PRODUCT_LINE_CODE, ZSD.PRODUCT_LINE_NAME,
ZSD.MATERIAL_MODEL, ZSD.QUALITY_DEFECT_CODE, ZSD.QUALITY_DEFECT_NAME, OS.OFFLINE_NUM
ORDER BY ZSD.PRODUCT_LINE_CODE, Q_SUM DESC
</select> </select>
<select id="ScanOfflineRecordReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap"> <select id="ScanOfflineRecordReportList" resultType="java.util.HashMap" parameterType="java.util.HashMap">
SELECT * SELECT *

Loading…
Cancel
Save