Commit f2148a0d by liuyang

2024-05-09 设备台账

parent 8093bed5
package com.baosight.hggp.common;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import java.util.HashMap;
import java.util.Map;
......@@ -156,7 +159,19 @@ public enum DdynamicEnum {
* 用途:工序编码下拉框
* 编写:ly
*/
PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode")
PROCESS_CODE_BLOCK_ID("processCode_block_id","processCode","processName","factoryCode","factoryName","unit","HGSJ001.queryProcessCode"),
/**
* 模块:工序编码
* 用途:工序编码下拉框
* 编写:ly
*/
GROUP_CODE_BOX_BLOCK_ID("groupCodeBox_block_id","orgEname","orgCname","factoryCode","factoryName","companyCode","companyName","HGSB001.queryGroupCodeBox",
new HashMap<String,Object>(){{
put(HGSB001.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
put(HGSB001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
put("orgTypes",new String[]{OrgTypeEnum.COMPANY.getCode(),OrgTypeEnum.FACTORY.getCode()});
}}
),
;
......
......@@ -81,6 +81,10 @@ public class HGConstant {
public static final String PROCESS_CODE = "PROCESS_CODE";
//工艺流程编码
public static final String FLOW_CODE = "FLOW_CODE";
//设备编码
public static final String DEVICE_CODE = "DEVICE_CODE";
//计划单号
public static final String PLAN_CODE = "PLAN_CODE";
}
/**
......
package com.baosight.hggp.hg.sb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sb.domain.HGSB001;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/5/9
*/
public class ServiceHGSB001 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSB001.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
inInfo = super.query(inInfo, HGSB001.QUERY, new HGSB001());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.GROUP_CODE_BOX_BLOCK_ID),null
);
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
block.setCell(ACConstants.ROW_CODE_0, HGSB001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
String purchaseDate = block.getCellStr(ACConstants.ROW_CODE_0,HGSB001.FIELD_PURCHASE_DATE);
if (!purchaseDate.isEmpty()) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGSB001.FIELD_PURCHASE_DATE,StringUtil.removeHorizontalLine(purchaseDate));
}
return super.query(inInfo,HGSB001.QUERY,new HGSB001());
}
@OperationLogAnnotation(operModul = "设备台账",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGSB001 hgsb001 = new HGSB001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb001.fromMap(map);
hgsb001.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSB001.DELETE_FLAG, hgsb001.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleDeleteException(inInfo,i,e);
logError("删除失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 保存操作
*/
@OperationLogAnnotation(operModul = "设备台账",operType = "保存",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSB001 hgsb001 = new HGSB001();
hgsb001.fromMap(resultRows.get(i));
if (hgsb001.getId() == null || hgsb001.getId() == 0) {
this.add(hgsb001);
} else {
this.modify(hgsb001);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGSB001 hgsb001) {
queryDeviceCode(hgsb001);
//生成工序编码
//hgsb001.setDeviceCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.DEVICE_CODE));
DaoUtils.insert(HGSB001.INSERT, hgsb001);
}
/**
* 修改操作
*/
public void modify(HGSB001 hgsb001) {
DaoUtils.update(HGSB001.UPDATE, hgsb001);
}
@OperationLogAnnotation(operModul = "设备台账",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGSB001 hgsb001 = new HGSB001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsb001.fromMap(map);
DaoUtils.update(HGSB001.UPDATE_STATUS, hgsb001);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
public void queryDeviceCode(HGSB001 hgsb001){
Map<String,Object> map = new HashMap<>();
//map.put(HPSB003.FIELD_FACTORY_CODE,hpsb001.getFactoryCode());
map.put("deviceCodeStr",hgsb001.getDeviceCode());
map.put(HGSB001.FIELD_DELETE_FLAG,hgsb001.getDeleteFlag());
List<HGSB001> hpsb003List = this.dao.query(HGSB001.QUERY,map);
AssertUtils.isNotEmpty(hpsb003List, String.format("设备编码[%s]已存在,添加失败!", hgsb001.getDeviceCode()));
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/9
Time: 15:01
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="设备台账">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="groupName" cname="设备区域" colWidth="3"/>
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="groupCode" cname="设备区域" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>--%>
<EF:EFSelect blockId="inqu_status" row="0" ename="deviceType" cname="设备类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="purchaseDate" cname="购置日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceCode" cname="设备编码" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="账套" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="设备区域"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="groupCodeBox_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceType" cname="设备类型"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="80" readonly="true" required="true"
align="center" filter="contains" sort="true">
<EF:EFCodeOption codeName="hpjx.hpsb.deviceType" />
</EF:EFComboColumn>
<EF:EFColumn ename="deviceCode" cname="设备编码" width="100" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="deviceName" cname="设备名称" width="160" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="deviceModel" cname="设备型号" width="120" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="purchaseDate" cname="购置日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="maintainDate" cname="保养日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFComboColumn ename="deviceUserId" cname="设备负责人"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="100" readonly="false" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="deviceStatus" cname="设备状态" width="80" align="center" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="100" readonly="true" required="false"
enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -447,6 +447,31 @@ function downKeyUp() {
}
const grush = {
initDropDownBox(carrierId, initBlockId, template) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
}
if (!$(carrierId).get(0)) {
throw new Error(
`装载数据的载体元素不存在, 找不到元素ID为{${carrierId}}的元素, 请去前端页面查看...`);
}
if (!__eiInfo.getBlock(initBlockId)) {
throw new Error(
`名称为{${initBlockId}的块不存在, 请查看后端初始化方法或前端页面EF:EFComboColumn标签的blockName属性...`);
}
$(carrierId).kendoAutoComplete({
dataSource: __eiInfo.getBlock(initBlockId).getMappedRows(),
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:valueField#-#:textField#",
valueTemplate: "#:valueField#-#:textField#",
template: "#:textField#",
filter: "contains"
});
},
openImportBox(importBoxDomId) {
if (!($ || jQuery)) {
throw new Error('jQuery引入失败...找不到对外暴露的$和jQuery');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment