Commit 6888fc57 by yukang

Merge branch 'dev' of https://gitlab.baocloud.cn/bggf/smart/hp-smart into dev

parents 2da9c06d 09cc56b5
......@@ -221,6 +221,18 @@ public class HPSqlConstant {
}
/**
* HPKC012 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC012 {
// 锁
public static final String QUERY = "HPKC012.query";
}
/**
* HPPZ010 SQL 定义
*
* @author:songx
......
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 23:15:22 create
* @history 2024-02-27 14:22:00 create
*/
public class HPKC002 extends DaoEPBase {
......@@ -40,6 +40,7 @@ public class HPKC002 extends DaoEPBase {
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
......@@ -64,6 +65,7 @@ public class HPKC002 extends DaoEPBase {
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 存货名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
......@@ -76,7 +78,7 @@ public class HPKC002 extends DaoEPBase {
public static final String UPDATE = "HPKC002.update";
public static final String DELETE = "HPKC002.delete";
private Long id = null; /* 主键id*/
private Long id; /* 主键id*/
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
......@@ -92,11 +94,12 @@ public class HPKC002 extends DaoEPBase {
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private Long inventRecordId; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private Long kcId; /* 库存ID*/
private String oldReqNo = " "; /* 原领料单号*/
private Integer deleteFlag; /* 是否删除0.否1.是*/
......@@ -177,15 +180,22 @@ public class HPKC002 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......@@ -504,6 +514,22 @@ public class HPKC002 extends DaoEPBase {
this.amount = amount;
}
/**
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the unitWeight - 单重.
*
* @param unitWeight - 单重
*/
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the weight - 重量.
* @return the weight
*/
......@@ -609,6 +635,7 @@ public class HPKC002 extends DaoEPBase {
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
......@@ -641,6 +668,7 @@ public class HPKC002 extends DaoEPBase {
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
......
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 17:57:24 create
* @history 2024-02-27 14:11:00 create
*/
public class HPKC010 extends DaoEPBase {
......@@ -32,6 +32,7 @@ public class HPKC010 extends DaoEPBase {
public static final String FIELD_INVENT_NAME = "inventName"; /* 物料名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
......@@ -51,6 +52,7 @@ public class HPKC010 extends DaoEPBase {
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 物料名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......@@ -66,7 +68,7 @@ public class HPKC010 extends DaoEPBase {
public static final String UPDATE = "HPKC010.update";
public static final String DELETE = "HPKC010.delete";
private Long id = null;
private Long id;
private String companyCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String whCode = " "; /* 仓库编码*/
......@@ -74,16 +76,17 @@ public class HPKC010 extends DaoEPBase {
private String inventType = " "; /* 物料类型*/
private String inventCode = " "; /* 物料编码*/
private String inventName = " "; /* 物料名称*/
private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal("0"); /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer version = null; /* 版本号*/
private Integer version; /* 版本号*/
/**
* initialize the metadata.
......@@ -130,15 +133,22 @@ public class HPKC010 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......@@ -341,6 +351,22 @@ public class HPKC010 extends DaoEPBase {
this.amount = amount;
}
/**
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the unitWeight - 单重.
*
* @param unitWeight - 单重
*/
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the weight - 重量.
* @return the weight
*/
......@@ -486,6 +512,7 @@ public class HPKC010 extends DaoEPBase {
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
......@@ -513,6 +540,7 @@ public class HPKC010 extends DaoEPBase {
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THpkc010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 17:57:24 create
*/
public class HPKC012 extends HPKC010 {
private static final long serialVersionUID = 1L;
public static final String FIELD_WARN_NUM = "warnNum"; /* 预警数量*/
public static final String COL_WARN_NUM = "WARN_NUM"; /* 预警数量*/
public static final String QUERY = "HPKC012.query";
private BigDecimal warnNum = new BigDecimal("0"); /* 预警数量*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_WARN_NUM);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setDescName("预警数量");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPKC012() {
super.initMetaData();
initMetaData();
}
/**
* get the warnNum - 预警数量.
* @return the warnNum
*/
public BigDecimal getWarnNum() {
return this.warnNum;
}
/**
* set the warnNum - 预警数量.
*
* @param warnNum - 预警数量
*/
public void setWarnNum(BigDecimal warnNum) {
this.warnNum = warnNum;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setWarnNum(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WARN_NUM)), warnNum));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_WARN_NUM, StringUtils.toString(warnNum, eiMetadata.getMeta(FIELD_WARN_NUM)));
return map;
}
}
......@@ -63,8 +63,8 @@ public class ServiceHPKC002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产领料单",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "生产领料单",operType = "查询",operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -79,7 +79,6 @@ public class ServiceHPKC002 extends ServiceBase {
return inInfo;
}
/**
* 删除操作
*
......@@ -111,7 +110,7 @@ public class ServiceHPKC002 extends ServiceBase {
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存
HPKCTools.updateStock(dbKc002.getWhCode(), dbKc002.getInventRecordId(),
dbKc002.getAmount().negate(), dbKc002.getWeight().negate());
dbKc002.getAmount().negate(), dbKc002.getUnitWeight(), dbKc002.getWeight().negate());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -46,8 +46,8 @@ public class ServiceHPKC002A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "生产领料单-库存查询-初始化")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "生产领料单-库存查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -69,8 +69,8 @@ public class ServiceHPKC002A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "生产领料单-库存查询-查询")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "生产领料单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -99,42 +99,57 @@ public class ServiceHPKC002A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(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 + "]可用重量不足!");
}
this.checkData(resultRows, dbKc010Map);
// 生成销售库单
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());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成领料单失败");
LogUtils.setMsg(inInfo, e, "生成领料单失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
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 + "]可用数量不足!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
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(dbKc010.getUnitWeight().multiply(applyAmount));
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(), dbKc010.getUnitWeight(), newKc002.getWeight().negate());
}
}
}
......@@ -23,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -41,10 +42,11 @@ public class ServiceHPKC005 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "查询",operDesc = "初始化")
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "初始化")
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, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
......@@ -61,8 +63,8 @@ public class ServiceHPKC005 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -84,11 +86,10 @@ public class ServiceHPKC005 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "新增",operDesc = "新增")
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
......@@ -112,32 +113,6 @@ public class ServiceHPKC005 extends ServiceBase {
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc005);
DaoUtils.update(HPKC005.UPDATE, fKc005);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 设置基础信息
*
* @param fKc005
......@@ -150,6 +125,13 @@ public class ServiceHPKC005 extends ServiceBase {
fKc005.setWhName(HPPZTools.HpPz007.getByCode(fKc005.getWhCode()).getWhName());
// 存货名称
fKc005.setInventName(HPPZTools.HpPz004.getByCode(fKc005.getInventCode()).getInventName());
// 根据规格计算账面单重
BigDecimal unitWeight = HPPZTools.HpPz006.calcUnitWeight(fKc005.getInventRecordId());
fKc005.setBookUnitWeight(unitWeight);
fKc005.setEntityUnitWeight(unitWeight);
// 计算总重
fKc005.setBookWeight(fKc005.getBookAmount().multiply(unitWeight));
fKc005.setEntityWeight(fKc005.getEntityAmount().multiply(unitWeight));
// 差异数量
fKc005.setDiffAmount(fKc005.getEntityAmount().subtract(fKc005.getBookAmount()));
// 差异重量
......@@ -172,24 +154,8 @@ public class ServiceHPKC005 extends ServiceBase {
HPKCTools.HpKc005.lock(checkNos);
// 查询数据库记录
Map<String, HPKC005> mapKc005 = HPKCTools.HpKc005.map(checkNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
DaoUtils.update(HPKC005.DELETE, fKc005);
// 原盘点单
HPKC005 dbKc005 = mapKc005.get(fKc005.getCheckNo());
// 生成红冲记录
HPKC005 newKc005 = BeanUtils.copy(dbKc005, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setDiffAmount(dbKc005.getDiffAmount().negate());
newKc005.setDiffWeight(dbKc005.getDiffWeight().negate());
newKc005.setOldCheckNo(dbKc005.getCheckNo());
newKc005.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
// 删除数据
this.deleteData(resultRows, mapKc005);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -199,4 +165,31 @@ public class ServiceHPKC005 extends ServiceBase {
return inInfo;
}
/**
* 删除数据
*
* @param resultRows
* @param mapKc005
*/
private void deleteData(List<Map> resultRows, Map<String, HPKC005> mapKc005) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
DaoUtils.update(HPKC005.DELETE, fKc005);
// 原盘点单
HPKC005 dbKc005 = mapKc005.get(fKc005.getCheckNo());
// 生成红冲记录
HPKC005 newKc005 = BeanUtils.copy(dbKc005, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setDiffAmount(dbKc005.getDiffAmount().negate());
newKc005.setDiffWeight(dbKc005.getDiffWeight().negate());
newKc005.setOldCheckNo(dbKc005.getCheckNo());
newKc005.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
}
}
......@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
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.HPKC005;
......@@ -39,8 +40,8 @@ public class ServiceHPKC005A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "初始化")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
......@@ -60,8 +61,8 @@ public class ServiceHPKC005A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "库存盘点单-库存查询-查询")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "库存盘点单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -89,44 +90,61 @@ public class ServiceHPKC005A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
AssertUtils.isGt(BigDecimal.ZERO, entityAmount, "库存号[" + id + "]实物数量不能小于0!");
BigDecimal entityWeight = MapUtils.getBigDecimal(row, "entityWeight");
AssertUtils.isGt(BigDecimal.ZERO, entityWeight, "库存号[" + id + "]实物重量不能小于0!");
}
this.checkData(resultRows, dbKc010Map);
// 生成盘点单
for (Map row : resultRows) {
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
BigDecimal entityWeight = MapUtils.getBigDecimal(row, "entityWeight");
String entityRemark = MapUtils.getString(row, "entityRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
// 生成盘点单
HPKC005 newKc005 = BeanUtils.copy(dbKc010, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setReceiptDate(DateUtils.shortDate());
newKc005.setEntityAmount(entityAmount);
newKc005.setEntityWeight(entityWeight);
newKc005.setBookAmount(dbKc010.getAmount());
newKc005.setBookWeight(dbKc010.getWeight());
newKc005.setDiffAmount(entityAmount.subtract(dbKc010.getAmount()));
newKc005.setDiffWeight(entityWeight.subtract(dbKc010.getWeight()));
newKc005.setKcId(kcId);
newKc005.setRemark(entityRemark);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存数量
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成盘点单失败");
}
return inInfo;
}
/**
* 校验数据
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
AssertUtils.isGt(BigDecimal.ZERO, entityAmount, "库存号[" + id + "]实物数量不能小于0!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
String entityRemark = MapUtils.getString(row, "entityRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
// 生成盘点单
HPKC005 newKc005 = BeanUtils.copy(dbKc010, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setReceiptDate(DateUtils.shortDate());
newKc005.setEntityAmount(entityAmount);
newKc005.setEntityWeight(dbKc010.getUnitWeight().multiply(entityAmount));
newKc005.setBookAmount(dbKc010.getAmount());
newKc005.setBookWeight(dbKc010.getWeight());
newKc005.setDiffAmount(entityAmount.subtract(dbKc010.getAmount()));
newKc005.setDiffWeight(newKc005.getEntityWeight().subtract(dbKc010.getWeight()));
newKc005.setKcId(kcId);
newKc005.setRemark(entityRemark);
newKc005.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存数量
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
}
}
......@@ -72,8 +72,8 @@ public class ServiceHPKC006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "其他入库单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -96,8 +96,8 @@ public class ServiceHPKC006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单",operType = "新增",operDesc = "新增")
@Override
@OperationLogAnnotation(operModul = "其他入库单", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -111,7 +111,7 @@ public class ServiceHPKC006 extends ServiceBase {
this.setBaseInfo(fKc006);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
HPPZ006 hppz006= HPPZTools.checkAndSavePZ06(
HPPZ006 hppz006 = HPPZTools.checkAndSavePZ06(
Integer.parseInt(resultRows.get(i).get("inventType").toString()),
resultRows.get(i).get("inventName").toString(),
NumberUtils.toBigDecimal(resultRows.get(i).get("length")),
......@@ -121,6 +121,10 @@ public class ServiceHPKC006 extends ServiceBase {
resultRows.get(i).get("material").toString(),
resultRows.get(i).get("unit").toString()
);
// 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(hppz006.getId()));
// 计算总重
fKc006.setWeight(fKc006.getAmount().multiply(fKc006.getUnitWeight()));
fKc006.setInventRecordId(hppz006.getId());
fKc006.setInventCode(hppz006.getInventCode());
DaoUtils.insert(HPKC006.INSERT, fKc006);
......@@ -138,46 +142,6 @@ public class ServiceHPKC006 extends ServiceBase {
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 入库单号
List<String> otherEnterNos = ObjectUtils.listKey(resultRows, "otherEnterNo");
// 锁记录
HPKCTools.HpKc006.lock(otherEnterNos);
// 查询数据库记录
Map<String, HPKC006> mapKc006 = HPKCTools.HpKc006.map(otherEnterNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc006);
DaoUtils.update(HPKC006.UPDATE, fKc006);
// 计算差异数量与重量
HPKC006 dbKc006 = mapKc006.get(fKc006.getOtherEnterNo());
BigDecimal diffAmount = fKc006.getAmount().subtract(dbKc006.getAmount());
BigDecimal diffWeight = fKc006.getWeight().subtract(dbKc006.getWeight());
// 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), diffAmount, diffWeight);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
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.HPKC007;
......@@ -45,8 +46,8 @@ public class ServiceHPKC007A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "其他出库单-库存查询-初始化")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "其他出库单-库存查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -68,8 +69,8 @@ public class ServiceHPKC007A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "其他出库单-库存查询-查询")
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "其他出库单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -98,41 +99,58 @@ public class ServiceHPKC007A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(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 + "]可用重量不足!");
}
this.checkData(resultRows, dbKc010Map);
// 生成出库单
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);
HPKC007 kc007 = BeanUtils.copy(dbKc010, HPKC007.class);
kc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
kc007.setReceiptDate(DateUtils.shortDate());
kc007.setAmount(applyAmount);
kc007.setWeight(applyWeight);
kc007.setKcId(kcId);
kc007.setRemark(applyRemark);
DaoUtils.insert(HPKC007.INSERT, kc007);
// 修改库存数量
HPKCTools.updateStock(kc007.getWhCode(), kc007.getInventRecordId(), kc007.getAmount().negate(),
kc007.getWeight().negate());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成出库单失败");
}
return inInfo;
}
/**
* 校验数据
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
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 + "]可用数量不足!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC007 kc007 = BeanUtils.copy(dbKc010, HPKC007.class);
kc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
kc007.setReceiptDate(DateUtils.shortDate());
kc007.setAmount(applyAmount);
kc007.setWeight(dbKc010.getUnitWeight().multiply(applyAmount));
kc007.setKcId(kcId);
kc007.setRemark(applyRemark);
kc007.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC007.INSERT, kc007);
// 修改库存数量
HPKCTools.updateStock(kc007.getWhCode(), kc007.getInventRecordId(), kc007.getAmount().negate(),
kc007.getWeight().negate());
}
}
}
......@@ -2,6 +2,7 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
......@@ -28,35 +29,39 @@ import java.util.Map;
import java.util.Objects;
/**
*
* @author:wwl
* @date:2024/1/23,10:51
*/
public class ServiceHPKC010 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.WASTE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "实时库存管理",operType = "查询",operDesc = "初始化")
@Override
@OperationLogAnnotation(operModul = "实时库存管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPKC010 HPKC010 = new HPKC010();
EiInfo outInfo = super.initLoad(inInfo, HPKC010);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
return outInfo;
inInfo.getBlock(EiConstant.resultBlock).addBlockMeta(new HPKC010().eiMetadata);
Map queryMap = new HashMap();
queryMap.put("inventCodes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
return inInfo;
}
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "实时库存管理",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "实时库存管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPKC010.query", new HPKC010());
......@@ -88,43 +93,45 @@ public class ServiceHPKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 更新库存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "实时库存管理",operType = "修改",operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo){
@OperationLogAnnotation(operModul = "实时库存管理", operType = "修改", operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo) {
String whCode = inInfo.getString("whCode");
Long inventRecordId = Long.parseLong(inInfo.getString("inventRecordId"));
BigDecimal amount = new BigDecimal(inInfo.getString("amount"));
BigDecimal weight = new BigDecimal(inInfo.getString("weight"));
String unitWeightStr = inInfo.getString("unitWeight");
BigDecimal unitWeight = unitWeightStr == null ? BigDecimal.ZERO : new BigDecimal(unitWeightStr);
String companyCode = UserSessionUtils.getCompanyCode();
try {
checkUpdateStockParam(companyCode,whCode,inventRecordId,amount,weight);
HPKC010 newObj = generatorBaseInfo(companyCode,whCode,inventRecordId,amount,weight);
List<Map> list = dao.query("HPKC010.queryByCondition",new HashMap<String,Object>(){{
put("companyCode",companyCode);
put("whCode",whCode);
put("inventRecordId",inventRecordId);
checkUpdateStockParam(companyCode, whCode, inventRecordId, amount, weight);
HPKC010 newObj = generatorBaseInfo(companyCode, whCode, inventRecordId, amount, unitWeight, weight);
List<Map> list = dao.query("HPKC010.queryByCondition", new HashMap<String, Object>() {{
put("companyCode", companyCode);
put("whCode", whCode);
put("inventRecordId", inventRecordId);
}});
if(CollectionUtils.isEmpty(list)){
if (CollectionUtils.isEmpty(list)) {
//新增
if(amount.compareTo(BigDecimal.ZERO)<0
||weight.compareTo(BigDecimal.ZERO)<0){
if (amount.compareTo(BigDecimal.ZERO) < 0
|| weight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
generatorBaseInfo(newObj);
DaoUtils.insert("HPKC010.insert",newObj);
}else{
DaoUtils.insert("HPKC010.insert", newObj);
} else {
//修改
HPKC010 oldObj = new HPKC010();
oldObj.fromMap(list.get(0));
BigDecimal afterAmout = oldObj.getAmount().add(amount);
BigDecimal afterWeight = oldObj.getWeight().add(weight);
if(afterAmout.compareTo(BigDecimal.ZERO)<0||afterWeight.compareTo(BigDecimal.ZERO)<0){
if (afterAmout.compareTo(BigDecimal.ZERO) < 0 || afterWeight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
}
oldObj.setAmount(afterAmout);
......@@ -144,9 +151,10 @@ public class ServiceHPKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 生成库存对象
*
* @param companyCode
* @param whCode
* @param inventRecordId
......@@ -154,13 +162,14 @@ public class ServiceHPKC010 extends ServiceBase {
* @param weight
* @reutrn HPKC010
*/
private HPKC010 generatorBaseInfo(String companyCode, String whCode, Long inventRecordId, BigDecimal amout, BigDecimal weight) {
private HPKC010 generatorBaseInfo(String companyCode, String whCode, Long inventRecordId, BigDecimal amout,
BigDecimal unitWeight, BigDecimal weight) {
HPKC010 hpkc010 = new HPKC010();
hpkc010.setCompanyCode(companyCode);
hpkc010.setWhCode(whCode);
hpkc010.setInventRecordId(inventRecordId);
hpkc010.setAmount(amout);
hpkc010.setUnitWeight(unitWeight);
hpkc010.setWeight(weight);
String userId = UserSession.getLoginName();
String userName = UserSession.getLoginCName();
......@@ -173,6 +182,7 @@ public class ServiceHPKC010 extends ServiceBase {
hpkc010.setUpdatedTime(time);
return hpkc010;
}
@OperationLogAnnotation(operModul = "实时库存管理",operType = "设置",operDesc = "生成库存对象")
private void generatorBaseInfo(HPKC010 hpkc010) {
String whName = "";
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.hp.kc.domain.HPKC012;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @author YK
* @date 2024年01月09日 10:18
*/
public class ServiceHPKC012 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警查询", operType = "查询", operDesc = "初始化")
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.SPEC_NAME_BLOCK_ID), queryMap);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC012().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警查询", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC012.QUERY, new HPKC012());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
......@@ -13,7 +13,6 @@
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
PURCHASE_NO as "purchaseNo", <!-- 采购单号 -->
OLD_PURCHASE_NO as "oldPurchaseNo", <!-- 原采购单号 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
......@@ -22,8 +21,10 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
OLD_PURCHASE_NO as "oldPurchaseNo", <!-- 原采购单号 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 -->
</sql>
......@@ -113,27 +114,31 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT <include refid="column"/>
FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT
<include refid="column"/>
FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPKC001 (
......@@ -152,13 +157,14 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#purchaseNo#,#oldPurchaseNo#, #receiptDate#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#remark#, #deleteFlag#
)
</insert>
......@@ -174,25 +180,6 @@
WHERE ID = #id#
</update>
<update id="update">
UPDATE hpjx.t_hpkc001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
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#, <!-- 重量 -->
REMARK = #remark# <!-- 备注 -->
WHERE ID = #id#
</update>
<!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT
......
......@@ -21,6 +21,7 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
......@@ -114,7 +115,7 @@
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$orderBy$
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
......@@ -152,6 +153,7 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
......@@ -160,7 +162,7 @@
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#reqNo#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #inventRecordId#, #amount#, #weight#, #remark#, #kcId#,
#inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldReqNo#, #deleteFlag#
)
</insert>
......
......@@ -15,6 +15,7 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格 -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 0提交 1保存 -->
KC_ID as "kcId", <!-- 库存ID -->
......@@ -80,10 +81,10 @@
</isNotEqual>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
......@@ -139,6 +140,7 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 规格 -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
KC_ID, <!-- 库存ID -->
REMARK, <!-- 备注 -->
......@@ -149,7 +151,7 @@
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #otherOuterNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#kcId#, #remark#, #oldOuterNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
......@@ -159,19 +161,6 @@
UPDATE hpjx.t_hpkc007 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPKC007
SET
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARK = #remark#, <!-- 备注 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC007
......
......@@ -13,6 +13,7 @@
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -125,23 +126,23 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
UPDATED_NAME, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
VERSION
) VALUES (
#companyCode#, #depCode#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #version#
)
</insert>
<update id="updateStock">
UPDATE hpjx.T_HPKC010
SET
......
......@@ -14,6 +14,7 @@
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -118,13 +119,13 @@
<insert id="backup">
INSERT INTO ${hpjxSchema}.T_HPKC010A (
COMPANY_CODE, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, UNIT_WEIGHT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
)
SELECT
COMPANY_CODE, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, UNIT_WEIGHT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
FROM ${hpjxSchema}.T_HPKC010
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC012">
<sql id="column">
A.ID as "id",
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.WH_CODE as "whCode", <!-- 仓库编码 -->
A.WH_NAME as "whName", <!-- 仓库名称 -->
A.INVENT_TYPE as "inventType", <!-- 物料类型 -->
A.INVENT_CODE as "inventCode", <!-- 物料编码 -->
A.INVENT_NAME as "inventName", <!-- 物料名称 -->
A.INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
A.AMOUNT as "amount", <!-- 数量 -->
A.WEIGHT as "weight", <!-- 重量 -->
A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 更新人 -->
A.UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
A.VERSION as "version", <!-- 版本号 -->
B.WARN_NUM as warnNum <!-- 预警值 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="inventRecordId">
A.INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
A.WH_NAME LIKE '%' || #whName# || '%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
A.INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
A.INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
A.INVENT_NAME = #inventName#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="inventTypes">
A.INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
A.INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
A.INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC012">
SELECT <include refid="column"/>
FROM hpjx.T_HPKC010 A
INNER JOIN hpjx.T_HPPZ012 B ON A.INVENT_RECORD_ID = B.INVENT_RECORD_ID
WHERE 1=1
AND A.AMOUNT &lt;= B.WARN_NUM
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.T_HPKC012
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</sqlMap>
......@@ -3,7 +3,15 @@ package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -433,12 +441,24 @@ public class HPKCTools {
}
/**
* HPKC010公共DAO方法定义
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight) {
updateStock(whCode, inventRecordId, amount, BigDecimal.ZERO, weight);
}
/**
* HPKC011公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc010 {
public static class HpKc011 {
/**
* 查询库存信息
......@@ -446,13 +466,13 @@ public class HPKCTools {
* @param ids
* @return
*/
public static List<HPKC010> list(List<Long> ids) {
public static List<HPKC011> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
return DaoBase.getInstance().query(HPKC011.QUERY, queryMap);
}
/**
......@@ -461,12 +481,12 @@ public class HPKCTools {
* @param ids
* @return
*/
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
public static Map<Long, HPKC011> map(List<Long> ids) {
List<HPKC011> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
return results.stream().collect(Collectors.toMap(HPKC011::getId, item -> item));
}
/**
......@@ -481,18 +501,61 @@ public class HPKCTools {
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
DaoBase.getInstance().update(HPSqlConstant.HPKC011.LOCK, queryMap);
}
}
/**
* HPKC011公共DAO方法定义
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param unitWeight
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal unitWeight,
BigDecimal weight) {
if (amount.compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("入库数量不能为空");
}
EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId);
inInfo.set("amount", amount);
inInfo.set("unitWeight", unitWeight);
inInfo.set("weight", weight);
inInfo.set(EiConstant.serviceName, "HPKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
/**
* HPKC010公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc011 {
public static class HpKc010 {
/**
* 查询
*
* @param inventRecordId
* @return
*/
public static List<HPKC010> listBySpec(Long inventRecordId) {
if (inventRecordId != null) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("inventRecordId", inventRecordId);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
/**
* 查询库存信息
......@@ -500,13 +563,13 @@ public class HPKCTools {
* @param ids
* @return
*/
public static List<HPKC011> list(List<Long> ids) {
public static List<HPKC010> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC011.QUERY, queryMap);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
/**
......@@ -515,12 +578,12 @@ public class HPKCTools {
* @param ids
* @return
*/
public static Map<Long, HPKC011> map(List<Long> ids) {
List<HPKC011> results = list(ids);
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC011::getId, item -> item));
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
}
/**
......@@ -535,37 +598,12 @@ public class HPKCTools {
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC011.LOCK, queryMap);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
}
}
/**
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight) {
if (amount.compareTo(BigDecimal.ZERO) == 0 && weight.compareTo(BigDecimal.ZERO) == 0) {
return;
}
EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId);
inInfo.set("amount", amount);
inInfo.set("weight", weight);
inInfo.set(EiConstant.serviceName, "HPKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
/**
* 查询产品库存信息
*
......
......@@ -6,13 +6,15 @@ import com.baosight.hpjx.common.InitiateModeEnum;
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.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
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;
......@@ -23,7 +25,11 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
......@@ -128,12 +134,15 @@ public class ServiceHPPZ006 extends ServiceBase {
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkUpdateData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006);
}
inInfo = this.query(inInfo);
......@@ -144,14 +153,29 @@ public class ServiceHPPZ006 extends ServiceBase {
}
return inInfo;
}
/**
* 修改数据校验
*
* @param resultRows
*/
private void checkUpdateData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
// 校验是否存在库存
List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId());
AssertUtils.isEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId()));
}
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "删除",operDesc = "删除")
@OperationLogAnnotation(operModul = "存货档案", operType = "删除", operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -235,17 +259,19 @@ public class ServiceHPPZ006 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "存货名称下拉框")
public EiInfo queryMaterialComboBox(EiInfo eiInfo) {
Map map = EiInfoUtils.getFirstRow(eiInfo);
if (ObjectUtils.isEmpty(map.get("inventType"))) {
map.put("inventType", eiInfo.getString("inventType"));
Map queryRow = EiInfoUtils.getFirstRow(eiInfo);
if (ObjectUtils.isEmpty(queryRow.get("inventType"))) {
queryRow.put("inventType", eiInfo.getString("inventType"));
}
boolean isSplicingSymbol = true;
if (eiInfo.getString("isSplicingSymbol") != null) {
isSplicingSymbol = Boolean.parseBoolean(eiInfo.getString("isSplicingSymbol"));
} else if (queryRow.get("isSplicingSymbol") != null) {
isSplicingSymbol = MapUtils.getBoolean(queryRow, "isSplicingSymbol");
}
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map,isSplicingSymbol);
CommonMethod.initBlock(eiInfo, list, queryRow, isSplicingSymbol);
return eiInfo;
}
......
......@@ -8,6 +8,7 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -154,13 +155,16 @@ public class ServiceHPPZ007 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBox(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.WH_RECORD_BLOCK_ID);
boolean isSplicingSymbol = true;
if (inInfo.getString("isSplicingSymbol") != null) {
isSplicingSymbol = Boolean.parseBoolean(inInfo.getString("isSplicingSymbol"));
} else if (queryRow.get("isSplicingSymbol") != null) {
isSplicingSymbol = MapUtils.getBoolean(queryRow, "isSplicingSymbol");
}
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo),isSplicingSymbol);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), isSplicingSymbol);
return inInfo;
}
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ012;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 库存预警值管理
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ012 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警管理", operType = "查询", operDesc = "初始化")
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, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_ALL_BLOCK_ID), queryMap, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ012().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPPZ012.QUERY, new HPPZ012());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存预警管理", operType = "新增", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
this.saveData(resultRows);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRows.get(i));
AssertUtils.isNull(fPz012.getWhCode(), "请选择仓库");
AssertUtils.isEmpty(fPz012.getInventCode(), "请选择存货");
AssertUtils.isNull(fPz012.getInventRecordId(), "请选择规格");
AssertUtils.isNull(fPz012.getWarnNum(), "预警数量不能为空");
}
}
/**
* 保存数据
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRow);
// 设置基础信息
this.setBaseInfo(fPz012);
if (fPz012.getId() == null || fPz012.getId() == 0) {
this.add(fPz012);
} else {
this.modify(fPz012);
}
}
}
/**
* 设置基础信息
*
* @param fPz012
*/
private void setBaseInfo(HPPZ012 fPz012) {
// 仓库名称
fPz012.setWhName(HPPZTools.HpPz007.getByCode(fPz012.getWhCode()).getWhName());
// 存货名称
fPz012.setInventName(HPPZTools.HpPz004.getByCode(fPz012.getInventCode()).getInventName());
}
/**
* 新增企业信息
*
* @param fPz012
*/
private void add(HPPZ012 fPz012) {
fPz012.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ012.INSERT, fPz012);
}
/**
* 修改数据
*
* @param fPz012
*/
private void modify(HPPZ012 fPz012) {
DaoUtils.update(HPPZ012.UPDATE, fPz012);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存预警管理", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRow);
fPz012.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ012.DELETE, fPz012);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPPZ012">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0.否1.是 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 物料类型 -->
INVENT_CODE as "inventCode", <!-- 物料编码 -->
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
WARN_NUM as "warnNum", <!-- 预警数量 -->
REMARK as "remark" <!-- 备注 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = '0'
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="warnNum">
WARN_NUM = #warnNum#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ012">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPPZ012
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPPZ012
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPPZ012 (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG,
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 物料类型 -->
INVENT_CODE, <!-- 物料编码 -->
INVENT_NAME, <!-- 物料名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
WARN_NUM, <!-- 预警数量 -->
REMARK
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #inventRecordId#,
#warnNum#, #remark#
)
</insert>
<!-- 逻辑删除 -->
<delete id="delete">
UPDATE FROM ${hpjxSchema}.T_HPPZ012 SET DELETE_FLAG = #deleteFlag# WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ012
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 物料类型 -->
INVENT_CODE = #inventCode#, <!-- 物料编码 -->
INVENT_NAME = #inventName#, <!-- 物料名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
WARN_NUM = #warnNum# <!-- 预警数量 -->
WHERE ID = #id#
</update>
</sqlMap>
......@@ -4,7 +4,6 @@ import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
......@@ -19,6 +18,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -137,6 +137,59 @@ public class HPPZTools {
}
/**
* HPPZ006 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public static class HpPz006 {
/**
* 查询
*
* @param id
* @return
*/
public static HPPZ006 get(Long id) {
AssertUtils.isNull(id, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
AssertUtils.isNull(results, String.format("规格[%s]不存在", id));
return results.get(0);
}
/**
* 计算单重
*
* @param id
* @return
*/
public static BigDecimal calcUnitWeight(Long id) {
HPPZ006 dbPz006 = get(id);
if ((dbPz006.getLength() == null && dbPz006.getWidth() == null && dbPz006.getThick() == null)
|| dbPz006.getCoefficient() == null) {
return BigDecimal.ZERO;
}
BigDecimal unitWeight = BigDecimal.ONE;
// 长
if (dbPz006.getLength() != null) {
unitWeight = unitWeight.multiply(dbPz006.getLength());
}
// 宽
if (dbPz006.getWidth() != null) {
unitWeight = unitWeight.multiply(dbPz006.getWidth());
}
// 厚
if (dbPz006.getThick() != null) {
unitWeight = unitWeight.multiply(dbPz006.getThick());
}
// 乘以系数
return unitWeight.multiply(dbPz006.getCoefficient()).setScale(3, RoundingMode.HALF_UP);
}
}
/**
* HPPZ007 公共DAO定义
*
* @author:songx
......
......@@ -195,8 +195,8 @@ public class ServiceHPZL001 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
fZl001.setCheckUser(UserSession.getLoginName());
fZl001.setCheckUserName(UserSession.getLoginCName());
/* fZl001.setCheckUser(UserSession.getLoginName());
fZl001.setCheckUserName(UserSession.getLoginCName());*/
fZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSqlConstant.HPZL001.DO_PROCESS, fZl001);
}
......
......@@ -4,6 +4,7 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
......@@ -23,6 +24,7 @@ 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.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
......@@ -124,6 +126,8 @@ public class ServiceHPZL001B extends ServiceEPBase {
newZl001.setProdOrderNo(dbSc005b.getProdOrderNo());
newZl001.setProdTaskNo(dbSc005b.getProdTaskNo());
newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
newZl001.setCheckUser(UserSession.getLoginName());
newZl001.setCheckUserName(UserSession.getLoginCName());
DaoUtils.insert(HPZL001.INSERT, newZl001);
}
} catch (Exception e) {
......
......@@ -142,6 +142,8 @@
ORG_NAME, <!-- 生产组名称 -->
POOR_TYPE, <!-- 不良品类 -->
PROBLEM_DESC, <!-- 质量问题描述 -->
CHECK_USER , <!-- 检查人 -->
CHECK_USER_NAME, <!-- 检查人名称 -->
STATUS, <!-- 单据状态 0未处理 1已处理 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
......@@ -150,7 +152,7 @@
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #checkNo#, #prodOrderNo#, #prodTaskNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#orgNo#, #orgName#, #poorType#, #problemDesc#, #status#,
#orgNo#, #orgName#, #poorType#, #problemDesc#,#checkUser#,#checkUserName#, #status#,
#createdBy#, #createdName#, #createdTime#, #deleteFlag#)
</insert>
......
......@@ -6,7 +6,7 @@ $(function() {
IPLATUI.EFGrid = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
pageSizes: [20, 50, 70, 100],
},
"result": {
columns: [{
......@@ -28,6 +28,7 @@ $(function() {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
......@@ -48,6 +49,7 @@ $(function() {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
......@@ -125,37 +127,64 @@ $(function() {
* 页面加载时执行
*/
$(window).load(function () {
// 仓库名称
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 存货名称
EiCommunicator.send("HPPZ004", "queryComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 规格
EiCommunicator.send("HPPZ006", "queryComboBoxAll", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
// 仓库名称
initWh()
// 存货名称
initInvent()
// 规格
initSpec()
// 查询
query();
});
/**
* 初始化仓库
*/
let initWh = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化存货
*/
let initInvent = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
EiCommunicator.send("HPPZ004", "queryComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ006", "queryComboBoxAll", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
let query = function () {
......@@ -171,9 +200,16 @@ let save = function () {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
let amount = rows[i]['amount'];
if (isBlank(amount) || !isNumber(amount) || !(amount > 0)) {
message("勾选的第" + (i + 1) + "行数量必须大于0");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC006", "save", true);
JSUtils.submitGridsData("result", "HPKC001", "save", true);
}
});
}
......
......@@ -14,7 +14,7 @@
<EF:EFInput cname="采购单号" ename="inqu_status-0-chpurchaseNoeckNo" 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:EFOption label="全部" value=""/>
......@@ -43,30 +43,35 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="90" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="90" align="right" readonly="true"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="90" align="right" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="90" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="100" align="right"
required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion title="提示">
<span style="color: red">说明:数据仅支持新增和删除,不能修改。</span>
</EF:EFRegion>
</EF:EFPage>
......
......@@ -44,7 +44,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="reqNo" cname="领料单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
......@@ -65,9 +65,11 @@
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
align="right"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="center"/>
align="right"/>
<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"/>
......
......@@ -43,9 +43,7 @@ let select = function () {
}
for (let i = 0; i < rows.length; i++) {
let applyAmount = rows[i]['applyAmount'];
let applyWeight = rows[i]['applyWeight'];
let amount = rows[i]['amount'];
let weight = rows[i]['weight'];
if (isBlank(applyAmount) || !isNumber(applyAmount) || !(applyAmount > 0)) {
message("第" + (i + 1) + "行申请数量必须大于0");
return;
......@@ -53,13 +51,6 @@ let select = function () {
if (parseFloat(applyAmount) > parseFloat(amount)) {
message("第" + (i + 1) + "行申请数量不能大于库存数量");
return;
}if (isBlank(applyWeight) || !isNumber(applyWeight) || !(applyWeight > 0)) {
message("第" + (i + 1) + "行申请重量必须大于0");
return;
}
if (parseFloat(applyWeight) > parseFloat(weight)) {
message("第" + (i + 1) + "行申请重量不能大于库存重量");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成出库单吗? ", {
......
......@@ -28,7 +28,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" 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"/>
......@@ -46,10 +46,10 @@
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="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="unitWeight" cname="单量" enable="false" width="120" align="right" format="{0:N3}"/>
<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"/>
......
......@@ -35,7 +35,8 @@
columnTemplate="#=textField#" itemTemplate="#=textField#" required="true">
</EF:EFComboColumn>
<EF:EFColumn ename="applyNum" cname="入库数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="completeNum" cname="已入库数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="completeNum" cname="已入库数量" enable="false" width="120" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="unCompleteNum" cname="待入库数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="num" cname="任务数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="totalWt" cname="任务重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="factoryName" cname="厂区名称" enable="false" width="150" align="center"/>
......
......@@ -27,6 +27,7 @@ $(function() {
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
......@@ -46,6 +47,7 @@ $(function() {
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
......@@ -94,6 +96,7 @@ $(function() {
*/
$(window).load(function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-isSplicingSymbol", false);
// 仓库名称
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
......
......@@ -56,12 +56,12 @@
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="bookAmount" cname="账面数量" format="{0:N3}" maxLength="20" width="90" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="bookWeight" cname="账面重量" format="{0:N3}" maxLength="20" width="90" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="bookWeight" cname="账面重量" enable="false" format="{0:N3}" maxLength="20" width="90"
align="right" sumType="all"/>
<EF:EFColumn ename="entityAmount" cname="实物数量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="entityWeight" cname="实物重量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="entityWeight" cname="实物重量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all"/>
<EF:EFColumn ename="diffAmount" cname="差异数量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all" readonly="true"/>
<EF:EFColumn ename="diffWeight" cname="差异重量" enable="false" format="{0:N3}" maxLength="20" width="100"
......
......@@ -66,15 +66,10 @@ let select = function () {
}
for (let i = 0; i < rows.length; i++) {
let entityAmount = rows[i]['entityAmount'];
let entityWeight = rows[i]['entityWeight'];
if (isBlank(entityAmount) || !isNumber(entityAmount) || entityAmount < 0) {
message("第" + (i + 1) + "行实物数量不能小于0");
return;
}
if (isBlank(entityWeight) || !isNumber(entityWeight) || entityWeight < 0) {
message("第" + (i + 1) + "行实物重量不能小于0");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成盘点单吗? ", {
ok: function () {
......
......@@ -46,8 +46,7 @@
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="entityAmount" cname="实物数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="entityWeight" cname="实物重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="entityRemark" cname="说明" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="entityRemark" 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}"
......
......@@ -30,6 +30,7 @@ $(function() {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
......@@ -62,7 +63,7 @@ $(function() {
var eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
eiInfo.set("inventType", options.model["inventType"]);
eiInfo.set("isSplicingSymbol",false);
eiInfo.set("isSplicingSymbol", false);
//eiInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
//eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
//eiInfo.set("inqu_status-0-company_name", options.model["company_name"]);
......@@ -203,7 +204,7 @@ $(window).load(function () {
// 仓库名称
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
inInfo.set("isSplicingSymbol", false);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
......
......@@ -48,22 +48,29 @@
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true" readonly="true">
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '5')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true" hidden ="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"
hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="length" cname="长" width="120" align="center" format="{0:N3}" required="false" readonly="true"/>
<EF:EFColumn ename="width" cname="宽" width="120" align="center" format="{0:N3}" required="false" readonly="true"/>
<EF:EFColumn ename="thick" cname="厚" width="120" align="center" format="{0:N3}" required="false" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="120" align="center" format="{0:N3}" required="false" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" width="100" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="length" cname="长" width="120" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="width" cname="宽" width="120" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="thick" cname="厚" width="120" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="120" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" maxLength="255" readonly="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
......
......@@ -63,10 +63,11 @@
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="right" sumType="all" required="true"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all" required="true"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N3}" width="100" align="right"
sumType="all"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" format="{0:N3}" width="100" align="right"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" format="{0:N3}" width="100" align="right"
sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="oldOuterNo" cname="原出库单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
......
......@@ -53,13 +53,6 @@ let select = function () {
if (parseFloat(applyAmount) > parseFloat(amount)) {
message("第" + (i + 1) + "行申请数量不能大于库存数量");
return;
}if (isBlank(applyWeight) || !isNumber(applyWeight) || !(applyWeight > 0)) {
message("第" + (i + 1) + "行申请重量必须大于0");
return;
}
if (parseFloat(applyWeight) > parseFloat(weight)) {
message("第" + (i + 1) + "行申请重量不能大于库存重量");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成出库单吗? ", {
......
......@@ -46,12 +46,10 @@
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="说明" enable="false" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N3}"
/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}"
/>
<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="unitWeight" cname="单重" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
</EF:EFGrid>
</EF:EFRegion>
......
......@@ -58,10 +58,6 @@
sumType="all"/>
<EF:EFColumn ename="cgEnterWeight" cname="采购入库重量" enable="false" width="100" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="scEnterAmount" cname="生产入库数量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="scEnterWeight" cname="生产入库重量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="qtEnterAmount" cname="其它入库数量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="qtEnterWeight" cname="其它入库重量" enable="false" width="90" align="right" format="{0:N3}"
......@@ -74,10 +70,6 @@
sumType="all"/>
<EF:EFColumn ename="scOuterWeight" cname="生产领料重量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="xsOuterAmount" cname="销售出库数量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="xsOuterWeight" cname="销售出库重量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="qtOuterAmount" cname="其它出库数量" enable="false" width="90" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="qtOuterWeight" cname="其它出库重量" enable="false" width="90" align="right" format="{0:N3}"
......
var inventNameGlobalData = [];
var specGlobalData = [];
$(function() {
// 查询
$("#QUERY").on("click", query);
......@@ -57,6 +58,7 @@ $(function() {
$(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
......
......@@ -25,33 +25,34 @@
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventRecordId" cname="存货档案ID" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true" enable="false">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" width="120" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" enable="false">
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" enable="false">
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" enable="false"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" enable="false"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="90" align="right" enable="false"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedBy" cname="更新人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="updatedTime" cname="更新时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
let inventAllGlobalData = [];
$(function() {
IPLATUI.EFGrid = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
"result": {
columns: [{
field: "spec",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['textField'];
}
}
return "";
}
}, {
field: "material",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param1Field'];
}
}
return "";
}
}, {
field: "unit",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param2Field'];
}
}
return "";
}
}],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
if (e.field == "inventRecordId") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field'])
}
}
}
});
}
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
$("#BTN_SAVE").on("click", save);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 规格
initSpec();
// 查询
query();
});
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ006", "queryComboBoxAll", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC006", "save", true);
}
});
}
<!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="查询条件">
<div class="row">
<div class="row">
<EF:EFSelect cname="存货类型" blockId="inqu_status" ename="inventType" row="0" 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="仓库名称" blockId="inqu_status" ename="whCode" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventRecordId" cname="存货档案ID" hidden="true"/>
<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"
columnTemplate="#=textField#" itemTemplate="#=textField#"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
columnTemplate="#=textField#" itemTemplate="#=textField#"
blockName="invent_name_block_id" textField="textField" valueField="valueField"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="120" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="90" align="right" format="{0:N3}"/>
<EF:EFColumn ename="warnNum" cname="预警值" enable="false" width="90" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="库存重量" enable="false" width="90" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -25,7 +25,7 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="id" cname="档案ID" enable="false" width="60" align="center"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" requird="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
......
......@@ -8,7 +8,7 @@
<EF:EFPage title="厂区管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="厂区名称:" ename="factoryName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="厂区名称" ename="factoryName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="生产组名称" ename="groupCode" blockId="inqu_status" row="0" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="group_record_block_id" textField="textField" valueField="valueField"/>
......
let whNameGlobalData = [];
let inventNameGlobalData = [];
let inventAllGlobalData = [];
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [ {
field: "whCode",
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
return whNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventRecordId",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "material",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param1Field'];
}
}
return "";
}
}, {
field: "unit",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param2Field'];
}
}
return "";
}
}],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
if (e.field == "inventRecordId") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field'])
}
}
}
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 仓库名称
initWh();
// 存货名称
initInvent();
// 规格
initSpec();
// 查询
query();
});
/**
* 初始化仓库
*/
let initWh = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化存货
*/
let initInvent = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
EiCommunicator.send("HPPZ004", "queryComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ006", "queryComboBoxAll", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ012", "save", true);
}
});
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ012", "delete", true);
}
});
}
<!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="查询条件">
<div class="row">
<EF:EFSelect cname="存货类型" blockId="inqu_status" ename="inventType" row="0" 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="仓库名称" blockId="inqu_status" ename="whCode" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="warnNum" cname="预警值" width="100" align="right" format="{0:N3}" maxLength="20"
required="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedName" cname="修改人" enable="false" align="center"/>
<EF:EFColumn ename="updatedTime" cname="修改时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -133,7 +133,7 @@ function deleteFunc() {
$.each(rows, function(index, item) {
let status= item.get("status");
if(status==="1"){
message("选中的第"+(index+1)+"行记录提交,不能删除!");
message("选中的第"+(index+1)+"行记录提交,不能删除!");
flag = false;
return false;
}
......
......@@ -51,8 +51,8 @@
<EF:EFInput ename="detail-0-actualCompletionTotalWt" cname="完成重量" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="detail-0-planCompletionDate" cname="计划完成日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="4" readonly="true"/>
<EF:EFInput ename="detail-0-actualCompletionDate" cname="实际完成时间" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="4" readonly="true"/>
<EF:EFDatePicker ename="detail-0-planCompletionDate" cname="计划完成日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="4" disabled="true" />
<EF:EFDatePicker ename="detail-0-actualCompletionDate" cname="实际完成时间" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="4" disabled="true" />
</div>
</EF:EFRegion>
</EF:EFPage>
......@@ -35,7 +35,8 @@
<EF:EFColumn enable="false" ename="prodOrderNo" cname="生产订单号"/>
<EF:EFColumn enable="false" ename="prdtName" cname="部件名称"/>
<EF:EFColumn enable="false" ename="partName" cname="零件名称"/>
<EF:EFColumn enable="false" ename="planCompletionDate" cname="计划完成日期"/>
<EF:EFColumn enable="false" ename="planCompletionDate" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"
cname="计划完成日期"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
......@@ -67,9 +68,10 @@
<EF:EFColumn ename="num" width="80" cname="数量"/>
<EF:EFColumn ename="unitWt" format="{0:N3}" width="80" cname="单重"/>
<EF:EFColumn enable="false" format="{0:N3}" ename="totalWt" width="80" cname="总重"/>
<EF:EFColumn ename="planCompletionDate" required='true' cname="计划完成时间" editType="date" dateFormat="yyyy/MM/dd" width="120"/>
<EF:EFColumn ename="actualCompletionDate" cname="实际完成时间" editType="date" dateFormat="yyyy/MM/dd" width="120"
enable="false"/>
<EF:EFColumn ename="planCompletionDate" required='true' cname="计划完成时间" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" width="120"/>
<EF:EFColumn ename="actualCompletionDate" cname="实际完成时间" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" width="120" enable="false"/>
<EF:EFColumn enable="false" ename="actualCompletionNum" cname="实际完工数量" width="100" readonly="true"/>
<EF:EFColumn enable="false" ename="actualCompletionTotalWt" cname="实际完工重量" width="100" readonly="true"/>
<EF:EFComboColumn enable="false" align="center" ename="status" width="80" cname="状态">
......
......@@ -41,7 +41,8 @@
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="材料名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="orgName" cname="生产组名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" enable="false" width="120" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn enable="false" ename="cutSchedule" cname="下料进度" format="{0:N2}" width="80" readonly="true" align="center"/>
<EF:EFComboColumn enable="false" align="center" ename="status" width="80" cname="状态">
<EF:EFOption label="计划中" value="0"/>
......
......@@ -135,7 +135,12 @@ $(function () {
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}]
}],
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
}
}
}
......@@ -246,3 +251,30 @@ let selectStockCallback = function () {
// 关闭弹窗
JSColorbox.close();
}
/**
* 删除
*/
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status==="1"){
message("选中的第"+(index+1)+"行记录已处理,不能删除!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPZL001", "delete", true);
}
});
}
}
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