Commit 80ef1525 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents 6a702e44 ea99567f
package com.baosight.hggp.core.enums;
/**
* @author:songx
* @date:2024/3/1,17:29
*/
public enum DeleteFlagEnum {
UN_REMOVE(0, "未删除"),
REMOVE(1, "已删除"),
;
private Integer code;
private String name;
DeleteFlagEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG001 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class);
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验
this.checkSaveData(fCg001s, dbCg001Map);
// 保存数据
this.saveData(fCg001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001s
* @param dbCg001Map
*/
private void checkSaveData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurQty(), String.format("计划[%s]采购数量必须大于0", planNo));
AssertUtils.isGe(BigDecimal.ZERO, fCg001.getPurWeight(), String.format("计划[%s]采购重量必须大于0", planNo));
}
}
/**
* 数据保存
*
* @param fCg001s
*/
private void saveData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_PUR, fCg001);
}
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class);
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验
this.checkRemoveData(fCg001s, dbCg001Map);
// 保存数据
this.removeData(fCg001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001s
* @param dbCg001Map
*/
private void checkRemoveData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
}
}
/**
* 数据保存
*
* @param fCg001s
*/
private void removeData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
fCg001.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG001.DELETE, fCg001);
}
}
/**
* 提交操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "保存")
public EiInfo submit(EiInfo inInfo) {
try {
List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class);
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验
this.checkSubmitData(fCg001s, dbCg001Map);
// 提交数据
this.submitData(fCg001s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001s
* @param dbCg001Map
*/
private void checkSubmitData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"待审核\",不允许操作", planNo));
AssertUtils.isGe(BigDecimal.ZERO, dbCg001.getPurQty(), String.format("计划[%s]采购数量必须大于0", planNo));
AssertUtils.isGe(BigDecimal.ZERO, dbCg001.getPurWeight(), String.format("计划[%s]采购重量必须大于0", planNo));
}
}
/**
* 提交数据
*
* @param fCg001s
*/
private void submitData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
fCg001.setStatus(HGConstant.planStatus.S_1);
fCg001.setAuditTime(DateUtils.shortDateTime());
fCg001.setAuditUserId(UserSessionUtils.getLoginName());
fCg001.setAuditUserName(UserSessionUtils.getLoginCName());
fCg001.setAuditReason("");
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_AUDIT, fCg001);
}
}
/**
* 锁并且获取数据
*
* @param fCg001s
* @return
*/
private Map<String, HGCG001> lockGetData(List<HGCG001> fCg001s) {
// 计划号
List<String> planNos = ObjectUtils.listEpKey(fCg001s, HGCG001.FIELD_PLAN_NO);
// 锁
HGCGTools.HgCg001.lock(planNos);
// db数据
return HGCGTools.HgCg001.map(planNos);
}
}
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG002 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购合同", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg002.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG002.QUERY, new HGCG002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
// 数据校验
this.checkSaveData(fCg002s, dbCg002Map);
// 保存数据
this.saveData(fCg002s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
*/
private void checkSaveData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_0, fCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
/**
* 数据保存
*
* @param fCg002s
*/
private void saveData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, fCg002);
}
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
// 数据校验
this.checkRemoveData(fCg002s, dbCg002Map);
// 保存数据
this.removeData(fCg002s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
*/
private void checkRemoveData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.contractStatus.S_0, fCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
/**
* 数据保存
*
* @param fCg002s
*/
private void removeData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) {
fCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, fCg002);
}
}
/**
* 提交操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "保存")
public EiInfo submit(EiInfo inInfo) {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002> dbCg002Map = this.lockGetData(fCg002s);
// 数据校验
this.checkSubmitData(fCg002s, dbCg002Map);
// 提交数据
this.submitData(fCg002s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002s.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg002s
* @param dbCg002Map
*/
private void checkSubmitData(List<HGCG002> fCg002s, Map<String, HGCG002> dbCg002Map) {
for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002Map.get(contractNo);
AssertUtils.isNull(dbCg002, String.format("合同[%s]不存在", contractNo));
AssertUtils.isNotEquals(HGConstant.contractStatus.S_0, dbCg002.getStatus(),
String.format("合同[%s]状态不是\"待审核\",不允许操作", contractNo));
}
}
/**
* 提交数据
*
* @param fCg002s
*/
private void submitData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) {
fCg002.setStatus(HGConstant.contractStatus.S_1);
fCg002.setAuditTime(DateUtils.shortDateTime());
fCg002.setAuditUserId(UserSessionUtils.getLoginName());
fCg002.setAuditUserName(UserSessionUtils.getLoginCName());
fCg002.setAuditReason("");
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_AUDIT, fCg002);
}
}
/**
* 锁并且获取数据
*
* @param fCg002s
* @return
*/
private Map<String, HGCG002> lockGetData(List<HGCG002> fCg002s) {
// 合同号
List<String> contractNos = ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO);
// 锁
HGCGTools.HgCg002.lock(contractNos);
// db数据
return HGCGTools.HgCg002.map(contractNos);
}
}
package com.baosight.hggp.hg.cg.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG002A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
// 仅审核通过
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.planStatus.S_1);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class);
// db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s);
// 数据校验
this.checkSaveData(fCg001s, dbCg001Map);
// 保存数据
this.confirmData(resultRows, dbCg001Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg001s
* @param dbCg001Map
*/
private void checkSaveData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) {
for (HGCG001 fCg001 : fCg001s) {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.planStatus.S_1, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"审核通过\",不允许操作", planNo));
}
}
/**
* 数据保存
*
* @param resultRows
* @param dbCg001Map
*/
private void confirmData(List<Map> resultRows, Map<String, HGCG001> dbCg001Map) {
for (Map resultRow : resultRows) {
String planNo = MapUtils.getString(resultRow, HGCG001.FIELD_PLAN_NO);
String supCode = MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE);
String supName = MapUtils.getString(resultRow, HGCG002.FIELD_SUP_NAME);
String purUserName = MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME);
HGCG002 newCg002 = BeanUtils.copy(dbCg001Map.get(planNo), HGCG002.class);
newCg002.setSupCode(supCode);
newCg002.setSupName(supName);
newCg002.setPurUserName(purUserName);
newCg002.setStatus(HGConstant.contractStatus.S_0);
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG002.INSERT, newCg002);
}
}
/**
* 锁并且获取数据
*
* @param fCg001s
* @return
*/
private Map<String, HGCG001> lockGetData(List<HGCG001> fCg001s) {
// 计划号
List<String> planNos = ObjectUtils.listEpKey(fCg001s, HGCG001.FIELD_PLAN_NO);
// 锁
HGCGTools.HgCg001.lock(planNos);
// db数据
return HGCGTools.HgCg001.map(planNos);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGCG001">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PLAN_DATE as "planDate", <!-- 计划日期 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
LENGTH as "length", <!-- 长度 -->
PLAN_WEIGHT as "planWeight", <!-- 计划重量 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
AUDIT_USER_NAME as "auditUserName", <!-- 审核人名称 -->
AUDIT_REASON as "auditReason" <!-- 审核原因 -->
</sql>
<sql id="authCondition">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planDate">
PLAN_DATE = #planDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditUserId">
AUDIT_USER_ID = #auditUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditUserName">
AUDIT_USER_NAME = #auditUserName#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="planNo">
PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNos">
PLAN_NO IN <iterate open="(" close=")" conjunction="," property="planNos">#planNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGCG001
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCG001 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGCG001 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
PLAN_DATE, <!-- 计划日期 -->
PLAN_NO, <!-- 计划单号 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
LENGTH, <!-- 长度 -->
PLAN_WEIGHT, <!-- 计划重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#companyCode#, #companyName#, #planDate#, #planNo#, #inventCode#, #inventName#,
#spec#, #material#, #length#, #planWeight#, #status#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGCG001
SET
DELETE_FLAG = #deleteFlag#,
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
</delete>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGCG001
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改采购信息 -->
<update id="updatePur">
UPDATE ${hggpSchema}.HGCG001
SET
PUR_QTY = #purQty#, <!-- 采购数量 -->
PUR_WEIGHT = #purWeight#, <!-- 采购重量 -->
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
</update>
<!-- 修改审核信息 -->
<update id="updateAudit">
UPDATE ${hggpSchema}.HGCG001
SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME = #auditTime#, <!-- 审核时间 -->
AUDIT_USER_ID = #auditUserId#, <!-- 审核人ID -->
AUDIT_USER_NAME = #auditUserName#, <!-- 审核人名称 -->
AUDIT_REASON = #auditReason#, <!-- 审核原因 -->
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGCG002">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
CONTRACT_DATE as "contractDate", <!-- 合同日期 -->
CONTRACT_NO as "contractNo", <!-- 合同号 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
SUP_CODE as "supCode", <!-- 供应商编码 -->
SUP_NAME as "supName", <!-- 供应商名称 -->
PUR_USER_ID as "purUserId", <!-- 采购员 -->
PUR_USER_NAME as "purUserName", <!-- 采购员名称 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
LENGTH as "length", <!-- 长度 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
AUDIT_USER_NAME as "auditUserName", <!-- 审核人名称 -->
AUDIT_REASON as "auditReason" <!-- 审核原因 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractDate">
CONTRACT_DATE = #contractDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
SUP_CODE = #supCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
SUP_NAME = #supName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserId">
PUR_USER_ID = #purUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserName">
PUR_USER_NAME = #purUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purQty">
PUR_QTY = #purQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purWeight">
PUR_WEIGHT = #purWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditTime">
AUDIT_TIME = #auditTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditUserId">
AUDIT_USER_ID = #auditUserId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditUserName">
AUDIT_USER_NAME = #auditUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditReason">
AUDIT_REASON = #auditReason#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO = #contractNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNos">
CONTRACT_NO IN <iterate open="(" close=")" conjunction="," property="contractNos">#contractNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGCG002 WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCG002 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGCG002 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
CONTRACT_DATE, <!-- 合同日期 -->
CONTRACT_NO, <!-- 合同号 -->
PLAN_NO, <!-- 计划单号 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
LENGTH, <!-- 长度 -->
PUR_QTY, <!-- 采购数量 -->
PUR_WEIGHT, <!-- 采购重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #contractDate#, #contractNo#, #planNo#,
#inventCode#, #inventName#, #spec#, #material#, #length#,
#purQty#, #purWeight#, #status#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGCG002
SET
DELETE_FLAG = #deleteFlag#,
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</delete>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGCG002
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
<!-- 修改审核信息 -->
<update id="updateAudit">
UPDATE ${hggpSchema}.HGCG002
SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME = #auditTime#, <!-- 审核时间 -->
AUDIT_USER_ID = #auditUserId#, <!-- 审核人ID -->
AUDIT_USER_NAME = #auditUserName#, <!-- 审核人名称 -->
AUDIT_REASON = #auditReason#, <!-- 审核原因 -->
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
</sqlMap>
package com.baosight.hggp.hg.cg.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/5/9,14:33
*/
public class HGCGTools {
/**
* HGCG001 工具类
*
* @author:songx
* @date:2024/5/9,14:33
*/
public static class HgCg001 {
/**
* 锁
*
* @param planNos
* @return
*/
public static void lock(List<String> planNos) {
if (CollectionUtils.isEmpty(planNos)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("planNos", planNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg001.LOCK, paramMap);
}
/**
* 查询
*
* @param planNos
* @return
*/
public static List<HGCG001> list(List<String> planNos) {
AssertUtils.isEmpty(planNos, "计划号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("planNos", planNos);
return DaoBase.getInstance().query(HGCG001.QUERY, paramMap);
}
/**
* 查询
*
* @param planNos
* @return
*/
public static Map<String, HGCG001> map(List<String> planNos) {
List<HGCG001> results = list(planNos);
return results.stream().collect(Collectors.toMap(HGCG001::getPlanNo, item -> item));
}
}
/**
* HGCG002 工具类
*
* @author:songx
* @date:2024/5/9,14:33
*/
public static class HgCg002 {
/**
* 锁
*
* @param contractNos
* @return
*/
public static void lock(List<String> contractNos) {
if (CollectionUtils.isEmpty(contractNos)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("contractNos", contractNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg002.LOCK, paramMap);
}
/**
* 查询
*
* @param contractNos
* @return
*/
public static List<HGCG002> list(List<String> contractNos) {
AssertUtils.isEmpty(contractNos, "计划号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("contractNos", contractNos);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
}
/**
* 查询
*
* @param contractNos
* @return
*/
public static Map<String, HGCG002> map(List<String> contractNos) {
List<HGCG002> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002::getContractNo, item -> item));
}
}
}
package com.baosight.hggp.hg.cg.utils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,13:50
*/
public class HgCgUtils {
/**
* 设置查询条件
*
* @param queryRow
*/
public static void setCondition(Map queryRow) {
// 创建时间
String createdTimeFrom = MapUtils.getString(queryRow, "createdTimeFrom");
if (StringUtils.isNotBlank(createdTimeFrom)) {
queryRow.put("createdTimeFrom", DateUtils.formatShort(createdTimeFrom));
}
String createdTimeTo = MapUtils.getString(queryRow, "createdTimeTo");
if (StringUtils.isNotBlank(createdTimeTo)) {
queryRow.put("createdTimeTo", DateUtils.formatShort(createdTimeTo));
}
}
/**
* HGCG001 工具类
*
* @author:songx
* @date:2024/5/9,16:57
*/
public static class HgCg001 {
/**
* 设置查询条件
*
* @param queryRow 集合
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
// 计划日期
String planDate = MapUtils.getString(queryRow, HGCG001.FIELD_PLAN_DATE);
if (StringUtils.isNotBlank(planDate)) {
queryRow.put(HGCG001.FIELD_PLAN_DATE, DateUtils.formatShort(planDate));
}
}
}
/**
* HGCG002 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgCg002 {
/**
* 设置查询条件
*
* @param queryRow 集合
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
// 合同日期
String contractDate = MapUtils.getString(queryRow, HGCG002.FIELD_CONTRACT_DATE);
if (StringUtils.isNotBlank(contractDate)) {
queryRow.put(HGCG002.FIELD_CONTRACT_DATE, DateUtils.formatShort(contractDate));
}
}
}
}
......@@ -12,7 +12,7 @@ public class HGConstant {
* @author:songx
* @date:2021/8/17,15:22
*/
public class SequenceId {
public static class SequenceId {
// 用户ID
public static final String USER_ID = "USER_ID";
......@@ -85,36 +85,56 @@ public class HGConstant {
public static final String DEVICE_CODE = "DEVICE_CODE";
//计划单号
public static final String PLAN_CODE = "PLAN_CODE";
// 计划号
public static final String PLAN_NO = "PLAN_NO";
}
/**
* 库存类型
* 计划状态
*
* @author:songx
* @date:2024/1/20,15:18
* @date:2024/2/22,13:57
*/
public class KcType {
public static class planStatus {
// 采购
public static final String CG = "CG";
// 生产
public static final String SC = "SC";
// 其他
public static final String QT = "QT";
// 待审核
public static final Integer S_0 = 0;
// 审核通过
public static final Integer S_1 = 1;
// 审核拒绝
public static final Integer S_2 = 2;
}
/**
* 计划状态常量
* 合同状态
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class planStatus {
public static class contractStatus {
// 计划中
// 待审核
public static final Integer S_0 = 0;
// 生产中
// 审核通过
public static final Integer S_1 = 1;
// 审核拒绝
public static final Integer S_2 = 2;
}
/**
* 库存类型
*
* @author:songx
* @date:2024/1/20,15:18
*/
public static class KcType {
// 采购
public static final String CG = "CG";
// 生产
public static final String SC = "SC";
// 其他
public static final String QT = "QT";
}
}
......@@ -25,6 +25,24 @@ public class HGSqlConstant {
}
/**
* HGCG002 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgCg002 {
// 模块名称
private static final String MODULE_NAME = "HGCG002.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
// 修改采购信息
public static final String UPDATE_PUR = MODULE_NAME + "updatePur";
// 修改审核信息
public static final String UPDATE_AUDIT = MODULE_NAME + "updateAudit";
}
/**
* HPKC001 SQL 定义
*
* @author:songx
......
......@@ -162,4 +162,41 @@ public class AssertUtils {
}
}
/**
* A大于等于B
*
* @param a
* @param b
*/
public static void isGe(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) > -1) {
throw new PlatException(message);
}
}
/**
* bool is true
*
* @param a
* @param b
* @param message
*/
public static void isEquals(Object a, Object b, String message) {
if (a == null || a.equals(b)) {
throw new PlatException(message);
}
}
/**
* bool is true
*
* @param a
* @param b
* @param message
*/
public static void isNotEquals(Object a, Object b, String message) {
if (a == null || !a.equals(b)) {
throw new PlatException(message);
}
}
}
package com.baosight.hggp.util;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
......@@ -9,11 +13,15 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* @author:songx
* @date:2021/7/24,14:45
*/
@Slf4j
public class MapUtils extends org.apache.commons.collections.MapUtils {
/**
......@@ -148,4 +156,51 @@ public class MapUtils extends org.apache.commons.collections.MapUtils {
return resultMap;
}
/**
* map 转 DaoEPBase
*
* @param inInfo
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(EiInfo inInfo, Class<T> clazz) {
return toDaoEPBase(inInfo, EiConstant.resultBlock, clazz);
}
/**
* map 转 DaoEPBase
*
* @param inInfo
* @param blockId
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(EiInfo inInfo, String blockId, Class<T> clazz) {
List<Map> rows = inInfo.getBlock(blockId).getRows();
return toDaoEPBase(rows, clazz);
}
/**
* map 转 DaoEPBase
*
* @param maps
* @param clazz
* @param <T>
*/
public static <T extends DaoEPBase> List<T> toDaoEPBase(List<Map> maps, Class<T> clazz) {
if (CollectionUtils.isEmpty(maps) || clazz == null) {
return null;
}
return maps.stream().map(row -> {
T newBean = null;
try {
newBean = clazz.newInstance();
newBean.fromMap(row);
} catch (Exception e) {
log.error("class new instance fail:{}", e.getMessage(), e);
}
return newBean;
}).filter(t -> t != null).collect(Collectors.toList());
}
}
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [{
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}],
loadComplete: function (grid) {
// 提交
$(document.body).on("click", "#SUBMIT", submit);
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['purQty'])) {
message("勾选的第" + (i + 1) + "行采购数量必须是大于0的数字");
return;
}
if (!isPositiveNumber(rows[i]['purWeight'])) {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "remove", true);
}
});
}
/**
* 提交
*/
let submit = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "submit", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ 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:EFDatePicker cname="计划日期" blockId="inqu_status" ename="planDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center"
hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [{
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}],
loadComplete: function (grid) {
// 提交
$(document.body).on("click", "#SUBMIT", submit);
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 选择计划
$("#SELECT_PLAN").on("click", selectPlan);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['purQty'])) {
message("勾选的第" + (i + 1) + "行采购数量必须是大于0的数字");
return;
}
if (!isPositiveNumber(rows[i]['purWeight'])) {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "remove", true);
}
});
}
/**
* 提交
*/
let submit = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "submit", true);
}
});
}
/**
* 选择计划
*/
let selectPlan = function () {
JSColorbox.open({
href: "HGCG002A?methodName=initLoad",
title: "<div style='text-align: center;'>计划查询</div>",
width: "80%",
height: "70%",
callbackName: selectPlanCallback
});
}
/**
* 选择计划回调
*/
let selectPlanCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ 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:EFDatePicker cname="计划日期" blockId="inqu_status" ename="contractDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="合同号" blockId="inqu_status" ename="contractNo" row="0" colWidth="3"/>
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: []
}
}
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购合同\"吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002A", "confirm",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ 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="查询区域" type="query">
<div class="row">
<EF:EFDatePicker cname="计划日期" blockId="inqu_status" ename="planDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center"
hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -33,7 +33,7 @@
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账号和密码与企业编码相同</span>
<span style='color: red;font-size: 13px;'>说明:新增企业时会同步新增企业管理员账户,账户=登录前缀0000,例如:登录前缀是HG,初始账账户就是HG0000,密码与账账户相同</span></br>
</EF:EFRegion>
</EF:EFPage>
......
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