Commit 440b3ff5 by yukang

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

# Conflicts:
#	src/main/java/com/baosight/hpjx/hp/zl/service/ServiceHPZL001.java
parents e3398e8f 4ad3c20e
......@@ -58,6 +58,8 @@ public class HPSqlConstant {
public static final String STAT_DATE = "HPKC004.statDate";
// 锁
public static final String LOCK = "HPKC004.lock";
// 修改打印状态
public static final String UPDATE_PRINT = "HPKC004.updatePrint";
}
/**
......
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 22:17:45 create
* @history 2024-01-31 17:22:56 create
*/
public class HPKC004 extends DaoEPBase {
......@@ -29,16 +29,23 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_SALE_NO = "saleNo"; /* 销售单号*/
public static final String FIELD_WH_CODE = "whCode"; /* 仓库编码*/
public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格*/
public static final String FIELD_PROD_NO = "prodNo"; /* 生产订单号*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目号*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 部件编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 部件名称*/
public static final String FIELD_SUB_INVENT_CODE = "subInventCode"; /* 零部件编码*/
public static final String FIELD_SUB_INVENT_NAME = "subInventName"; /* 零部件名称*/
public static final String FIELD_LENGTH = "length"; /* 长*/
public static final String FIELD_WIDTH = "width"; /* 宽*/
public static final String FIELD_THICK = "thick"; /* 厚*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_STATUS = "status"; /* 状态*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/
public static final String FIELD_IS_PRINT = "isPrint"; /* 是否打印:0.否1.是*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
......@@ -54,16 +61,23 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_SALE_NO = "SALE_NO"; /* 销售单号*/
public static final String COL_WH_CODE = "WH_CODE"; /* 仓库编码*/
public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/
public static final String COL_INVENT_TYPE = "INVENT_TYPE"; /* 存货类型*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 存货编码*/
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 存货名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 规格*/
public static final String COL_PROD_NO = "PROD_NO"; /* 生产订单号*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目号*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 部件编码*/
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 部件名称*/
public static final String COL_SUB_INVENT_CODE = "SUB_INVENT_CODE"; /* 零部件编码*/
public static final String COL_SUB_INVENT_NAME = "SUB_INVENT_NAME"; /* 零部件名称*/
public static final String COL_LENGTH = "LENGTH"; /* 长*/
public static final String COL_WIDTH = "WIDTH"; /* 宽*/
public static final String COL_THICK = "THICK"; /* 厚*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/
public static final String COL_IS_PRINT = "IS_PRINT"; /* 是否打印:0.否1.是*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
......@@ -78,23 +92,30 @@ public class HPKC004 extends DaoEPBase {
public static final String UPDATE = "HPKC004.update";
public static final String DELETE = "HPKC004.delete";
private Long id = null; /* ID*/
private Long id; /* ID*/
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/
private String receiptDate = " "; /* 票据日期*/
private String saleNo = " "; /* 销售单号*/
private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = null; /* 规格*/
private BigDecimal amount = new BigDecimal(0); /* 数量*/
private BigDecimal weight = new BigDecimal(0); /* 重量*/
private Integer status; /* 状态*/
private String prodNo = " "; /* 生产订单号*/
private String projCode = " "; /* 项目号*/
private String projName = " "; /* 项目名称*/
private String inventCode = " "; /* 部件编码*/
private String inventName = " "; /* 部件名称*/
private String subInventCode = " "; /* 零部件编码*/
private String subInventName = " "; /* 零部件名称*/
private BigDecimal length = new BigDecimal("0"); /* 长*/
private BigDecimal width = new BigDecimal("0"); /* 宽*/
private BigDecimal thick = new BigDecimal("0"); /* 厚*/
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private Long kcId; /* 库存ID*/
private String oldSaleNo = " "; /* 原销售单号*/
private Integer isPrint; /* 是否打印:0.否1.是*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
......@@ -138,38 +159,74 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("仓库名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE);
eiColumn.setDescName("存货类型");
eiColumn = new EiColumn(FIELD_PROD_NO);
eiColumn.setDescName("生产订单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_CODE);
eiColumn.setDescName("项目号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_CODE);
eiColumn.setDescName("存货编码");
eiColumn.setDescName("部件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_NAME);
eiColumn.setDescName("存货名称");
eiColumn.setDescName("部件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
eiColumn.setDescName("规格");
eiColumn = new EiColumn(FIELD_SUB_INVENT_CODE);
eiColumn.setDescName("零部件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn = new EiColumn(FIELD_SUB_INVENT_NAME);
eiColumn.setDescName("零部件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LENGTH);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("数量");
eiColumn.setDescName("");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn = new EiColumn(FIELD_WIDTH);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("重量");
eiColumn.setDescName("");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态");
eiColumn = new EiColumn(FIELD_THICK);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("厚");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
......@@ -184,6 +241,10 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("原销售单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_PRINT);
eiColumn.setDescName("是否打印:0.否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
......@@ -335,23 +396,55 @@ public class HPKC004 extends DaoEPBase {
this.whName = whName;
}
/**
* get the inventType - 存货类型.
* @return the inventType
* get the prodNo - 生产订单号.
* @return the prodNo
*/
public String getProdNo() {
return this.prodNo;
}
/**
* set the prodNo - 生产订单号.
*
* @param prodNo - 生产订单号
*/
public void setProdNo(String prodNo) {
this.prodNo = prodNo;
}
/**
* get the projCode - 项目号.
* @return the projCode
*/
public String getProjCode() {
return this.projCode;
}
/**
* set the projCode - 项目号.
*
* @param projCode - 项目号
*/
public void setProjCode(String projCode) {
this.projCode = projCode;
}
/**
* get the projName - 项目名称.
* @return the projName
*/
public String getInventType() {
return this.inventType;
public String getProjName() {
return this.projName;
}
/**
* set the inventType - 存货类型.
* set the projName - 项目名称.
*
* @param inventType - 存货类型
* @param projName - 项目名称
*/
public void setInventType(String inventType) {
this.inventType = inventType;
public void setProjName(String projName) {
this.projName = projName;
}
/**
* get the inventCode - 存货编码.
* get the inventCode - 部件编码.
* @return the inventCode
*/
public String getInventCode() {
......@@ -359,15 +452,15 @@ public class HPKC004 extends DaoEPBase {
}
/**
* set the inventCode - 存货编码.
* set the inventCode - 部件编码.
*
* @param inventCode - 存货编码
* @param inventCode - 部件编码
*/
public void setInventCode(String inventCode) {
this.inventCode = inventCode;
}
/**
* get the inventName - 存货名称.
* get the inventName - 部件名称.
* @return the inventName
*/
public String getInventName() {
......@@ -375,29 +468,92 @@ public class HPKC004 extends DaoEPBase {
}
/**
* set the inventName - 存货名称.
* set the inventName - 部件名称.
*
* @param inventName - 存货名称
* @param inventName - 部件名称
*/
public void setInventName(String inventName) {
this.inventName = inventName;
}
/**
* get the subInventCode - 零部件编码.
* @return the subInventCode
*/
public String getSubInventCode() {
return this.subInventCode;
}
/**
* set the subInventCode - 零部件编码.
*
* @param subInventCode - 零部件编码
*/
public void setSubInventCode(String subInventCode) {
this.subInventCode = subInventCode;
}
/**
* get the subInventName - 零部件名称.
* @return the subInventName
*/
public String getSubInventName() {
return this.subInventName;
}
/**
* set the subInventName - 零部件名称.
*
* @param subInventName - 零部件名称
*/
public void setSubInventName(String subInventName) {
this.subInventName = subInventName;
}
/**
* get the length - 长.
* @return the length
*/
public BigDecimal getLength() {
return this.length;
}
/**
* get the inventRecordId - 规格.
* @return the inventRecordId
* set the length - 长.
*
* @param length - 长
*/
public void setLength(BigDecimal length) {
this.length = length;
}
/**
* get the width - 宽.
* @return the width
*/
public BigDecimal getWidth() {
return this.width;
}
/**
* set the width - 宽.
*
* @param width - 宽
*/
public void setWidth(BigDecimal width) {
this.width = width;
}
/**
* get the thick - 厚.
* @return the thick
*/
public Long getInventRecordId() {
return this.inventRecordId;
public BigDecimal getThick() {
return this.thick;
}
/**
* set the inventRecordId - 规格.
* set the thick - 厚.
*
* @param inventRecordId - 规格
* @param thick - 厚
*/
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
public void setThick(BigDecimal thick) {
this.thick = thick;
}
/**
* get the amount - 数量.
......@@ -416,36 +572,36 @@ public class HPKC004 extends DaoEPBase {
this.amount = amount;
}
/**
* get the weight - 重量.
* @return the weight
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getWeight() {
return this.weight;
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the weight - 重量.
* set the unitWeight - 单重.
*
* @param weight - 重量
* @param unitWeight - 单重
*/
public void setWeight(BigDecimal weight) {
this.weight = weight;
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the status - 状态.
* @return the status
* get the weight - 重量.
* @return the weight
*/
public Integer getStatus() {
return this.status;
public BigDecimal getWeight() {
return this.weight;
}
/**
* set the status - 状态.
* set the weight - 重量.
*
* @param status - 状态
* @param weight - 重量
*/
public void setStatus(Integer status) {
this.status = status;
public void setWeight(BigDecimal weight) {
this.weight = weight;
}
/**
* get the remark - 备注.
......@@ -496,6 +652,22 @@ public class HPKC004 extends DaoEPBase {
this.oldSaleNo = oldSaleNo;
}
/**
* get the isPrint - 是否打印:0.否1.是.
* @return the isPrint
*/
public Integer getIsPrint() {
return this.isPrint;
}
/**
* set the isPrint - 是否打印:0.否1.是.
*
* @param isPrint - 是否打印:0.否1.是
*/
public void setIsPrint(Integer isPrint) {
this.isPrint = isPrint;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
......@@ -622,16 +794,23 @@ public class HPKC004 extends DaoEPBase {
setSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SALE_NO)), saleNo));
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));
setProdNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROD_NO)), prodNo));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
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));
setSubInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUB_INVENT_CODE)), subInventCode));
setSubInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUB_INVENT_NAME)), subInventName));
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_LENGTH)), length));
setWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WIDTH)), width));
setThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_THICK)), thick));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
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));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo));
setIsPrint(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PRINT)), isPrint));
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));
......@@ -655,16 +834,23 @@ public class HPKC004 extends DaoEPBase {
map.put(FIELD_SALE_NO, StringUtils.toString(saleNo, eiMetadata.getMeta(FIELD_SALE_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_PROD_NO, StringUtils.toString(prodNo, eiMetadata.getMeta(FIELD_PROD_NO)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
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_SUB_INVENT_CODE, StringUtils.toString(subInventCode, eiMetadata.getMeta(FIELD_SUB_INVENT_CODE)));
map.put(FIELD_SUB_INVENT_NAME, StringUtils.toString(subInventName, eiMetadata.getMeta(FIELD_SUB_INVENT_NAME)));
map.put(FIELD_LENGTH, StringUtils.toString(length, eiMetadata.getMeta(FIELD_LENGTH)));
map.put(FIELD_WIDTH, StringUtils.toString(width, eiMetadata.getMeta(FIELD_WIDTH)));
map.put(FIELD_THICK, StringUtils.toString(thick, eiMetadata.getMeta(FIELD_THICK)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
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_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
map.put(FIELD_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO)));
map.put(FIELD_IS_PRINT, StringUtils.toString(isPrint, eiMetadata.getMeta(FIELD_IS_PRINT)));
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)));
......
......@@ -150,11 +150,19 @@ public class HPKC011 extends DaoEPBase {
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_CODE);
eiColumn.setDescName("物料编码");
eiColumn.setDescName("部件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_NAME);
eiColumn.setDescName("物料名称");
eiColumn.setDescName("部件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUB_INVENT_CODE);
eiColumn.setDescName("零部件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SUB_INVENT_NAME);
eiColumn.setDescName("零部件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LENGTH);
......
......@@ -91,9 +91,9 @@ public class ServiceHPKC002A extends ServiceEPBase {
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.lockKc010(ids);
HPKCTools.HpKc010.lock(ids);
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids);
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
......
......@@ -89,9 +89,9 @@ public class ServiceHPKC004 extends ServiceBase {
// 销售单号
List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo");
// 锁记录
HPKCTools.lockKc004(saleNos);
HPKCTools.HpKc004.lock(saleNos);
// 查询数据库记录
Map<String, HPKC004> mapKc004 = HPKCTools.mapKc004(saleNos);
Map<String, HPKC004> mapKc004 = HPKCTools.HpKc004.map(saleNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC004 fKc004 = new HPKC004();
fKc004.fromMap(resultRows.get(i));
......@@ -103,10 +103,11 @@ public class ServiceHPKC004 extends ServiceBase {
newKc004.setAmount(dbKc004.getAmount().negate());
newKc004.setWeight(dbKc004.getWeight().negate());
newKc004.setOldSaleNo(dbKc004.getSaleNo());
newKc004.setIsPrint(CommonConstant.YesNo.NO_0);
newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存
HPKCTools.updateStock(dbKc004.getWhCode(), dbKc004.getInventRecordId(),
HPKCTools.updateProdStock(dbKc004.getWhCode(), dbKc004.getProdNo(),
dbKc004.getAmount(), dbKc004.getWeight());
}
inInfo = this.query(inInfo);
......
......@@ -7,6 +7,7 @@ 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.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
......@@ -35,11 +36,6 @@ import java.util.Map;
*/
public class ServiceHPKC004A extends ServiceEPBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.MATERIAL.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.SEMI_FINISHED_PRODUCT.getCode(),
InventTypeEnum.FINISHED_PRODUCT.getCode()};
/**
* 初始化
*
......@@ -49,13 +45,7 @@ public class ServiceHPKC004A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC010().eiMetadata);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC011().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......@@ -71,9 +61,7 @@ public class ServiceHPKC004A extends ServiceEPBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC010.QUERY, new HPKC010());
inInfo = super.query(inInfo, HPKC011.QUERY, new HPKC011());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -92,40 +80,36 @@ public class ServiceHPKC004A extends ServiceEPBase {
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.lockKc010(ids);
HPKCTools.HpKc011.lock(ids);
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids);
Map<Long, HPKC011> dbKc011Map = HPKCTools.HpKc011.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
HPKC011 dbKc011 = dbKc011Map.get(id);
AssertUtils.isNull(dbKc011, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
AssertUtils.isGt(applyAmount, dbKc010.getAmount(),
"库存号[" + id + "]可用数量不足!");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
AssertUtils.isGt(applyWeight, dbKc010.getWeight(),
"库存号[" + id + "]可用重量不足!");
AssertUtils.isGt(applyAmount, dbKc011.getAmount(), "库存号[" + id + "]可用数量不足!");
}
// 生成销售库单
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC004 newKc004 = BeanUtils.copy(dbKc010, HPKC004.class);
HPKC011 dbKc011 = dbKc011Map.get(kcId);
HPKC004 newKc004 = BeanUtils.copy(dbKc011, HPKC004.class);
newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
newKc004.setReceiptDate(DateUtils.shortDate());
newKc004.setAmount(applyAmount);
newKc004.setWeight(applyWeight);
newKc004.setWeight(applyAmount.multiply(dbKc011.getUnitWeight()));
newKc004.setRemark(applyRemark);
newKc004.setKcId(kcId);
newKc004.setIsPrint(CommonConstant.YesNo.NO_0);
newKc004.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存数量
HPKCTools.updateStock(newKc004.getWhCode(), newKc004.getInventRecordId(),
HPKCTools.updateProdStock(newKc004.getWhCode(), newKc004.getProdNo(),
newKc004.getAmount().negate(), newKc004.getWeight().negate());
}
} catch (Exception e) {
......
......@@ -81,9 +81,9 @@ public class ServiceHPKC005A extends ServiceEPBase {
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.lockKc010(ids);
HPKCTools.HpKc010.lock(ids);
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids);
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
......
......@@ -90,9 +90,9 @@ public class ServiceHPKC007A extends ServiceEPBase {
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.lockKc010(ids);
HPKCTools.HpKc010.lock(ids);
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids);
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
......
......@@ -195,8 +195,8 @@ public class ServiceHPKC009 extends ServiceBase {
// 1.6、销售出库
List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventCode(), item.getSubInventCode(),
item.getWhCode(), ""), item -> item));
// 1.7、其它出库
List<HPKC007> qtCks = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> qtCkMap = qtCks.stream().collect(Collectors.toMap(item ->
......@@ -278,210 +278,6 @@ public class ServiceHPKC009 extends ServiceBase {
}
/**
* 按天统计采购库存
*
* @return
*/
private List<HPKC009> statCg(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC001> aItems = dao.query(HPSqlConstant.HPKC001.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterTo") + "235959");
List<HPKC001> bKc001s = dao.query(HPSqlConstant.HPKC001.STAT_DATE, queryMap);
Map<String, HPKC001> bKc001Map = bKc001s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.3、发出
List<HPKC002> cKc002s = dao.query(HPSqlConstant.HPKC002.STAT_DATE, queryMap);
Map<String, HPKC002> cKc001Map = cKc002s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.CG);
List<HPKC009> dKc009s = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dKc009Map = dKc009s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 根据期末库存生成收发存对象
for (HPKC001 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getInventType() + "#"
+ aItem.getInventCode() + "#" + aItem.getInventRecordId();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getInventType());
kc009.setInventCode(aItem.getInventCode());
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
// 期末
kc009.setEndAmount(aItem.getAmount());
kc009.setEndWeight(aItem.getWeight());
// 收入
HPKC001 bKc001 = bKc001Map.get(key);
kc009.setEnterAmount(bKc001 == null ? BigDecimal.ZERO : bKc001.getAmount());
kc009.setEnterWeight(bKc001 == null ? BigDecimal.ZERO : bKc001.getWeight());
// 发出
HPKC002 cKc002 = cKc001Map.get(key);
kc009.setOuterAmount(cKc002 == null ? BigDecimal.ZERO : cKc002.getAmount());
kc009.setOuterWeight(cKc002 == null ? BigDecimal.ZERO : cKc002.getWeight());
// 期初
HPKC009 dKc009 = dKc009Map.get(key);
if (dKc009 != null) {
kc009.setInitAmount(dKc009.getEndAmount());
kc009.setInitWeight(dKc009.getEndWeight());
} else {
kc009.setInitAmount(kc009.getEndAmount().add(kc009.getOuterAmount())
.subtract(kc009.getEnterAmount()));
kc009.setInitWeight(kc009.getEndWeight().add(kc009.getOuterWeight())
.subtract(kc009.getEnterWeight()));
}
kc009Map.put(key, kc009);
}
return kc009Map.values().stream().collect(Collectors.toList());
}
/**
* 按天统计生产库存
*
* @param queryMap
* @return
*/
private List<HPKC009> statSc(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC003> aItems = dao.query(HPSqlConstant.HPKC003.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
List<HPKC003> bItems = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
Map<String, HPKC003> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.3、发出
List<HPKC004> cItems = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.SC);
List<HPKC009> dItems = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 根据期末库存生成收发存对象
for (HPKC003 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getInventType() + "#"
+ aItem.getInventCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setWhCode(aItem.getWhCode());
kc009.setInventType(aItem.getInventType() + "");
kc009.setInventCode(aItem.getInventCode());
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
// 期末
kc009.setEndAmount(aItem.getAmount());
kc009.setEndWeight(aItem.getWeight());
// 收入
HPKC003 bItem = bItemMap.get(key);
kc009.setEnterAmount(bItem == null ? BigDecimal.ZERO : bItem.getAmount());
kc009.setEnterWeight(bItem == null ? BigDecimal.ZERO : bItem.getWeight());
// 发出
HPKC004 cItem = cItemMap.get(key);
kc009.setOuterAmount(cItem == null ? BigDecimal.ZERO : cItem.getAmount());
kc009.setOuterWeight(cItem == null ? BigDecimal.ZERO : cItem.getWeight());
// 期初
HPKC009 dItem = dItemMap.get(key);
if (dItem != null) {
kc009.setInitAmount(dItem.getEndAmount());
kc009.setInitWeight(dItem.getEndWeight());
} else {
kc009.setInitAmount(kc009.getEndAmount().add(kc009.getOuterAmount())
.subtract(kc009.getEnterAmount()));
kc009.setInitWeight(kc009.getEndWeight().add(kc009.getOuterWeight())
.subtract(kc009.getEnterWeight()));
}
kc009Map.put(key, kc009);
}
return kc009Map.values().stream().collect(Collectors.toList());
}
/**
* 按天统计其他库存
*
* @param queryMap
* @return
*/
private List<HPKC009> statQt(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC006> aItems = dao.query(HPSqlConstant.HPKC006.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
List<HPKC006> bItems = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.3、发出
List<HPKC007> cItems = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.QT);
List<HPKC009> dItems = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 根据期末库存生成收发存对象
for (HPKC006 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getInventType() + "#" + aItem.getInventCode() + "#"
+ aItem.getInventRecordId();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getInventType());
kc009.setInventCode(aItem.getInventCode());
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
// 期末
kc009.setEndAmount(aItem.getAmount());
kc009.setEndWeight(aItem.getWeight());
// 收入
HPKC006 bItem = bItemMap.get(key);
kc009.setEnterAmount(bItem == null ? BigDecimal.ZERO : bItem.getAmount());
kc009.setEnterWeight(bItem == null ? BigDecimal.ZERO : bItem.getWeight());
// 发出
HPKC007 cItem = cItemMap.get(key);
kc009.setOuterAmount(cItem == null ? BigDecimal.ZERO : cItem.getAmount());
kc009.setOuterWeight(cItem == null ? BigDecimal.ZERO : cItem.getWeight());
// 期初
HPKC009 dItem = dItemMap.get(key);
if (dItem != null) {
kc009.setInitAmount(dItem.getEndAmount());
kc009.setInitWeight(dItem.getEndWeight());
} else {
kc009.setInitAmount(kc009.getEndAmount().add(kc009.getOuterAmount())
.subtract(kc009.getOuterAmount()));
kc009.setInitWeight(kc009.getEndWeight().add(kc009.getOuterWeight())
.subtract(kc009.getEnterWeight()));
}
kc009Map.put(key, kc009);
}
return kc009Map.values().stream().collect(Collectors.toList());
}
/**
* 设置基础信息
*
* @param kc009s
......
......@@ -10,16 +10,23 @@
SALE_NO as "saleNo", <!-- 销售单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格 -->
PROD_NO as "prodNo", <!-- 生产订单号 -->
PROJ_CODE as "projCode", <!-- 项目号 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零部件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零部件名称 -->
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 -->
IS_PRINT as "isPrint", <!-- 是否打印:0.否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
......@@ -51,38 +58,51 @@
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
<isNotEmpty prepend=" AND " property="prodNo">
PROD_NO = #prodNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME LIKE CONCAT('%', #subInventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="oldSaleNo">
OLD_SALE_NO = #oldSaleNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isPrint">
IS_PRINT = #isPrint#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="saleNos">
SALE_NO IN <iterate close=")" open="(" conjunction="," property="saleNos">#saleNos[]#</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>
<isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
......@@ -91,6 +111,13 @@
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -125,27 +152,34 @@
SALE_NO, <!-- 销售单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 规格 -->
PROD_NO, <!-- 生产订单号 -->
PROJ_CODE, <!-- 项目号 -->
PROJ_NAME, <!-- 项目名称 -->
INVENT_CODE, <!-- 部件编码 -->
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零部件编码 -->
SUB_INVENT_NAME, <!-- 零部件名称 -->
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK, <!-- 厚 -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
STATUS, <!-- 状态 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 -->
IS_PRINT, <!-- 是否打印:0.否1.是 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG <!-- 是否删除 -->
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #status#,
#remark#, #kcId#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #prodNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldSaleNo#, #isPrint#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id#
......@@ -157,16 +191,26 @@
RECEIPT_DATE = #receiptDate#, <!-- 票据日期 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
PROD_NO = #prodNo#, <!-- 生产订单号 -->
PROJ_CODE = #projCode#, <!-- 项目号 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
INVENT_CODE = #inventCode#, <!-- 部件编码 -->
INVENT_NAME = #inventName#, <!-- 部件名称 -->
SUB_INVENT_CODE = #subInventCode#, <!-- 零部件编码 -->
SUB_INVENT_NAME = #subInventName#, <!-- 零部件名称 -->
LENGTH = #length#, <!-- 长 -->
WIDTH = #width#, <!-- 宽 -->
THICK = #thick#, <!-- 厚 -->
AMOUNT = #amount#, <!-- 数量 -->
UNIT_WEIGHT = #unitWeight#, <!-- 单重 -->
WEIGHT = #weight#, <!-- 重量 -->
STATUS = #status#, <!-- 状态 -->
REMARK = #remark#, <!-- 备注 -->
KC_ID = #kcId#, <!-- 库存ID -->
OLD_SALE_NO = #oldSaleNo#, <!-- 原销售单号 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除 -->
WHERE ID = #id#
</update>
......@@ -183,6 +227,14 @@
</isNotEmpty>
</update>
<!-- 修改状态 -->
<update id="updatePrint">
UPDATE ${hpjxSchema}.T_HPKC004
SET IS_PRINT = 1,
<include refid="updateRevise"/>
WHERE ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
<!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC004">
SELECT
......
......@@ -57,13 +57,13 @@
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
INVENT_NAME LIKE CONCAT('%', #inventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME = #subInventName#
SUB_INVENT_NAME LIKE CONCAT('%', #subInventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
......
package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.ExcelUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
......@@ -23,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
......@@ -35,66 +40,55 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CKExcelTools {
public static void main(String[] args) {
List<Map<String, Object>> items = new ArrayList<>();
Map<String, Object> itemMap1 = new HashMap<>();
itemMap1.put("groupName", "内膜");
List<Map<String, String>> itemChildren1 = new ArrayList<>();
Map<String, String> childMap1_1 = new HashMap<>();
childMap1_1.put("itemName", "内模封板");
childMap1_1.put("quantity", "4");
itemChildren1.add(childMap1_1);
Map<String, String> childMap1_2 = new HashMap<>();
childMap1_2.put("itemName", "加长定位稍");
childMap1_2.put("spec", "1200");
childMap1_2.put("length", "120");
childMap1_2.put("quantity", "700");
childMap1_2.put("remark", "含螺母");
itemChildren1.add(childMap1_2);
itemMap1.put("itemChildren", itemChildren1);
items.add(itemMap1);
Map<String, Object> itemMap2 = new HashMap<>();
itemMap2.put("groupName", "外模");
List<Map<String, String>> itemChildren2 = new ArrayList<>();
Map<String, String> childMap2_1 = new HashMap<>();
childMap2_1.put("itemName", "中梁底边3米");
childMap2_1.put("spec", "3000");
childMap2_1.put("length", "3000");
childMap2_1.put("quantity", "3");
itemChildren2.add(childMap2_1);
Map<String, String> childMap2_2 = new HashMap<>();
childMap2_2.put("itemName", "中梁底边2米");
childMap2_2.put("spec", "2000");
childMap2_2.put("length", "2000");
childMap2_2.put("quantity", "1");
itemChildren2.add(childMap2_2);
itemMap2.put("itemChildren", itemChildren2);
items.add(itemMap2);
Map dataMap = new HashMap();
dataMap.put("projectName", "20米液压箱梁");
dataMap.put("items", items);
/**
* 下载文件
*
* @param pageContext
*/
public static void downloadFile(PageContext pageContext) {
try {
HSSFWorkbook workbook = build(dataMap);
FileOutputStream fout = new FileOutputStream("d:/出库单.xls");
workbook.write(fout);
fout.close();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
Map parameter = StringUtils.encodeParam(request.getParameter("parameter"));
// 获取数据
List<Long> saleIds = (List<Long>) parameter.get("saleIds");
List<HPKC004> dbKc004s = HPKCTools.HpKc004.listById(saleIds);
// 数据格式转换
Map dataMap = convertData(dbKc004s);
// 构建excel
HSSFWorkbook workbook = buildExcel(dataMap);
String fileName = "出库单-" + DateUtils.shortYmdhmss() + ".xls";
ExcelUtils.download(fileName, workbook, response);
// 更新状态
HPKCTools.HpKc004.updatePrint(saleIds);
} catch (Exception e) {
log.error("生成出库单失败:{}", e.getMessage(), e);
log.error("下载文件失败:{}", e.getMessage(), e);
throw new PlatException("下载打印失败");
}
}
/**
* 下载文件
* 数据格式转换
*
* @param pageContext
* @param dbKc004s
* @return
*/
public static void downloadFile(PageContext pageContext) throws IOException {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
// String docId = request.getParameter("docId");
// HSSFWorkbook workbook = build(dataMap);
// String fileName = "出库单-" + DateUtils.shortYmdhmss() + ".xls";
// ExcelUtils.download(fileName, workbook, response);
private static Map convertData(List<HPKC004> dbKc004s) {
// 转换数据格式用于生成excel
Map dataMap = new HashMap();
for (HPKC004 dbKc004 : dbKc004s) {
String projCode = dbKc004.getProjCode();
String dataProjCode = MapUtils.getString(dataMap, Field.PROJ_CODE);
if (StringUtils.isBlank(dataProjCode)) {
dataMap.put(Field.PROJ_CODE, dbKc004.getProjCode());
dataMap.put(Field.PROJ_NAME, dbKc004.getProjName());
} else if (!projCode.equals(dataProjCode)) {
throw new PlatException("打印数据中存在不同的项目信息,请检查");
}
}
// 按父级产品分类数据
dataMap.put(Field.CHILDREN, dbKc004s.stream().collect(Collectors.groupingBy(item -> item.getInventName())));
return dataMap;
}
/**
......@@ -102,7 +96,7 @@ public class CKExcelTools {
*
* @param dataMap 数据集
*/
public static HSSFWorkbook build(Map dataMap) {
public static HSSFWorkbook buildExcel(Map dataMap) {
HSSFWorkbook workbook = new HSSFWorkbook();
// 在Workbook中,创建一个sheet,对应Excel中的工作薄(sheet)
HSSFSheet sheet = workbook.createSheet("出库单");
......@@ -118,13 +112,14 @@ public class CKExcelTools {
// 遍历数据行,excel行从第3行开始
int headRow = 2;
int lastRow = 2;
List<Map<String, Object>> items = (List<Map<String, Object>>) dataMap.get("items");
for (int i = 0; i < items.size(); i++) {
Map<String, Object> itemMap = items.get(i);
Map<String, List<HPKC004>> childrenMap = (Map<String, List<HPKC004>>) dataMap.get(Field.CHILDREN);
for (Map.Entry<String, List<HPKC004>> childrenEntry : childrenMap.entrySet()) {
String key = childrenEntry.getKey();
List<HPKC004> values = childrenEntry.getValue();
// 组名称
lastRow = buildGroupRow(workbook, sheet, itemMap, lastRow, headRow);
lastRow = buildGroupRow(workbook, sheet, key, lastRow, headRow);
// 明细数据,返回末尾行数
lastRow = buildChildRow(workbook, sheet, itemMap, lastRow, headRow);
lastRow = buildChildRow(workbook, sheet, values, lastRow, headRow);
}
// 页脚
buildFoot(workbook, sheet, lastRow);
......@@ -176,16 +171,15 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param itemMap
* @param values
* @param lastRow
* @param headRow
*/
private static int buildChildRow(HSSFWorkbook workbook, HSSFSheet sheet, Map<String, Object> itemMap,
private static int buildChildRow(HSSFWorkbook workbook, HSSFSheet sheet, List<HPKC004> values,
int lastRow, int headRow) {
List<Map<String, String>> children = MapUtils.getList(itemMap, "itemChildren");
int currRow = lastRow + 1;
for (int i = 0; i < children.size(); i++) {
Map<String, String> childMap = children.get(i);
for (int i = 0; i < values.size(); i++) {
HPKC004 valueMap = values.get(i);
currRow = currRow + i;
HSSFRow row = sheet.createRow(currRow);
row.setHeight((short) (20 * 20));
......@@ -195,7 +189,7 @@ public class CKExcelTools {
cell1_0.setCellStyle(getCellStyle(workbook));
// 名称
HSSFCell cell1_1 = row.createCell(1);
cell1_1.setCellValue(MapUtils.getString(childMap, "itemName"));
cell1_1.setCellValue(valueMap.getSubInventName());
cell1_1.setCellStyle(getCellStyle(workbook));
// 规格
// HSSFCell cell1_2 = row.createCell(2);
......@@ -203,23 +197,23 @@ public class CKExcelTools {
// cell1_2.setCellStyle(getCellStyle(workbook));
// 长
HSSFCell cell1_2 = row.createCell(2);
cell1_2.setCellValue(MapUtils.getString(childMap, "length"));
cell1_2.setCellValue(valueMap.getLength() == null ? "" : valueMap.getLength().toString());
cell1_2.setCellStyle(getCellStyle(workbook));
// 宽
HSSFCell cell1_3 = row.createCell(3);
cell1_3.setCellValue(MapUtils.getString(childMap, "width"));
cell1_3.setCellValue(valueMap.getWidth() == null ? "" : valueMap.getWidth().toString());
cell1_3.setCellStyle(getCellStyle(workbook));
// 高
HSSFCell cell1_4 = row.createCell(4);
cell1_4.setCellValue(MapUtils.getString(childMap, "height"));
cell1_4.setCellValue(valueMap.getThick() == null ? "" : valueMap.getThick().toString());
cell1_4.setCellStyle(getCellStyle(workbook));
// 数量
HSSFCell cell1_5 = row.createCell(5);
cell1_5.setCellValue(MapUtils.getString(childMap, "quantity"));
cell1_5.setCellValue(valueMap.getAmount() + "");
cell1_5.setCellStyle(getCellStyle(workbook));
// 备注
HSSFCell cell1_6 = row.createCell(6);
cell1_6.setCellValue(MapUtils.getString(childMap, "remark"));
cell1_6.setCellValue(valueMap.getRemark());
cell1_6.setCellStyle(getCellStyle(workbook));
}
return currRow;
......@@ -230,14 +224,12 @@ public class CKExcelTools {
*
* @param workbook
* @param sheet
* @param itemMap
* @param lastRow
* @param headRow
*/
private static int buildGroupRow(HSSFWorkbook workbook, HSSFSheet sheet, Map<String, Object> itemMap,
private static int buildGroupRow(HSSFWorkbook workbook, HSSFSheet sheet, String groupName,
int lastRow, int headRow) {
int currRow = lastRow + 1;
String groupName = MapUtils.getString(itemMap, "groupName");
HSSFRow row = sheet.createRow(currRow);
row.setHeight((short) (20 * 20));
// 序号
......@@ -277,7 +269,7 @@ public class CKExcelTools {
row1.setHeight((short) (20 * 20));
// 1.1、表头:项目名
HSSFCell cell1_1 = row1.createCell(0);
cell1_1.setCellValue("项目:" + dataMap.get("projectName"));
cell1_1.setCellValue("项目:" + dataMap.get(Field.PROJ_NAME));
cell1_1.setCellStyle(getCellStyle(workbook, HorizontalAlignment.LEFT, VerticalAlignment.CENTER, true, false));
// 1.2、表头日期
HSSFCell cell1_2 = row1.createCell(5);
......@@ -453,4 +445,37 @@ public class CKExcelTools {
return cellStyle;
}
/**
* 字段信息
*/
public class Field {
// 项目号
public static final String PROJ_CODE = "projCode";
// 项目名称
public static final String PROJ_NAME = "projName";
// 父级产品编码
public static final String PARENT_PRDT_CODE = "parentPrdtCode";
// 父级产品名称
public static final String PARENT_PRDT_NAME = "parentPrdtName";
// 产品编码
public static final String PRDT_CODE = "prdtCode";
// 产品名称
public static final String PRDT_NAME = "prdtName";
// 长
public static final String LENGTH = "length";
// 宽
public static final String WIDTH = "width";
// 高
public static final String HEIGHT = "height";
// 厚
public static final String THICK = "thick";
// 数量
public static final String NUM = "num";
// 备注
public static final String REMARK = "remark";
// 子集集合
public static final String CHILDREN = "children";
}
}
package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -110,12 +111,20 @@ public class HPKCTools {
}
/**
* HPKC004 公共方法定义
*
* @author:songx
* @date:2024/1/31,16:36
*/
public static class HpKc004 {
/**
* 锁
*
* @param saleNos
* @return
*/
public static void lockKc004(List<String> saleNos) {
public static void lock(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return;
}
......@@ -127,10 +136,25 @@ public class HPKCTools {
/**
* 查询销售出库信息
*
* @param ids
* @return
*/
public static List<HPKC004> listById(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC004.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static List<HPKC004> listKc004(List<String> saleNos) {
public static List<HPKC004> list(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return null;
}
......@@ -145,8 +169,8 @@ public class HPKCTools {
* @param saleNos
* @return
*/
public static Map<String, HPKC004> mapKc004(List<String> saleNos) {
List<HPKC004> results = listKc004(saleNos);
public static Map<String, HPKC004> map(List<String> saleNos) {
List<HPKC004> results = list(saleNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
......@@ -154,6 +178,21 @@ public class HPKCTools {
}
/**
* 修改打印状态
*
* @param ids
*/
public static void updatePrint(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoUtils.update(HPSqlConstant.HPKC004.UPDATE_PRINT, queryMap);
}
}
/**
* 锁
*
* @param checkNos
......@@ -286,12 +325,20 @@ public class HPKCTools {
}
/**
* HPKC010公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc010 {
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static List<HPKC010> listKc010(List<Long> ids) {
public static List<HPKC010> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
......@@ -306,8 +353,8 @@ public class HPKCTools {
* @param ids
* @return
*/
public static Map<Long, HPKC010> mapKc010(List<Long> ids) {
List<HPKC010> results = listKc010(ids);
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
......@@ -320,7 +367,7 @@ public class HPKCTools {
* @param ids
* @return
*/
public static void lockKc010(List<Long> ids) {
public static void lock(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
......@@ -329,6 +376,63 @@ public class HPKCTools {
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
}
}
/**
* HPKC011公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc011 {
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static List<HPKC011> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC011.QUERY, queryMap);
}
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static Map<Long, HPKC011> map(List<Long> ids) {
List<HPKC011> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC011::getId, item -> item));
}
/**
* 锁
*
* @param ids
* @return
*/
public static void lock(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC011.LOCK, queryMap);
}
}
/**
* 更新库存
*
......
package com.baosight.hpjx.util;
import com.alibaba.fastjson.JSONObject;
import com.baosight.iplat4j.core.exception.PlatException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Map;
import java.util.UUID;
/**
......@@ -109,4 +115,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
return str.length() > endIndex ? str.substring(0, endIndex) : str;
}
/**
* 解码参数
*
* @param parameter
* @return
*/
public static Map<String, Object> encodeParam(String parameter) throws UnsupportedEncodingException {
// 帆软传递进来的参数进行了两次编码,因此需要进行两次解码
String paramsText = URLDecoder.decode(parameter, "UTF-8");
paramsText = URLDecoder.decode(paramsText, "UTF-8");
return JSONObject.parseObject(paramsText).getInnerMap();
}
}
......@@ -18,6 +18,9 @@ $(function () {
// 挑选库存
$("#SELECT_STOCK").on("click", selectStock);
// 导出打印
$("#PRINT").on("click", exportPrint);
});
......@@ -59,3 +62,31 @@ let selectStockCallback = function () {
// 关闭弹窗
JSColorbox.close();
}
/**
* 导出打印
*/
let exportPrint = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择同一个项目的数据")
return;
}
let saleIds = [];
let projCodeTemp;
for (let i = 0; i < rows.length; i++) {
let projCode = rows[i]['projCode'];
if (projCodeTemp == null) {
projCodeTemp = projCode;
} else if (projCodeTemp != projCode) {
message("第" + (i + 1) + "行项目号不一致,请选择同一个项目的数据");
return;
}
saleIds.push(rows[i]['id']);
}
let parameter = {
"saleIds": saleIds
};
window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter="
+ encodeURI(encodeURI(JSON.stringify(parameter)));
}
......@@ -8,66 +8,63 @@
<EF:EFPage title="销售出库单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3" format="yyyy-MM-dd"
readonly="true"/>
<EF:EFInput cname="销售单号" ename="inqu_status-0-saleNo" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '3', '4')"/>
</EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDatePicker cname="单据日期" ename="receiptDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="销售单号" ename="saleNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFInput cname="部件编码" ename="inventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件编码" ename="subInventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFSelect cname="是否删除" ename="inqu_status-0-deleteFlag" colWidth="3" defaultValue="0">
<EF:EFSelect cname="是否打印" ename="isPrint" blockId="inqu_status" row="0" colWidth="3" defaultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFSelect>
<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" startName="createdDateFrom" endName="createdDateTo"
blockId="inqu_status" row="0" role="date" format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8"
endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库编码" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventName" cname="零部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100"
<EF:EFColumn ename="length" cname="长" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="width" cname="宽" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="thick" cname="厚" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFColumn ename="weight" cname="总重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
<EF:EFComboColumn ename="isPrint" cname="是否打印" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
......
......@@ -43,9 +43,7 @@ let select = function () {
}
for (let i = 0; i < rows.length; i++) {
let applyAmount = rows[i]['applyAmount'];
let applyWeight = rows[i]['applyWeight'];
let amount = rows[i]['amount'];
let weight = rows[i]['weight'];
if (isBlank(applyAmount) || !isNumber(applyAmount) || !(applyAmount > 0)) {
message("第" + (i + 1) + "行申请数量必须大于0");
return;
......@@ -53,13 +51,6 @@ let select = function () {
if (parseFloat(applyAmount) > parseFloat(amount)) {
message("第" + (i + 1) + "行申请数量不能大于库存数量");
return;
}if (isBlank(applyWeight) || !isNumber(applyWeight) || !(applyWeight > 0)) {
message("第" + (i + 1) + "行申请重量必须大于0");
return;
}
if (parseFloat(applyWeight) > parseFloat(weight)) {
message("第" + (i + 1) + "行申请重量不能大于库存重量");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成出库单吗? ", {
......
......@@ -8,51 +8,38 @@
<EF:EFPage title="库存查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '3', '4')"/>
</EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-spec" cname="规格" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<div class="row">
<EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件编码" ename="inventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="零部件编码" ename="subInventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventName" cname="零部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="applyAmount" cname="申请数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="applyWeight" cname="申请重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="说明" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="whCode" cname="仓库编码" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
var inventNameGlobalData = [];
var specGlobalData = [];
$(function() {
// 查询
$("#QUERY").on("click", query);
......@@ -16,32 +15,12 @@ $(function() {
}
return "";
}
}, {
field: "spec",
},{
field: "subInventCode",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return specGlobalData[i]['textField'];
}
}
return "";
}
}, {
field: "material",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return specGlobalData[i]['param1Field'];
}
}
return "";
}
}, {
field: "unit",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return specGlobalData[i]['param2Field'];
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['subInventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
......@@ -64,14 +43,6 @@ $(window).load(function () {
onFail: function (ei) {
}
}, {async: false});
// 规格
EiCommunicator.send("HPPZ006", "queryComboBoxAll", eiInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
......
......@@ -5,24 +5,25 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="实时库存管理">
<EF:EFPage title="产品库存管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" ename="projCode" colWidth="3" cname="项目编号:" />
<EF:EFInput blockId="inqu_status" ename="projName" colWidth="3" cname="项目名称:" />
<EF:EFInput blockId="inqu_status" ename="prodNo" colWidth="3" cname="生产单号:" />
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-inventType" cname="存货类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-inventCode" cname="存货名称" colWidth="3" filter="contains" defultValue="">
</div>
<div class="row">
<EF:EFSelect ename="inqu_status-0-inventCode" cname="部件名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-spec" cname="规格" colWidth="3" filter="contains" defultValue="">
<EF:EFSelect ename="inqu_status-0-subInventCode" cname="零部件名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
......@@ -30,21 +31,23 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventRecordId" cname="存货档案ID" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产单号" width="120" 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">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
align="center" filter="contains" required="true">
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="projCode" cname="项目编号" width="120" align="center" required="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="部件名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="subInventCode" cname="零部件名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="length" cname="长" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="width" cname="宽" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="thich" cname="厚" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="90" align="right" required="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="90" align="right"/>
<EF:EFColumn ename="remark" cname="备注" width="120" align="center"/>
<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']"/>
......@@ -53,5 +56,4 @@
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.baosight.hpjx.hp.kc.tools.CKExcelTools" %>
<%@ page import="com.baosight.iplat4j.core.exception.PlatException" %>
<%
try {
// 1.出库单
if ("1".equals(request.getParameter("route"))) {
CKExcelTools.downloadFile(pageContext);
} else {
throw new PlatException("非法的路由信息");
}
out.clear();
out = pageContext.pushBody();
} catch (Exception e) {
} catch (Throwable e) {
request.setAttribute("iplat_msgKey", "ES001");
request.setAttribute("iplat_msg", "出库单下载失败");
request.setAttribute("iplat_msg", "文件下载失败");
request.setAttribute("iplat_msgDetail", e.toString());
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response);
}
%>
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