Commit 133f9bd8 by 宋祥

1.生产领料逻辑

parent 04c2a659
...@@ -30,6 +30,8 @@ public class HPSqlConstant { ...@@ -30,6 +30,8 @@ public class HPSqlConstant {
// 统计 // 统计
public static final String STAT_DATE = "HPKC002.statDate"; public static final String STAT_DATE = "HPKC002.statDate";
// 锁
public static final String LOCK = "HPKC002.lock";
} }
/** /**
......
...@@ -2,8 +2,6 @@ package com.baosight.hpjx.hp.kc.domain; ...@@ -2,8 +2,6 @@ package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baosight.iplat4j.core.util.DateUtils;
import java.sql.Timestamp;
import com.baosight.iplat4j.core.ei.EiColumn; import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap; import java.util.HashMap;
...@@ -18,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils; ...@@ -18,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br> * Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
* *
* @version 1.0 * @version 1.0
* @history 2024-01-25 13:33:31 create * @history 2024-01-25 23:15:22 create
*/ */
public class HPKC002 extends DaoEPBase { public class HPKC002 extends DaoEPBase {
...@@ -43,7 +41,9 @@ public class HPKC002 extends DaoEPBase { ...@@ -43,7 +41,9 @@ public class HPKC002 extends DaoEPBase {
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/ public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/ public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/ public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_REMARKS = "remarks"; /* 备注*/ public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_OLD_REQ_NO = "oldReqNo"; /* 原领料单号*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/ public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String COL_ID = "ID"; /* 主键id*/ public static final String COL_ID = "ID"; /* 主键id*/
...@@ -65,36 +65,40 @@ public class HPKC002 extends DaoEPBase { ...@@ -65,36 +65,40 @@ public class HPKC002 extends DaoEPBase {
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/ public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/ public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/ public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_REMARKS = "REMARKS"; /* 备注*/ public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_OLD_REQ_NO = "OLD_REQ_NO"; /* 原领料单号*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/ public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/
public static final String QUERY = "t_hpkc002.query"; public static final String QUERY = "HPKC002.query";
public static final String COUNT = "t_hpkc002.count"; public static final String COUNT = "HPKC002.count";
public static final String INSERT = "t_hpkc002.insert"; public static final String INSERT = "HPKC002.insert";
public static final String UPDATE = "t_hpkc002.update"; public static final String UPDATE = "HPKC002.update";
public static final String DELETE = "t_hpkc002.delete"; public static final String DELETE = "HPKC002.delete";
private Long id = null; /* 主键id*/ private Long id = null; /* 主键id*/
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
private String createdTime ; /* 创建时间*/ private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/ private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/ private String updatedName = " "; /* 更新人名称*/
private String updatedTime ; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private String reqNo = " "; /* 领料单号*/ private String reqNo = " "; /* 领料单号*/
private String receiptDate ; /* 单据日期*/ private String receiptDate = " "; /* 单据日期*/
private String whCode = " "; /* 仓库编码*/ private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/ private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/ private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/ private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal("0"); /* 数量*/ private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/ private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private String remarks = " "; /* 备注*/ private String remark = " "; /* 备注*/
private Boolean deleteFlag; /* 是否删除0.否1.是*/ private Long kcId = new Long(0); /* 库存ID*/
private String oldReqNo = " "; /* 原领料单号*/
private Integer deleteFlag; /* 是否删除0.否1.是*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -173,22 +177,30 @@ public class HPKC002 extends DaoEPBase { ...@@ -173,22 +177,30 @@ public class HPKC002 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT); eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N"); eiColumn.setType("N");
eiColumn.setScaleLength(0); eiColumn.setScaleLength(2);
eiColumn.setFieldLength(12); eiColumn.setFieldLength(10);
eiColumn.setDescName("数量"); eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT); eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N"); eiColumn.setType("N");
eiColumn.setScaleLength(0); eiColumn.setScaleLength(2);
eiColumn.setFieldLength(12); eiColumn.setFieldLength(10);
eiColumn.setDescName("重量"); eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARKS); eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注"); eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_KC_ID);
eiColumn.setDescName("库存ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_REQ_NO);
eiColumn.setDescName("原领料单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG); eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是"); eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -508,26 +520,58 @@ public class HPKC002 extends DaoEPBase { ...@@ -508,26 +520,58 @@ public class HPKC002 extends DaoEPBase {
this.weight = weight; this.weight = weight;
} }
/** /**
* get the remarks - 备注. * get the remark - 备注.
* @return the remarks * @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the kcId - 库存ID.
* @return the kcId
*/
public Long getKcId() {
return this.kcId;
}
/**
* set the kcId - 库存ID.
*
* @param kcId - 库存ID
*/
public void setKcId(Long kcId) {
this.kcId = kcId;
}
/**
* get the oldReqNo - 原领料单号.
* @return the oldReqNo
*/ */
public String getRemarks() { public String getOldReqNo() {
return this.remarks; return this.oldReqNo;
} }
/** /**
* set the remarks - 备注. * set the oldReqNo - 原领料单号.
* *
* @param remarks - 备注 * @param oldReqNo - 原领料单号
*/ */
public void setRemarks(String remarks) { public void setOldReqNo(String oldReqNo) {
this.remarks = remarks; this.oldReqNo = oldReqNo;
} }
/** /**
* get the deleteFlag - 是否删除0.否1.是. * get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag * @return the deleteFlag
*/ */
public Boolean getDeleteFlag() { public Integer getDeleteFlag() {
return this.deleteFlag; return this.deleteFlag;
} }
...@@ -536,7 +580,7 @@ public class HPKC002 extends DaoEPBase { ...@@ -536,7 +580,7 @@ public class HPKC002 extends DaoEPBase {
* *
* @param deleteFlag - 是否删除0.否1.是 * @param deleteFlag - 是否删除0.否1.是
*/ */
public void setDeleteFlag(Boolean deleteFlag) { public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag; this.deleteFlag = deleteFlag;
} }
/** /**
...@@ -566,8 +610,10 @@ public class HPKC002 extends DaoEPBase { ...@@ -566,8 +610,10 @@ public class HPKC002 extends DaoEPBase {
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId)); setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount)); setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight)); setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setRemarks(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARKS)), remarks)); setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setDeleteFlag(NumberUtils.toBoolean(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag)); setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setOldReqNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_REQ_NO)), oldReqNo));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
} }
/** /**
...@@ -596,7 +642,9 @@ public class HPKC002 extends DaoEPBase { ...@@ -596,7 +642,9 @@ public class HPKC002 extends DaoEPBase {
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID))); map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT))); map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT))); map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_REMARKS, StringUtils.toString(remarks, eiMetadata.getMeta(FIELD_REMARKS))); 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_REQ_NO, StringUtils.toString(oldReqNo, eiMetadata.getMeta(FIELD_OLD_REQ_NO)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG))); map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map; return map;
......
...@@ -37,6 +37,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -37,6 +37,7 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_WEIGHT = "weight"; /* 重量*/ public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_STATUS = "status"; /* 状态*/ public static final String FIELD_STATUS = "status"; /* 状态*/
public static final String FIELD_REMARK = "remark"; /* 备注*/ 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_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/ public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
...@@ -61,6 +62,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -61,6 +62,7 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/ public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_STATUS = "STATUS"; /* 状态*/ public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/ 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_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
...@@ -91,6 +93,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -91,6 +93,7 @@ public class HPKC004 extends DaoEPBase {
private BigDecimal weight = new BigDecimal(0); /* 重量*/ private BigDecimal weight = new BigDecimal(0); /* 重量*/
private Integer status; /* 状态*/ private Integer status; /* 状态*/
private String remark = " "; /* 备注*/ private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private String oldSaleNo = " "; /* 原销售单号*/ private String oldSaleNo = " "; /* 原销售单号*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
...@@ -173,6 +176,10 @@ public class HPKC004 extends DaoEPBase { ...@@ -173,6 +176,10 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("备注"); eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_KC_ID);
eiColumn.setDescName("库存ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_SALE_NO); eiColumn = new EiColumn(FIELD_OLD_SALE_NO);
eiColumn.setDescName("原销售单号"); eiColumn.setDescName("原销售单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -457,6 +464,22 @@ public class HPKC004 extends DaoEPBase { ...@@ -457,6 +464,22 @@ public class HPKC004 extends DaoEPBase {
this.remark = remark; this.remark = remark;
} }
/** /**
* get the kcId - 库存ID.
* @return the kcId
*/
public Long getKcId() {
return this.kcId;
}
/**
* set the kcId - 库存ID.
*
* @param kcId - 库存ID
*/
public void setKcId(Long kcId) {
this.kcId = kcId;
}
/**
* get the oldSaleNo - 原销售单号. * get the oldSaleNo - 原销售单号.
* @return the oldSaleNo * @return the oldSaleNo
*/ */
...@@ -607,6 +630,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -607,6 +630,7 @@ public class HPKC004 extends DaoEPBase {
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight)); setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status)); setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark)); 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)); setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy)); setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName)); setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
...@@ -639,6 +663,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -639,6 +663,7 @@ public class HPKC004 extends DaoEPBase {
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_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_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK))); 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_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY))); 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_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnun;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 生产领料挑选库存
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPKC002A extends ServiceEPBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnun.MATERIAL.getCode(),
InventTypeEnun.CONSUMABLE.getCode()};
/**
* 初始化
*
* @param inInfo
* @return
*/
@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);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@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());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 生成出库单
*
* @param inInfo
* @return
*/
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 行锁
HPKCTools.lockKc010(ids);
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.mapKc010(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + 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 + "]可用重量不足!");
}
// 生成销售库单
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);
HPKC002 newKc002 = BeanUtils.copy(dbKc010, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setReceiptDate(DateUtils.shortDate());
newKc002.setAmount(applyAmount);
newKc002.setWeight(applyWeight);
newKc002.setRemark(applyRemark);
newKc002.setKcId(kcId);
newKc002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存数量
HPKCTools.updateStock(newKc002.getWhCode(), newKc002.getInventRecordId(),
newKc002.getAmount().negate(), newKc002.getWeight().negate());
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成领料单失败");
}
return inInfo;
}
}
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID --> INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 --> AMOUNT as "amount", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 --> WEIGHT as "weight", <!-- 重量 -->
REMARKS as "remarks", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
OLD_REQ_NO as "oldReqNo", <!-- 原领料单号 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 --> DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 -->
</sql> </sql>
...@@ -55,7 +57,7 @@ ...@@ -55,7 +57,7 @@
UPDATED_TIME = #updatedTime# UPDATED_TIME = #updatedTime#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="reqNo"> <isNotEmpty prepend=" AND " property="reqNo">
REQ_NO= #reqNo# REQ_NO = #reqNo#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate"> <isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate# RECEIPT_DATE = #receiptDate#
...@@ -78,14 +80,11 @@ ...@@ -78,14 +80,11 @@
<isNotEmpty prepend=" AND " property="inventRecordId"> <isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId# INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="amount"> <isNotEmpty prepend=" AND " property="kcId">
AMOUNT = #amount# KC_ID = #kcId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="weight"> <isNotEmpty prepend=" AND " property="oldReqNo">
WEIGHT = #weight# OLD_REQ_NO = #oldReqNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remarks">
REMARKS = #remarks#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag"> <isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag# DELETE_FLAG = #deleteFlag#
...@@ -93,6 +92,9 @@ ...@@ -93,6 +92,9 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="reqNos">
REQ_NO IN <iterate close=")" open="(" conjunction="," property="reqNos">#reqNos[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec"> <isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格"> <isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '') INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
...@@ -109,27 +111,30 @@ ...@@ -109,27 +111,30 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <sql id="order">
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002"> <dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$orderBy$
</isNotEmpty>
<isEmpty property="order">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT <include refid="column"/> SELECT <include refid="column"/>
FROM hpjx.t_hpkc002 WHERE 1=1 FROM hpjx.t_hpkc002 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <include refid="order"/>
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1
<include refid="condition"/> <include refid="condition"/>
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
<insert id="insert"> <insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPKC002 ( INSERT INTO ${hpjxSchema}.T_HPKC002 (
...@@ -148,12 +153,15 @@ ...@@ -148,12 +153,15 @@
INVENT_RECORD_ID, <!-- 存货档案ID --> INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 --> AMOUNT, <!-- 数量 -->
WEIGHT, <!-- 重量 --> WEIGHT, <!-- 重量 -->
REMARKS, <!-- 备注 --> REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_REQ_NO, <!-- 原领料单号 -->
DELETE_FLAG <!-- 是否删除0.否1.是 --> DELETE_FLAG <!-- 是否删除0.否1.是 -->
) VALUES ( ) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#reqCode#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#, #reqNo#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #inventRecordId#, #amount#, #weight#, #remarks#, #deleteFlag# #inventName#, #inventRecordId#, #amount#, #weight#, #remark#, #kcId#,
#oldReqNo#, #deleteFlag#
) )
</insert> </insert>
...@@ -162,24 +170,17 @@ ...@@ -162,24 +170,17 @@
UPDATE hpjx.t_hpkc002 SET DELETE_FLAG = 1 WHERE ID = #id# UPDATE hpjx.t_hpkc002 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete> </delete>
<update id="update"> <!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC002 UPDATE ${hpjxSchema}.T_HPKC002
SET SET CREATED_TIME = CREATED_TIME
UPDATED_BY = #updatedBy#, <!-- 更新人 --> WHERE 1=1
UPDATED_NAME = #updatedName#, <!-- 更新人名称 --> <isNotEmpty prepend=" AND " property="reqNo">
UPDATED_TIME = #updatedTime#, <!-- 更新时间 --> REQ_NO = #reqNo#
REQ_NO = #reqNo#, <!-- 领料单号 --> </isNotEmpty>
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 --> <isNotEmpty prepend=" AND " property="reqNos">
WH_CODE = #whCode#, <!-- 仓库编码 --> REQ_NO IN <iterate close=")" open="(" conjunction="," property="reqNos">#reqNos[]#</iterate>
WH_NAME = #whName#, <!-- 仓库名称 --> </isNotEmpty>
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARKS = #remarks# <!-- 备注 -->
WHERE ID = #id#
</update> </update>
<!-- 统计库存 --> <!-- 统计库存 -->
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
WEIGHT as "weight", <!-- 重量 --> WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 --> STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 --> OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
...@@ -62,6 +63,9 @@ ...@@ -62,6 +63,9 @@
<isNotEmpty prepend=" AND " property="inventRecordId"> <isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId# INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag"> <isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag# DELETE_FLAG = #deleteFlag#
</isNotEmpty> </isNotEmpty>
...@@ -129,6 +133,7 @@ ...@@ -129,6 +133,7 @@
WEIGHT, <!-- 重量 --> WEIGHT, <!-- 重量 -->
STATUS, <!-- 状态 --> STATUS, <!-- 状态 -->
REMARK, <!-- 备注 --> REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 --> OLD_SALE_NO, <!-- 原销售单号 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_NAME, <!-- 创建人名称 -->
...@@ -137,7 +142,7 @@ ...@@ -137,7 +142,7 @@
) VALUES ( ) VALUES (
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #status#, #inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #status#,
#remark#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag# #remark#, #kcId#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
) )
</insert> </insert>
......
...@@ -24,89 +24,89 @@ public class HPKCTools { ...@@ -24,89 +24,89 @@ public class HPKCTools {
/** /**
* 锁 * 锁
* *
* @param checkNos * @param otherEnterNos
* @return * @return
*/ */
public static void lockKc005(List<String> checkNos) { public static void lockKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(checkNos)) { if (CollectionUtils.isEmpty(otherEnterNos)) {
return; return;
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos); queryMap.put("otherEnterNos", otherEnterNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC005.LOCK, queryMap); DaoBase.getInstance().update(HPSqlConstant.HPKC001.LOCK, queryMap);
} }
/** /**
* 查询盘点单信息 * 查询其他入库信息
* *
* @param checkNos * @param otherEnterNos
* @return * @return
*/ */
public static List<HPKC005> listKc005(List<String> checkNos) { public static List<HPKC001> listKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(checkNos)) { if (CollectionUtils.isEmpty(otherEnterNos)) {
return null; return null;
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos); queryMap.put("otherEnterNos", otherEnterNos);
return DaoBase.getInstance().query(HPKC005.QUERY, queryMap); return DaoBase.getInstance().query(HPKC001.QUERY, queryMap);
} }
/** /**
* 查询盘点单信息 * 查询其他入库信息
* *
* @param checkNos * @param otherEnterNos
* @return * @return
*/ */
public static Map<String, HPKC005> mapKc005(List<String> checkNos) { public static Map<String, HPKC001> mapKc001(List<String> otherEnterNos) {
List<HPKC005> results = listKc005(checkNos); List<HPKC001> results = listKc001(otherEnterNos);
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
return null; return null;
} }
return results.stream().collect(Collectors.toMap(HPKC005::getCheckNo, item -> item)); return results.stream().collect(Collectors.toMap(HPKC001::getPurchaseNo, item -> item));
} }
/** /**
* 锁 * 锁
* *
* @param otherEnterNos * @param reqNos
* @return * @return
*/ */
public static void lockKc001(List<String> otherEnterNos) { public static void lockKc002(List<String> reqNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) { if (CollectionUtils.isEmpty(reqNos)) {
return; return;
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos); queryMap.put("reqNos", reqNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC001.LOCK, queryMap); DaoBase.getInstance().update(HPSqlConstant.HPKC002.LOCK, queryMap);
} }
/** /**
* 查询其他入库信息 * 查询生产领料信息
* *
* @param otherEnterNos * @param reqNos
* @return * @return
*/ */
public static List<HPKC001> listKc001(List<String> otherEnterNos) { public static List<HPKC002> listKc002(List<String> reqNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) { if (CollectionUtils.isEmpty(reqNos)) {
return null; return null;
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos); queryMap.put("reqNos", reqNos);
return DaoBase.getInstance().query(HPKC001.QUERY, queryMap); return DaoBase.getInstance().query(HPKC002.QUERY, queryMap);
} }
/** /**
* 查询其他入库信息 * 查询生产领料信息
* *
* @param otherEnterNos * @param reqNos
* @return * @return
*/ */
public static Map<String, HPKC001> mapKc001(List<String> otherEnterNos) { public static Map<String, HPKC002> mapKc002(List<String> reqNos) {
List<HPKC001> results = listKc001(otherEnterNos); List<HPKC002> results = listKc002(reqNos);
if (CollectionUtils.isEmpty(results)) { if (CollectionUtils.isEmpty(results)) {
return null; return null;
} }
return results.stream().collect(Collectors.toMap(HPKC001::getPurchaseNo, item -> item)); return results.stream().collect(Collectors.toMap(HPKC002::getReqNo, item -> item));
} }
/** /**
...@@ -156,6 +156,50 @@ public class HPKCTools { ...@@ -156,6 +156,50 @@ public class HPKCTools {
/** /**
* 锁 * 锁
* *
* @param checkNos
* @return
*/
public static void lockKc005(List<String> checkNos) {
if (CollectionUtils.isEmpty(checkNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC005.LOCK, queryMap);
}
/**
* 查询盘点单信息
*
* @param checkNos
* @return
*/
public static List<HPKC005> listKc005(List<String> checkNos) {
if (CollectionUtils.isEmpty(checkNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos);
return DaoBase.getInstance().query(HPKC005.QUERY, queryMap);
}
/**
* 查询盘点单信息
*
* @param checkNos
* @return
*/
public static Map<String, HPKC005> mapKc005(List<String> checkNos) {
List<HPKC005> results = listKc005(checkNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC005::getCheckNo, item -> item));
}
/**
* 锁
*
* @param otherEnterNos * @param otherEnterNos
* @return * @return
*/ */
......
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" colWidth="3" format="yyyy-MM-dd" <EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3" format="yyyy-MM-dd"
required="true"/> readonly="true"/>
<EF:EFInput ename="inqu_status-0-documentCode" cname="生产领料单号" colWidth="3" readonly="false"/> <EF:EFInput cname="领料单号" ename="inqu_status-0-reqNo" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains"> <EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains" defultValue=""> <EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains" defultValue=""> <EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" defultValue=""> <EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
...@@ -43,25 +43,36 @@ ...@@ -43,25 +43,36 @@
</div> </div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/> <EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/> <EF:EFColumn ename="reqNo" cname="领料单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="reqNo" cname="生产领料单号" width="100" readonly="false" align="center" required="false" enable="false" /> <EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
<EF:EFComboColumn ename="materialType" cname="存货类型" width="90" align="center"> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" /> <EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
</EF:EFComboColumn> <EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
<EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/> </EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/> <EF:EFComboColumn ename="whCode" cname="仓库编码" enable="false" width="120" align="center"
<EF:EFColumn ename="materialCode" cname="存货名称" width="100" readonly="false" required="true"/> blockName="wh_record_block_id" textField="textField" valueField="valueField"
<EF:EFColumn ename="materialName" cname="存货名称" width="100" readonly="false" hidden="true"/> columnTemplate="#=textField#" itemTemplate="#=textField#">
<EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/> </EF:EFComboColumn>
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/> <EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
<EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/> blockName="invent_name_block_id" textField="textField" valueField="valueField"
<EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/> columnTemplate="#=textField#" itemTemplate="#=textField#">
<EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/> </EF:EFComboColumn>
</EF:EFGrid> <EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
</EF:EFRegion> blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<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"
align="center"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center"/>
<EF:EFColumn ename="oldReqNo" 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"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage> </EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 选择
$("#BTN_SELECT").on("click", select);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let select = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
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;
}
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 + "]条数据生成出库单吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC002A", "select",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="库存查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<EF: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')"/>
</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>
</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="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:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="applyAmount" cname="申请数量" width="120" align="right" format="{0:N3}" required="true"/> <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="applyWeight" cname="申请重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="说明" enable="false" width="150" editType="textarea" copy="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}" <EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/> sumType="all"/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}"
......
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