Commit 133f9bd8 by 宋祥

1.生产领料逻辑

parent 04c2a659
......@@ -30,6 +30,8 @@ public class HPSqlConstant {
// 统计
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;
import com.baosight.iplat4j.core.util.NumberUtils;
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.data.DaoEPBase;
import java.util.HashMap;
......@@ -18,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 13:33:31 create
* @history 2024-01-25 23:15:22 create
*/
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_AMOUNT = "amount"; /* 数量*/
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 COL_ID = "ID"; /* 主键id*/
......@@ -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_AMOUNT = "AMOUNT"; /* 数量*/
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 QUERY = "t_hpkc002.query";
public static final String COUNT = "t_hpkc002.count";
public static final String INSERT = "t_hpkc002.insert";
public static final String UPDATE = "t_hpkc002.update";
public static final String DELETE = "t_hpkc002.delete";
public static final String QUERY = "HPKC002.query";
public static final String COUNT = "HPKC002.count";
public static final String INSERT = "HPKC002.insert";
public static final String UPDATE = "HPKC002.update";
public static final String DELETE = "HPKC002.delete";
private Long id = null; /* 主键id*/
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime ; /* 创建时间*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime ; /* 更新时间*/
private String updatedTime = " "; /* 更新时间*/
private String reqNo = " "; /* 领料单号*/
private String receiptDate ; /* 单据日期*/
private String receiptDate = " "; /* 单据日期*/
private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/
private BigDecimal amount = new BigDecimal("0"); /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/
private String remarks = " "; /* 备注*/
private Boolean deleteFlag; /* 是否删除0.否1.是*/
private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private String oldReqNo = " "; /* 原领料单号*/
private Integer deleteFlag; /* 是否删除0.否1.是*/
/**
* initialize the metadata.
......@@ -173,22 +177,30 @@ public class HPKC002 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARKS);
eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_KC_ID);
eiColumn.setDescName("库存ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_REQ_NO);
eiColumn.setDescName("原领料单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn);
......@@ -508,26 +520,58 @@ public class HPKC002 extends DaoEPBase {
this.weight = weight;
}
/**
* get the remarks - 备注.
* @return the remarks
* get the remark - 备注.
* @return the remark
*/
public String getRemark() {
return this.remark;
}
/**
* set the remark - 备注.
*
* @param remark - 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* get the 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() {
return this.remarks;
public String getOldReqNo() {
return this.oldReqNo;
}
/**
* set the remarks - 备注.
* set the oldReqNo - 原领料单号.
*
* @param remarks - 备注
* @param oldReqNo - 原领料单号
*/
public void setRemarks(String remarks) {
this.remarks = remarks;
public void setOldReqNo(String oldReqNo) {
this.oldReqNo = oldReqNo;
}
/**
* get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag
*/
public Boolean getDeleteFlag() {
public Integer getDeleteFlag() {
return this.deleteFlag;
}
......@@ -536,7 +580,7 @@ public class HPKC002 extends DaoEPBase {
*
* @param deleteFlag - 是否删除0.否1.是
*/
public void setDeleteFlag(Boolean deleteFlag) {
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
......@@ -566,8 +610,10 @@ public class HPKC002 extends DaoEPBase {
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setRemarks(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARKS)), remarks));
setDeleteFlag(NumberUtils.toBoolean(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
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 {
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_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)));
return map;
......
......@@ -37,6 +37,7 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_STATUS = "status"; /* 状态*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
......@@ -61,6 +62,7 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......@@ -91,6 +93,7 @@ public class HPKC004 extends DaoEPBase {
private BigDecimal weight = new BigDecimal(0); /* 重量*/
private Integer status; /* 状态*/
private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private String oldSaleNo = " "; /* 原销售单号*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
......@@ -173,6 +176,10 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_KC_ID);
eiColumn.setDescName("库存ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_OLD_SALE_NO);
eiColumn.setDescName("原销售单号");
eiMetadata.addMeta(eiColumn);
......@@ -457,6 +464,22 @@ public class HPKC004 extends DaoEPBase {
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 - 原销售单号.
* @return the oldSaleNo
*/
......@@ -607,6 +630,7 @@ public class HPKC004 extends DaoEPBase {
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
......@@ -639,6 +663,7 @@ public class HPKC004 extends DaoEPBase {
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
map.put(FIELD_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
......@@ -2,12 +2,19 @@ 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.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -15,26 +22,33 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
/**
* @author YK
* @date 2024年01月09日 10:18
* @author:songx
* @date:2024/1/25,23:19
*/
public class ServiceHPKC002 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnun.MATERIAL.getCode(),
InventTypeEnun.CONSUMABLE.getCode()};
/**
* 画面初始化.
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
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 HPKC002().eiMetadata);
inInfo.setBlock(InventTypeEnun.generatorEiBlock());
} catch (PlatException e) {
......@@ -44,135 +58,66 @@ public class ServiceHPKC002 extends ServiceBase {
}
/**
* 查询操作.
* 查询操作
*
* @param inInfo
* @return
*/
@Override
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 {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPKC002 insertEntity = new HPKC002();
insertEntity.fromMap(resultRows.get(i));
// 仓库名称
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);
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC002.QUERY, new HPKC002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
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;
}
/**
* 校验保存的数据
* 删除操作
*
* @param resultRows
*/
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(), "仓库不能为空");
}
}
/**
* 修改操作.
* @param inInfo
* @return
*/
@Override
public EiInfo update(EiInfo inInfo) {
public EiInfo delete(EiInfo inInfo) {
try {
CommonMethod.udpateInfo(inInfo,EiConstant.resultBlock);
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++) {
HPKC002 updateEntity = new HPKC002();
updateEntity.fromMap(resultRows.get(i));
// 仓库名称
Map params = new HashMap<>();
params.put("whCode", updateEntity.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode", params);
updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//存货类型
updateEntity.setInventType(InventTypeEnun.getNameByCode(updateEntity.getInventType()));
dao.insert("HPKC002.update", updateEntity);
HPKC002 fKc002 = new HPKC002();
fKc002.fromMap(resultRows.get(i));
DaoUtils.update(HPKC002.DELETE, fKc002);
// 生成红冲记录
HPKC002 dbKc002 = dbMapKc002.get(fKc002.getReqNo());
HPKC002 newKc002 = BeanUtils.copy(dbKc002, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setAmount(dbKc002.getAmount().negate());
newKc002.setWeight(dbKc002.getWeight().negate());
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.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;
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
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 @@
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
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.是 -->
</sql>
......@@ -55,7 +57,7 @@
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="reqNo">
REQ_NO= #reqNo#
REQ_NO = #reqNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
......@@ -78,14 +80,11 @@
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remarks">
REMARKS = #remarks#
<isNotEmpty prepend=" AND " property="oldReqNo">
OLD_REQ_NO = #oldReqNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
......@@ -93,6 +92,9 @@
</sql>
<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">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
......@@ -109,20 +111,23 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
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"/>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
<isNotEmpty property="order">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
<isEmpty property="order">
ID asc
</isEmpty>
</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 id="count" resultClass="int">
......@@ -148,12 +153,15 @@
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
REMARKS, <!-- 备注 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_REQ_NO, <!-- 原领料单号 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#reqCode#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #inventRecordId#, #amount#, #weight#, #remarks#, #deleteFlag#
#reqNo#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #inventRecordId#, #amount#, #weight#, #remark#, #kcId#,
#oldReqNo#, #deleteFlag#
)
</insert>
......@@ -162,24 +170,17 @@
UPDATE hpjx.t_hpkc002 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC002
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
REQ_NO = #reqNo#, <!-- 领料单号 -->
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARKS = #remarks# <!-- 备注 -->
WHERE ID = #id#
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="reqNo">
REQ_NO = #reqNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="reqNos">
REQ_NO IN <iterate close=")" open="(" conjunction="," property="reqNos">#reqNos[]#</iterate>
</isNotEmpty>
</update>
<!-- 统计库存 -->
......
......@@ -18,6 +18,7 @@
WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
OLD_SALE_NO as "oldSaleNo", <!-- 原销售单号 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -62,6 +63,9 @@
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
......@@ -129,6 +133,7 @@
WEIGHT, <!-- 重量 -->
STATUS, <!-- 状态 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
......@@ -137,7 +142,7 @@
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#, #status#,
#remark#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
#remark#, #kcId#, #oldSaleNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
......
......@@ -24,89 +24,89 @@ public class HPKCTools {
/**
* 锁
*
* @param checkNos
* @param otherEnterNos
* @return
*/
public static void lockKc005(List<String> checkNos) {
if (CollectionUtils.isEmpty(checkNos)) {
public static void lockKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC005.LOCK, queryMap);
queryMap.put("otherEnterNos", otherEnterNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC001.LOCK, queryMap);
}
/**
* 查询盘点单信息
* 查询其他入库信息
*
* @param checkNos
* @param otherEnterNos
* @return
*/
public static List<HPKC005> listKc005(List<String> checkNos) {
if (CollectionUtils.isEmpty(checkNos)) {
public static List<HPKC001> listKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos);
return DaoBase.getInstance().query(HPKC005.QUERY, queryMap);
queryMap.put("otherEnterNos", otherEnterNos);
return DaoBase.getInstance().query(HPKC001.QUERY, queryMap);
}
/**
* 查询盘点单信息
* 查询其他入库信息
*
* @param checkNos
* @param otherEnterNos
* @return
*/
public static Map<String, HPKC005> mapKc005(List<String> checkNos) {
List<HPKC005> results = listKc005(checkNos);
public static Map<String, HPKC001> mapKc001(List<String> otherEnterNos) {
List<HPKC001> results = listKc001(otherEnterNos);
if (CollectionUtils.isEmpty(results)) {
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
*/
public static void lockKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
public static void lockKc002(List<String> reqNos) {
if (CollectionUtils.isEmpty(reqNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC001.LOCK, queryMap);
queryMap.put("reqNos", reqNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC002.LOCK, queryMap);
}
/**
* 查询其他入库信息
* 查询生产领料信息
*
* @param otherEnterNos
* @param reqNos
* @return
*/
public static List<HPKC001> listKc001(List<String> otherEnterNos) {
if (CollectionUtils.isEmpty(otherEnterNos)) {
public static List<HPKC002> listKc002(List<String> reqNos) {
if (CollectionUtils.isEmpty(reqNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("otherEnterNos", otherEnterNos);
return DaoBase.getInstance().query(HPKC001.QUERY, queryMap);
queryMap.put("reqNos", reqNos);
return DaoBase.getInstance().query(HPKC002.QUERY, queryMap);
}
/**
* 查询其他入库信息
* 查询生产领料信息
*
* @param otherEnterNos
* @param reqNos
* @return
*/
public static Map<String, HPKC001> mapKc001(List<String> otherEnterNos) {
List<HPKC001> results = listKc001(otherEnterNos);
public static Map<String, HPKC002> mapKc002(List<String> reqNos) {
List<HPKC002> results = listKc002(reqNos);
if (CollectionUtils.isEmpty(results)) {
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 {
/**
* 锁
*
* @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
* @return
*/
......
......@@ -9,24 +9,24 @@
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" colWidth="3" format="yyyy-MM-dd"
required="true"/>
<EF:EFInput ename="inqu_status-0-documentCode" cname="生产领料单号" colWidth="3" readonly="false"/>
<EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3" format="yyyy-MM-dd"
readonly="true"/>
<EF:EFInput cname="领料单号" ename="inqu_status-0-reqNo" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<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 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:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<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:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</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:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
......@@ -44,24 +44,35 @@
</EF:EFRegion>
<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="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/>
<EF:EFColumn ename="reqNo" cname="生产领料单号" width="100" readonly="false" align="center" required="false" enable="false" />
<EF:EFComboColumn ename="materialType" cname="存货类型" width="90" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
<EF:EFColumn ename="reqNo" cname="领料单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库编码" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="materialCode" cname="存货名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="materialName" cname="存货名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/>
<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="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/>
<EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/>
<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="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>
$(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 @@
</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="说明" 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}"
sumType="all"/>
<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