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)));
......
...@@ -2,12 +2,19 @@ package com.baosight.hpjx.hp.kc.service; ...@@ -2,12 +2,19 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.common.InventTypeEnun;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002; import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -15,26 +22,33 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -15,26 +22,33 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
/** /**
* @author YK * @author:songx
* @date 2024年01月09日 10:18 * @date:2024/1/25,23:19
*/ */
public class ServiceHPKC002 extends ServiceBase { public class ServiceHPKC002 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnun.MATERIAL.getCode(),
InventTypeEnun.CONSUMABLE.getCode()};
/** /**
* 画面初始化. * 画面初始化.
*/ */
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); Map queryMap = new HashMap();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null); 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 HPKC002().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC002().eiMetadata);
inInfo.setBlock(InventTypeEnun.generatorEiBlock()); inInfo.setBlock(InventTypeEnun.generatorEiBlock());
} catch (PlatException e) { } catch (PlatException e) {
...@@ -44,135 +58,66 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -44,135 +58,66 @@ public class ServiceHPKC002 extends ServiceBase {
} }
/** /**
* 查询操作. * 查询操作
*
* @param inInfo
* @return
*/ */
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
String documentTime = inInfo.getCellStr(EiConstant.queryBlock,0,"documentTime");
if(StringUtils.isNotBlank(documentTime)){
inInfo.setCell(EiConstant.queryBlock,0,"documentTime", StringUtil.removeHorizontalLine(documentTime));
}
/* 调用EI查询方法.*/
return super.query(inInfo, "HPKC002.query", new HPKC002());
}
/**
* 新增操作.
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); String receiptDate = MapUtils.getString(queryRow, "receiptDate");
this.checkSaveData(resultRows); queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
// 写入数据 StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
for (int i = 0; i < resultRows.size(); i++) { queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
HPKC002 insertEntity = new HPKC002(); inInfo = super.query(inInfo, HPKC002.QUERY, new HPKC002());
insertEntity.fromMap(resultRows.get(i)); } catch (Exception e) {
// 仓库名称 LogUtils.setDetailMsg(inInfo, e, "查询失败");
Map params = new HashMap<>();
params.put("whCode", insertEntity.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode", params);
insertEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//存货类型
insertEntity.setInventType(InventTypeEnun.getNameByCode(insertEntity.getInventType()));
// 生成单据号
insertEntity.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
dao.insert("HPKC002.insert", insertEntity);
} }
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo; return inInfo;
} }
return inInfo;
}
/** /**
* 校验保存的数据 * 删除操作
* *
* @param resultRows * @param inInfo
*/ * @return
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC002 entity = new HPKC002();
entity.fromMap(resultRows.get(i));
AssertUtils.isEmpty(entity.getInventType(), "存货类型不能为空");
AssertUtils.isEmpty(entity.getInventCode(), "物料不能为空");
AssertUtils.isEmpty(entity.getWhCode(), "仓库不能为空");
}
}
/**
* 修改操作.
*/ */
@Override public EiInfo delete(EiInfo inInfo) {
public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.udpateInfo(inInfo,EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
this.checkSaveData(resultRows); // 销售单号
// 写入数据 List<String> reqNos = ObjectUtils.listKey(resultRows, "reqNo");
// 锁记录
HPKCTools.lockKc002(reqNos);
// 查询数据库记录
Map<String, HPKC002> dbMapKc002 = HPKCTools.mapKc002(reqNos);
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HPKC002 updateEntity = new HPKC002(); HPKC002 fKc002 = new HPKC002();
updateEntity.fromMap(resultRows.get(i)); fKc002.fromMap(resultRows.get(i));
// 仓库名称 DaoUtils.update(HPKC002.DELETE, fKc002);
Map params = new HashMap<>(); // 生成红冲记录
params.put("whCode", updateEntity.getWhCode()); HPKC002 dbKc002 = dbMapKc002.get(fKc002.getReqNo());
List query = dao.query("HPPZ007.queryByWhCode", params); HPKC002 newKc002 = BeanUtils.copy(dbKc002, HPKC002.class);
updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName()); newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
//存货类型 newKc002.setAmount(dbKc002.getAmount().negate());
updateEntity.setInventType(InventTypeEnun.getNameByCode(updateEntity.getInventType())); newKc002.setWeight(dbKc002.getWeight().negate());
dao.insert("HPKC002.update", updateEntity); newKc002.setOldReqNo(dbKc002.getReqNo());
newKc002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存
HPKCTools.updateStock(dbKc002.getWhCode(), dbKc002.getInventRecordId(),
dbKc002.getAmount().negate(), dbKc002.getWeight().negate());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
} catch (PlatException e) { LogUtils.setDetailMsg(inInfo, e, "删除失败");
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
} }
return inInfo; return inInfo;
} }
/**
* 删除操作.
*/
@Override
public EiInfo delete(EiInfo eiInfo) {
HPKC002 HPKC002 = new HPKC002();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPKC002.fromMap(map);
this.dao.delete("HPKC002.delete", HPKC002.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
} }
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,20 +111,23 @@ ...@@ -109,20 +111,23 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <sql id="order">
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT <include refid="column"/>
FROM hpjx.t_hpkc002 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="order">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="order">
ID asc ID asc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT <include refid="column"/>
FROM hpjx.t_hpkc002 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
...@@ -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
*/ */
......
let materialCodeGlobalData = []; $(function () {
let whCodeGlobalData = [];
let specGlobalData = [];
$(function() {
var editorModel0 = '';
var eiInfo = new EiInfo();
// 查询
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [
{
field: "materialCode",
template: function(dataItem) {
for (var i = 0 ; i < materialCodeGlobalData.length ; i++) {
if ( materialCodeGlobalData[i]['valueField'] === dataItem['materialCode']) {
return materialCodeGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
eiInfo.set("inventType", options.model["materialType"]);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
materialCodeGlobalData = dataSource;
}, onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({ IPLATUI.EFGrid = {
valuePrimitive: true, "result": {
dataTextField: "textField", columns: [{
dataValueField: "valueField", field: "createdName",
dataSource: dataSource, template: function (options) {
template: "#=textField#" return showUserName(options.createdBy, options.createdName);
});
},
},
{
field: "whCode",
template: function(dataItem) {
for (var i = 0 ; i < whCodeGlobalData.length ; i++) {
if ( whCodeGlobalData[i]['valueField'] === dataItem['whCode']) {
return whCodeGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
var whEiInfo = new EiInfo();
whEiInfo.set("whType", options.model["materialType"]);
var dataSource;
EiCommunicator.send("HPPZ007", "queryComboBox", whEiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("wh_record_block_id").getMappedRows();
whCodeGlobalData = dataSource;
}, onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
},
},
{
field: "spec",
template: function(dataItem) {
for (var i = 0 ; i < specGlobalData.length ; i++) {
if ( specGlobalData[i]['valueField'] === dataItem['spec']) {
return specGlobalData[i]['textField'];
} }
} }],
return "";
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
var specEiInfo = new EiInfo();
specEiInfo.set("inqu_status-0-inventCode", options.model["materialCode"]);
specEiInfo.set("inqu_status-0-inventType", options.model["materialType"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", specEiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_spec_block_id").getMappedRows();
specGlobalData = dataSource;
}, onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
},
}
],
onRowClick : function(e) {
editorModel0 = e.row;
$("input[name='materialType']").on('change', function (me) {
//清空物料信息
resultGrid.setCellValue(editorModel0, "materialName", "");
resultGrid.setCellValue(editorModel0, "materialCode", "");
resultGrid.setCellValue(editorModel0, "whCode", "");
resultGrid.setCellValue(editorModel0, "whName", "");
resultGrid.setCellValue(editorModel0, "spec", "");
resultGrid.setCellValue(editorModel0, "unit", "");
});
$("input[name='materialCode']").on('change', function (me) {
var materialCode = $("input[name='materialCode']").val();
var queryEiInfo = new EiInfo();
queryEiInfo.set("inventCode", materialCode);
EiCommunicator.send("HPPZ004", "query", eiInfo, {
onSuccess: function (eiInfo) {
var status = eiInfo.getStatus();
if (status != "-1") {
console.log(eiInfo)
var materialName = eiInfo.blocks.result.rows[0][14];
resultGrid.setCellValue(e.row, "materialName", materialName);
//清空物料信息
resultGrid.setCellValue(editorModel0, "spec", "");
resultGrid.setCellValue(editorModel0, "unit", "");
}
}, onFail: function (ei) {
}
}, {async: false});
});
$("input[name='spec']").on('change', function (me) {
var spec = $("input[name='spec']").val();
var materialCode = $("input[name='materialCode']").val();
var queryEiInfo = new EiInfo();
queryEiInfo.set("inventCode", materialCode);
queryEiInfo.set("spec", spec);
EiCommunicator.send("HPPZ006", "query", eiInfo, {
onSuccess: function (eiInfo) {
var status = eiInfo.getStatus();
if (status != "-1") {
console.log(eiInfo)
var unit = eiInfo.blocks.result.rows[0][23];
resultGrid.setCellValue(editorModel0, "unit", unit);
}
}, onFail: function (ei) {
}
}, {async: false});
});
},
loadComplete: function (grid) { loadComplete: function (grid) {
//删除
$("#DELETE").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
var dataItems = resultGrid.getCheckedRows();
if (dataItems == null || dataItems == "") {
NotificationUtil({
msg: '选择要删除的数据'
}, "warning");
//释放禁用按钮
btnNode.attr("disabled", false);
return false;
} }
IPLAT.submitNode($("#HPKC002"), "HPKC002", "delete", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '删除成功'
});
// 绑定grid
resultGrid.setEiInfo(ei);
} }
//释放禁用按钮
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
},
onFail: function (ei) {// onFail
// 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
} }
});
});
}, // 查询
onSuccess: function (e) { $("#QUERY").on("click", query);
if (e.type != 'read') {
// 不显示notifications
e.preventDefault();
// 重新查询Grid前,把新增、修改、删除操作成功的信息先弹出。
// 弹窗关闭后重新查询Grid
//resultGrid.dataSource.page(1);
IPLAT.alert({
// e.eiInfo 是EiInfo对象,可从浏览器F12的Console中查看。
message: e.eiInfo.getMsg(),
okFn: function (e) {
parent.window.location.href = IPLATUI.CONTEXT_PATH+'/web/HPKC002';
},
title: '成功'
});
} // 挑选库存
} $("#SELECT_STOCK").on("click", selectStock);
});
};
});
/** /**
* 页面加载时执行 * 页面加载时执行
*/ */
$(window).load(function () { $(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
materialCodeGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
let speceiInfo = new EiInfo();
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", speceiInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
let wheiInfo = new EiInfo();
EiCommunicator.send("HPPZ007", "queryComboBox", wheiInfo, {
onSuccess: function (ei) {
whCodeGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询 // 查询
query(); query();
}); });
...@@ -285,3 +36,26 @@ let query = function () { ...@@ -285,3 +36,26 @@ let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
/**
* 挑选库存
*/
let selectStock = function () {
JSColorbox.open({
href: "HPKC002A?methodName=initLoad",
title: "<div style='text-align: center;'>库存查询</div>",
width: "90%",
height: "80%",
callbackName: selectStockCallback
});
}
/**
* 挑选库存回调
*/
let selectStockCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
...@@ -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>
...@@ -44,24 +44,35 @@ ...@@ -44,24 +44,35 @@
</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: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>
<EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/> <EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center"
<EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/> blockName="invent_spec_block_id" textField="textField" valueField="valueField"
<EF:EFColumn ename="materialCode" cname="存货名称" width="100" readonly="false" required="true"/> columnTemplate="#=textField#" itemTemplate="#=textField#">
<EF:EFColumn ename="materialName" cname="存货名称" width="100" readonly="false" hidden="true"/> </EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/> <EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100"
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/> align="center"/>
<EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/> <EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100"
<EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/> align="center"/>
<EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/> <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:EFGrid>
</EF:EFRegion> </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