Commit f7796178 by 宋祥

1.销售出库逻辑关联生产任务

parent c4e7d5a0
......@@ -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,12 +16,12 @@ 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 {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id"; /* ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/
......@@ -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"; /* 创建时间*/
......@@ -46,7 +53,7 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 修改人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 修改时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/
......@@ -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"; /* 创建时间*/
......@@ -71,30 +85,37 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 修改人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 修改时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除*/
public static final String QUERY = "HPKC004.query";
public static final String COUNT = "HPKC004.count";
public static final String INSERT = "HPKC004.insert";
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 = " "; /* 创建时间*/
......@@ -102,126 +123,166 @@ public class HPKC004 extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/
private Integer deleteFlag; /* 是否删除*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_ID);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName("ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_CODE);
eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE);
eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIPT_DATE);
eiColumn.setDescName("票据日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SALE_NO);
eiColumn.setDescName("销售单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WH_CODE);
eiColumn.setDescName("仓库编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WH_NAME);
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(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("长");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WIDTH);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("宽");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_THICK);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
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(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_KC_ID);
eiColumn.setDescName("库存ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_SALE_NO);
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);
eiColumn = new EiColumn(FIELD_CREATED_NAME);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_TIME);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_BY);
eiColumn.setDescName("修改人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_NAME);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UPDATED_TIME);
eiColumn.setDescName("修改时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPKC004() {
initMetaData();
}
/**
* get the id - ID.
* @return the id
......@@ -229,7 +290,7 @@ public class HPKC004 extends DaoEPBase {
public Long getId() {
return this.id;
}
/**
* set the id - ID.
*
......@@ -245,7 +306,7 @@ public class HPKC004 extends DaoEPBase {
public String getCompanyCode() {
return this.companyCode;
}
/**
* set the companyCode - 企业编码 预留.
*
......@@ -261,7 +322,7 @@ public class HPKC004 extends DaoEPBase {
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码 预留.
*
......@@ -277,7 +338,7 @@ public class HPKC004 extends DaoEPBase {
public String getReceiptDate() {
return this.receiptDate;
}
/**
* set the receiptDate - 票据日期.
*
......@@ -293,7 +354,7 @@ public class HPKC004 extends DaoEPBase {
public String getSaleNo() {
return this.saleNo;
}
/**
* set the saleNo - 销售单号.
*
......@@ -309,7 +370,7 @@ public class HPKC004 extends DaoEPBase {
public String getWhCode() {
return this.whCode;
}
/**
* set the whCode - 仓库编码.
*
......@@ -325,7 +386,7 @@ public class HPKC004 extends DaoEPBase {
public String getWhName() {
return this.whName;
}
/**
* set the whName - 仓库名称.
*
......@@ -335,69 +396,164 @@ public class HPKC004 extends DaoEPBase {
this.whName = whName;
}
/**
* get the inventType - 存货类型.
* @return the inventType
* get the prodNo - 生产订单号.
* @return the prodNo
*/
public String getInventType() {
return this.inventType;
public String getProdNo() {
return this.prodNo;
}
/**
* set the inventType - 存货类型.
* set the prodNo - 生产订单号.
*
* @param inventType - 存货类型
* @param prodNo - 生产订单号
*/
public void setProdNo(String prodNo) {
this.prodNo = prodNo;
}
/**
* get the projCode - 项目号.
* @return the projCode
*/
public void setInventType(String inventType) {
this.inventType = inventType;
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 getProjName() {
return this.projName;
}
/**
* get the inventCode - 存货编码.
* set the projName - 项目名称.
*
* @param projName - 项目名称
*/
public void setProjName(String projName) {
this.projName = projName;
}
/**
* get the inventCode - 部件编码.
* @return the inventCode
*/
public String getInventCode() {
return this.inventCode;
}
/**
* 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() {
return this.inventName;
}
/**
* set the inventName - 存货名称.
* set the inventName - 部件名称.
*
* @param inventName - 存货名称
* @param inventName - 部件名称
*/
public void setInventName(String inventName) {
this.inventName = inventName;
}
/**
* get the inventRecordId - 规格.
* @return the inventRecordId
* 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 Long getInventRecordId() {
return this.inventRecordId;
public void setSubInventName(String subInventName) {
this.subInventName = subInventName;
}
/**
* set the inventRecordId - 规格.
* get the length - 长.
* @return the length
*/
public BigDecimal getLength() {
return this.length;
}
/**
* 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 BigDecimal getThick() {
return this.thick;
}
/**
* 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 - 数量.
......@@ -406,7 +562,7 @@ public class HPKC004 extends DaoEPBase {
public BigDecimal getAmount() {
return this.amount;
}
/**
* set the amount - 数量.
*
......@@ -416,13 +572,29 @@ public class HPKC004 extends DaoEPBase {
this.amount = amount;
}
/**
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the unitWeight - 单重.
*
* @param unitWeight - 单重
*/
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the weight - 重量.
* @return the weight
*/
public BigDecimal getWeight() {
return this.weight;
}
/**
* set the weight - 重量.
*
......@@ -432,29 +604,13 @@ public class HPKC004 extends DaoEPBase {
this.weight = weight;
}
/**
* get the status - 状态.
* @return the status
*/
public Integer getStatus() {
return this.status;
}
/**
* set the status - 状态.
*
* @param status - 状态
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
......@@ -470,7 +626,7 @@ public class HPKC004 extends DaoEPBase {
public Long getKcId() {
return this.kcId;
}
/**
* set the kcId - 库存ID.
*
......@@ -486,7 +642,7 @@ public class HPKC004 extends DaoEPBase {
public String getOldSaleNo() {
return this.oldSaleNo;
}
/**
* set the oldSaleNo - 原销售单号.
*
......@@ -496,13 +652,29 @@ 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
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
......@@ -518,7 +690,7 @@ public class HPKC004 extends DaoEPBase {
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
......@@ -534,7 +706,7 @@ public class HPKC004 extends DaoEPBase {
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
......@@ -550,7 +722,7 @@ public class HPKC004 extends DaoEPBase {
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 修改人.
*
......@@ -566,7 +738,7 @@ public class HPKC004 extends DaoEPBase {
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改人名称.
*
......@@ -582,7 +754,7 @@ public class HPKC004 extends DaoEPBase {
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 修改时间.
*
......@@ -598,7 +770,7 @@ public class HPKC004 extends DaoEPBase {
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除.
*
......@@ -614,7 +786,7 @@ public class HPKC004 extends DaoEPBase {
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(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));
......@@ -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));
......@@ -640,13 +819,13 @@ public class HPKC004 extends DaoEPBase {
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
}
/**
* 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)));
......@@ -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)));
......@@ -672,7 +858,7 @@ public class HPKC004 extends DaoEPBase {
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)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map;
}
}
......@@ -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));
......@@ -101,13 +101,13 @@ public class ServiceHPKC004 extends ServiceBase {
HPKC004 newKc004 = BeanUtils.copy(dbKc004, HPKC004.class);
newKc004.setSaleNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC004_SALE_NO));
newKc004.setAmount(dbKc004.getAmount().negate());
newKc004.setWeight(dbKc004.getWeight().negate());
newKc004.setUnitWeight(dbKc004.getUnitWeight().negate());
newKc004.setOldSaleNo(dbKc004.getSaleNo());
newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存
HPKCTools.updateStock(dbKc004.getWhCode(), dbKc004.getInventRecordId(),
dbKc004.getAmount(), dbKc004.getWeight());
// HPKCTools.updateStock(dbKc004.getWhCode(), dbKc004.getInventRecordId(),
// dbKc004.getAmount(), dbKc004.getWeight());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -92,9 +92,9 @@ public class ServiceHPKC004A 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");
......@@ -125,8 +125,8 @@ public class ServiceHPKC004A extends ServiceEPBase {
newKc004.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC004.INSERT, newKc004);
// 修改库存数量
HPKCTools.updateStock(newKc004.getWhCode(), newKc004.getInventRecordId(),
newKc004.getAmount().negate(), newKc004.getWeight().negate());
// HPKCTools.updateStock(newKc004.getWhCode(), newKc004.getInventRecordId(),
// newKc004.getAmount().negate(), newKc004.getWeight().negate());
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, 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="subInventName">
SUB_INVENT_NAME LIKE CONCAT('%', #subInventName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
<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
......
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,47 +111,85 @@ public class HPKCTools {
}
/**
*
* HPKC004 公共方法定义
*
* @param saleNos
* @return
* @author:songx
* @date:2024/1/31,16:36
*/
public static void lockKc004(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return;
public static class HpKc004 {
/**
* 锁
*
* @param saleNos
* @return
*/
public static void lock(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC004.LOCK, queryMap);
}
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC004.LOCK, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static List<HPKC004> listKc004(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return null;
/**
* 查询销售出库信息
*
* @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);
}
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos);
return DaoBase.getInstance().query(HPKC004.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static Map<String, HPKC004> mapKc004(List<String> saleNos) {
List<HPKC004> results = listKc004(saleNos);
if (CollectionUtils.isEmpty(results)) {
return null;
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static List<HPKC004> list(List<String> saleNos) {
if (CollectionUtils.isEmpty(saleNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("saleNos", saleNos);
return DaoBase.getInstance().query(HPKC004.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param saleNos
* @return
*/
public static Map<String, HPKC004> map(List<String> saleNos) {
List<HPKC004> results = list(saleNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC004::getSaleNo, item -> item));
}
/**
* 修改打印状态
*
* @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);
}
return results.stream().collect(Collectors.toMap(HPKC004::getSaleNo, item -> item));
}
/**
......@@ -286,47 +325,57 @@ public class HPKCTools {
}
/**
* 查询库存信息
* HPKC004公共DAO方法定义
*
* @param ids
* @return
* @author:songx
* @date:2024/1/31,16:42
*/
public static List<HPKC010> listKc010(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
public static class HpKc010 {
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static List<HPKC010> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static Map<Long, HPKC010> mapKc010(List<Long> ids) {
List<HPKC010> results = listKc010(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
/**
* 查询库存信息
*
* @param ids
* @return
*/
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
}
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
}
/**
* 锁
*
* @param ids
* @return
*/
public static void lockKc010(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
/**
* 锁
*
* @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.HPKC010.LOCK, queryMap);
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.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();
}
}
......@@ -8,8 +8,8 @@ $(function () {
return showUserName(options.createdBy, options.createdName);
}
}],
loadComplete: function (grid) {
}
loadComplete: function (grid) {
}
}
}
......@@ -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"
......
<!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 {
CKExcelTools.downloadFile(pageContext);
out.clear();
out = pageContext.pushBody();
} catch (Exception e) {
request.setAttribute("iplat_msgKey", "ES001");
request.setAttribute("iplat_msg", "出库单下载失败");
request.setAttribute("iplat_msgDetail", e.toString());
request.getRequestDispatcher("/EU/DM/EUDM30.jsp").forward(request, response);
}
try {
// 1.出库单
if ("1".equals(request.getParameter("route"))) {
CKExcelTools.downloadFile(pageContext);
} else {
throw new PlatException("非法的路由信息");
}
out.clear();
out = pageContext.pushBody();
} catch (Throwable e) {
request.setAttribute("iplat_msgKey", "ES001");
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