diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseDeviceLedgerController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseDeviceLedgerController.java index 9bc3621..897b314 100644 --- a/aucma-base/src/main/java/com/aucma/base/controller/BaseDeviceLedgerController.java +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseDeviceLedgerController.java @@ -30,16 +30,16 @@ import com.aucma.common.core.page.TableDataInfo; * @date 2023-09-19 */ @RestController -@RequestMapping("/base/deviceLedger" ) +@RequestMapping("/base/deviceLedger") public class BaseDeviceLedgerController extends BaseController { @Autowired private IBaseDeviceLedgerService baseDeviceLedgerService; -/** - * 查询设备台账列表 - */ -@PreAuthorize("@ss.hasPermi('base:deviceLedger:list')" ) -@GetMapping("/list" ) + /** + * 查询设备台账列表 + */ + @PreAuthorize("@ss.hasPermi('base:deviceLedger:list')") + @GetMapping("/list") public TableDataInfo list(BaseDeviceLedger baseDeviceLedger) { startPage(); List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(baseDeviceLedger); @@ -49,29 +49,29 @@ public class BaseDeviceLedgerController extends BaseController { /** * 导出设备台账列表 */ - @PreAuthorize("@ss.hasPermi('base:deviceLedger:export')" ) - @Log(title = "设备台账" , businessType = BusinessType.EXPORT) - @PostMapping("/export" ) + @PreAuthorize("@ss.hasPermi('base:deviceLedger:export')") + @Log(title = "设备台账", businessType = BusinessType.EXPORT) + @PostMapping("/export") public void export(HttpServletResponse response, BaseDeviceLedger baseDeviceLedger) { List list = baseDeviceLedgerService.selectBaseDeviceLedgerList(baseDeviceLedger); - ExcelUtil util = new ExcelUtil(BaseDeviceLedger. class); - util.exportExcel(response, list, "设备台账数据" ); + ExcelUtil util = new ExcelUtil(BaseDeviceLedger.class); + util.exportExcel(response, list, "设备台账数据"); } /** * 获取设备台账详细信息 */ - @PreAuthorize("@ss.hasPermi('base:deviceLedger:query')" ) - @GetMapping(value = "/{objId}" ) - public AjaxResult getInfo(@PathVariable("objId" ) Long objId) { + @PreAuthorize("@ss.hasPermi('base:deviceLedger:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { return success(baseDeviceLedgerService.selectBaseDeviceLedgerByObjId(objId)); } /** * 新增设备台账 */ - @PreAuthorize("@ss.hasPermi('base:deviceLedger:add')" ) - @Log(title = "设备台账" , businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('base:deviceLedger:add')") + @Log(title = "设备台账", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BaseDeviceLedger baseDeviceLedger) { baseDeviceLedger.setCreatedBy(getUsername()); @@ -82,8 +82,8 @@ public class BaseDeviceLedgerController extends BaseController { /** * 修改设备台账 */ - @PreAuthorize("@ss.hasPermi('base:deviceLedger:edit')" ) - @Log(title = "设备台账" , businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('base:deviceLedger:edit')") + @Log(title = "设备台账", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody BaseDeviceLedger baseDeviceLedger) { baseDeviceLedger.setUpdatedBy(getUsername()); @@ -94,10 +94,19 @@ public class BaseDeviceLedgerController extends BaseController { /** * 删除设备台账 */ - @PreAuthorize("@ss.hasPermi('base:deviceLedger:remove')" ) - @Log(title = "设备台账" , businessType = BusinessType.DELETE) - @DeleteMapping("/{objIds}" ) + @PreAuthorize("@ss.hasPermi('base:deviceLedger:remove')") + @Log(title = "设备台账", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") public AjaxResult remove(@PathVariable Long[] objIds) { return toAjax(baseDeviceLedgerService.deleteBaseDeviceLedgerByObjIds(objIds)); } + + /** + * 获取设备编号 + * @return + */ + @GetMapping("/getDeviceCode") + public AjaxResult getDeviceCode() { + return success(baseDeviceLedgerService.getDeviceCode()); + } } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseDeviceLedger.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseDeviceLedger.java index 5746911..98e5381 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/BaseDeviceLedger.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseDeviceLedger.java @@ -47,9 +47,9 @@ public class BaseDeviceLedger extends BaseEntity { private String deviceType; /** - * 设备位置 + * IP地址 */ - @Excel(name = "设备位置") + @Excel(name = "IP地址") private String deviceAddress; /** @@ -78,11 +78,16 @@ public class BaseDeviceLedger extends BaseEntity { private Date enableDate; /** - * 所属工位 + * 所属产线编号 */ - @Excel(name = "所属工位") 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") 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() { 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) { this.factoryName = factoryName; } diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/BaseDeviceLedgerMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/BaseDeviceLedgerMapper.java index 2d38520..32aa587 100644 --- a/aucma-base/src/main/java/com/aucma/base/mapper/BaseDeviceLedgerMapper.java +++ b/aucma-base/src/main/java/com/aucma/base/mapper/BaseDeviceLedgerMapper.java @@ -58,4 +58,10 @@ public interface BaseDeviceLedgerMapper * @return 结果 */ public int deleteBaseDeviceLedgerByObjIds(Long[] objIds); + + /** + * 获取设备编号 + * @return + */ + public String getDeviceCode(); } diff --git a/aucma-base/src/main/java/com/aucma/base/service/IBaseDeviceLedgerService.java b/aucma-base/src/main/java/com/aucma/base/service/IBaseDeviceLedgerService.java index 9ffbba9..db746e1 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/IBaseDeviceLedgerService.java +++ b/aucma-base/src/main/java/com/aucma/base/service/IBaseDeviceLedgerService.java @@ -58,4 +58,10 @@ public interface IBaseDeviceLedgerService * @return 结果 */ public int deleteBaseDeviceLedgerByObjId(Long objId); + + /** + * 获取设备编号 + * @return + */ + public String getDeviceCode(); } diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseDeviceLedgerServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseDeviceLedgerServiceImpl.java index 1597c44..9fd21ce 100644 --- a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseDeviceLedgerServiceImpl.java +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseDeviceLedgerServiceImpl.java @@ -90,4 +90,22 @@ public class BaseDeviceLedgerServiceImpl implements IBaseDeviceLedgerService { 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; + } + } diff --git a/aucma-base/src/main/resources/mapper/base/BaseDeviceLedgerMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseDeviceLedgerMapper.xml index ddce671..d03daf4 100644 --- a/aucma-base/src/main/resources/mapper/base/BaseDeviceLedgerMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/BaseDeviceLedgerMapper.xml @@ -23,109 +23,129 @@ + + + + - select obj_id, - device_code, - device_name, - device_model, - device_type, - device_address, - device_status, - used_department, - cost_center, - manufacturer, - enable_date, - product_line_code, - factory_code, - is_flag, - created_by, - created_time, - updated_by, - updated_time - from base_deviceledger + select dl.OBJ_ID, + dl.DEVICE_CODE, + dl.DEVICE_NAME, + dl.DEVICE_MODEL, + dl.DEVICE_TYPE, + dl.DEVICE_ADDRESS, + dl.DEVICE_STATUS, + dl.USED_DEPARTMENT, + dl.COST_CENTER, + dl.MANUFACTURER, + dl.ENABLE_DATE, + dl.PRODUCT_LINE_CODE, + dl.IS_FLAG, + dl.CREATED_BY, + dl.CREATED_TIME, + dl.UPDATED_BY, + dl.UPDATED_TIME, + dl.FACTORY_CODE, + 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 + - + SELECT seq_base_deviceledger.NEXTVAL as objId FROM DUAL insert into base_deviceledger obj_id, - device_code, + device_code, device_name, device_model, device_type, device_address, device_status, used_department, - product_line_code, cost_center, manufacturer, enable_date, - factory_code, + product_line_code, is_flag, created_by, created_time, updated_by, updated_time, + factory_code, + team_code, + asset_code, #{objId}, - #{deviceCode}, + #{deviceCode}, #{deviceName}, #{deviceModel}, #{deviceType}, #{deviceAddress}, #{deviceStatus}, #{usedDepartment}, - #{productLineCode}, #{costCenter}, #{manufacturer}, #{enableDate}, - #{factoryCode}, + #{productLineCode}, #{isFlag}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}, + #{factoryCode}, + #{teamCode}, + #{assetCode}, - + update base_deviceledger - device_code = #{deviceCode}, + device_code = #{deviceCode}, device_name = #{deviceName}, device_model = #{deviceModel}, device_type = #{deviceType}, @@ -136,12 +156,14 @@ manufacturer = #{manufacturer}, enable_date = #{enableDate}, product_line_code = #{productLineCode}, - factory_code = #{factoryCode}, is_flag = #{isFlag}, created_by = #{createdBy}, created_time = #{createdTime}, updated_by = #{updatedBy}, updated_time = #{updatedTime}, + factory_code = #{factoryCode}, + team_code = #{teamCode}, + asset_code = #{assetCode}, where obj_id = #{objId} diff --git a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml index bb0c875..e73419e 100644 --- a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml +++ b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml @@ -192,26 +192,28 @@ ORDER BY DEFECT_NUMBER DESC