Commit 14298a2e by wasx8023

1.其他入库单逻辑关联库存

parent e7f11fa5
...@@ -36,6 +36,8 @@ public class HPConstant { ...@@ -36,6 +36,8 @@ public class HPConstant {
public static final String INVENT_CODE = "INVENT_CODE"; public static final String INVENT_CODE = "INVENT_CODE";
// 仓库编码 // 仓库编码
public static final String WH_CODE = "WH_CODE"; public static final String WH_CODE = "WH_CODE";
// 其他入库单号
public static final String OTHER_ENTER_NO = "OTHER_ENTER_NO";
} }
/** /**
......
...@@ -7,6 +7,20 @@ package com.baosight.hpjx.hp.constant; ...@@ -7,6 +7,20 @@ package com.baosight.hpjx.hp.constant;
public class HPSqlConstant { public class HPSqlConstant {
/** /**
* HPKC006 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC006 {
// 查询
public static final String QUERY_SUM = "HPKC006.querySum";
// 锁
public static final String LOCK = "HPKC006.lock";
}
/**
* HPKC009 SQL 定义 * HPKC009 SQL 定义
* *
* @author:songx * @author:songx
......
/**
* Generate time : 2024-01-10 10:28:03
* Version : 1.0
*/
package com.baosight.hpjx.hp.kc.domain; package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.util.DateUtils;
import java.sql.Timestamp;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
/** /**
* THpkc006 * Project: <br>
* Title:THpkc006.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
* *
* @version 1.0
* @history 2024-01-23 20:37:58 create
*/ */
public class HPKC006 extends DaoEPBase { public class HPKC006 extends DaoEPBase {
private Integer id = 0; private static final long serialVersionUID = 1L;
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/ public static final String FIELD_ID = "id";
private Date receiptTime; /* 单据日期*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
private String otherEnthouse = " "; /* 其他入库单号*/ public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/
private String whCode = " "; /* 仓库编码*/ public static final String FIELD_RECEIPT_DATE = "receiptDate"; /* 单据日期*/
private String whName = " "; /* 仓库名称*/ public static final String FIELD_OTHER_ENTER_NO = "otherEnterNo"; /* 其他入库单号*/
private String matType = " "; /* 物料类型*/ public static final String FIELD_WH_CODE = "whCode"; /* 仓库编码*/
private String matCode = " "; /* 物料编码*/ public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/
private String matName = " "; /* 物料名称*/ public static final String FIELD_INVENT_TYPE = "inventType"; /* 物料类型*/
private String spec = " "; /* 规格*/ public static final String FIELD_INVENT_CODE = "inventCode"; /* 物料编码*/
private BigDecimal amount = new BigDecimal("0"); /* 数量*/ public static final String FIELD_INVENT_NAME = "inventName"; /* 物料名称*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/ public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格*/
private int status; /* 状态 0审核 1保存*/ public static final String FIELD_AMOUNT = "amount"; /* 数量*/
private String remark = " "; /* 备注*/ public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_STATUS = "status"; /* 状态 0审核 1保存*/
/** public static final String FIELD_REMARK = "remark"; /* 备注*/
* initialize the metadata public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public void initMetaData() { public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
EiColumn eiColumn; public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
eiColumn = new EiColumn("id"); public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" "); public static final String COL_ID = "ID";
eiMetadata.addMeta(eiColumn); public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
eiColumn = new EiColumn("companyCode"); public static final String COL_RECEIPT_DATE = "RECEIPT_DATE"; /* 单据日期*/
eiColumn.setDescName("企业编码 预留"); public static final String COL_OTHER_ENTER_NO = "OTHER_ENTER_NO"; /* 其他入库单号*/
eiMetadata.addMeta(eiColumn); public static final String COL_WH_CODE = "WH_CODE"; /* 仓库编码*/
public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/
eiColumn = new EiColumn("depCode"); public static final String COL_INVENT_TYPE = "INVENT_TYPE"; /* 物料类型*/
eiColumn.setDescName("部门编码 预留"); public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 物料编码*/
eiMetadata.addMeta(eiColumn); public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 物料名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 规格*/
eiColumn = new EiColumn("receiptTime"); public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
eiColumn.setDescName("单据日期"); public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
eiMetadata.addMeta(eiColumn); public static final String COL_STATUS = "STATUS"; /* 状态 0审核 1保存*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
eiColumn = new EiColumn("otherEnthouse"); public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
eiColumn.setDescName("其他入库单号"); public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
eiMetadata.addMeta(eiColumn); public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
eiColumn = new EiColumn("whCode"); public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
eiColumn.setDescName("仓库编码"); public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
eiMetadata.addMeta(eiColumn);
public static final String QUERY = "HPKC006.query";
eiColumn = new EiColumn("whName"); public static final String COUNT = "HPKC006.count";
eiColumn.setDescName("仓库名称"); public static final String INSERT = "HPKC006.insert";
eiMetadata.addMeta(eiColumn); public static final String UPDATE = "HPKC006.update";
public static final String DELETE = "HPKC006.delete";
eiColumn = new EiColumn("matType");
eiColumn.setDescName("物料类型"); private Integer id = null;
eiMetadata.addMeta(eiColumn); private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/
eiColumn = new EiColumn("matCode"); private String receiptDate = " "; /* 单据日期*/
eiColumn.setDescName("物料编码"); private String otherEnterNo = " "; /* 其他入库单号*/
eiMetadata.addMeta(eiColumn); private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
eiColumn = new EiColumn("matName"); private String inventType = " "; /* 物料类型*/
eiColumn.setDescName("物料名称"); private String inventCode = " "; /* 物料编码*/
eiMetadata.addMeta(eiColumn); private String inventName = " "; /* 物料名称*/
private Long inventRecordId = null; /* 规格*/
eiColumn = new EiColumn("spec"); private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
eiColumn.setDescName("规格"); private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
eiMetadata.addMeta(eiColumn); private Integer status; /* 状态 0审核 1保存*/
private String remark = " "; /* 备注*/
eiColumn = new EiColumn("amount"); private String createdBy = " "; /* 创建人*/
eiColumn.setType("N"); private String createdName = " "; /* 创建人名称*/
eiColumn.setScaleLength(2); private String createdTime = " "; /* 创建时间*/
eiColumn.setFieldLength(10); private String updatedBy = " "; /* 更新人*/
eiColumn.setDescName("数量"); private String updatedName = " "; /* 更新人名称*/
eiMetadata.addMeta(eiColumn); private String updatedTime = " "; /* 更新时间*/
eiColumn = new EiColumn("weight"); /**
eiColumn.setType("N"); * initialize the metadata.
eiColumn.setScaleLength(2); */
eiColumn.setFieldLength(10); public void initMetaData() {
eiColumn.setDescName("重量"); EiColumn eiColumn;
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ID);
eiColumn = new EiColumn("status"); eiColumn.setPrimaryKey(true);
eiColumn.setDescName("状态 0审核 1保存"); eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("remark"); eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("备注"); eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
} eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn);
/**
* the constructor eiColumn = new EiColumn(FIELD_RECEIPT_DATE);
*/ eiColumn.setDescName("单据日期");
public HPKC006() { eiMetadata.addMeta(eiColumn);
initMetaData();
} eiColumn = new EiColumn(FIELD_OTHER_ENTER_NO);
eiColumn.setDescName("其他入库单号");
/** eiMetadata.addMeta(eiColumn);
* get the id
* @return the id eiColumn = new EiColumn(FIELD_WH_CODE);
*/ eiColumn.setDescName("仓库编码");
public Integer getId() { eiMetadata.addMeta(eiColumn);
return this.id;
} eiColumn = new EiColumn(FIELD_WH_NAME);
eiColumn.setDescName("仓库名称");
/** eiMetadata.addMeta(eiColumn);
* set the id
*/ eiColumn = new EiColumn(FIELD_INVENT_TYPE);
public void setId(Integer id) { eiColumn.setDescName("物料类型");
this.id = id; eiMetadata.addMeta(eiColumn);
}
eiColumn = new EiColumn(FIELD_INVENT_CODE);
/** eiColumn.setDescName("物料编码");
* get the companyCode - 企业编码 预留 eiMetadata.addMeta(eiColumn);
* @return the companyCode
*/ eiColumn = new EiColumn(FIELD_INVENT_NAME);
public String getCompanyCode() { eiColumn.setDescName("物料名称");
return this.companyCode; eiMetadata.addMeta(eiColumn);
}
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
/** eiColumn.setDescName("规格");
* set the companyCode - 企业编码 预留 eiMetadata.addMeta(eiColumn);
*/
public void setCompanyCode(String companyCode) { eiColumn = new EiColumn(FIELD_AMOUNT);
this.companyCode = companyCode; eiColumn.setType("N");
} eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
/** eiColumn.setDescName("数量");
* get the depCode - 部门编码 预留 eiMetadata.addMeta(eiColumn);
* @return the depCode
*/ eiColumn = new EiColumn(FIELD_WEIGHT);
public String getDepCode() { eiColumn.setType("N");
return this.depCode; eiColumn.setScaleLength(2);
} eiColumn.setFieldLength(10);
eiColumn.setDescName("重量");
/** eiMetadata.addMeta(eiColumn);
* set the depCode - 部门编码 预留
*/ eiColumn = new EiColumn(FIELD_STATUS);
public void setDepCode(String depCode) { eiColumn.setDescName("状态 0审核 1保存");
this.depCode = depCode; eiMetadata.addMeta(eiColumn);
}
eiColumn = new EiColumn(FIELD_REMARK);
/** eiColumn.setDescName("备注");
* get the receiptTime - 单据日期 eiMetadata.addMeta(eiColumn);
* @return the receiptTime
*/ eiColumn = new EiColumn(FIELD_CREATED_BY);
public Date getReceiptTime() { eiColumn.setDescName("创建人");
return this.receiptTime; eiMetadata.addMeta(eiColumn);
}
eiColumn = new EiColumn(FIELD_CREATED_NAME);
/** eiColumn.setDescName("创建人名称");
* set the receiptTime - 单据日期 eiMetadata.addMeta(eiColumn);
*/
public void setReceiptTime(Date receiptTime) { eiColumn = new EiColumn(FIELD_CREATED_TIME);
this.receiptTime = receiptTime; eiColumn.setDescName("创建时间");
} eiMetadata.addMeta(eiColumn);
/** eiColumn = new EiColumn(FIELD_UPDATED_BY);
* get the otherEnthouse - 其他入库单号 eiColumn.setDescName("更新人");
* @return the otherEnthouse eiMetadata.addMeta(eiColumn);
*/
public String getOtherEnthouse() { eiColumn = new EiColumn(FIELD_UPDATED_NAME);
return this.otherEnthouse; eiColumn.setDescName("更新人名称");
} eiMetadata.addMeta(eiColumn);
/** eiColumn = new EiColumn(FIELD_UPDATED_TIME);
* set the otherEnthouse - 其他入库单号 eiColumn.setDescName("更新时间");
*/ eiMetadata.addMeta(eiColumn);
public void setOtherEnthouse(String otherEnthouse) {
this.otherEnthouse = otherEnthouse;
} }
/** /**
* get the whCode - 仓库编码 * the constructor.
* @return the whCode */
*/ public HPKC006() {
public String getWhCode() { initMetaData();
return this.whCode; }
}
/**
/** * get the id .
* set the whCode - 仓库编码 * @return the id
*/ */
public void setWhCode(String whCode) { public Integer getId() {
this.whCode = whCode; return this.id;
} }
/** /**
* get the whName - 仓库名称 * set the id .
* @return the whName *
*/ * @param id
public String getWhName() { */
return this.whName; public void setId(Integer id) {
} this.id = id;
}
/** /**
* set the whName - 仓库名称 * get the companyCode - 企业编码 预留.
*/ * @return the companyCode
public void setWhName(String whName) { */
this.whName = whName; public String getCompanyCode() {
} return this.companyCode;
}
/**
* get the matType - 物料类型 /**
* @return the matType * set the companyCode - 企业编码 预留.
*/ *
public String getMatType() { * @param companyCode - 企业编码 预留
return this.matType; */
} public void setCompanyCode(String companyCode) {
this.companyCode = companyCode;
/** }
* set the matType - 物料类型 /**
*/ * get the depCode - 部门编码 预留.
public void setMatType(String matType) { * @return the depCode
this.matType = matType; */
} public String getDepCode() {
return this.depCode;
/** }
* get the matCode - 物料编码
* @return the matCode /**
*/ * set the depCode - 部门编码 预留.
public String getMatCode() { *
return this.matCode; * @param depCode - 部门编码 预留
} */
public void setDepCode(String depCode) {
/** this.depCode = depCode;
* set the matCode - 物料编码 }
*/ /**
public void setMatCode(String matCode) { * get the receiptDate - 单据日期.
this.matCode = matCode; * @return the receiptDate
} */
public String getReceiptDate() {
/** return this.receiptDate;
* get the matName - 物料名称 }
* @return the matName
*/ /**
public String getMatName() { * set the receiptDate - 单据日期.
return this.matName; *
} * @param receiptDate - 单据日期
*/
/** public void setReceiptDate(String receiptDate) {
* set the matName - 物料名称 this.receiptDate = receiptDate;
*/ }
public void setMatName(String matName) { /**
this.matName = matName; * get the otherEnterNo - 其他入库单号.
} * @return the otherEnterNo
*/
/** public String getOtherEnterNo() {
* get the spec - 规格 return this.otherEnterNo;
* @return the spec }
*/
public String getSpec() { /**
return this.spec; * set the otherEnterNo - 其他入库单号.
} *
* @param otherEnterNo - 其他入库单号
/** */
* set the spec - 规格 public void setOtherEnterNo(String otherEnterNo) {
*/ this.otherEnterNo = otherEnterNo;
public void setSpec(String spec) { }
this.spec = spec; /**
} * get the whCode - 仓库编码.
* @return the whCode
/** */
* get the amount - 数量 public String getWhCode() {
* @return the amount return this.whCode;
*/ }
public BigDecimal getAmount() {
return this.amount; /**
} * set the whCode - 仓库编码.
*
/** * @param whCode - 仓库编码
* set the amount - 数量 */
*/ public void setWhCode(String whCode) {
public void setAmount(BigDecimal amount) { this.whCode = whCode;
this.amount = amount; }
} /**
* get the whName - 仓库名称.
/** * @return the whName
* get the weight - 重量 */
* @return the weight public String getWhName() {
*/ return this.whName;
public BigDecimal getWeight() { }
return this.weight;
} /**
* set the whName - 仓库名称.
/** *
* set the weight - 重量 * @param whName - 仓库名称
*/ */
public void setWeight(BigDecimal weight) { public void setWhName(String whName) {
this.weight = weight; this.whName = whName;
} }
/**
/** * get the inventType - 物料类型.
* get the status - 状态 0审核 1保存 * @return the inventType
* @return the status */
*/ public String getInventType() {
public int getStatus() { return this.inventType;
return this.status; }
}
/**
/** * set the inventType - 物料类型.
* set the status - 状态 0审核 1保存 *
*/ * @param inventType - 物料类型
public void setStatus(int status) { */
this.status = status; public void setInventType(String inventType) {
} this.inventType = inventType;
}
/** /**
* get the remark - 备注 * get the inventCode - 物料编码.
* @return the remark * @return the inventCode
*/ */
public String getRemark() { public String getInventCode() {
return this.remark; return this.inventCode;
} }
/** /**
* set the remark - 备注 * set the inventCode - 物料编码.
*/ *
public void setRemark(String remark) { * @param inventCode - 物料编码
this.remark = remark; */
} public void setInventCode(String inventCode) {
this.inventCode = inventCode;
/** }
* get the value from Map /**
*/ * get the inventName - 物料名称.
public void fromMap(Map map) { * @return the inventName
*/
setId(NumberUtils.toInteger(StringUtils.toString(map.get("id")), id)); public String getInventName() {
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("companyCode")), companyCode)); return this.inventName;
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("depCode")), depCode)); }
setReceiptTime(DateUtils.toDate(StringUtils.toString(map.get("receiptTime"))));
setOtherEnthouse(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("otherEnthouse")), otherEnthouse)); /**
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("whCode")), whCode)); * set the inventName - 物料名称.
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("whName")), whName)); *
setMatType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("matType")), matType)); * @param inventName - 物料名称
setMatCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("matCode")), matCode)); */
setMatName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("matName")), matName)); public void setInventName(String inventName) {
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("spec")), spec)); this.inventName = inventName;
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get("amount")), amount)); }
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get("weight")), weight)); /**
setStatus(NumberUtils.toint(StringUtils.toString(map.get("status")), status)); * get the inventRecordId - 规格.
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("remark")), remark)); * @return the inventRecordId
} */
public Long getInventRecordId() {
/** return this.inventRecordId;
* set the value to Map }
*/
public Map toMap() { /**
* set the inventRecordId - 规格.
Map map = new HashMap(); *
map.put("id", StringUtils.toString(id, eiMetadata.getMeta("id"))); * @param inventRecordId - 规格
map.put("companyCode", StringUtils.toString(companyCode, eiMetadata.getMeta("companyCode"))); */
map.put("depCode", StringUtils.toString(depCode, eiMetadata.getMeta("depCode"))); public void setInventRecordId(Long inventRecordId) {
map.put("receiptTime",StringUtils.toString(receiptTime, eiMetadata.getMeta("receiptTime"))); this.inventRecordId = inventRecordId;
map.put("otherEnthouse", StringUtils.toString(otherEnthouse, eiMetadata.getMeta("otherEnthouse"))); }
map.put("whCode", StringUtils.toString(whCode, eiMetadata.getMeta("whCode"))); /**
* get the amount - 数量.
map.put("whName", StringUtils.toString(whName, eiMetadata.getMeta("whName"))); * @return the amount
map.put("matType", StringUtils.toString(matType, eiMetadata.getMeta("matType"))); */
map.put("matCode", StringUtils.toString(matCode, eiMetadata.getMeta("matCode"))); public BigDecimal getAmount() {
map.put("matName", StringUtils.toString(matName, eiMetadata.getMeta("matName"))); return this.amount;
map.put("spec", StringUtils.toString(spec, eiMetadata.getMeta("spec"))); }
map.put("amount", StringUtils.toString(amount, eiMetadata.getMeta("amount")));
map.put("weight", StringUtils.toString(weight, eiMetadata.getMeta("weight"))); /**
map.put("status", StringUtils.toString(status, eiMetadata.getMeta("status"))); * set the amount - 数量.
map.put("remark", StringUtils.toString(remark, eiMetadata.getMeta("remark"))); *
// System.out.println("map-->"+map); * @param amount - 数量
return map; */
public void setAmount(BigDecimal amount) {
} this.amount = amount;
} }
\ No newline at end of file /**
* get the weight - 重量.
* @return the weight
*/
public BigDecimal getWeight() {
return this.weight;
}
/**
* set the weight - 重量.
*
* @param weight - 重量
*/
public void setWeight(BigDecimal weight) {
this.weight = weight;
}
/**
* get the status - 状态 0审核 1保存.
* @return the status
*/
public Integer getStatus() {
return this.status;
}
/**
* set the status - 状态 0审核 1保存.
*
* @param status - 状态 0审核 1保存
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 更新人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 更新人名称.
*
* @param updatedName - 更新人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setReceiptDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIPT_DATE)), receiptDate));
setOtherEnterNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OTHER_ENTER_NO)), otherEnterNo));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_RECEIPT_DATE, StringUtils.toString(receiptDate, eiMetadata.getMeta(FIELD_RECEIPT_DATE)));
map.put(FIELD_OTHER_ENTER_NO, StringUtils.toString(otherEnterNo, eiMetadata.getMeta(FIELD_OTHER_ENTER_NO)));
map.put(FIELD_WH_CODE, StringUtils.toString(whCode, eiMetadata.getMeta(FIELD_WH_CODE)));
map.put(FIELD_WH_NAME, StringUtils.toString(whName, eiMetadata.getMeta(FIELD_WH_NAME)));
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
return map;
}
}
...@@ -4,13 +4,13 @@ import com.baosight.hpjx.common.DdynamicEnum; ...@@ -4,13 +4,13 @@ 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.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
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.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;
...@@ -36,16 +36,16 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -36,16 +36,16 @@ public class ServiceHPKC005 extends ServiceBase {
* @return * @return
*/ */
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC005 HPKC005 = new HPKC005(); try {
EiInfo outInfo = super.initLoad(inInfo, HPKC005); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
outInfo.addBlock(EiConstant.queryBlock).setCell(0, "receiptDate", CommonMethod.getCurrentSameYearMonth()); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC006().eiMetadata);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null); } catch (PlatException e) {
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false); }
return outInfo; return inInfo;
} }
/** /**
...@@ -169,10 +169,10 @@ public class ServiceHPKC005 extends ServiceBase { ...@@ -169,10 +169,10 @@ public class ServiceHPKC005 extends ServiceBase {
*/ */
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005(); HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(eiBlock.getRow(i)); fKc005.fromMap(resultRows.get(i));
// 设置基础信息 // 设置基础信息
this.setBaseInfo(fKc005); this.setBaseInfo(fKc005);
DaoUtils.update(HPKC005.UPDATE, fKc005); DaoUtils.update(HPKC005.UPDATE, fKc005);
......
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.iplat4j.core.ei.EiBlock; 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.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
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.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
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.kc.domain.HPKC006; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import org.apache.commons.collections.MapUtils;
import java.sql.Timestamp; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.util.Arrays;
import java.util.Date; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author:songx
* @date:,
*/
public class ServiceHPKC006 extends ServiceBase { public class ServiceHPKC006 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) { /**
HPKC006 hpkc006 = new HPKC006(); * 画面初始化
EiInfo outInfo = super.initLoad(inInfo, hpkc006); *
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hpkc006.eiMetadata); * @param inInfo
return inInfo; * @return
} */
public EiInfo initLoad(EiInfo inInfo) {
try {
/** CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
* 查询操作. CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
*/ CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
@Override CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
public EiInfo query(EiInfo inInfo) { inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC006().eiMetadata);
/* 调用EI查询方法.*/ } catch (PlatException e) {
EiInfo outInfo = super.query(inInfo, "HPKC006.query", new HPKC006()); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
System.out.println(outInfo); }
return outInfo; return inInfo;
}
}
/**
/** * 查询操作
* 新增操作. *
*/ * @param inInfo
@Override * @return
public EiInfo insert(EiInfo inInfo) { */
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @Override
try { public EiInfo query(EiInfo inInfo) {
HPKC006 hpkc006 = new HPKC006(); try {
// System.out.println(inInfo.getBlock("result")); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
for (int i = 0; i < eiBlock.getRowCount(); i++) { inInfo = super.query(inInfo, HPKC006.QUERY, new HPKC006());
Map<?, ?> map = eiBlock.getRow(i); List sum = dao.query(HPSqlConstant.HPKC006.QUERY_SUM, queryRow);
// System.out.println(map); inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
hpkc006.fromMap(map); } catch (Exception e) {
System.out.println(UserSession.getSessionJson()); LogUtils.setDetailMsg(inInfo, e, "查询失败");
System.out.println(Timestamp.valueOf(sdf.format(new Date()))); }
return inInfo;
this.dao.insert("HPKC006.insert", hpkc006.toMap()); }
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS); /**
inInfo.setMsg("新增成功!"); * 新增操作
*
} catch (PlatException e) { * @param inInfo
e.printStackTrace(); * @return
inInfo.setStatus(EiConstant.STATUS_FAILURE); */
inInfo.setMsg("新增失败!原因参见详细错误描述!"); @Override
inInfo.setDetailMsg(e.getMessage()); public EiInfo insert(EiInfo inInfo) {
logError("新增失败", e.getMessage()); try {
return inInfo; List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
} // 数据校验
return inInfo; this.checkSaveData(resultRows);
} // 数据写入
for (int i = 0; i < resultRows.size(); i++) {
/** HPKC006 fKc006 = new HPKC006();
* 修改操作. fKc006.fromMap(resultRows.get(i));
*/ // 设置基础信息
public EiInfo update(EiInfo inInfo) { this.setBaseInfo(fKc006);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 生成入库单号
try { fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
HPKC006 hpkc006 = new HPKC006(); DaoUtils.insert(HPKC006.INSERT, fKc006);
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); // 修改库存
for (int i = 0; i < eiBlock.getRowCount(); i++) { HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(),
Map<?, ?> map = eiBlock.getRow(i); fKc006.getWeight());
hpkc006.fromMap(map); }
inInfo = this.query(inInfo);
this.dao.update("HPKC006.update", hpkc006.toMap()); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
inInfo.setStatus(EiConstant.STATUS_SUCCESS); } catch (Exception e) {
inInfo.setMsg("修改成功!"); LogUtils.setDetailMsg(inInfo, e, "新增失败");
} catch (PlatException e) { }
inInfo.setStatus(EiConstant.STATUS_FAILURE); return inInfo;
inInfo.setMsg("操作失败!原因参见详细错误描述!"); }
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage()); /**
return inInfo; * 修改操作
} *
return query(inInfo); * @param inInfo
} * @return
*/
/** public EiInfo update(EiInfo inInfo) {
* 删除操作. try {
*/ List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
public EiInfo delete(EiInfo eiInfo) { // 数据校验
HPKC006 hpkc006 = new HPKC006(); this.checkSaveData(resultRows);
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock); // 入库单号
try { List<String> otherEnterNos = ObjectUtils.listKey(resultRows, "otherEnterNo");
for (int i = 0; i < eiBlock.getRowCount(); i++) { // 锁记录
Map<?, ?> map = eiBlock.getRow(i); HPKCTools.lockKc006(otherEnterNos);
hpkc006.fromMap(map); // 查询数据库记录
Map<String, HPKC006> mapKc006 = HPKCTools.mapKc006(otherEnterNos);
this.dao.delete("HPKC006.delete", hpkc006.toMap()); for (int i = 0; i < resultRows.size(); i++) {
} HPKC006 fKc006 = new HPKC006();
} catch (PlatException e) { fKc006.fromMap(resultRows.get(i));
eiInfo.setStatus(EiConstant.STATUS_FAILURE); // 设置基础信息
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); this.setBaseInfo(fKc006);
eiInfo.setDetailMsg(e.getMessage()); DaoUtils.update(HPKC006.UPDATE, fKc006);
logError("删除失败!", e.getMessage()); // 计算差异数量与重量
return eiInfo; HPKC006 dbKc006 = mapKc006.get(fKc006.getOtherEnterNo());
} BigDecimal diffAmount = fKc006.getAmount().subtract(dbKc006.getAmount());
BigDecimal diffWeight = fKc006.getWeight().subtract(dbKc006.getWeight());
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); // 修改库存
eiInfo.setMsg("删除成功!"); HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), diffAmount, diffWeight);
return eiInfo; }
} inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fKc006.getWhCode(), "仓库名称不能为空");
AssertUtils.isNull(fKc006.getInventCode(), "存货名称不能为空");
AssertUtils.isNull(fKc006.getInventRecordId(), "规格不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc006.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc006.getWeight(), "重量必须大于0");
}
}
/**
* 设置基础信息
*
* @param fKc006
*/
private void setBaseInfo(HPKC006 fKc006) {
// 去除日期字符串中的-
fKc006.setReceiptDate(StringUtil.removeHorizontalLine(fKc006.getReceiptDate()));
// 仓库名称
fKc006.setWhName(HPPZTools.getPz007ByCode(fKc006.getWhCode()).getWhName());
// 物料名称
fKc006.setInventName(HPPZTools.getPz004ByCode(fKc006.getInventCode()).getInventName());
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 入库单号
List<String> otherEnterNos = ObjectUtils.listKey(resultRows, "otherEnterNo");
// 锁记录
HPKCTools.lockKc006(otherEnterNos);
// 查询数据库记录
Map<String, HPKC006> mapKc006 = HPKCTools.mapKc006(otherEnterNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRows.get(i));
DaoUtils.update(HPKC006.DELETE, fKc006);
// 修改库存
HPKC006 dbKc006 = mapKc006.get(fKc006.getOtherEnterNo());
HPKCTools.updateStock(dbKc006.getWhCode(), dbKc006.getInventRecordId(), dbKc006.getAmount(),
dbKc006.getWeight());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
} }
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
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.hpjx.hp.kc.domain.HPKC007;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Map; import java.util.Map;
/**
* 其他出库单
*
* @author:songx
* @date:2024/1/23,21:44
*/
public class ServiceHPKC007 extends ServiceBase { public class ServiceHPKC007 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) { /**
HPKC007 hpkc007 = new HPKC007(); * 画面初始化
EiInfo outInfo = super.initLoad(inInfo, hpkc007); *
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(hpkc007.eiMetadata); * @param inInfo
return inInfo; * @return
} */
public EiInfo initLoad(EiInfo inInfo) {
try {
/** inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC007().eiMetadata);
* 查询操作. } catch (PlatException e) {
*/ LogUtils.setDetailMsg(inInfo, e, "初始化失败");
@Override }
public EiInfo query(EiInfo inInfo) { return inInfo;
/* 调用EI查询方法.*/ }
EiInfo outInfo = super.query(inInfo, "HPKC007.query", new HPKC007());
return outInfo; /**
* 查询操作.
} */
@Override
/** public EiInfo query(EiInfo inInfo) {
* 新增操作. /* 调用EI查询方法.*/
*/ EiInfo outInfo = super.query(inInfo, "HPKC007.query", new HPKC007());
@Override return outInfo;
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); }
try {
HPKC007 hpkc007 = new HPKC007(); /**
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); * 新增操作.
*/
@Override
for (int i = 0; i < eiBlock.getRowCount(); i++) { public EiInfo insert(EiInfo inInfo) {
Map<?, ?> map = eiBlock.getRow(i); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
hpkc007.fromMap(map); try {
HPKC007 hpkc007 = new HPKC007();
this.dao.insert("HPKC007.insert", hpkc007.toMap()); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!"); for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
} catch (PlatException e) { hpkc007.fromMap(map);
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE); this.dao.insert("HPKC007.insert", hpkc007.toMap());
inInfo.setMsg("新增失败!原因参见详细错误描述!"); }
inInfo.setDetailMsg(e.getMessage()); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
logError("新增失败", e.getMessage()); inInfo.setMsg("新增成功!");
return inInfo;
} } catch (PlatException e) {
return inInfo; e.printStackTrace();
} inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
/** inInfo.setDetailMsg(e.getMessage());
* 修改操作. logError("新增失败", e.getMessage());
*/ return inInfo;
public EiInfo update(EiInfo inInfo) { }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return inInfo;
try { }
HPKC007 hpkc007 = new HPKC007();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); /**
for (int i = 0; i < eiBlock.getRowCount(); i++) { * 修改操作.
Map<?, ?> map = eiBlock.getRow(i); */
hpkc007.fromMap(map); public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.dao.update("HPKC007.update", hpkc007.toMap()); try {
} HPKC007 hpkc007 = new HPKC007();
inInfo.setStatus(EiConstant.STATUS_SUCCESS); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
inInfo.setMsg("修改成功!"); for (int i = 0; i < eiBlock.getRowCount(); i++) {
} catch (PlatException e) { Map<?, ?> map = eiBlock.getRow(i);
inInfo.setStatus(EiConstant.STATUS_FAILURE); hpkc007.fromMap(map);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage()); this.dao.update("HPKC007.update", hpkc007.toMap());
logError("修改失败", e.getMessage()); }
return inInfo; inInfo.setStatus(EiConstant.STATUS_SUCCESS);
} inInfo.setMsg("修改成功!");
return query(inInfo); } catch (PlatException e) {
} inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
/** inInfo.setDetailMsg(e.getMessage());
* 删除操作. logError("修改失败", e.getMessage());
*/ return inInfo;
public EiInfo delete(EiInfo eiInfo) { }
HPKC007 hpkc007 = new HPKC007(); return query(inInfo);
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock); }
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) { /**
Map<?, ?> map = eiBlock.getRow(i); * 删除操作.
hpkc007.fromMap(map); */
public EiInfo delete(EiInfo eiInfo) {
this.dao.delete("HPKC007.delete", hpkc007.toMap()); HPKC007 hpkc007 = new HPKC007();
} EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
} catch (PlatException e) { try {
eiInfo.setStatus(EiConstant.STATUS_FAILURE); for (int i = 0; i < eiBlock.getRowCount(); i++) {
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); Map<?, ?> map = eiBlock.getRow(i);
eiInfo.setDetailMsg(e.getMessage()); hpkc007.fromMap(map);
logError("删除失败!", e.getMessage());
return eiInfo; this.dao.delete("HPKC007.delete", hpkc007.toMap());
} }
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除成功!"); eiInfo.setMsg("删除失败,原因参见详细错误描述!");
return eiInfo; eiInfo.setDetailMsg(e.getMessage());
} logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
} }
...@@ -320,7 +320,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -320,7 +320,7 @@ public class ServiceHPKC009 extends ServiceBase {
List<HPKC006> bItems = dao.query("HPKC006.statDate", queryMap); List<HPKC006> bItems = dao.query("HPKC006.statDate", queryMap);
Map<String, HPKC006> bItemMap = bItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC006> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#" item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMatType() + "#" + item.getMatCode(), item -> item)); + item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.3、发出 // 1.3、发出
List<HPKC007> cItems = dao.query("HPKC007.statDate", queryMap); List<HPKC007> cItems = dao.query("HPKC007.statDate", queryMap);
Map<String, HPKC007> cItemMap = cItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC007> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
...@@ -336,10 +336,10 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -336,10 +336,10 @@ public class ServiceHPKC009 extends ServiceBase {
// 根据期末库存生成收发存对象 // 根据期末库存生成收发存对象
for (HPKC006 aItem : aItems) { for (HPKC006 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#" String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getMatType() + "#" + aItem.getMatCode(); + aItem.getWhCode() + "#" + aItem.getInventType() + "#" + aItem.getInventCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(Integer.parseInt(aItem.getMatType())); kc009.setInventType(Integer.parseInt(aItem.getInventType()));
kc009.setInventCode(aItem.getMatCode()); kc009.setInventCode(aItem.getInventCode());
kc009.setKcType(HPConstant.KcType.QT); kc009.setKcType(HPConstant.KcType.QT);
kc009.setDateType(queryMap.get("dateType").toString()); kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString()); kc009.setDateProc(queryMap.get("yesterDate").toString());
......
...@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.kc.service; ...@@ -2,6 +2,7 @@ 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.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
...@@ -166,19 +167,19 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -166,19 +167,19 @@ public class ServiceHPKC010 extends ServiceBase {
/** /**
* 更新库存 * 更新库存
* @param companyCode 企业编码 *
* @param whCode 仓库编码 * @param inInfo
* @param inventRecordId 存货档案ID
* @param amout 数量
* @param weight 重量
* @return * @return
*/ */
public EiInfo updateStock(String companyCode, String whCode, Long inventRecordId public EiInfo updateStock(EiInfo inInfo){
, BigDecimal amout, BigDecimal weight){ String whCode = inInfo.getString("whCode");
EiInfo inInfo = new EiInfo(); Long inventRecordId = Long.parseLong(inInfo.getString("inventRecordId"));
BigDecimal amount = new BigDecimal(inInfo.getString("amount"));
BigDecimal weight = new BigDecimal(inInfo.getString("weight"));
String companyCode = UserSessionUtils.getCompanyCode();
try { try {
checkUpdateStockParam(companyCode,whCode,inventRecordId,amout,weight); checkUpdateStockParam(companyCode,whCode,inventRecordId,amount,weight);
HPKC010 newObj = generatorBaseInfo(companyCode,whCode,inventRecordId,amout,weight); HPKC010 newObj = generatorBaseInfo(companyCode,whCode,inventRecordId,amount,weight);
List<Map> list = dao.query("queryByCondition",new HashMap<String,Object>(){{ List<Map> list = dao.query("queryByCondition",new HashMap<String,Object>(){{
put("companyCode",companyCode); put("companyCode",companyCode);
put("whCode",whCode); put("whCode",whCode);
...@@ -186,8 +187,8 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -186,8 +187,8 @@ public class ServiceHPKC010 extends ServiceBase {
}}); }});
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
//新增 //新增
if(Objects.isNull(amout)||amout.compareTo(BigDecimal.ZERO)<=0 if(Objects.isNull(amount)||amount.compareTo(BigDecimal.ZERO)<=0
||Objects.isNull(amout)||weight.compareTo(BigDecimal.ZERO)<=0){ ||Objects.isNull(amount)||weight.compareTo(BigDecimal.ZERO)<=0){
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!"); throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
} }
generatorBaseInfo(newObj); generatorBaseInfo(newObj);
...@@ -196,7 +197,7 @@ public class ServiceHPKC010 extends ServiceBase { ...@@ -196,7 +197,7 @@ public class ServiceHPKC010 extends ServiceBase {
//修改 //修改
HPKC010 oldObj = new HPKC010(); HPKC010 oldObj = new HPKC010();
oldObj.fromMap(list.get(0)); oldObj.fromMap(list.get(0));
BigDecimal afterAmout = oldObj.getAmount().add(amout); BigDecimal afterAmout = oldObj.getAmount().add(amount);
BigDecimal afterWeight = oldObj.getWeight().add(weight); BigDecimal afterWeight = oldObj.getWeight().add(weight);
if(afterAmout.compareTo(BigDecimal.ZERO)<=0||afterWeight.compareTo(BigDecimal.ZERO)<=0){ if(afterAmout.compareTo(BigDecimal.ZERO)<=0||afterWeight.compareTo(BigDecimal.ZERO)<=0){
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!"); throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
......
<?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-10 10:28:03
Version : 1.0
tableName :hpjx.t_hpkc006
ID INTEGER NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
DEP_CODE VARCHAR NOT NULL,
RECEIPT_TIME DATETIME,
OTHER_ENTHOUSE VARCHAR NOT NULL,
WH_CODE VARCHAR NOT NULL,
WH_NAME VARCHAR NOT NULL,
MAT_TYPE VARCHAR NOT NULL,
MAT_CODE VARCHAR NOT NULL,
MAT_NAME VARCHAR NOT NULL,
SPEC VARCHAR NOT NULL,
AMOUNT DECIMAL NOT NULL,
WEIGHT DECIMAL NOT NULL,
STATUS TINYINT NOT NULL,
REMARK VARCHAR
-->
<sqlMap namespace="HPKC006"> <sqlMap namespace="HPKC006">
<select id="query" parameterClass="java.util.HashMap" <sql id="column">
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC006"> ID as "id",
SELECT COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
ID as "id", DEP_CODE as "depCode", <!-- 部门编码 预留 -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 --> RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 --> OTHER_ENTER_NO as "otherEnterNo", <!-- 其他入库单号 -->
RECEIPT_TIME as "receiptTime", <!-- 单据日期 --> WH_CODE as "whCode", <!-- 仓库编码 -->
OTHER_ENTHOUSE as "otherEnthouse", <!-- 其他入库单号 --> WH_NAME as "whName", <!-- 仓库名称 -->
WH_CODE as "whCode", <!-- 仓库编码 --> INVENT_TYPE as "inventType", <!-- 物料类型 -->
WH_NAME as "whName", <!-- 仓库名称 --> INVENT_CODE as "inventCode", <!-- 物料编码 -->
MAT_TYPE as "matType", <!-- 物料类型 --> INVENT_NAME as "inventName", <!-- 物料名称 -->
MAT_CODE as "matCode", <!-- 物料编码 --> INVENT_RECORD_ID as "inventRecordId", <!-- 规格 -->
MAT_NAME as "matName", <!-- 物料名称 --> AMOUNT as "amount", <!-- 数量 -->
SPEC as "spec", <!-- 规格 --> WEIGHT as "weight", <!-- 重量 -->
AMOUNT as "amount", <!-- 数量 --> STATUS as "status", <!-- 状态 0审核 1保存 -->
WEIGHT as "weight", <!-- 重量 --> REMARK as "remark", <!-- 备注 -->
STATUS as "status", <!-- 状态 0审核 1保存 --> CREATED_BY as "createdBy", <!-- 创建人 -->
REMARK as "remark" <!-- 备注 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
FROM hpjx.t_hpkc006 WHERE 1=1 CREATED_TIME as "createdTime", <!-- 创建时间 -->
<isNotEmpty prepend=" AND " property="receiptTime"> UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
</sql>
RECEIPT_TIME STR_TO_DATE(#receiptTime#, 'yyyy-MM-dd') <sql id="condition">
</isNotEmpty> <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 prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterNo">
OTHER_ENTER_NO = #otherEnterNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
</sql>
<isNotEmpty prepend=" AND " property="otherEnthouse"> <sql id="customCondition">
OTHER_ENTHOUSE LIKE CONCAT('%' ,CONCAT( #otherEnthouse#,'%')) <isNotEmpty prepend=" AND " property="otherEnterNos">
</isNotEmpty> OTHER_ENTER_NO IN <iterate close=")" open="(" conjunction="," property="otherEnterNos">#otherEnterNos[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<isNotEmpty prepend=" AND " property="whName"> <sql id="order">
WH_NAME LIKE CONCAT('%' ,CONCAT( #whName#,'%')) <dynamic prepend="ORDER BY">
</isNotEmpty> <isNotEmpty property="orderBy">
<isNotEmpty prepend=" AND " property="status"> $orderBy$
STATUS = #status# </isNotEmpty>
</isNotEmpty> <isEmpty property="orderBy">
<dynamic prepend="ORDER BY"> ID DESC
<isNotEmpty property="orderBy"> </isEmpty>
$orderBy$ </dynamic>
</isNotEmpty> </sql>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select> <select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC006">
SELECT
<include refid="column"/>
FROM hpjx.t_hpkc006
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc006 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc006 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id# <include refid="customCondition"/>
</isNotEmpty>
</select> </select>
<insert id="insert"> <!-- 查询统计 -->
INSERT INTO hpjx.t_hpkc006 ( <select id="querySum" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC006">
COMPANY_CODE, <!-- 企业编码 预留 --> SELECT
DEP_CODE, <!-- 部门编码 预留 --> COALESCE(SUM(AMOUNT), 0) AS "amount", <!-- 数量 -->
RECEIPT_TIME, <!-- 单据日期 --> COALESCE(SUM(WEIGHT), 0) AS "weight" <!-- 重量 -->
OTHER_ENTHOUSE, <!-- 其他入库单号 --> FROM ${hpjxSchema}.T_HPKC006
WH_CODE, <!-- 仓库编码 --> WHERE 1=1
WH_NAME, <!-- 仓库名称 --> <include refid="condition"/>
MAT_TYPE, <!-- 物料类型 --> <include refid="customCondition"/>
MAT_CODE, <!-- 物料编码 --> </select>
MAT_NAME, <!-- 物料名称 -->
SPEC, <!-- 规格 --> <insert id="insert">
AMOUNT, <!-- 数量 --> INSERT INTO ${hpjxSchema}.T_HPKC006 (
WEIGHT, <!-- 重量 --> COMPANY_CODE, <!-- 企业编码 预留 -->
STATUS, <!-- 状态 0审核 1保存 --> DEP_CODE, <!-- 部门编码 预留 -->
REMARK <!-- 备注 --> RECEIPT_DATE, <!-- 单据日期 -->
) OTHER_ENTER_NO, <!-- 其他入库单号 -->
VALUES ( #companyCode#, #depCode#, #receiptTime#, #otherEnthouse#, #whCode#, #whName#, #matType#, #matCode#, #matName#, #spec#, #amount#, #weight#, #status#, #remark#) WH_CODE, <!-- 仓库编码 -->
</insert> WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 物料类型 -->
INVENT_CODE, <!-- 物料编码 -->
INVENT_NAME, <!-- 物料名称 -->
INVENT_RECORD_ID, <!-- 规格 -->
AMOUNT, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #otherEnterNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#remark#, #createdBy#, #createdName#, #createdTime#
)
</insert>
<delete id="delete"> <delete id="delete">
DELETE FROM hpjx.t_hpkc006 WHERE DELETE FROM hpjx.t_hpkc006 WHERE ID = #id#
ID = #id#
</delete> </delete>
<update id="update"> <update id="update">
UPDATE hpjx.t_hpkc006 UPDATE ${hpjxSchema}.T_HPKC006
SET SET
COMPANY_CODE = #companyCode#, <!-- 企业编码 预留 --> RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
DEP_CODE = #depCode#, <!-- 部门编码 预留 --> WH_CODE = #whCode#, <!-- 仓库编码 -->
RECEIPT_TIME = #receiptTime#, <!-- 单据日期 --> WH_NAME = #whName#, <!-- 仓库名称 -->
OTHER_ENTHOUSE = #otherEnthouse#, <!-- 其他入库单号 --> INVENT_TYPE = #inventType#, <!-- 物料类型 -->
WH_CODE = #whCode#, <!-- 仓库编码 --> INVENT_CODE = #inventCode#, <!-- 物料编码 -->
WH_NAME = #whName#, <!-- 仓库名称 --> INVENT_NAME = #inventName#, <!-- 物料名称 -->
MAT_TYPE = #matType#, <!-- 物料类型 --> INVENT_RECORD_ID = #inventRecordId#, <!-- 规格 -->
MAT_CODE = #matCode#, <!-- 物料编码 --> AMOUNT = #amount#, <!-- 数量 -->
MAT_NAME = #matName#, <!-- 物料名称 --> WEIGHT = #weight#, <!-- 重量 -->
SPEC = #spec#, <!-- 规格 --> REMARK = #remark#, <!-- 备注 -->
AMOUNT = #amount#, <!-- 数量 --> UPDATED_BY = #updatedBy#, <!-- 更新人 -->
WEIGHT = #weight#, <!-- 重量 --> UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
STATUS = #status#, <!-- 状态 0审核 1保存 --> UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
REMARK = #remark# <!-- 备注 --> WHERE ID = #id#
WHERE
ID = #id#
</update> </update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC006
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="otherEnterNo">
OTHER_ENTER_NO = #otherEnterNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterNos">
OTHER_ENTER_NO IN <iterate close=")" open="(" conjunction="," property="otherEnterNos">#otherEnterNos[]#</iterate>
</isNotEmpty>
</update>
<!-- 统计库存 --> <!-- 统计库存 -->
<select id="statDate" 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",
WH_CODE AS "whCode", WH_CODE AS "whCode",
MAT_TYPE AS "matType", INVENT_TYPE AS "inventType",
MAT_CODE AS "matCode", INVENT_CODE AS "inventCode",
COALESCE(SUM(AMOUNT), 0) AS "amount", COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight" COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC006 FROM ${hpjxSchema}.T_HPKC006
...@@ -135,7 +190,7 @@ ...@@ -135,7 +190,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom"> <isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo# CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty> </isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, MAT_TYPE, MAT_CODE GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE
</select> </select>
</sqlMap> </sqlMap>
package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/1/23,21:18
*/
public class HPKCTools {
/**
* 锁
*
* @param otherEnterNos
* @return
*/
public static void lockKc006(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC006.LOCK, queryMap);
}
/**
* 查询其他入库信息
*
* @param otherEnterNos
* @return
*/
public static List<HPKC006> listKc006(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos);
return DaoBase.getInstance().query(HPKC006.QUERY, queryMap);
}
/**
* 查询其他入库信息
*
* @param otherEnterNos
* @return
*/
public static Map<String, HPKC006> mapKc006(List<String> otherEnterNos) {
List<HPKC006> results = listKc006(otherEnterNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC006::getOtherEnterNo, item -> item));
}
/**
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight) {
EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId);
inInfo.set("amount", amount);
inInfo.set("weight", weight);
inInfo.set(EiConstant.serviceName, "HPKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
}
...@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.pz.service; ...@@ -3,7 +3,6 @@ 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.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -15,7 +14,6 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -15,7 +14,6 @@ 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.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
...@@ -51,7 +49,7 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -51,7 +49,7 @@ public class ServiceHPPZ006 extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, "HPPZ006.query", new HPKC006()); inInfo = super.query(inInfo, "HPPZ006.query", new HPPZ006());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -5,6 +5,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -5,6 +5,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
...@@ -148,4 +149,17 @@ public class AssertUtils { ...@@ -148,4 +149,17 @@ public class AssertUtils {
} }
} }
/**
* A大于B
*
* @param a
* @param b
* @param message
*/
public static void isGt(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) < 1) {
throw new PlatException(message);
}
}
} }
package com.baosight.hpjx.util; package com.baosight.hpjx.util;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 重写Apache.ObjectUtils类方法 * 重写Apache.ObjectUtils类方法
* *
...@@ -82,5 +87,16 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils { ...@@ -82,5 +87,16 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
} }
return StringUtils.isBlank(object.toString()); return StringUtils.isBlank(object.toString());
} }
/**
* 从集合MAP中取KEY
*
* @param items
* @param keyName
* @return
*/
public static List<String> listKey(List<Map> items, String keyName) {
return items.stream().map(item -> MapUtils.getString(item, keyName)).collect(Collectors.toList());
}
} }
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="statisticalNumber" cname="盘点单号" enable="false" width="130" algin="center"/> <EF:EFColumn ename="statisticalNumber" cname="盘点单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" <EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true"/> parseFormats="['yyyyMMdd']" width="90" align="center" required="true"/>
<%--<EF:EFComboColumn ename="status" cname="单据状态" enable="false" width="100" readonly="true" <%--<EF:EFComboColumn ename="status" cname="单据状态" enable="false" width="100" readonly="true"
......
$(function () { var inventNameGlobalData = [];
var specGlobalData = [];
$(function() {
$("#QUERY").on("click", function () { IPLATUI.EFGrid = {
resultGrid.dataSource.page(1); pageable: {
}); pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
"result": {
columns: [{
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inventType", options.model["inventType"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryMaterialComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("material_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
}
}, {
field: "inventRecordId",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return specGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
refreshsel
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
}
}],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
$("#BTN_SAVE").on("click", save);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 规格
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", eiInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC006", "save", true);
}
});
}
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
}
});
\ No newline at end of file
...@@ -4,60 +4,61 @@ ...@@ -4,60 +4,61 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %> <%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="其他入库单">
<EF:EFRegion id="inqu" title="查询条件" align-item="center"><%-- type="query" efRegionShowClear="true" efRegionSave="true"--%>
<style>
.row {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<div class="row"> <%-- blockId="inqu_status" row="0" --%>
<EF:EFDatePicker blockId="inqu_status" ename = "receiptTime" cname="单据日期"
format="yyyy-MM-dd" />
<EF:EFInput blockId="inqu_status" ename="otherEnthouse" cname="其他入库单号" row="0"/>
<EF:EFInput blockId="inqu_status" ename="whName" cname="仓库名称" row="0"/>
<EF:EFSelect cname="单据状态" optionLabel="全部" blockId="inqu_status" ename="status" row="0">
<EF:EFOption label="审核" value="1"/>
<EF:EFOption label="反审" value="0"/>
</EF:EFSelect>
</div>
</EF:EFRegion> <EF:EFPage title="其他入库单">
<EF:EFRegion id="inqu" title="查询条件" align-item="center">
<EF:EFRegion id="result" title="记录集"> <div class="row">
<EF:EFGrid blockId="result" autoDraw="no"> <EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3"
<EF:EFColumn ename="id" cname="主键" hidden="true"/> role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="入库单号" ename="inqu_status-0-otherEnterNo" colWidth="3"/>
<EF:EFColumn ename="receiptTime" cname="单据日期"/> <EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
<EF:EFColumn ename="otherEnthouse" cname="其他入库单号"/> <EF:EFOption label="全部" value=""/>
<EF:EFColumn ename="whCode" cname="仓库编码"/> <EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
<EF:EFColumn ename="whName" cname="仓库名称"/> </EF:EFSelect>
<EF:EFColumn ename="matType" cname="物料类型"/> <EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains"
<EF:EFColumn ename="matCode" cname="物料编码"/> template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
<EF:EFColumn ename="matName" cname="物料名称"/> <EF:EFOption label="全部" value=""/>
<EF:EFColumn ename="spec" cname="规格"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
<EF:EFColumn ename="amount" cname="数量"/> </EF:EFSelect>
<EF:EFColumn ename="weight" cname="重量"/> </div>
<EF:EFComboColumn align="center" ename="status" cname="操作"> <div class="row">
<EF:EFOption label="审核" value="1"/> <EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="反审" value="0"/> <EF:EFOption label="全部" value=""/>
</EF:EFComboColumn> <EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
<EF:EFColumn ename="remark" cname="备注"/> </EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-spec" cname="规格" colWidth="3" filter="contains" defultValue="">
</EF:EFGrid> <EF:EFOption label="全部" value=""/>
</EF:EFRegion> <EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFPage> </EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true"/>
<EF:EFComboColumn ename="whCode" cname="仓库编码" width="120" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" required="true">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="notes" cname="备注" width="100"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
<script> </EF:EFPage>
var ctx = "${ctx}"; \ No newline at end of file
</script>
<script src="${ctx}/HP/KC/HPKC006.js"></script>
\ No newline at end of file
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