Commit 1d319492 by yukang

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/webapp/HP/KC/HPKC004.js
parents 14a1f6b1 60682ab7
package com.baosight.hpjx.common;
import com.baosight.iplat4j.core.ei.EiBlock;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author jhs
* @Date 2024/1/22 18:23
*/
public enum ApprovalStatusEnum {
SAVED(1,"保存"),
SUBMIT(2,"已提交"),
APPROVED(3,"审批通过"),
REJECTION(4,"审批拒绝");
private Integer code;
private String value;
ApprovalStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static EiBlock generatorEiBlock(){
EiBlock block = new EiBlock("approval_status_block_id");
List<Map<String,Object>> rows = new ArrayList<Map<String,Object>>(){{
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,SAVED.code);
put(HPConstants.VALUE_FIELD,SAVED.value);
}});
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,SUBMIT.code);
put(HPConstants.VALUE_FIELD,SUBMIT.value);
}});
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,APPROVED.code);
put(HPConstants.VALUE_FIELD,APPROVED.value);
}});
add(new HashMap<String,Object>(){{
put(HPConstants.TEXT_FIELD,REJECTION.code);
put(HPConstants.VALUE_FIELD,REJECTION.value);
}});
}};
block.setRows(rows);
return block;
}
}
...@@ -46,6 +46,13 @@ public enum DdynamicEnum { ...@@ -46,6 +46,13 @@ public enum DdynamicEnum {
/** /**
* 模块:存货档案 * 模块:存货档案
* 用途:存货档案下拉框 * 用途:存货档案下拉框
* 编写:jhs
*/
MATERIAL_RECORD_BLOCK_ID("material_record_block_id","inventCode","inventName","HPPZ006.queryMaterialComboBox"),
/**
* 模块:存货档案
* 用途:存货档案下拉框
* 编写:wwl * 编写:wwl
*/ */
INVENT_SPEC_BLOCK_ID("invent_spec_block_id","spec","spec","HPPZ006.queryComboBoxSpec"), INVENT_SPEC_BLOCK_ID("invent_spec_block_id","spec","spec","HPPZ006.queryComboBoxSpec"),
......
...@@ -26,6 +26,27 @@ public enum InventTypeEnun { ...@@ -26,6 +26,27 @@ public enum InventTypeEnun {
this.value = value; this.value = value;
} }
public static String getNameByCode(String code){
String returnName = "";
switch (code){
case "1":
returnName = MATERIAL.value;
break;
case "2":
returnName = CONSUMABLE.value;
break;
case "3":
returnName = SEMI_FINISHED_PRODUCT.value;
break;
case "4":
returnName = FINISHED_PRODUCT.value;
break;
default:
break;
}
return returnName;
};
public Integer getCode() { public Integer getCode() {
return code; return code;
} }
...@@ -46,20 +67,20 @@ public enum InventTypeEnun { ...@@ -46,20 +67,20 @@ public enum InventTypeEnun {
EiBlock block = new EiBlock("customer_type_block_id"); EiBlock block = new EiBlock("customer_type_block_id");
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{ List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>() {{
add(new HashMap<String, Object>() {{ add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, MATERIAL.code); put(HPConstants.TEXT_FIELD, MATERIAL.code + HPConstants.SPLICING_SYMBOL + MATERIAL.value);
put(HPConstants.VALUE_FIELD, MATERIAL.value); put(HPConstants.VALUE_FIELD, MATERIAL.code);
}}); }});
add(new HashMap<String, Object>() {{ add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, CONSUMABLE.code); put(HPConstants.TEXT_FIELD, CONSUMABLE.code + HPConstants.SPLICING_SYMBOL + CONSUMABLE.value);
put(HPConstants.VALUE_FIELD, CONSUMABLE.value); put(HPConstants.VALUE_FIELD, CONSUMABLE.code);
}}); }});
add(new HashMap<String, Object>() {{ add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, SEMI_FINISHED_PRODUCT.code); put(HPConstants.TEXT_FIELD, SEMI_FINISHED_PRODUCT.code + HPConstants.SPLICING_SYMBOL + SEMI_FINISHED_PRODUCT.value);
put(HPConstants.VALUE_FIELD, SEMI_FINISHED_PRODUCT.value); put(HPConstants.VALUE_FIELD, SEMI_FINISHED_PRODUCT.code);
}}); }});
add(new HashMap<String, Object>() {{ add(new HashMap<String, Object>() {{
put(HPConstants.TEXT_FIELD, FINISHED_PRODUCT.code); put(HPConstants.TEXT_FIELD, FINISHED_PRODUCT.code + HPConstants.SPLICING_SYMBOL + FINISHED_PRODUCT.value);
put(HPConstants.VALUE_FIELD, FINISHED_PRODUCT.value); put(HPConstants.VALUE_FIELD, FINISHED_PRODUCT.code);
}}); }});
}}; }};
block.setRows(rows); block.setRows(rows);
......
package com.baosight.hpjx.core.dao; package com.baosight.hpjx.core.dao;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils; import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
...@@ -103,6 +105,24 @@ public class DaoUtils { ...@@ -103,6 +105,24 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
try {
BeanUtils.setProperty(bean, "depCode", HPXSUserTools.getOrgId());
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime()); BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime());
...@@ -141,6 +161,24 @@ public class DaoUtils { ...@@ -141,6 +161,24 @@ public class DaoUtils {
} }
map.put("createdName", userName); map.put("createdName", userName);
map.put("updatedName", ""); map.put("updatedName", "");
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
map.put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
try {
map.put("depCode", HPXSUserTools.getOrgId());
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
map.put("createdTime", DateUtils.shortDateTime()); map.put("createdTime", DateUtils.shortDateTime());
......
...@@ -20,6 +20,22 @@ public class HPConstant { ...@@ -20,6 +20,22 @@ public class HPConstant {
public static final String HPKC008_NUMBER = "HPKC008_NUMBER"; public static final String HPKC008_NUMBER = "HPKC008_NUMBER";
// 巡检单号 // 巡检单号
public static final String HPZL001_NUMBER = "HPZL001_NUMBER"; public static final String HPZL001_NUMBER = "HPZL001_NUMBER";
//采购入库单号
public static final String HPKC001_NUMBER = "HPKC001_NUMBER";
//生产领料单号
public static final String HPKC002_NUMBER = "HPKC002_NUMBER";
// 生产入库单号
public static final String HPKC003_PROD_NO = "HPKC003_PROD_NO";
// 生产销售单号
public static final String HPKC004_SALE_NO = "HPKC004_SALE_NO";
// 供应商编码
public static final String HPPZ002_CUST_CODE = "HPPZ002_CUST_CODE";
// 客户编码
public static final String HPPZ003_CUST_CODE = "HPPZ003_CUST_CODE";
// 存货编码
public static final String INVENT_CODE = "INVENT_CODE";
// 仓库编码
public static final String WH_CODE = "WH_CODE";
} }
/** /**
......
...@@ -42,7 +42,7 @@ public class HPKC001 extends DaoEPBase { ...@@ -42,7 +42,7 @@ public class HPKC001 extends DaoEPBase {
private Long quantity = 0L; /* 数量*/ private Long quantity = 0L; /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/ private BigDecimal weight = new BigDecimal("0"); /* 重量*/
private String remarks = " "; /* 备注*/ private String remarks = " "; /* 备注*/
private int approvalStatus; /* 审批状态:0-未审核,1-已审核*/ private int approvalStatus; /* 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝*/
private String custCode = " "; /* 供应商编码*/ private String custCode = " "; /* 供应商编码*/
private String custName = " "; /* 供应商名称*/ private String custName = " "; /* 供应商名称*/
...@@ -151,7 +151,7 @@ EiColumn eiColumn; ...@@ -151,7 +151,7 @@ EiColumn eiColumn;
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("approvalStatus"); eiColumn = new EiColumn("approvalStatus");
eiColumn.setDescName("审批状态:0-未审核,1-已审核"); eiColumn.setDescName("审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCode"); eiColumn = new EiColumn("custCode");
......
...@@ -42,7 +42,7 @@ public class HPKC002 extends DaoEPBase { ...@@ -42,7 +42,7 @@ public class HPKC002 extends DaoEPBase {
private Long quantity = 0L; /* 数量*/ private Long quantity = 0L; /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/ private BigDecimal weight = new BigDecimal("0"); /* 重量*/
private String remarks = " "; /* 备注*/ private String remarks = " "; /* 备注*/
private int approvalStatus; /* 审批状态:0-未审核,1-已审核*/ private int approvalStatus; /* 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝*/
private String custCode = " "; /* 供应商编码*/ private String custCode = " "; /* 供应商编码*/
private String custName = " "; /* 供应商名称*/ private String custName = " "; /* 供应商名称*/
...@@ -151,7 +151,7 @@ public class HPKC002 extends DaoEPBase { ...@@ -151,7 +151,7 @@ public class HPKC002 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("approvalStatus"); eiColumn = new EiColumn("approvalStatus");
eiColumn.setDescName("审批状态:0-未审核,1-已审核"); eiColumn.setDescName("审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCode"); eiColumn = new EiColumn("custCode");
......
...@@ -70,11 +70,11 @@ public class HPKC005 extends DaoEPBase { ...@@ -70,11 +70,11 @@ public class HPKC005 extends DaoEPBase {
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/ public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/ public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String QUERY = "t_hpkc005.query"; public static final String QUERY = "HPKC005.query";
public static final String COUNT = "t_hpkc005.count"; public static final String COUNT = "HPKC005.count";
public static final String INSERT = "t_hpkc005.insert"; public static final String INSERT = "HPKC005.insert";
public static final String UPDATE = "t_hpkc005.update"; public static final String UPDATE = "HPKC005.update";
public static final String DELETE = "t_hpkc005.delete"; public static final String DELETE = "HPKC005.delete";
private Long id = new Long(0); private Long id = new Long(0);
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
......
...@@ -84,7 +84,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -84,7 +84,7 @@ public class HPKC009 extends DaoEPBase {
private String dateProc = " "; /* 日期*/ private String dateProc = " "; /* 日期*/
private String whCode = " "; /* 仓库编码*/ private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/ private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/ private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
...@@ -380,7 +380,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -380,7 +380,7 @@ public class HPKC009 extends DaoEPBase {
* get the inventType - 存货类型. * get the inventType - 存货类型.
* @return the inventType * @return the inventType
*/ */
public String getInventType() { public Integer getInventType() {
return this.inventType; return this.inventType;
} }
...@@ -389,7 +389,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -389,7 +389,7 @@ public class HPKC009 extends DaoEPBase {
* *
* @param inventType - 存货类型 * @param inventType - 存货类型
*/ */
public void setInventType(String inventType) { public void setInventType(Integer inventType) {
this.inventType = inventType; this.inventType = inventType;
} }
/** /**
...@@ -680,7 +680,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -680,7 +680,7 @@ public class HPKC009 extends DaoEPBase {
setDateProc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DATE_PROC)), dateProc)); setDateProc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DATE_PROC)), dateProc));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode)); setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName)); setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec)); setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
......
...@@ -2,19 +2,22 @@ package com.baosight.hpjx.hp.kc.service; ...@@ -2,19 +2,22 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.common.InventTypeEnun;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002; import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.Arrays; import java.util.*;
import java.util.Map;
/** /**
* @author YK * @author YK
...@@ -27,17 +30,17 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -27,17 +30,17 @@ public class ServiceHPKC002 extends ServiceBase {
*/ */
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC002 HPKC002 = new HPKC002(); try {
EiInfo outInfo = super.initLoad(inInfo, HPKC002); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC002().eiMetadata);
EiBlock block = outInfo.addBlock(EiConstant.queryBlock); inInfo.setBlock(InventTypeEnun.generatorEiBlock());
block.setCell(ACConstants.ROW_CODE_0, ACConstants.PARAM_WH_CODE, outInfo.getBlock(ACConstants.WH_CODE_BLOCK_ID).getRow(ACConstants.ROW_CODE_0).get(ACConstants.FIELD_VALUE)); } catch (PlatException e) {
block.setCell(ACConstants.ROW_CODE_0, ACConstants.PARAM_WH_CODE, outInfo.getBlock(ACConstants.WH_CODE_QUERY_BLOCK_ID).getRow(ACConstants.ROW_CODE_0).get(ACConstants.FIELD_VALUE)); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
outInfo.setBlock(InventTypeEnun.generatorEiBlock()); }
return outInfo; return inInfo;
} }
/** /**
...@@ -61,15 +64,29 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -61,15 +64,29 @@ public class ServiceHPKC002 extends ServiceBase {
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock);
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
String documentTime = inInfo.getCellStr(EiConstant.resultBlock,i,"documentTime"); this.checkSaveData(resultRows);
if(StringUtils.isNotBlank(documentTime)){ // 写入数据
inInfo.setCell(EiConstant.resultBlock,i,"documentTime", StringUtil.removeHorizontalLine(documentTime)); for (int i = 0; i < resultRows.size(); i++) {
} HPKC002 insertEntity = new HPKC002();
inInfo.setCell(EiConstant.resultBlock,i,"status", 1); insertEntity.fromMap(resultRows.get(i));
inInfo.setCell(EiConstant.resultBlock,i,"approvalStatus", 0); // 仓库名称
super.insert(inInfo,"HPKC002.insert"); Map params = new HashMap<>();
} params.put("whCode", insertEntity.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode", params);
insertEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//物料类型
insertEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(insertEntity.getMaterialType()));
// 生成单据号
insertEntity.setDocumentCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
insertEntity.setStatus(1);
insertEntity.setApprovalStatus(0);
dao.insert("HPKC002.insert", insertEntity);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); inInfo.setMsg("操作失败!原因参见详细错误描述!");
...@@ -78,30 +95,53 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -78,30 +95,53 @@ public class ServiceHPKC002 extends ServiceBase {
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC002 entity = new HPKC002();
entity.fromMap(resultRows.get(i));
AssertUtils.isEmpty(entity.getMaterialType(), "物料类型不能为空");
AssertUtils.isEmpty(entity.getMaterialCode(), "物料不能为空");
AssertUtils.isEmpty(entity.getWhCode(), "仓库不能为空");
}
} }
/** /**
* 修改操作. * 修改操作.
*/ */
@Override @Override
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); CommonMethod.udpateInfo(inInfo,EiConstant.resultBlock);
HPKC002 hpkc002 = new HPKC002(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); this.checkSaveData(resultRows);
for (int i = 0; i < eiBlock.getRowCount(); i++) { // 写入数据
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
hpkc002.fromMap(map); HPKC002 updateEntity = new HPKC002();
String documentTime = inInfo.getCellStr(EiConstant.resultBlock,i,"documentTime"); updateEntity.fromMap(resultRows.get(i));
if(StringUtils.isNotBlank(documentTime)){ // 仓库名称
inInfo.setCell(EiConstant.resultBlock,i,"documentTime", StringUtil.removeHorizontalLine(documentTime)); Map params = new HashMap<>();
} params.put("whCode", updateEntity.getWhCode());
this.dao.update("HPKC002.update", hpkc002.toMap()); List query = dao.query("HPPZ007.queryByWhCode", params);
} updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//物料类型
updateEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(updateEntity.getMaterialType()));
dao.insert("HPKC002.update", updateEntity);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); inInfo.setMsg("操作失败!原因参见详细错误描述!");
...@@ -109,7 +149,7 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -109,7 +149,7 @@ public class ServiceHPKC002 extends ServiceBase {
logError("修改失败", e.getMessage()); logError("修改失败", e.getMessage());
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
...@@ -137,15 +177,4 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -137,15 +177,4 @@ public class ServiceHPKC002 extends ServiceBase {
eiInfo.setMsg("删除成功!"); eiInfo.setMsg("删除成功!");
return eiInfo; return eiInfo;
} }
public EiInfo queryMaterialTypeSetName(EiInfo eiInfo) {
eiInfo.setBlock(InventTypeEnun.generatorEiBlock());
return eiInfo;
}
public EiInfo queryWhCodeSetName(EiInfo eiInfo) {
CommonMethod.initBlock(eiInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
return eiInfo;
}
} }
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003; import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author xuao * @author:songx
* @date 2024年01月12日 14:22 * @date:2024/1/22,10:48
*/ */
public class ServiceHPKC003 extends ServiceBase { public class ServiceHPKC003 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC003 hpkc003 = new HPKC003(); try {
EiInfo outInfo = new EiInfo(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
outInfo.addBlock(EiConstant.resultBlock); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
outInfo.getBlock(EiConstant.resultBlock).addBlockMeta(hpkc003.eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC003().eiMetadata);
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPKC003.query", new HPKC003()); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
return outInfo; String receiptDate = MapUtils.getString(queryRow, "documentDate");
queryRow.put("documentDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, "HPKC003.query", new HPPZ009());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { for (int i = 0; i < resultRows.size(); i++) {
// String inventName =inInfo.getCellStr(EiConstant.resultBlock,i,"inventName"); HPKC003 fKc003 = new HPKC003();
// String[] str = inventName.split("-"); fKc003.fromMap(resultRows.get(i));
// inInfo.setCell(EiConstant.resultBlock,i,"inventCode", str[0]); fKc003.setDocumentDate(StringUtil.removeHorizontalLine(fKc003.getDocumentDate()));
// inInfo.setCell(EiConstant.resultBlock,i,"inventName", str[1]); // 仓库名称
String documentDate = inInfo.getCellStr(EiConstant.resultBlock,i,"documentDate"); fKc003.setWhName(HPPZTools.getPz007ByCode(fKc003.getWhCode()).getWhName());
inInfo.setCell(EiConstant.resultBlock,i,"documentDate", StringUtil.removeHorizontalLine(documentDate)); // 物料名称
fKc003.setInventName(HPPZTools.getPz004ByCode(fKc003.getInventCode()).getInventName());
// 生成入库单号
fKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
DaoUtils.insert("HPKC003.insert", fKc003);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return super.insert(inInfo,"HPKC003.insert"); return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
HPKC003 hpkc003 = new HPKC003(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPKC003 fKc003 = new HPKC003();
Map<?, ?> map = eiBlock.getRow(i); fKc003.fromMap(resultRows.get(i));
hpkc003.fromMap(map); fKc003.setDocumentDate(StringUtil.removeHorizontalLine(fKc003.getDocumentDate()));
String documentDate = inInfo.getCellStr(EiConstant.resultBlock,i,"documentDate"); // 仓库名称
inInfo.setCell(EiConstant.resultBlock,i,"documentDate", StringUtil.removeHorizontalLine(documentDate)); fKc003.setWhName(HPPZTools.getPz007ByCode(fKc003.getWhCode()).getWhName());
this.dao.update("HPKC003.update", hpkc003.toMap()); // 物料名称
fKc003.setInventName(HPPZTools.getPz004ByCode(fKc003.getInventCode()).getInventName());
DaoUtils.update("HPKC003.update", fKc003);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param eiInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo eiInfo) {
HPKC003 hpkc003 = new HPKC003(); HPKC003 hpkc003 = new HPKC003();
...@@ -109,19 +140,13 @@ public class ServiceHPKC003 extends ServiceBase { ...@@ -109,19 +140,13 @@ public class ServiceHPKC003 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hpkc003.fromMap(map); hpkc003.fromMap(map);
this.dao.delete("HPKC003.delete", hpkc003.toMap()); this.dao.delete("HPKC003.delete", hpkc003.toMap());
} }
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!"); eiInfo.setMsg("删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(eiInfo, e, "删除失败");
}
return eiInfo; return eiInfo;
} }
......
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004; import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author YK * @author YK
...@@ -23,103 +27,103 @@ import java.util.stream.Collectors; ...@@ -23,103 +27,103 @@ import java.util.stream.Collectors;
public class ServiceHPKC004 extends ServiceBase { public class ServiceHPKC004 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC004 HPKC004 = new HPKC004(); try {
EiInfo outInfo = super.initLoad(inInfo, HPKC004); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
outInfo.addBlock(EiConstant.queryBlock).setCell(0,"receiptDate",CommonMethod.getCurrentSameYearMonth()); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC004().eiMetadata);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); } catch (Exception e) {
EiBlock block = outInfo.addBlock(EiConstant.queryBlock); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
block.setCell(ACConstants.ROW_CODE_0, ACConstants.PARAM_WH_CODE, outInfo.getBlock(ACConstants.WH_CODE_BLOCK_ID).getRow(ACConstants.ROW_CODE_0).get(ACConstants.FIELD_VALUE)); }
return inInfo;
return outInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
String receiptDate = inInfo.getCellStr(EiConstant.queryBlock,0,"receiptDate"); try {
inInfo.setCell(EiConstant.queryBlock,0,"receiptDate", StringUtil.removeHorizontalLine(receiptDate)); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
/* 调用EI查询方法.*/ String receiptDate = MapUtils.getString(queryRow, "receiptDate");
return super.query(inInfo, "HPKC004.query", new HPKC004()); queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, "HPKC004.query", new HPKC004());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); try {
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
String receiptDate = inInfo.getCellStr(EiConstant.resultBlock,i,"receiptDate"); // 数据写入
inInfo.setCell(EiConstant.resultBlock,i,"receiptDate", StringUtil.removeHorizontalLine(receiptDate)); for (int i = 0; i < resultRows.size(); i++) {
String whCode = inInfo.getCellStr(EiConstant.resultBlock,i,"whCode"); HPKC004 fKc004 = new HPKC004();
String matCode = inInfo.getCellStr(EiConstant.resultBlock,i,"matCode"); fKc004.fromMap(resultRows.get(i));
Map params=new HashMap<>(); fKc004.setReceiptDate(StringUtil.removeHorizontalLine(fKc004.getReceiptDate()));
params.put("whCode", whCode); // 仓库名称
List query = dao.query("HPPZ007.queryByWhCode",params); fKc004.setWhName(HPPZTools.getPz007ByCode(fKc004.getWhCode()).getWhName());
String whName = ((HPPZ007)query.get(0)).getWhName(); // 物料名称
inInfo.setCell(EiConstant.resultBlock,i,"whName", whName); fKc004.setInventName(HPPZTools.getPz004ByCode(fKc004.getInventCode()).getInventName());
Map params1=new HashMap<>(); // 生成销售单号
params1.put("inventCode", matCode); fKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
List query1 = dao.query("HPPZ004.queryMatNameByCode",params1); DaoUtils.insert("HPKC004.insert", fKc004);
String matName = ((THppz004)query1.get(0)).getInventName();
inInfo.setCell(EiConstant.resultBlock,i,"matName", matName);
} }
return super.insert(inInfo,"HPKC004.insert"); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try { try {
HPKC004 HPKC004 = new HPKC004(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
List<String> list = new ArrayList<>(); HPKC004 fKc004 = new HPKC004();
for (int i = 0; i < eiBlock.getRowCount(); i++) { fKc004.fromMap(resultRows.get(i));
Map<?, ?> map = eiBlock.getRow(i); fKc004.setReceiptDate(StringUtil.removeHorizontalLine(fKc004.getReceiptDate()));
HPKC004.fromMap(map); // 仓库名称
if (HPKC004.getStatus() == 1) { fKc004.setWhName(HPPZTools.getPz007ByCode(fKc004.getWhCode()).getWhName());
list.add(HPKC004.getSaleNumber()); // 物料名称
continue; fKc004.setInventName(HPPZTools.getPz004ByCode(fKc004.getInventCode()).getInventName());
} DaoUtils.update("HPKC004.update", fKc004);
Map params=new HashMap<>();
params.put("whCode", HPKC004.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode",params);
String whName = ((HPPZ007)query.get(0)).getWhName();
HPKC004.setWhName(whName);
Map params1=new HashMap<>();
params1.put("inventCode", HPKC004.getMatCode());
List query1 = dao.query("HPPZ004.queryMatNameByCode",params1);
String matName = ((THppz004)query1.get(0)).getInventName();
HPKC004.setMatName(matName);
this.dao.update("HPKC004.update", HPKC004.toMap());
} }
if (list.size() > 0) { inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("部分数据修改成功!销售出库单号为:" + list.stream() inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
.collect(Collectors.joining(",")) + "状态为已审核不能进行修改!"); } catch (Exception e) {
} else { LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} }
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo; return inInfo;
} }
return query(inInfo);
}
/** /**
* 删除操作. * 删除操作.
......
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC005; import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -22,21 +18,22 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -22,21 +18,22 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author YK *
* @date 2024年01月09日 10:18 * @author:songx
* @date:2024/1/22,10:51
*/ */
public class ServiceHPKC005 extends ServiceBase { public class ServiceHPKC005 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC005 HPKC005 = new HPKC005(); HPKC005 HPKC005 = new HPKC005();
...@@ -83,18 +80,8 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -83,18 +80,8 @@ public class ServiceHPKC005 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005(); HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i)); fKc005.fromMap(resultRows.get(i));
// 去除日期字符串中的- // 设置基础信息
fKc005.setReceiptDate(StringUtil.removeHorizontalLine(fKc005.getReceiptDate())); this.setBaseInfo(fKc005);
// 仓库名称
Map params = new HashMap<>();
params.put("whCode", fKc005.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode", params);
fKc005.setWhName(((HPPZ007) query.get(0)).getWhName());
// 物料名称
Map params1 = new HashMap<>();
params1.put("inventCode", fKc005.getInventCode());
List query1 = dao.query("HPPZ004.queryMatNameByCode", params1);
fKc005.setInventName(((THppz004) query1.get(0)).getInventName());
if (fKc005.getId() == null || fKc005.getId() == 0) { if (fKc005.getId() == null || fKc005.getId() == 0) {
this.add(fKc005); this.add(fKc005);
} else { } else {
...@@ -154,28 +141,14 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -154,28 +141,14 @@ public class ServiceHPKC005 extends ServiceBase {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock); CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
Map resultRow = resultRows.get(i); HPKC005 fKc005 = new HPKC005();
// 去除日期字符串中的- fKc005.fromMap(resultRows.get(i));
String receiptDate = MapUtils.getString(resultRow, "receiptDate"); // 设置基础信息
resultRow.put("receiptDate", StringUtil.removeHorizontalLine(receiptDate)); this.setBaseInfo(fKc005);
String whCode = MapUtils.getString(resultRow, "whCode");
String inventCode = MapUtils.getString(resultRow, "inventCode");
// 仓库名称
Map params = new HashMap<>();
params.put("whCode", whCode);
List query = dao.query("HPPZ007.queryByWhCode", params);
String whName = ((HPPZ007) query.get(0)).getWhName();
resultRow.put("whName", whName);
// 物料名称
Map params1 = new HashMap<>();
params1.put("inventCode", inventCode);
List query1 = dao.query("HPPZ004.queryMatNameByCode", params1);
String inventName = ((THppz004) query1.get(0)).getInventName();
resultRow.put("inventName", inventName);
// 生成单据号 // 生成单据号
resultRow.put("statisticalNumber", SequenceGenerator.getNextSequence( fKc005.setStatisticalNumber(SequenceGenerator.getNextSequence(
HPConstant.SequenceId.STATISTICAL_NUMBER)); HPConstant.SequenceId.STATISTICAL_NUMBER));
DaoUtils.insert("HPKC005.insert", resultRow); DaoUtils.insert(HPKC005.INSERT, fKc005);
} }
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -185,30 +158,20 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -185,30 +158,20 @@ public class ServiceHPKC005 extends ServiceBase {
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
List<String> list = new ArrayList<>();
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < eiBlock.getRowCount(); i++) {
HPKC005 HPKC005 = new HPKC005(); HPKC005 fKc005 = new HPKC005();
HPKC005.fromMap(eiBlock.getRow(i)); fKc005.fromMap(eiBlock.getRow(i));
if (HPKC005.getStatus() == 1) { // 设置基础信息
list.add(HPKC005.getStatisticalNumber()); this.setBaseInfo(fKc005);
continue; DaoUtils.update(HPKC005.UPDATE, fKc005);
}
Map params=new HashMap<>();
params.put("whCode", HPKC005.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode",params);
String whName = ((HPPZ007)query.get(0)).getWhName();
HPKC005.setWhName(whName);
Map params1=new HashMap<>();
params1.put("inventCode", HPKC005.getInventCode());
List query1 = dao.query("HPPZ004.queryMatNameByCode",params1);
String matName = ((THppz004)query1.get(0)).getInventName();
HPKC005.setInventName(matName);
this.dao.update("HPKC005.update", HPKC005.toMap());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
...@@ -220,27 +183,42 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -220,27 +183,42 @@ public class ServiceHPKC005 extends ServiceBase {
} }
/** /**
* 删除操作. * 设置基础信息
*
* @param fKc005
*/
private void setBaseInfo(HPKC005 fKc005) {
// 去除日期字符串中的-
fKc005.setReceiptDate(StringUtil.removeHorizontalLine(fKc005.getReceiptDate()));
// 仓库名称
fKc005.setWhName(HPPZTools.getPz007ByCode(fKc005.getWhCode()).getWhName());
// 物料名称
fKc005.setInventName(HPPZTools.getPz004ByCode(fKc005.getInventCode()).getInventName());
// 差异数量
fKc005.setDiffAmount(fKc005.getEntityAmount().subtract(fKc005.getBookAmount()));
// 差异重量
fKc005.setDiffWeight(fKc005.getEntityWeight().subtract(fKc005.getBookWeight()));
}
/**
* 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
HPKC005 HPKC005 = new HPKC005();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
HPKC005.fromMap(map); DaoUtils.update(HPKC005.DELETE, resultRows.get(i));
this.dao.delete("HPKC005.delete", HPKC005.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo; }
} return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
} }
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC008; import com.baosight.hpjx.hp.kc.domain.HPKC008;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.pz.domain.THppz004; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -52,8 +45,8 @@ public class ServiceHPKC008 extends ServiceBase { ...@@ -52,8 +45,8 @@ public class ServiceHPKC008 extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "receiptDate"); String dateMonth = MapUtils.getString(queryRow, "dateMonth");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate, queryRow.put("dateMonth", StringUtil.removeSpecifiedCharacter(dateMonth,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED)); StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, "HPKC008.query", new HPKC008()); inInfo = super.query(inInfo, "HPKC008.query", new HPKC008());
List sum = dao.query("HPKC008.querySum", queryRow); List sum = dao.query("HPKC008.querySum", queryRow);
...@@ -65,28 +58,27 @@ public class ServiceHPKC008 extends ServiceBase { ...@@ -65,28 +58,27 @@ public class ServiceHPKC008 extends ServiceBase {
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
Map resultRow = resultRows.get(i); HPKC008 fKc008 = new HPKC008();
fKc008.fromMap(resultRows.get(i));
// 去除日期字符串中的- // 去除日期字符串中的-
String datemonth = MapUtils.getString(resultRow, "datemonth"); fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
resultRow.put("datemonth", StringUtil.removeHorizontalLine(datemonth));
// 物料名称 // 物料名称
Map params1 = new HashMap<>(); fKc008.setInventName(HPPZTools.getPz004ByCode(fKc008.getInventCode()).getInventName());
params1.put("inventCode", MapUtils.getString(resultRow, "materialCode")); // 计算总金额
List query1 = dao.query("HPPZ004.queryMatNameByCode", params1); fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
String matName = ((THppz004) query1.get(0)).getInventName();
resultRow.put("materialName", matName);
// 生成单据号 // 生成单据号
resultRow.put("statisticalNumber", SequenceGenerator.getNextSequence( fKc008.setStatNo(SequenceGenerator.getNextSequence(
HPConstant.SequenceId.HPKC008_NUMBER)); HPConstant.SequenceId.HPKC008_NUMBER));
DaoUtils.insert("HPKC008.insert", resultRow); DaoUtils.insert(HPKC008.INSERT, fKc008);
} }
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -95,56 +87,54 @@ public class ServiceHPKC008 extends ServiceBase { ...@@ -95,56 +87,54 @@ public class ServiceHPKC008 extends ServiceBase {
return inInfo; return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
HPKC008 HPKC008 = new HPKC008(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPKC008 fKc008 = new HPKC008();
Map<?, ?> map = eiBlock.getRow(i); fKc008.fromMap(resultRows.get(i));
HPKC008.fromMap(map); // 去除日期字符串中的-
fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
this.dao.update("HPKC008.update", HPKC008.toMap()); // 物料名称
fKc008.setInventName(HPPZTools.getPz004ByCode(fKc008.getInventCode()).getInventName());
// 计算总金额
fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
DaoUtils.update(HPKC008.UPDATE, fKc008);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
HPKC008 HPKC008 = new HPKC008();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
HPKC008.fromMap(map); DaoUtils.update(HPKC008.DELETE, resultRows.get(i));
this.dao.delete("HPKC008.delete", HPKC008.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
} }
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC001"> <sqlMap namespace="HPKC001">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001"> resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT SELECT
...@@ -28,22 +51,11 @@ ...@@ -28,22 +51,11 @@
QUANTITY as "quantity", <!-- 数量 --> QUANTITY as "quantity", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 --> WEIGHT as "weight", <!-- 重量 -->
REMARKS as "remarks", <!-- 备注 --> REMARKS as "remarks", <!-- 备注 -->
APPROVAL_STATUS as "approvalStatus", <!-- 审批状态:0-未审核,1-已审核 --> APPROVAL_STATUS as "approvalStatus", <!-- 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝 -->
CUST_CODE as "custCode", <!-- 供应商编码 --> CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName" <!-- 供应商名称 --> CUST_NAME as "custName" <!-- 供应商名称 -->
FROM hpjx.t_hpkc001 WHERE 1=1 FROM hpjx.t_hpkc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -56,15 +68,7 @@ ...@@ -56,15 +68,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -91,7 +95,7 @@ ...@@ -91,7 +95,7 @@
QUANTITY, <!-- 数量 --> QUANTITY, <!-- 数量 -->
WEIGHT, <!-- 重量 --> WEIGHT, <!-- 重量 -->
REMARKS, <!-- 备注 --> REMARKS, <!-- 备注 -->
APPROVAL_STATUS, <!-- 审批状态:0-未审核,1-已审核 --> APPROVAL_STATUS, <!-- 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝 -->
CUST_CODE, <!-- 供应商编码 --> CUST_CODE, <!-- 供应商编码 -->
CUST_NAME <!-- 供应商名称 --> CUST_NAME <!-- 供应商名称 -->
) )
...@@ -106,12 +110,18 @@ ...@@ -106,12 +110,18 @@
DELETE FROM hpjx.t_hpkc001 WHERE ID = #id# DELETE FROM hpjx.t_hpkc001 WHERE ID = #id#
</delete> </delete>
<update id="approvalStatusUpdate">
UPDATE hpjx.t_hpkc001
SET APPROVAL_STATUS = #approvalStatus#
WHERE ID = #id#
</update>
<update id="update"> <update id="update">
UPDATE hpjx.t_hpkc001 UPDATE hpjx.t_hpkc001
SET SET
UPDATED_BY = #updatedBy#, UPDATED_BY = #updatedBy#,
UPDATED_BY = #updatedBy#, UPDATED_NAME = #updatedName#,
UPDATED_BY = #updatedBy# UPDATED_TIME = #updatedTime#
<isNotEmpty property="companyCode"> <isNotEmpty property="companyCode">
,COMPANY_CODE = #companyCode# ,COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -172,8 +182,8 @@ ...@@ -172,8 +182,8 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<!-- 按天统计 --> <!-- 统计库存 -->
<select id="statDay" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001"> <select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT SELECT
COMPANY_CODE AS "companyCode", COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode", DEP_CODE AS "depCode",
......
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC002"> <sqlMap namespace="HPKC002">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002"> resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT SELECT
...@@ -28,19 +51,11 @@ ...@@ -28,19 +51,11 @@
QUANTITY as "quantity", <!-- 数量 --> QUANTITY as "quantity", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 --> WEIGHT as "weight", <!-- 重量 -->
REMARKS as "remarks", <!-- 备注 --> REMARKS as "remarks", <!-- 备注 -->
APPROVAL_STATUS as "approvalStatus", <!-- 审批状态:0-未审核,1-已审核 --> APPROVAL_STATUS as "approvalStatus", <!-- 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝 -->
CUST_CODE as "custCode", <!-- 供应商编码 --> CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName" <!-- 供应商名称 --> CUST_NAME as "custName" <!-- 供应商名称 -->
FROM hpjx.t_hpkc002 WHERE 1=1 FROM hpjx.t_hpkc002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -52,17 +67,10 @@ ...@@ -52,17 +67,10 @@
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
</select> </select>
<insert id="insert"> <insert id="insert">
...@@ -89,7 +97,7 @@ ...@@ -89,7 +97,7 @@
QUANTITY, <!-- 数量 --> QUANTITY, <!-- 数量 -->
WEIGHT, <!-- 重量 --> WEIGHT, <!-- 重量 -->
REMARKS, <!-- 备注 --> REMARKS, <!-- 备注 -->
APPROVAL_STATUS, <!-- 审批状态:0-未审核,1-已审核 --> APPROVAL_STATUS, <!-- 审批状态:1-保存,2-已提交,3-审批通过,4-审批拒绝 -->
CUST_CODE, <!-- 供应商编码 --> CUST_CODE, <!-- 供应商编码 -->
CUST_NAME <!-- 供应商名称 --> CUST_NAME <!-- 供应商名称 -->
) )
...@@ -170,8 +178,8 @@ ...@@ -170,8 +178,8 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<!-- 按天统计 --> <!-- 统计库存 -->
<select id="statDay" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002"> <select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT SELECT
COMPANY_CODE AS "companyCode", COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode", DEP_CODE AS "depCode",
......
...@@ -120,8 +120,8 @@ ...@@ -120,8 +120,8 @@
ID = #id# ID = #id#
</update> </update>
<!-- 按天统计 --> <!-- 统计库存 -->
<select id="statDay" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC006"> <select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC006">
SELECT SELECT
COMPANY_CODE AS "companyCode", COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode", DEP_CODE AS "depCode",
......
...@@ -163,8 +163,8 @@ ...@@ -163,8 +163,8 @@
ID = #id# ID = #id#
</update> </update>
<!-- 按天统计 --> <!-- 统计库存 -->
<select id="statDay" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC007"> <select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC007">
SELECT SELECT
COMPANY_CODE AS "companyCode", COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode", DEP_CODE AS "depCode",
......
...@@ -4,39 +4,50 @@ ...@@ -4,39 +4,50 @@
<sql id="column"> <sql id="column">
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DATEMONTH as "datemonth", <!-- 月份 --> DEP_CODE as "depCode", <!-- 部门编码 -->
STATISTICAL_NUMBER as "statisticalNumber", <!-- 统计单单号 --> DATE_MONTH as "dateMonth", <!-- 月份 -->
MATERIAL_CODE as "materialCode", <!-- 物料编码 --> STAT_NO as "statNo", <!-- 统计单号 -->
MATERIAL_NAME as "materialName", <!-- 物料名称 --> INVENT_CODE as "inventCode", <!-- 存货代码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
UNIT as "unit", <!-- 单位 --> UNIT as "unit", <!-- 单位 -->
AMOUNT as "amount", <!-- 数量 --> AMOUNT as "amount", <!-- 数量 -->
PRICE as "price", <!-- 单价 --> PRICE as "price", <!-- 单价 -->
TOTAL_PRICE as "totalPrice", <!-- 金额 --> TOTAL_PRICE as "totalPrice", <!-- 总价 -->
NOTES as "notes", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人姓名 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="datemonth"> <isNotEmpty prepend=" AND " property="companyCode">
DATEMONTH = #datemonth# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="statisticalNumber"> <isNotEmpty prepend=" AND " property="depCode">
STATISTICAL_NUMBER = #statisticalNumber# DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateMonth">
DATE_MONTH = #dateMonth#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="statNo">
STAT_NO = #statNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC008"> <sql id="order">
SELECT
<include refid="column"/>
FROM hpjx.t_hpkc008 WHERE 1=1
<include refid="condition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -45,13 +56,19 @@ ...@@ -45,13 +56,19 @@
ID DESC ID DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC008">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPKC008 WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc008 WHERE 1=1 SELECT COUNT(*) FROM ${hpjxSchema}.T_HPKC008 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
</select> </select>
<!-- 查询统计 --> <!-- 查询统计 -->
...@@ -59,20 +76,31 @@ ...@@ -59,20 +76,31 @@
SELECT SELECT
COALESCE(SUM(AMOUNT), 0) AS "amount", <!-- 数量 --> COALESCE(SUM(AMOUNT), 0) AS "amount", <!-- 数量 -->
COALESCE(SUM(TOTAL_PRICE), 0) AS "totalPrice" <!-- 金额 --> COALESCE(SUM(TOTAL_PRICE), 0) AS "totalPrice" <!-- 金额 -->
FROM ${hpjxSchema}.t_hpkc008 FROM ${hpjxSchema}.T_HPKC008
WHERE 1=1 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hpkc008 ( INSERT INTO hpjx.t_hpkc008 (
COMPANY_CODE, DATEMONTH, STATISTICAL_NUMBER, MATERIAL_CODE, COMPANY_CODE, <!-- 企业编码 -->
MATERIAL_NAME, UNIT, AMOUNT, PRICE, TOTAL_PRICE, NOTES, DEP_CODE, <!-- 部门编码 -->
CREATED_BY, CREATED_TIME DATE_MONTH, <!-- 月份 -->
STAT_NO, <!-- 统计单号 -->
INVENT_CODE, <!-- 存货代码 -->
INVENT_NAME, <!-- 存货名称 -->
UNIT, <!-- 单位 -->
AMOUNT, <!-- 数量 -->
PRICE, <!-- 单价 -->
TOTAL_PRICE, <!-- 总价 -->
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人姓名 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES ( ) VALUES (
#companyCode#, #datemonth#, #statisticalNumber#, #materialCode#, #materialName#, #companyCode#, #depCode#, #dateMonth#, #statNo#, #inventCode#, #inventName#,
#unit#, #amount#, #price#, #totalPrice#, #notes#, #createdBy#, #createdTime#, #unit#, #amount#, #price#, #totalPrice#, #remark#, #createdBy#, #createdName#,
#updatedBy#, #updatedTime# #createdTime#
) )
</insert> </insert>
...@@ -83,16 +111,17 @@ ...@@ -83,16 +111,17 @@
<update id="update"> <update id="update">
UPDATE hpjx.t_hpkc008 UPDATE hpjx.t_hpkc008
SET SET
DATEMONTH = #datemonth#, <!-- 月份 --> DATE_MONTH = #dateMonth#, <!-- 月份 -->
MATERIAL_CODE = #materialCode#, <!-- 物料编码 --> INVENT_CODE = #inventCode#, <!-- 存货代码 -->
MATERIAL_NAME = #materialName#, <!-- 物料名称 --> INVENT_NAME = #inventName#, <!-- 存货名称 -->
UNIT = #unit#, <!-- 单位 --> UNIT = #unit#, <!-- 单位 -->
AMOUNT = #amount#, <!-- 数量 --> AMOUNT = #amount#, <!-- 数量 -->
PRICE = #price#, <!-- 单价 --> PRICE = #price#, <!-- 单价 -->
TOTAL_PRICE = #totalPrice#, <!-- 金额 --> TOTAL_PRICE = #totalPrice#, <!-- 总价 -->
NOTES = #notes#, <!-- 备注 --> REMARK = #remark#, <!-- 备注 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 --> UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
WHERE ID = #id# WHERE ID = #id#
</update> </update>
......
/**
* Generate time : 2024-01-10 10:28:33
* Version : 1.0
*/
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* THppz002
*
*/
public class THppz002 extends DaoEPBase {
private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/
private int custType; /* 供应商类型 1 国企 : 2 民营*/
private String custCode = " "; /* 供应商编码*/
private String custName = " "; /* 供应商名称*/
private String address = " "; /* 地址*/
private int status; /* 状态 0禁用 1启用*/
private String createdBy = " "; /* 创建人*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedTime = " "; /* 更新时间*/
private String depCode = " "; /* 部门编码*/
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("id");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("companyCode");
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custType");
eiColumn.setDescName("供应商类型 1 国企 : 2 民营");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCode");
eiColumn.setDescName("供应商编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custName");
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("address");
eiColumn.setDescName("地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("status");
eiColumn.setDescName("状态 0禁用 1启用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdBy");
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdTime");
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedBy");
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedTime");
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("depCode");
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public THppz002() {
initMetaData();
}
/**
* get the id
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the custType - 供应商类型 1 国企 : 2 民营
* @return the custType
*/
public int getCustType() {
return this.custType;
}
/**
* set the custType - 供应商类型 1 国企 : 2 民营
*/
public void setCustType(int custType) {
this.custType = custType;
}
/**
* get the custCode - 供应商编码
* @return the custCode
*/
public String getCustCode() {
return this.custCode;
}
/**
* set the custCode - 供应商编码
*/
public void setCustCode(String custCode) {
this.custCode = custCode;
}
/**
* get the custName - 供应商名称
* @return the custName
*/
public String getCustName() {
return this.custName;
}
/**
* set the custName - 供应商名称
*/
public void setCustName(String custName) {
this.custName = custName;
}
/**
* get the address - 地址
* @return the address
*/
public String getAddress() {
return this.address;
}
/**
* set the address - 地址
*/
public void setAddress(String address) {
this.address = address;
}
/**
* get the status - 状态 0未启用 1启用
* @return the status
*/
public int getStatus() {
return this.status;
}
/**
* set the status - 状态 0未启用 1启用
*/
public void setStatus(int status) {
this.status = status;
}
/**
* get the createdBy - 创建人
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdTime - 创建时间
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 更新时间
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the depCode - 部门编码
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get("id")), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("companyCode")), companyCode));
setCustType(NumberUtils.toint(StringUtils.toString(map.get("custType")), custType));
setCustCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custCode")), custCode));
setCustName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custName")), custName));
setAddress(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("address")), address));
setStatus(NumberUtils.toint(StringUtils.toString(map.get("status")), status));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdBy")), createdBy));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdTime")), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedBy")), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedTime")), updatedTime));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("depCode")), depCode));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("id",StringUtils.toString(id, eiMetadata.getMeta("id")));
map.put("companyCode",StringUtils.toString(companyCode, eiMetadata.getMeta("companyCode")));
map.put("custType",StringUtils.toString(custType, eiMetadata.getMeta("custType")));
map.put("custCode",StringUtils.toString(custCode, eiMetadata.getMeta("custCode")));
map.put("custName",StringUtils.toString(custName, eiMetadata.getMeta("custName")));
map.put("address",StringUtils.toString(address, eiMetadata.getMeta("address")));
map.put("status",StringUtils.toString(status, eiMetadata.getMeta("status")));
map.put("createdBy",StringUtils.toString(createdBy, eiMetadata.getMeta("createdBy")));
map.put("createdTime",StringUtils.toString(createdTime, eiMetadata.getMeta("createdTime")));
map.put("updatedBy",StringUtils.toString(updatedBy, eiMetadata.getMeta("updatedBy")));
map.put("updatedTime",StringUtils.toString(updatedTime, eiMetadata.getMeta("updatedTime")));
map.put("depCode",StringUtils.toString(depCode, eiMetadata.getMeta("depCode")));
return map;
}
}
\ No newline at end of file
/**
* Generate time : 2024-01-09 17:46:33
* Version : 1.0
*/
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* THppz003
*
*/
public class THppz003 extends DaoEPBase {
private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/
private int custType; /* 客商类型 1:国企;2:民营;*/
private String custCode = " "; /* 客户编码*/
private String custCname = " "; /* 客户名称*/
private String custAddr = " "; /* 地址*/
private int status; /* 状态 0未启用 1启用*/
private String createdBy = " "; /* 创建人*/
private String createdTime; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedTime; /* 更新时间*/
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("id");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("companyCode");
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custType");
eiColumn.setDescName("客商类型 1:国企;2:民营;");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCode");
eiColumn.setDescName("客户编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custCname");
eiColumn.setDescName("客户名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("custAddr");
eiColumn.setDescName("地址");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("status");
eiColumn.setDescName("状态 0未启用 1启用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdBy");
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdTime");
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedBy");
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedTime");
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public THppz003() {
initMetaData();
}
/**
* get the id
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the custType - 客商类型 1:国企;2:民营;
* @return the custType
*/
public int getCustType() {
return this.custType;
}
/**
* set the custType - 客商类型 1:国企;2:民营;
*/
public void setCustType(int custType) {
this.custType = custType;
}
/**
* get the custCode - 客户编码
* @return the custCode
*/
public String getCustCode() {
return this.custCode;
}
/**
* set the custCode - 客户编码
*/
public void setCustCode(String custCode) {
this.custCode = custCode;
}
/**
* get the custCname - 客户名称
* @return the custCname
*/
public String getCustCname() {
return this.custCname;
}
/**
* set the custCname - 客户名称
*/
public void setCustCname(String custCname) {
this.custCname = custCname;
}
/**
* get the custAddr - 地址
* @return the custAddr
*/
public String getCustAddr() {
return this.custAddr;
}
/**
* set the custAddr - 地址
*/
public void setCustAddr(String custAddr) {
this.custAddr = custAddr;
}
/**
* get the status - 状态 0未启用 1启用
* @return the status
*/
public int getStatus() {
return this.status;
}
/**
* set the status - 状态 0未启用 1启用
*/
public void setStatus(int status) {
this.status = status;
}
/**
* get the createdBy - 创建人
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdTime - 创建时间
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 更新时间
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get("id")), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("companyCode")), companyCode));
setCustType(NumberUtils.toint(StringUtils.toString(map.get("custType")), custType));
setCustCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custCode")), custCode));
setCustCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custCname")), custCname));
setCustAddr(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("custAddr")), custAddr));
setStatus(NumberUtils.toint(StringUtils.toString(map.get("status")), status));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdBy")), createdBy));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdTime")), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedBy")), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedTime")), updatedTime));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("id", StringUtils.toString(id, eiMetadata.getMeta("id")));
map.put("companyCode", StringUtils.toString(companyCode, eiMetadata.getMeta("companyCode")));
map.put("custType", StringUtils.toString(custType, eiMetadata.getMeta("custType")));
map.put("custCode", StringUtils.toString(custCode, eiMetadata.getMeta("custCode")));
map.put("custCname", StringUtils.toString(custCname, eiMetadata.getMeta("custCname")));
map.put("custAddr", StringUtils.toString(custAddr, eiMetadata.getMeta("custAddr")));
map.put("status", StringUtils.toString(status, eiMetadata.getMeta("status")));
map.put("createdBy", StringUtils.toString(createdBy, eiMetadata.getMeta("createdBy")));
map.put("createdTime", StringUtils.toString(createdTime, eiMetadata.getMeta("createdTime")));
map.put("updatedBy", StringUtils.toString(updatedBy, eiMetadata.getMeta("updatedBy")));
map.put("updatedTime", StringUtils.toString(updatedTime, eiMetadata.getMeta("updatedTime")));
return map;
}
}
\ No newline at end of file
/**
* Generate time : 2024-01-10 14:11:21
* Version : 1.0
*/
package com.baosight.hpjx.hp.pz.domain;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* THppz004
*
*/
public class THppz004 extends DaoEPBase {
private Long id = 0L;
private String companyCode = " "; /* 企业编码 预留*/
private String inventName = " "; /* 存货名称*/
private String inventCode = " "; /* 存货编码*/
private int inventType; /* 存货类型*/
private int status; /* 状态 0未启用 1启用*/
private String createdBy = " "; /* 创建人*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedTime = " "; /* 更新时间*/
private String depCode = " "; /* 部门编码*/
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("id");
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("companyCode");
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("inventName");
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("inventCode");
eiColumn.setDescName("存货编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("inventType");
eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("status");
eiColumn.setDescName("状态 0未启用 1启用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdBy");
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("createdTime");
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedBy");
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("updatedTime");
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("depCode");
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public THppz004() {
initMetaData();
}
/**
* get the id
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the companyCode - 企业编码 预留
* @return the companyCode
*/
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留
*/
public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
}
/**
* get the inventName - 存货名称
* @return the inventName
*/
public String getInventName() {
return this.inventName;
}
/**
* set the inventName - 存货名称
*/
public void setInventName(String inventName) {
this.inventName = inventName;
}
/**
* get the inventCode - 存货编码
* @return the inventCode
*/
public String getInventCode() {
return this.inventCode;
}
/**
* set the inventCode - 存货编码
*/
public void setInventCode(String inventCode) {
this.inventCode = inventCode;
}
/**
* get the inventType - 存货类型
* @return the inventType
*/
public int getInventType() {
return this.inventType;
}
/**
* set the inventType - 存货类型
*/
public void setInventType(int inventType) {
this.inventType = inventType;
}
/**
* get the status - 状态 0未启用 1启用
* @return the status
*/
public int getStatus() {
return this.status;
}
/**
* set the status - 状态 0未启用 1启用
*/
public void setStatus(int status) {
this.status = status;
}
/**
* get the createdBy - 创建人
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdTime - 创建时间
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedTime - 更新时间
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the depCode - 部门编码
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get("id")), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("companyCode")), companyCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("inventName")), inventName));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("inventCode")), inventCode));
setInventType(NumberUtils.toint(StringUtils.toString(map.get("inventType")), inventType));
setStatus(NumberUtils.toint(StringUtils.toString(map.get("status")), status));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdBy")), createdBy));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("createdTime")), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedBy")), updatedBy));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("updatedTime")), updatedTime));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("depCode")), depCode));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("id",StringUtils.toString(id, eiMetadata.getMeta("id")));
map.put("companyCode",StringUtils.toString(companyCode, eiMetadata.getMeta("companyCode")));
map.put("inventName",StringUtils.toString(inventName, eiMetadata.getMeta("inventName")));
map.put("inventCode",StringUtils.toString(inventCode, eiMetadata.getMeta("inventCode")));
map.put("inventType",StringUtils.toString(inventType, eiMetadata.getMeta("inventType")));
map.put("status",StringUtils.toString(status, eiMetadata.getMeta("status")));
map.put("createdBy",StringUtils.toString(createdBy, eiMetadata.getMeta("createdBy")));
map.put("createdTime",StringUtils.toString(createdTime, eiMetadata.getMeta("createdTime")));
map.put("updatedBy",StringUtils.toString(updatedBy, eiMetadata.getMeta("updatedBy")));
map.put("updatedTime",StringUtils.toString(updatedTime, eiMetadata.getMeta("updatedTime")));
map.put("depCode",StringUtils.toString(depCode, eiMetadata.getMeta("depCode")));
return map;
}
}
\ No newline at end of file
...@@ -2,14 +2,26 @@ package com.baosight.hpjx.hp.pz.service; ...@@ -2,14 +2,26 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.CompanyTypeEnum; import com.baosight.hpjx.common.CompanyTypeEnum;
import com.baosight.hpjx.common.InitiateModeEnum; import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.hpjx.hp.pz.domain.THppz002; import com.baosight.hpjx.hp.pz.domain.HPPZ002;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -19,110 +31,109 @@ import java.util.Map; ...@@ -19,110 +31,109 @@ import java.util.Map;
public class ServiceHPPZ002 extends ServiceBase { public class ServiceHPPZ002 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
THppz002 hppz002 = new THppz002(); try {
EiInfo outInfo = new EiInfo(); inInfo.setBlock(CompanyTypeEnum.generatorEiBlock());
outInfo.addBlock(EiConstant.queryBlock); inInfo.setBlock(InitiateModeEnum.generatorEiBlock());
outInfo.getBlock(EiConstant.queryBlock).addBlockMeta(hppz002.eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ002().eiMetadata);
outInfo.addBlock(EiConstant.resultBlock); } catch (PlatException e) {
outInfo.getBlock(EiConstant.resultBlock).addBlockMeta(hppz002.eiMetadata); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
outInfo.setBlock(CompanyTypeEnum.generatorEiBlock()); }
outInfo.setBlock(InitiateModeEnum.generatorEiBlock()); return inInfo;
return outInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPPZ002.query", new THppz002()); inInfo = super.query(inInfo, "HPPZ002.query", new HPPZ002());
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
THppz002 hppz002 = new THppz002(); // 数据写入
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPPZ002 fPz002 = new HPPZ002();
Map<?, ?> map = eiBlock.getRow(i); fPz002.fromMap(resultRows.get(i));
hppz002.fromMap(map); // 生成供应商编码
this.dao.insert("HPPZ002.insert", hppz002.toMap()); fPz002.setCustCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPPZ002_CUST_CODE));
DaoUtils.insert("HPPZ002.insert", fPz002);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
THppz002 HPPZ002 = new THppz002(); for (int i = 0; i < resultRows.size(); i++) {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); HPPZ002 fPz002 = new HPPZ002();
for (int i = 0; i < eiBlock.getRowCount(); i++) { fPz002.fromMap(resultRows.get(i));
Map<?, ?> map = eiBlock.getRow(i); DaoUtils.update("HPPZ002.update", fPz002);
HPPZ002.fromMap(map);
this.dao.update("HPPZ002.update", HPPZ002.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
THppz002 HPPZ002 = new THppz002();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
HPPZ002.fromMap(map); DaoUtils.update("HPPZ002.delete", resultRows.get(i));
this.dao.delete("HPPZ002.delete", HPPZ002.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
} }
package com.baosight.hpjx.hp.pz.service; package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.CompanyTypeEnum;
import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ002;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.hpjx.hp.pz.domain.THppz003; import com.baosight.hpjx.hp.pz.domain.HPPZ003;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* * @author:songx
* @date:2024/1/22,14:13
*/ */
public class ServiceHPPZ003 extends ServiceBase { public class ServiceHPPZ003 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
THppz003 hppz003 = new THppz003(); try {
EiInfo outInfo = super.initLoad(inInfo, hppz003); inInfo.setBlock(CompanyTypeEnum.generatorEiBlock());
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hppz003.eiMetadata); inInfo.setBlock(InitiateModeEnum.generatorEiBlock());
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ003().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo; return inInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPPZ003.query", new THppz003()); inInfo = super.query(inInfo, "HPPZ003.query", new HPPZ003());
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
THppz003 hppz003 = new THppz003(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); // 数据写入
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < resultRows.size(); i++) {
Map<?, ?> map = eiBlock.getRow(i); HPPZ003 fPz003 = new HPPZ003();
hppz003.fromMap(map); fPz003.fromMap(resultRows.get(i));
hppz003.setCreatedBy(UserSession.getUserId()); // 生成客户编码
hppz003.setCreatedTime(sdf.format(new Date())); fPz003.setCustCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPPZ003_CUST_CODE));
hppz003.setUpdatedBy(null); DaoUtils.insert("HPPZ003.insert", fPz003);
hppz003.setUpdatedTime(null);
this.dao.insert("HPPZ003.insert", hppz003.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
THppz003 hppz003 = new THppz003(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPPZ003 fPz003 = new HPPZ003();
Map<?, ?> map = eiBlock.getRow(i); fPz003.fromMap(resultRows.get(i));
hppz003.fromMap(map); DaoUtils.update("HPPZ003.update", fPz003);
hppz003.setUpdatedBy(UserSession.getUserId());
hppz003.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ003.update", hppz003.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
THppz003 hppz003 = new THppz003();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
hppz003.fromMap(map); DaoUtils.update("HPPZ003.delete", resultRows.get(i));
this.dao.delete("HPPZ003.delete", hppz003.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
} }
package com.baosight.hpjx.hp.pz.service; package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.CompanyTypeEnum;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InitiateModeEnum; import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.THppz004; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ003;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -19,117 +20,118 @@ import java.util.List; ...@@ -19,117 +20,118 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author xuao * @author:songx
* @date 2024年01月09日 19:35 * @date:2024/1/22,15:18
*/ */
public class ServiceHPPZ004 extends ServiceBase { public class ServiceHPPZ004 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
THppz004 hppz004 = new THppz004(); try {
EiInfo outInfo = new EiInfo(); inInfo.setBlock(InitiateModeEnum.generatorEiBlock());
outInfo.addBlock(EiConstant.resultBlock); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ004().eiMetadata);
outInfo.getBlock(EiConstant.resultBlock).addBlockMeta(hppz004.eiMetadata); } catch (PlatException e) {
outInfo.setBlock(InventTypeEnun.generatorEiBlock()); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
outInfo.setBlock(InitiateModeEnum.generatorEiBlock()); }
return outInfo; return inInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPPZ004.query", new THppz004()); inInfo = super.query(inInfo, "HPPZ004.query", new HPPZ003());
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
THppz004 hppz004 = new THppz004(); // 数据写入
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPPZ004 fPz004 = new HPPZ004();
Map<?, ?> map = eiBlock.getRow(i); fPz004.fromMap(resultRows.get(i));
hppz004.fromMap(map); // 生成客户编码
fPz004.setInventCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.INVENT_CODE));
this.dao.insert("HPPZ004.insert", hppz004.toMap()); DaoUtils.insert(HPPZ004.INSERT, fPz004);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
THppz004 HPPZ004 = new THppz004(); for (int i = 0; i < resultRows.size(); i++) {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); HPPZ004 fPz004 = new HPPZ004();
for (int i = 0; i < eiBlock.getRowCount(); i++) { fPz004.fromMap(resultRows.get(i));
Map<?, ?> map = eiBlock.getRow(i); DaoUtils.update(HPPZ004.UPDATE, fPz004);
HPPZ004.fromMap(map);
this.dao.update("HPPZ004.update", HPPZ004.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
THppz004 HPPZ004 = new THppz004();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
HPPZ004.fromMap(map); DaoUtils.update(HPPZ004.DELETE, resultRows.get(i));
this.dao.delete("HPPZ004.delete", HPPZ004.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
/**
* @param eiInfo
* @return
*/
public EiInfo queryComboBox(EiInfo eiInfo) { public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap(); Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType")); map.put("inventType", eiInfo.getString("inventType"));
......
...@@ -2,46 +2,42 @@ package com.baosight.hpjx.hp.pz.service; ...@@ -2,46 +2,42 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InitiateModeEnum; import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.THppz006; import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author xuao * @author:songx
* @date 2024年01月10日 15:51 * @date:2024/1/22,15:17
*/ */
public class ServiceHPPZ006 extends ServiceBase { public class ServiceHPPZ006 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*
* @param inInfo
* @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
THppz006 hppz006 = new THppz006(); try {
EiInfo outInfo = new EiInfo(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
outInfo.addBlock(EiConstant.resultBlock); inInfo.setBlock(InitiateModeEnum.generatorEiBlock());
outInfo.getBlock(EiConstant.resultBlock).addBlockMeta(hppz006.eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ006().eiMetadata);
outInfo.setBlock(InitiateModeEnum.generatorEiBlock()); } catch (PlatException e) {
outInfo.setBlock(InventTypeEnun.generatorEiBlock()); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
CommonMethod.initBlock(outInfo, Arrays.asList( }
DdynamicEnum.INVENT_NAME_BLOCK_ID), return inInfo;
new HashMap<String,String>(1) {{
put("status", "1" );
}});
return outInfo;
} }
/** /**
...@@ -49,92 +45,101 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -49,92 +45,101 @@ public class ServiceHPPZ006 extends ServiceBase {
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPPZ006.query", new THppz006()); inInfo = super.query(inInfo, "HPPZ006.query", new HPKC006());
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
* 新增操作. * 新增操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { this.checkSaveData(resultRows);
String inventName =inInfo.getCellStr(EiConstant.resultBlock,i,"inventName"); // 数据写入
String[] str = inventName.split("-"); for (int i = 0; i < resultRows.size(); i++) {
inInfo.setCell(EiConstant.resultBlock,i,"inventCode", str[0]); HPPZ006 fPz006 = new HPPZ006();
inInfo.setCell(EiConstant.resultBlock,i,"inventName", str[1]); fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.getPz004ByCode(fPz006.getInventCode()).getInventName());
DaoUtils.insert(HPPZ006.INSERT, fPz006);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return super.insert(inInfo,"HPPZ006.insert"); return inInfo;
} }
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空");
AssertUtils.isNull(fPz006.getInventCode(), "存货名称不能为空");
}
}
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
THppz006 hppz006 = new THppz006(); for (int i = 0; i < resultRows.size(); i++) {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); HPPZ006 fPz006 = new HPPZ006();
for (int i = 0; i < eiBlock.getRowCount(); i++) { fPz006.fromMap(resultRows.get(i));
Map<?, ?> map = eiBlock.getRow(i); // 存货名称
hppz006.fromMap(map); fPz006.setInventName(HPPZTools.getPz004ByCode(fPz006.getInventCode()).getInventName());
DaoUtils.update(HPPZ006.UPDATE, fPz006);
this.dao.update("HPPZ006.update", hppz006.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
THppz006 hppz006 = new THppz006();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
hppz006.fromMap(map); DaoUtils.update(HPPZ006.DELETE, resultRows.get(i));
this.dao.delete("HPPZ006.delete", hppz006.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
/** /**
...@@ -149,9 +154,28 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -149,9 +154,28 @@ public class ServiceHPPZ006 extends ServiceBase {
list.add(DdynamicEnum.INVENT_SPEC_BLOCK_ID); list.add(DdynamicEnum.INVENT_SPEC_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false); CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "规格下拉框"); LogUtils.setDetailMsg(inInfo, e, "查询规格失败");
} }
return inInfo; return inInfo;
} }
public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
public EiInfo queryMaterialComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
} }
package com.baosight.hpjx.hp.pz.service; package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.sql.Timestamp; import java.util.ArrayList;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author:songx
* @date:2024/1/22,15:57
*/
public class ServiceHPPZ007 extends ServiceBase { public class ServiceHPPZ007 extends ServiceBase {
/**
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPPZ007 hppz007 = new HPPZ007(); try {
EiInfo outInfo = super.initLoad(inInfo, hppz007); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ007().eiMetadata);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hppz007.eiMetadata); } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo; return inInfo;
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ try {
EiInfo outInfo = super.query(inInfo, "HPPZ007.query", new HPPZ007()); inInfo = super.query(inInfo, HPPZ007.QUERY, new HPKC007());
return outInfo; } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
} }
/** /**
...@@ -41,98 +58,90 @@ public class ServiceHPPZ007 extends ServiceBase { ...@@ -41,98 +58,90 @@ public class ServiceHPPZ007 extends ServiceBase {
*/ */
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
HPPZ007 hppz007 = new HPPZ007(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); // 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPPZ007 fPz007 = new HPPZ007();
for (int i = 0; i < eiBlock.getRowCount(); i++) { fPz007.fromMap(resultRows.get(i));
Map<?, ?> map = eiBlock.getRow(i); // 仓库编码
hppz007.fromMap(map); fPz007.setWhCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.WH_CODE));
hppz007.setCreatedBy(UserSession.getLoginName()); DaoUtils.insert(HPPZ007.INSERT, fPz007);
hppz007.setCreatedTime(Timestamp.valueOf(sdf.format(new Date())));
this.dao.insert("HPPZ007.insert", hppz007.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("新增成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (PlatException e) { } catch (Exception e) {
e.printStackTrace(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try { try {
HPPZ007 hppz007 = new HPPZ007(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPPZ007 fPz007 = new HPPZ007();
Map<?, ?> map = eiBlock.getRow(i); fPz007.fromMap(resultRows.get(i));
hppz007.fromMap(map); DaoUtils.update(HPPZ007.UPDATE, fPz007);
hppz007.setUpdatedBy(UserSession.getLoginName());
hppz007.setUpdatedTime(Timestamp.valueOf(sdf.format(new Date())));
System.out.println(Timestamp.valueOf(sdf.format(new Date())));
this.dao.update("HPPZ007.update", hppz007.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo = this.query(inInfo);
inInfo.setMsg("修改成功!"); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
inInfo.setStatus(EiConstant.STATUS_FAILURE); } catch (Exception e) {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); LogUtils.setDetailMsg(inInfo, e, "修改失败");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
HPPZ007 hppz007 = new HPPZ007();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
hppz007.fromMap(map); DaoUtils.update(HPPZ007.DELETE, resultRows.get(i));
this.dao.delete("HPPZ007.delete", hppz007.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo;
} }
return inInfo;
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
} }
/** /**
* 根据仓库CODE找对象 * 根据仓库CODE找对象
*
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo queryByWhCode(EiInfo inInfo) { public EiInfo queryByWhCode(EiInfo inInfo) {
Map params=new HashMap<>(); Map params = new HashMap<>();
params.put("whCode", inInfo.getString("whCode")); params.put("whCode", inInfo.getString("whCode"));
List query = dao.query("HPPZ007.queryByWhCode",params); List query = dao.query("HPPZ007.queryByWhCode", params);
inInfo.set("list", query); inInfo.set("list", query);
return inInfo; return inInfo;
} }
public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("whType", eiInfo.getString("whType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.WH_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-09 14:40:53
Version : 1.0
tableName :hpjx.t_hppz002
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CUST_TYPE TINYINT NOT NULL,
CUST_CODE VARCHAR NOT NULL,
CUST_NAME VARCHAR NOT NULL,
ADDRESS VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR
-->
<sqlMap namespace="HPPZ002"> <sqlMap namespace="HPPZ002">
<select id="query" parameterClass="java.util.HashMap" <sql id="column">
resultClass="com.baosight.hpjx.hp.pz.domain.THppz002">
SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CUST_TYPE as "custType", <!-- 供应商类型 1 国企 : 2 民营 --> CUST_TYPE as "custType", <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE as "custCode", <!-- 供应商编码 --> CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName", <!-- 供应商名称 --> CUST_NAME as "custName", <!-- 供应商名称 -->
ADDRESS as "address", <!-- 地址 --> ADDRESS as "address", <!-- 地址 -->
STATUS as "status", <!-- 状态 0禁用 1启用 --> STATUS as "status", <!-- 状态 0禁用 1启用 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
DEP_CODE as "depCode" <!-- 部门编码 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz002 WHERE 1=1 </sql>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custType">
CUST_TYPE = #custType#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
<!-- <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custType"> <isNotEmpty prepend=" AND " property="custType">
CUST_TYPE = #custType# CUST_TYPE = #custType#
</isNotEmpty> </isNotEmpty>
...@@ -75,7 +36,7 @@ ...@@ -75,7 +36,7 @@
CUST_CODE = #custCode# CUST_CODE = #custCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="custName"> <isNotEmpty prepend=" AND " property="custName">
CUST_NAME = #custName# CUST_NAME LIKE CONCAT('%', #custName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="address"> <isNotEmpty prepend=" AND " property="address">
ADDRESS = #address# ADDRESS = #address#
...@@ -83,52 +44,66 @@ ...@@ -83,52 +44,66 @@
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> </sql>
CREATED_BY = #createdBy#
</isNotEmpty> <sql id="order">
<isNotEmpty prepend=" AND " property="createdTime"> <dynamic prepend=" ORDER BY ">
CREATED_TIME = #createdTime# <isNotEmpty property="orderBy">
</isNotEmpty> $orderBy$
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty> </isNotEmpty>
--> <isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ002">
SELECT
<include refid="column"/>
FROM hpjx.t_hppz002 WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz002 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz002 ( INSERT INTO ${hpjxSchema}.T_HPPZ002 (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CUST_TYPE, <!-- 供应商类型 1 国企 : 2 民营 --> CUST_TYPE, <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE, <!-- 供应商编码 --> CUST_CODE, <!-- 供应商编码 -->
CUST_NAME, <!-- 供应商名称 --> CUST_NAME, <!-- 供应商名称 -->
ADDRESS, <!-- 地址 --> ADDRESS, <!-- 地址 -->
STATUS, <!-- 状态 0禁用 1启用 --> STATUS, <!-- 状态 0禁用 1启用 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_NAME, <!-- 创建人名称 -->
DEP_CODE <!-- 部门编码 --> CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #depCode#, #custType#, #custCode#, #custName#, #address#,
#status#, #createdBy#, #createdName#, #createdTime#
) )
VALUES ( #companyCode#, #custType#, #custCode#, #custName#, #address#, #status#, #createdBy#, #createdTime#, #depCode#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hppz002 WHERE DELETE FROM hpjx.t_hppz002 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hppz002 UPDATE hpjx.t_hppz002
SET SET
CUST_TYPE = #custType#, <!-- 供应商类型 1 国企 : 2 民营 --> CUST_TYPE = #custType#, <!-- 供应商类型 1 国企 : 2 民营 -->
CUST_CODE = #custCode#, <!-- 供应商编码 -->
CUST_NAME = #custName#, <!-- 供应商名称 --> CUST_NAME = #custName#, <!-- 供应商名称 -->
ADDRESS = #address#, <!-- 地址 --> ADDRESS = #address#, <!-- 地址 -->
STATUS = #status#, <!-- 状态 0禁用 1启用 --> STATUS = #status#, <!-- 状态 0禁用 1启用 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 --> UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE WHERE ID = #id#
ID = #id#
</update> </update>
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-09 17:46:33
Version : 1.0
tableName :hpjx.t_hppz003
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
CUST_TYPE TINYINT NOT NULL,
CUST_CODE VARCHAR NOT NULL,
CUST_CNAME VARCHAR NOT NULL,
CUST_ADDR VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME
-->
<sqlMap namespace="HPPZ003"> <sqlMap namespace="HPPZ003">
<select id="query" parameterClass="java.util.HashMap" <sql id="column">
resultClass="com.baosight.hpjx.hp.pz.domain.THppz003">
SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
CUST_TYPE as "custType", <!-- 客商类型 1:国企;2:民营; --> CUST_TYPE as "custType", <!-- 客商类型 1:国企;2:民营; -->
CUST_CODE as "custCode", <!-- 客户编码 --> CUST_CODE as "custCode", <!-- 客户编码 -->
CUST_CNAME as "custCname", <!-- 客户名称 --> CUST_NAME as "custName", <!-- 客户名称 -->
CUST_ADDR as "custAddr", <!-- 地址 --> ADDRESS as "address", <!-- 地址 -->
STATUS as "status", <!-- 状态 0未启用 1启用 --> STATUS as "status", <!-- 状态 0未启用 1启用 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz003 WHERE 1=1 </sql>
<isNotEmpty prepend=" AND " property="custCname">
CUST_CNAME LIKE CONCAT('%',CONCAT(#custCname#,'%')) <sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="custType"> <isNotEmpty prepend=" AND " property="custType">
CUST_TYPE = #custType# CUST_TYPE = #custType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="custCode">
CUST_CODE = #custCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custName">
CUST_NAME LIKE CONCAT('%', #custName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="address">
ADDRESS = #address#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -50,95 +55,60 @@ ...@@ -50,95 +55,60 @@
CREATED_TIME DESC CREATED_TIME DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ003">
SELECT
<include refid="column"/>
FROM hpjx.t_hppz003 WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz003 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hppz003 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custType">
CUST_TYPE = #custType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custCode">
CUST_CODE = #custCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custCname">
CUST_CNAME = #custCname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="custAddr">
CUST_ADDR = #custAddr#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz003 (ID, INSERT INTO ${hpjxSchema}.T_HPPZ003 (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
CUST_TYPE, <!-- 客商类型 1:国企;2:民营; --> CUST_TYPE, <!-- 客商类型 1:国企;2:民营; -->
CUST_CODE, <!-- 客户编码 --> CUST_CODE, <!-- 客户编码 -->
CUST_CNAME, <!-- 客户名称 --> CUST_NAME, <!-- 客户名称 -->
CUST_ADDR, <!-- 地址 --> ADDRESS, <!-- 地址 -->
STATUS, <!-- 状态 0未启用 1启用 --> STATUS, <!-- 状态 0未启用 1启用 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_NAME, <!-- 创建人名称 -->
UPDATED_BY, <!-- 更新人 --> CREATED_TIME <!-- 创建时间 -->
UPDATED_TIME <!-- 更新时间 --> ) VALUES (
#companyCode#, #depCode#, #custType#, #custCode#, #custName#, #address#,
#status#, #createdBy#, #createdName#, #createdTime#
) )
VALUES (#id#, #companyCode#, #custType#, #custCode#, #custCname#, #custAddr#, #status#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hppz003 WHERE DELETE FROM hpjx.t_hppz003 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hppz003 UPDATE hpjx.t_hppz003
SET SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 -->
CUST_TYPE = #custType#, <!-- 客商类型 1:国企;2:民营; --> CUST_TYPE = #custType#, <!-- 客商类型 1:国企;2:民营; -->
CUST_CODE = #custCode#, <!-- 客户编码 --> CUST_NAME = #custName#, <!-- 客户名称 -->
CUST_CNAME = #custCname#, <!-- 客户名称 --> ADDRESS = #address#, <!-- 地址 -->
CUST_ADDR = #custAddr#, <!-- 地址 -->
STATUS = #status#, <!-- 状态 0未启用 1启用 --> STATUS = #status#, <!-- 状态 0未启用 1启用 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 --> UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE WHERE ID = #id#
ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap" <select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
CUST_CODE as "custCode", CUST_CODE as "custCode",
CUST_CNAME as "custName" CUST_NAME as "custName"
FROM hpjx.t_hppz003 WHERE STATUS=1 FROM hpjx.t_hppz003 WHERE STATUS=1
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
...@@ -148,4 +118,5 @@ ...@@ -148,4 +118,5 @@
</isNotEmpty> </isNotEmpty>
ORDER BY CUST_CODE ORDER BY CUST_CODE
</select> </select>
</sqlMap> </sqlMap>
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-09 19:25:19
Version : 1.0
tableName :hpjx.t_hppz004
ID INTEGER NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
INVENT_CODE VARCHAR NOT NULL,
INVENT_FATHER_NAME VARCHAR NOT NULL,
INVENT_FATHER_CODE VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_BY VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR
-->
<sqlMap namespace="HPPZ004"> <sqlMap namespace="HPPZ004">
<select id="query" parameterClass="java.util.HashMap" <sql id="column">
resultClass="com.baosight.hpjx.hp.pz.domain.THppz004">
SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
INVENT_NAME as "inventName", <!-- 存货名称 --> DEP_CODE as "depCode", <!-- 部门编码 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_TYPE as "inventType", <!-- 存货类型 --> INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
STATUS as "status", <!-- 状态 0未启用 1启用 --> STATUS as "status", <!-- 状态 0未启用 1启用 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
DEP_CODE as "depCode" <!-- 部门编码 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz004 WHERE 1=1 </sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes"> <isNotEmpty prepend=" AND " property="companyCode">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate> COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName"> <isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName# INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID asc ID DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ004">
SELECT
<include refid="column"/>
FROM hpjx.t_hppz004 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz004 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hppz004 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id# <include refid="customCondition"/>
</isNotEmpty>
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventFatherName">
INVENT_FATHER_NAME = #inventFatherName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventFatherCode">
INVENT_FATHER_CODE = #inventFatherCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz004 ( INSERT INTO ${hpjxSchema}.T_HPPZ004 (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
INVENT_NAME, <!-- 存货名称 --> DEP_CODE, <!-- 部门编码 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_TYPE, <!-- 存货类型 --> INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
STATUS, <!-- 状态 0未启用 1启用 --> STATUS, <!-- 状态 0未启用 1启用 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_NAME, <!-- 创建人名称 -->
DEP_CODE <!-- 部门编码 --> CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #depCode#, #inventType#, #inventCode#, #inventName#,
#status#, #createdBy#, #createdName#, #createdTime#
) )
VALUES ( #companyCode#, #inventName#, #inventCode#, #inventType#, #status#, #createdBy#, #createdTime#, #depCode#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hppz004 WHERE DELETE FROM hpjx.t_hppz004 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hppz004 UPDATE hpjx.t_hppz004
SET SET
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 --> INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
STATUS = #status#, <!-- 状态 0未启用 1启用 --> STATUS = #status#, <!-- 状态 0未启用 1启用 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 --> UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE WHERE ID = #id#
ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap" <!-- -->
resultClass="java.util.HashMap"> <select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
INVENT_CODE as "inventCode", INVENT_CODE as "inventCode",
INVENT_NAME as "inventName" INVENT_NAME as "inventName"
FROM hpjx.t_hppz004 WHERE STATUS=1 FROM hpjx.t_hppz004
WHERE STATUS = 1
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -146,31 +123,6 @@ ...@@ -146,31 +123,6 @@
<isNotEmpty prepend=" AND " property="inventType"> <isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType# INVENT_TYPE = #inventType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
ORDER BY INVENT_CODE
</select>
<select id="queryMatNameByCode" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.THppz004">
SELECT DISTINCT
INVENT_CODE as "inventCode",
INVENT_NAME as "inventName"
FROM hpjx.t_hppz004 WHERE STATUS=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
ORDER BY INVENT_CODE ORDER BY INVENT_CODE
</select> </select>
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ006"> <sqlMap namespace="HPPZ006">
<select id="query" parameterClass="java.util.HashMap" <sql id="column">
resultClass="com.baosight.hpjx.hp.pz.domain.THppz006">
SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
INVENT_NAME as "inventName", <!-- 存货名称 --> DEP_CODE as "depCode", <!-- 部门编码 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_TYPE as "inventType", <!-- 存货类型 --> INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
STATUS as "status", <!-- 状态 0未启用 1启用 --> STATUS as "status", <!-- 状态 0未启用 1启用 -->
SPEC as "spec", <!-- 规格 --> SPEC as "spec", <!-- 规格 -->
LENGTH as "length", <!-- 长 --> LENGTH as "length", <!-- 长 -->
...@@ -19,47 +18,71 @@ ...@@ -19,47 +18,71 @@
COEFFICIENT as "coefficient", <!-- 系数 --> COEFFICIENT as "coefficient", <!-- 系数 -->
UNIT as "unit", <!-- 单位 --> UNIT as "unit", <!-- 单位 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 --> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 --> UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
DEP_CODE as "depCode" <!-- 部门编码 --> UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
FROM hpjx.t_hppz006 WHERE 1=1 </sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType"> <isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType# INVENT_TYPE = #inventType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName"> <isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName# INVENT_NAME = #inventName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID asc ID DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ006">
SELECT
<include refid="column"/>
FROM hpjx.t_hppz006 WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz006 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hppz006 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz006 ( INSERT INTO ${hpjxSchema}.T_HPPZ006 (
COMPANY_CODE, <!-- 企业编码 预留 --> COMPANY_CODE, <!-- 企业编码 预留 -->
INVENT_NAME, <!-- 存货名称 --> DEP_CODE, <!-- 部门编码 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_TYPE, <!-- 存货类型 --> INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
STATUS, <!-- 状态 0未启用 1启用 --> STATUS, <!-- 状态 0未启用 1启用 -->
SPEC, <!-- 规格 --> SPEC, <!-- 规格 -->
LENGTH, <!-- 长 --> LENGTH, <!-- 长 -->
...@@ -69,23 +92,22 @@ ...@@ -69,23 +92,22 @@
COEFFICIENT, <!-- 系数 --> COEFFICIENT, <!-- 系数 -->
UNIT, <!-- 单位 --> UNIT, <!-- 单位 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_NAME, <!-- 创建人名称 -->
DEP_CODE <!-- 部门编码 --> CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #depCode#, #inventType#, #inventCode#, #inventName#,
#status#, #spec#, #length#, #wide#, #thick#, #material#, #coefficient#,
#unit#, #createdBy#, #createdName#, #createdTime#
) )
VALUES ( #companyCode#, #inventName#, #inventCode#, #inventType#, #status#, #spec#, #length#, #wide#, #thick#, #material#, #coefficient#, #unit#, #createdBy#, #createdTime#, #depCode#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hppz006 WHERE DELETE FROM hpjx.t_hppz006 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hppz006 UPDATE hpjx.t_hppz006
SET SET
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
STATUS = #status#, <!-- 状态 0未启用 1启用 --> STATUS = #status#, <!-- 状态 0未启用 1启用 -->
SPEC = #spec#, <!-- 规格 --> SPEC = #spec#, <!-- 规格 -->
LENGTH = #length#, <!-- 长 --> LENGTH = #length#, <!-- 长 -->
...@@ -95,14 +117,12 @@ ...@@ -95,14 +117,12 @@
COEFFICIENT = #coefficient#, <!-- 系数 --> COEFFICIENT = #coefficient#, <!-- 系数 -->
UNIT = #unit#, <!-- 单位 --> UNIT = #unit#, <!-- 单位 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 --> UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id#
WHERE
ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap" <select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
ID as "id", ID as "id",
CONCAT(INVENT_CODE,'-',INVENT_NAME,'[',SPEC,']') as "inventName" CONCAT(INVENT_CODE,'-',INVENT_NAME,'[',SPEC,']') as "inventName"
...@@ -116,6 +136,21 @@ ...@@ -116,6 +136,21 @@
ORDER BY INVENT_CODE ORDER BY INVENT_CODE
</select> </select>
<select id="queryMaterialComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
INVENT_CODE as "inventCode",
INVENT_NAME as "inventName"
FROM hpjx.t_hppz006 WHERE STATUS=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
ORDER BY INVENT_CODE
</select>
<!-- 规格下拉框 --> <!-- 规格下拉框 -->
<select id="queryComboBoxSpec" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryComboBoxSpec" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
...@@ -127,6 +162,9 @@ ...@@ -127,6 +162,9 @@
<isNotEmpty prepend=" AND " property="inventCode"> <isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode# INVENT_CODE = #inventCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
ORDER BY ID ORDER BY ID
</select> </select>
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-09 15:56:49
Version : 1.0
tableName :hpjx.t_hppz007
ID INTEGER NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
WH_TYPE VARCHAR NOT NULL,
WH_CODE VARCHAR NOT NULL,
WH_NAME VARCHAR NOT NULL,
PRINC VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_TIME DATETIME,
CREATED_BY VARCHAR,
UPDATED_TIME DATETIME,
UPDATED_BY VARCHAR
-->
<sqlMap namespace="HPPZ007"> <sqlMap namespace="HPPZ007">
<sql id="column">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
SELECT
ID as "id", ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
WH_TYPE as "whType", <!-- 仓库类型 --> WH_TYPE as "whType", <!-- 仓库类型 -->
WH_CODE as "whCode", <!-- 仓库编码 --> WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 --> WH_NAME as "whName", <!-- 仓库名称 -->
PRINC as "princ", <!-- 负责人 --> PRINC as "princ", <!-- 负责人 -->
STATUS as "status", <!-- 状态 0未启用 1启用 --> STATUS as "status", <!-- 状态 0未启用 1启用 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
UPDATED_TIME as "updatedTime", <!-- 修改时间 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
UPDATED_BY as "updatedBy" <!-- 修改人 --> CREATED_TIME as "createdTime", <!-- 创建时间 -->
FROM hpjx.t_hppz007 WHERE 1=1 UPDATED_BY as "updatedBy", <!-- 修改人 -->
<isNotEmpty prepend=" AND " property="whCode"> UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
WH_CODE = #whCode# UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</isNotEmpty> </sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="whCodes"> <isNotEmpty prepend=" AND " property="whCodes">
WH_CODE IN <iterate close=")" open="(" conjunction="," property="whCodes">#whCodes[]#</iterate> WH_CODE IN <iterate close=")" open="(" conjunction="," property="whCodes">#whCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="whName"> </sql>
WH_NAME LIKE CONCAT('%',CONCAT(#whName#),'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whType">
WH_TYPE LIKE CONCAT('%',CONCAT(#whType#),'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz007 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
<!-- <sql id="condition">
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whType"> <isNotEmpty prepend=" AND " property="whType">
WH_TYPE = #whType# WH_TYPE = #whType#
</isNotEmpty> </isNotEmpty>
...@@ -81,7 +42,7 @@ ...@@ -81,7 +42,7 @@
WH_CODE = #whCode# WH_CODE = #whCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="whName"> <isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName# WH_NAME LIKE CONCAT('%', #whName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="princ"> <isNotEmpty prepend=" AND " property="princ">
PRINC = #princ# PRINC = #princ#
...@@ -89,54 +50,67 @@ ...@@ -89,54 +50,67 @@
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime"> </sql>
CREATED_TIME = #createdTime#
</isNotEmpty> <sql id="order">
<isNotEmpty prepend=" AND " property="createdBy"> <dynamic prepend="ORDER BY">
CREATED_BY = #createdBy# <isNotEmpty property="orderBy">
</isNotEmpty> $orderBy$
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty> </isNotEmpty>
--> <isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
SELECT
<include refid="column"/>
FROM hpjx.t_hppz007 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz007 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<insert id="insert"> <insert id="insert">
INSERT INTO hpjx.t_hppz007 ( INSERT INTO ${hpjxSchema}.T_HPPZ007 (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
WH_TYPE, <!-- 仓库类型 --> WH_TYPE, <!-- 仓库类型 -->
WH_CODE, <!-- 仓库编码 --> WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 --> WH_NAME, <!-- 仓库名称 -->
PRINC, <!-- 负责人 --> PRINC, <!-- 负责人 -->
STATUS, <!-- 状态 0未启用 1启用 --> STATUS, <!-- 状态 0未启用 1启用 -->
CREATED_TIME, <!-- 创建时间 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
UPDATED_TIME, <!-- 修改时间 --> CREATED_NAME, <!-- 创建人名称 -->
UPDATED_BY <!-- 修改人 --> CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #depCode#, #whType#, #whCode#, #whName#, #princ#, #status#,
#createdBy#, #createdName#, #createdTime#
) )
VALUES (#whType#, #whCode#, #whName#, #princ#, #status#, #createdTime#, #createdBy#, #updatedTime#, #updatedBy#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hppz007 WHERE DELETE FROM hpjx.t_hppz007 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hppz007 UPDATE hpjx.t_hppz007
SET SET
WH_TYPE = #whType#, <!-- 仓库类型 --> WH_TYPE = #whType#, <!-- 仓库类型 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 --> WH_NAME = #whName#, <!-- 仓库名称 -->
PRINC = #princ#, <!-- 负责人 --> PRINC = #princ#, <!-- 负责人 -->
STATUS = #status#, <!-- 状态 0未启用 1启用 --> STATUS = #status#, <!-- 状态 0未启用 1启用 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 --> UPDATED_BY = #updatedBy#, <!-- 修改人 -->
CREATED_BY = #createdBy#, <!-- 创建人 --> UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 --> UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
UPDATED_BY = #updatedBy# <!-- 修改人 --> WHERE ID = #id#
WHERE
ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap" <select id="queryComboBox" parameterClass="java.util.HashMap"
...@@ -154,15 +128,10 @@ ...@@ -154,15 +128,10 @@
ORDER BY WH_CODE ORDER BY WH_CODE
</select> </select>
<select id="queryByWhCode" parameterClass="java.util.HashMap" <select id="queryByWhCode" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
SELECT WH_NAME as "whName" SELECT WH_NAME as "whName"
FROM hpjx.t_hppz007 WHERE 1=1 FROM hpjx.t_hppz007 WHERE 1=1
<isNotEmpty prepend=" AND " property="whCode"> AND WH_CODE = #whCode#
WH_CODE = #whCode#
</isNotEmpty>
</select> </select>
</sqlMap> </sqlMap>
...@@ -4,8 +4,7 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -4,8 +4,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.THppz004; import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.THppz006;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -21,12 +20,42 @@ import java.util.stream.Collectors; ...@@ -21,12 +20,42 @@ import java.util.stream.Collectors;
public class HPPZTools { public class HPPZTools {
/** /**
* 查询存货
*
* @param inventCode
* @return
*/
public static HPPZ004 getPz004ByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
List<HPPZ004> pz004s = DaoBase.getInstance().query("HPPZ004.query", queryMap);
AssertUtils.isNull(pz004s, String.format("存货编码[%s]不存在", inventCode));
return pz004s.get(0);
}
/**
* 查询仓库
*
* @param whCode
* @return
*/
public static HPPZ007 getPz007ByCode(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("whCode", whCode);
List<HPPZ007> pz007s = DaoBase.getInstance().query("HPPZ007.queryByWhCode", queryMap);
AssertUtils.isNull(pz007s, String.format("仓库编码[%s]不存在", whCode));
return pz007s.get(0);
}
/**
* 查询存货信息 * 查询存货信息
* *
* @param inventCodes * @param inventCodes
* @return * @return
*/ */
public static List<THppz004> listPz004(List<String> inventCodes) { public static List<HPPZ004> listPz004(List<String> inventCodes) {
if (CollectionUtils.isEmpty(inventCodes)) { if (CollectionUtils.isEmpty(inventCodes)) {
return null; return null;
} }
...@@ -41,12 +70,12 @@ public class HPPZTools { ...@@ -41,12 +70,12 @@ public class HPPZTools {
* @param inventCodes * @param inventCodes
* @return * @return
*/ */
public static Map<String, THppz004> mapPz004(List<String> inventCodes) { public static Map<String, HPPZ004> mapPz004(List<String> inventCodes) {
List<THppz004> pz004s = listPz004(inventCodes); List<HPPZ004> pz004s = listPz004(inventCodes);
if (CollectionUtils.isEmpty(pz004s)) { if (CollectionUtils.isEmpty(pz004s)) {
return null; return null;
} }
return pz004s.stream().collect(Collectors.toMap(THppz004::getInventCode, item -> item)); return pz004s.stream().collect(Collectors.toMap(HPPZ004::getInventCode, item -> item));
} }
/** /**
......
...@@ -52,15 +52,11 @@ ...@@ -52,15 +52,11 @@
AND MEMBER_ID = #memberId# AND MEMBER_ID = #memberId#
</select> </select>
<!-- 用户组查询 --> <!-- 查询用户组织机构 -->
<select id="queryGroupEname" resultClass="java.util.LinkedHashMap"> <select id="queryOrgId" resultClass="java.util.LinkedHashMap">
SELECT SELECT ORG_ID AS "orgId"
ID as "id", <!-- id --> FROM ${platSchema}.TXSOG02
GROUP_ENAME as "groupEname", <!-- 用户组id --> WHERE USER_ID = #userId#
GROUP_CNAME as "groupCname" <!-- 用户组名字 -->
FROM ${platSchema}.XS_USER_GROUP
WHERE 1=1
AND ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</select> </select>
</sqlMap> </sqlMap>
package com.baosight.hpjx.hp.xs.tools; package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
...@@ -26,4 +27,16 @@ public class HPXSUserTools { ...@@ -26,4 +27,16 @@ public class HPXSUserTools {
return CollectionUtils.isEmpty(results) ? 0 : results.get(0); return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
} }
/**
* 查询用户组织机构
*
* @return
*/
public static String getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString();
}
} }
package com.baosight.hpjx.hp.zl.service; package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC008; import com.baosight.hpjx.hp.kc.domain.HPKC008;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.hp.sc.domain.THPSC001; import com.baosight.hpjx.hp.sc.domain.THPSC001;
import com.baosight.hpjx.hp.sc.domain.THPSC002;
import com.baosight.hpjx.hp.zl.domain.HPZL001; import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
...@@ -14,13 +13,14 @@ import com.baosight.hpjx.util.StringUtil; ...@@ -14,13 +13,14 @@ import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.*; import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author ZJH * @author ZJH
...@@ -64,22 +64,21 @@ public class ServiceHPZL001 extends ServiceBase { ...@@ -64,22 +64,21 @@ public class ServiceHPZL001 extends ServiceBase {
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
Map resultRow = resultRows.get(i); HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
// 去除日期字符串中的- // 去除日期字符串中的-
String datemonth = MapUtils.getString(resultRow, "receiptDate"); fZl001.setReceiptDate(StringUtil.removeHorizontalLine(fZl001.getReceiptDate()));
resultRow.put("datemonth", StringUtil.removeHorizontalLine(datemonth));
// 项目名称 // 项目名称
Map params1 = new HashMap<>(); Map params1 = new HashMap<>();
params1.put("itemCode", MapUtils.getString(resultRow, "itemCode")); params1.put("itemCode", fZl001.getItemCode());
List<THPSC001> query1 = dao.query("HPSC001.query", params1); List<THPSC001> query1 = dao.query("HPSC001.query", params1);
resultRow.put("itemName", query1.get(0).getProjName()); fZl001.setItemName(query1.get(0).getProjName());
// 生成单据号 // 生成单据号
resultRow.put("chkBillno", SequenceGenerator.getNextSequence( fZl001.setChkBillno(SequenceGenerator.getNextSequence(
HPConstant.SequenceId.HPZL001_NUMBER)); HPConstant.SequenceId.HPZL001_NUMBER));
DaoUtils.insert("HPZL001.insert", resultRow); DaoUtils.insert("HPZL001.insert", fZl001);
} }
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) { } catch (Exception e) {
...@@ -88,75 +87,103 @@ public class ServiceHPZL001 extends ServiceBase { ...@@ -88,75 +87,103 @@ public class ServiceHPZL001 extends ServiceBase {
return inInfo; return inInfo;
} }
/** /**
* 修改操作. * 修改操作
*
* @param inInfo
* @return
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
HPZL001 HPZL001 = new HPZL001(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
String itemName =inInfo.getCellStr(EiConstant.resultBlock,i,"itemName"); // 去除日期字符串中的-
String[] str = itemName.split("-"); fZl001.setReceiptDate(StringUtil.removeHorizontalLine(fZl001.getReceiptDate()));
inInfo.setCell(EiConstant.resultBlock,i,"itemCode", str[0]); // 项目名称
inInfo.setCell(EiConstant.resultBlock,i,"itemName", str[1]); Map params1 = new HashMap<>();
params1.put("itemCode", fZl001.getItemCode());
String receiptDate = inInfo.getCellStr(EiConstant.resultBlock,i,"receiptDate"); List<THPSC001> query1 = dao.query("HPSC001.query", params1);
inInfo.setCell(EiConstant.resultBlock,i,"receiptDate", StringUtil.removeHorizontalLine(receiptDate)); fZl001.setItemName(query1.get(0).getProjName());
DaoUtils.update("HPZL001.update", fZl001);
Map<?, ?> map = eiBlock.getRow(i);
HPZL001.fromMap(map);
this.dao.update("HPZL001.update", HPZL001.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
} }
/** /**
* 删除操作. * 删除操作
*
* @param inInfo
* @return
*/ */
public EiInfo delete(EiInfo eiInfo) { public EiInfo delete(EiInfo inInfo) {
HPZL001 HPZL001 = new HPZL001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try { try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
HPZL001.fromMap(map); DaoUtils.update("HPZL001.delete", resultRows.get(i));
this.dao.delete("HPZL001.delete", HPZL001.toMap());
} }
} catch (PlatException e) { inInfo = this.query(inInfo);
eiInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
eiInfo.setDetailMsg(e.getMessage()); } catch (Exception e) {
logError("删除失败!", e.getMessage()); LogUtils.setDetailMsg(inInfo, e, "删除失败");
return eiInfo; }
return inInfo;
} }
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); /**
eiInfo.setMsg("删除成功!"); * 审核操作
return eiInfo; *
* @param inInfo
* @return
*/
public EiInfo audit(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
fZl001.setStatus(1);
DaoUtils.update("HPZL001.operator", fZl001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据审核成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
} }
/** /**
* 审核操作. * 反审操作
*
* @param inInfo
* @return
*/ */
public EiInfo operator(EiInfo inInfo) { public EiInfo unAudit(EiInfo inInfo) {
HPZL001 HPZL001 = new HPZL001(); try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
CommonMethod.updateuserInfo(inInfo, EiConstant.resultBlock); for (int i = 0; i < resultRows.size(); i++) {
return super.update(inInfo, "HPZL001.operator"); HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
fZl001.setStatus(0);
DaoUtils.update("HPZL001.operator", fZl001);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据反审成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败");
}
return inInfo;
} }
/** /**
......
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