Commit 1b482d6a by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

 Conflicts:
	src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
parents d6a5ed38 62c2f016
......@@ -28,20 +28,22 @@ public enum DdynamicEnum {
* 用途:项目性质下拉框
* 编写:wwl
*/
PROJ_TYPE_BLOCK_ID("proj_type_block_id","natCode","natName","HGPZ008.queryComboBox"),
PROJ_TYPE_BLOCK_ID("proj_type_block_id", "natCode", "natName", "HGPZ008.queryComboBox"),
/**
* 模块:客户类型
* 用途:客户类型下拉框
* 编写:
*/
CUSTOMER_TYPE_BLOCK_ID("customer_type_block_id","custType","custTypeName","HGPZ001.queryComboBox"),
/** TODO
CUSTOMER_TYPE_BLOCK_ID("customer_type_block_id", "custType", "custTypeName", "HGPZ001.queryComboBox"),
/**
* TODO
* 模块:客户档案
* 用途:客户档案下拉框
* 编写:wwl
*/
CUSTOMER_RECORD_BLOCK_ID("customer_record_block_id","custCode","custName","HGPZ002.queryComboBox"),
CUSTOMER_RECORD_BLOCK_ID("customer_record_block_id", "custCode", "custName", "HGPZ002.queryComboBox"),
/**
* 模块:供应商档案
......@@ -78,25 +80,34 @@ public enum DdynamicEnum {
*/
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick",
"coefficient", "HGPZ005.queryComboBoxAll"),
/**
* 模块:规格(无ID)
* 用途:存货档案下拉框
* 编写:
*/
SPEC_NAME_BLOCK_ID("spec_name_block_id", "spec", "spec", "HGPZ005.queryComboBoxSpecName"),
/**
* 模块:仓库类型
* 用途:仓库类型下拉框
* 编写:
*/
WH_TYPE_BLOCK_ID("wh_type_block_id","whType","whTypeName","HGPZ006.queryComboBox"),
WH_TYPE_BLOCK_ID("wh_type_block_id", "whType", "whTypeName", "HGPZ006.queryComboBox"),
/**
* 模块:仓库档案
* 用途:仓库档案下拉框
* 编写:
*/
WH_RECORD_BLOCK_ID("wh_record_block_id","whCode","whName","HGPZ007.queryComboBox"),
WH_RECORD_BLOCK_ID("wh_record_block_id", "whCode", "whName", "HGPZ007.queryComboBox"),
/**
* 模块:厂区管理
* 用途:厂区管理下拉框
* 编写:songx
*/
FACTORY_RECORD_BLOCK_ID("factory_record_block_id","orgId","orgCname","HPXSOrg.queryFactoryComboBox"),
FACTORY_RECORD_BLOCK_ID("factory_record_block_id", "orgId", "orgCname", "HPXSOrg.queryFactoryComboBox"),
/**
......
<?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="BaseCondition">
<!-- 规格 -->
<sql id="specCondition">
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
SPEC_ID IN (SELECT ID FROM ${metaSchema}.HGPZ005 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
SPEC_ID IN (SELECT ID FROM ${metaSchema}.HGPZ005 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<!-- 创建时间 -->
<sql id="createdTimeCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
</sql>
</sqlMap>
package com.baosight.hggp.hg.cg.domain;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.Map;
/**
* Project: <br>
* Title:Hgcg003.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-05-11 17:26:18 create
*/
public class HGCG003A extends HGCG003 {
private static final long serialVersionUID = 1L;
public static final String FIELD_WH_CODE = "whCode"; /* 仓库编码*/
public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/
public static final String COL_WH_CODE = "WH_CODE"; /* 仓库编码*/
public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/
private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_WH_CODE);
eiColumn.setDescName("仓库编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WH_NAME);
eiColumn.setDescName("仓库名称");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGCG003A() {
super.initMetaData();
initMetaData();
}
/**
* get the whCode - 仓库编码.
* @return the whCode
*/
public String getWhCode() {
return this.whCode;
}
/**
* set the whCode - 仓库编码.
*
* @param whCode - 仓库编码
*/
public void setWhCode(String whCode) {
this.whCode = whCode;
}
/**
* get the whName - 仓库名称.
* @return the whName
*/
public String getWhName() {
return this.whName;
}
/**
* set the whName - 仓库名称.
*
* @param whName - 仓库名称
*/
public void setWhName(String whName) {
this.whName = whName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_WH_CODE, StringUtils.toString(whCode, eiMetadata.getMeta(FIELD_WH_CODE)));
map.put(FIELD_WH_NAME, StringUtils.toString(whName, eiMetadata.getMeta(FIELD_WH_NAME)));
return map;
}
}
......@@ -7,7 +7,7 @@ import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
......@@ -23,6 +23,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -44,6 +45,8 @@ public class ServiceHGCG001 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -62,7 +65,7 @@ public class ServiceHGCG001 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
HGCGUtils.HgCg001.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -120,6 +123,7 @@ public class ServiceHGCG001 extends ServiceBase {
*/
private void saveData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
fCg001.setPurUnitWeight(fCg001.getPurWeight().divide(fCg001.getPurQty(), 3, RoundingMode.HALF_UP));
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_PUR, fCg001);
}
}
......@@ -228,7 +232,7 @@ public class ServiceHGCG001 extends ServiceBase {
*/
private void submitData(List<HGCG001> fCg001s) {
for (HGCG001 fCg001 : fCg001s) {
fCg001.setStatus(HGConstant.CgPlanStatus.S_1);
fCg001.setStatus(HGConstant.CgPlanStatus.S_2);
fCg001.setAuditTime(DateUtils.shortDateTime());
fCg001.setAuditUserId(UserSessionUtils.getLoginName());
fCg001.setAuditUserName(UserSessionUtils.getLoginCName());
......
......@@ -8,7 +8,7 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
......@@ -17,7 +17,6 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -45,6 +44,8 @@ public class ServiceHGCG002 extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -63,7 +64,7 @@ public class ServiceHGCG002 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg002.setCondition(queryRow);
HGCGUtils.HgCg002.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG002.QUERY, new HGCG002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -82,7 +83,7 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkSaveData(fCg002s, dbCg002AMap);
// 保存数据
......@@ -134,7 +135,7 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkRemoveData(fCg002s, dbCg002AMap);
// 保存数据
......@@ -177,7 +178,7 @@ public class ServiceHGCG002 extends ServiceBase {
dbCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, dbCg002);
// 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_1);
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_2);
}
}
......@@ -192,7 +193,7 @@ public class ServiceHGCG002 extends ServiceBase {
try {
List<HGCG002> fCg002s = MapUtils.toDaoEPBase(inInfo, HGCG002.class);
// db数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetDataEp(fCg002s);
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002s);
// 数据校验
this.checkSubmitData(fCg002s, dbCg002AMap);
// 提交数据
......@@ -230,7 +231,7 @@ public class ServiceHGCG002 extends ServiceBase {
*/
private void submitData(List<HGCG002> fCg002s) {
for (HGCG002 fCg002 : fCg002s) {
fCg002.setStatus(HGConstant.CgContractStatus.S_1);
fCg002.setStatus(HGConstant.CgContractStatus.S_2);
fCg002.setAuditTime(DateUtils.shortDateTime());
fCg002.setAuditUserId(UserSessionUtils.getLoginName());
fCg002.setAuditUserName(UserSessionUtils.getLoginCName());
......
......@@ -7,7 +7,7 @@ import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
......@@ -45,6 +45,8 @@ public class ServiceHGCG002A extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -63,9 +65,9 @@ public class ServiceHGCG002A extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
HGCGUtils.HgCg001.setCondition(queryRow);
// 仅审核通过
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.CgPlanStatus.S_1);
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.CgPlanStatus.S_2);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -110,7 +112,7 @@ public class ServiceHGCG002A extends ServiceBase {
String planNo = fCg001.getPlanNo();
HGCG001 dbCg001 = dbCg001Map.get(planNo);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_1, dbCg001.getStatus(),
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_2, dbCg001.getStatus(),
String.format("计划[%s]状态不是\"审核通过\",不允许操作", planNo));
}
}
......@@ -134,7 +136,7 @@ public class ServiceHGCG002A extends ServiceBase {
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG002.INSERT, newCg002);
// 更新计划状态
HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_3);
HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_4);
}
}
......
......@@ -4,11 +4,10 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
......@@ -45,6 +44,8 @@ public class ServiceHGCG003 extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -63,7 +64,7 @@ public class ServiceHGCG003 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg003.setCondition(queryRow);
HGCGUtils.HgCg003.setCondition(queryRow);
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -82,9 +83,9 @@ public class ServiceHGCG003 extends ServiceBase {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// 采购收货DB数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetData(
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// 数据校验
this.checkSaveData(fCg003s, dbCg003Map);
......@@ -139,6 +140,8 @@ public class ServiceHGCG003 extends ServiceBase {
for (HGCG003 fCg003 : fCg003s) {
String receiveNo = fCg003.getReceiveNo();
String contractNo = fCg003.getContractNo();
// 计算重量
fCg003.setReceiveWeight(fCg003.getReceiveQty().multiply(fCg003.getReceiveUnitWeight()));
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, fCg003);
// 计算差异数量,更新合同状态
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
......@@ -158,9 +161,9 @@ public class ServiceHGCG003 extends ServiceBase {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// 采购收货DB数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// 采购合同DB数据
Map<String, HGCG002A> dbCg002AMap = HgCgUtils.HgCg002.lockGetData(
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetData(
ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_CONTRACT_NO));
// 数据校验
this.checkRemoveData(fCg003s, dbCg003Map);
......@@ -221,16 +224,16 @@ public class ServiceHGCG003 extends ServiceBase {
try {
List<HGCG003> fCg003s = MapUtils.toDaoEPBase(inInfo, HGCG003.class);
// db数据
Map<String, HGCG003> dbCg003Map = HgCgUtils.HgCg003.lockGetDataEp(fCg003s);
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003s);
// 数据校验
this.checkConfirmData(fCg003s, dbCg003Map);
// 提交数据
this.confirmData(fCg003s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据审核成功!");
inInfo.setMsg("操作成功!本次对[" + fCg003s.size() + "]条数据收货成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "审核失败");
LogUtils.setDetailMsg(inInfo, e, "收货失败");
}
return inInfo;
}
......@@ -246,8 +249,13 @@ public class ServiceHGCG003 extends ServiceBase {
String receiveNo = fCg003.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_0, dbCg003.getStatus(),
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_4, dbCg003.getStatus(),
String.format("收货单【%s】状态不是\"质检完成\",不允许操作", receiveNo));
// 计算退货数量和入库数量
BigDecimal totalQty = fCg003.getDeliverQty().add(fCg003.getDepositQty());
AssertUtils.isNotEquals(totalQty, dbCg003.getReceiveQty(),
String.format("收货单【%s】的\"退货数量(%s)\"加\"入库数量(%s)\"不等于\"收货数量(%s)\",请检查", receiveNo,
fCg003.getDeliverQty(), fCg003.getDepositQty(), dbCg003.getReceiveQty()));
}
}
......@@ -258,8 +266,8 @@ public class ServiceHGCG003 extends ServiceBase {
*/
private void confirmData(List<HGCG003> fCg003s) {
for (HGCG003 fCg003 : fCg003s) {
fCg003.setStatus(HGConstant.CgReceiveStatus.S_1);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, fCg003);
fCg003.setStatus(HGConstant.CgReceiveStatus.S_2);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, fCg003);
}
}
......
......@@ -8,7 +8,7 @@ import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HgCgUtils;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
......@@ -17,14 +17,12 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -47,6 +45,8 @@ public class ServiceHGCG003A extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -65,9 +65,9 @@ public class ServiceHGCG003A extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HgCgUtils.HgCg001.setCondition(queryRow);
HGCGUtils.HgCg001.setCondition(queryRow);
// 仅审核通过和收货中
queryRow.put("statuses", new Integer[]{HGConstant.CgContractStatus.S_1, HGConstant.CgContractStatus.S_3});
queryRow.put("statuses", new Integer[]{HGConstant.CgContractStatus.S_2, HGConstant.CgContractStatus.S_4});
inInfo = super.query(inInfo, HGCG002.QUERY, new HGCG002A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -84,10 +84,9 @@ public class ServiceHGCG003A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购合同", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG002A> fCg002As = MapUtils.toDaoEPBase(inInfo, HGCG002A.class);
// db数据
Map<String, HGCG002A> dbCg002AMap = this.lockGetData(fCg002As);
Map<String, HGCG002A> dbCg002AMap = HGCGUtils.HgCg002.lockGetDataEp(fCg002As);
// 数据校验
this.checkConfirmData(fCg002As, dbCg002AMap);
// 保存数据
......@@ -112,8 +111,8 @@ public class ServiceHGCG003A extends ServiceBase {
String contractNo = fCg002A.getContractNo();
HGCG002A dbCg002A = dbCg002AMap.get(contractNo);
AssertUtils.isNull(dbCg002A, String.format("合同[%s]不存在", contractNo));
AssertUtils.isTrue(!(HGConstant.CgContractStatus.S_1.equals(dbCg002A.getStatus())
|| HGConstant.CgContractStatus.S_3.equals(dbCg002A.getStatus())),
AssertUtils.isTrue(!(HGConstant.CgContractStatus.S_2.equals(dbCg002A.getStatus())
|| HGConstant.CgContractStatus.S_4.equals(dbCg002A.getStatus())),
String.format("合同[%s]状态不是\"审核通过\"或\"收货中\",不允许操作", contractNo));
AssertUtils.isGt(fCg002A.getBcReceiveQty(), dbCg002A.getBcMaxReceiveQty(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", contractNo,
......@@ -135,6 +134,8 @@ public class ServiceHGCG003A extends ServiceBase {
newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
newCg003.setReceiveQty(fCg002A.getBcReceiveQty());
newCg003.setReceiveUnitWeight(fCg002A.getPurUnitWeight());
newCg003.setReceiveWeight(fCg002A.getBcReceiveQty().multiply(fCg002A.getPurUnitWeight()));
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG003.INSERT, newCg003);
......@@ -143,19 +144,4 @@ public class ServiceHGCG003A extends ServiceBase {
}
}
/**
* 锁并且获取数据
*
* @param fCg002As
* @return
*/
private Map<String, HGCG002A> lockGetData(List<HGCG002A> fCg002As) {
// 合同号
List<String> contractNos = ObjectUtils.listEpKey(fCg002As, HGCG002.FIELD_CONTRACT_NO);
// 锁
HGCGTools.HgCg002.lock(contractNos);
// db数据
return HGCGTools.HgCg002.map(contractNos);
}
}
......@@ -12,17 +12,26 @@
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PLAN_DATE as "planDate", <!-- 计划日期 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
PLAN_QTY as "planQty", <!-- 计划数量 -->
PLAN_UNIT_WEIGHT as "planUnitWeight", <!-- 计划单重 -->
PLAN_WEIGHT as "planWeight", <!-- 计划重量 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
......@@ -36,27 +45,12 @@
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -72,12 +66,6 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
......@@ -90,6 +78,9 @@
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
PLAN_NO = #planNo#
</isNotEmpty>
......@@ -99,12 +90,8 @@
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
<include refid="BaseCondition.specCondition"/>
<include refid="BaseCondition.createdTimeCondition"/>
</sql>
<!-- 公共修改字段 -->
......@@ -152,15 +139,22 @@
PLAN_NO, <!-- 计划单号 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
UNIT, <!-- 单位 -->
LENGTH, <!-- 长度 -->
WIDTH, <!-- 宽度 -->
THICK, <!-- 厚度 -->
PLAN_QTY, <!-- 计划数量 -->
PLAN_UNIT_WEIGHT, <!-- 计划单重 -->
PLAN_WEIGHT, <!-- 计划重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#companyCode#, #companyName#, #planDate#, #planNo#, #inventCode#, #inventName#,
#spec#, #material#, #length#, #planWeight#, #status#
#specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
#planQty#, #planUnitWeight#, #planWeight#, #status#
)
</insert>
......@@ -185,6 +179,7 @@
UPDATE ${hggpSchema}.HGCG001
SET
PUR_QTY = #purQty#, <!-- 采购数量 -->
PUR_UNIT_WEIGHT = #purUnitWeight#, <!-- 采购单重 -->
PUR_WEIGHT = #purWeight#, <!-- 采购重量 -->
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
......
......@@ -22,14 +22,21 @@
SUP_NAME as "supName", <!-- 供应商名称 -->
PUR_USER_ID as "purUserId", <!-- 采购员 -->
PUR_USER_NAME as "purUserName", <!-- 采购员名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
PUR_QTY as "purQty", <!-- 采购数量 -->
PUR_UNIT_WEIGHT as "purUnitWeight", <!-- 采购单重 -->
PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
......@@ -46,33 +53,12 @@
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
......@@ -103,21 +89,9 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purQty">
PUR_QTY = #purQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="purWeight">
PUR_WEIGHT = #purWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
......@@ -130,12 +104,12 @@
<isNotEmpty prepend=" AND " property="auditUserName">
AUDIT_USER_NAME = #auditUserName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="auditReason">
AUDIT_REASON = #auditReason#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO = #contractNo#
</isNotEmpty>
......@@ -145,11 +119,10 @@
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
<include refid="BaseCondition.specCondition"/>
<include refid="BaseCondition.createdTimeCondition"/>
<isNotEmpty prepend=" AND " property="statuses">
STATUS IN <iterate open="(" close=")" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
</sql>
......@@ -198,19 +171,29 @@
CONTRACT_DATE, <!-- 合同日期 -->
CONTRACT_NO, <!-- 合同号 -->
PLAN_NO, <!-- 计划单号 -->
SUP_CODE, <!-- 供应商编码 -->
SUP_NAME, <!-- 供应商名称 -->
PUR_USER_ID, <!-- 采购员 -->
PUR_USER_NAME, <!-- 采购员名称 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
UNIT, <!-- 单位 -->
LENGTH, <!-- 长度 -->
WIDTH, <!-- 宽度 -->
THICK, <!-- 厚度 -->
PUR_QTY, <!-- 采购数量 -->
PUR_UNIT_WEIGHT, <!-- 采购单重 -->
PUR_WEIGHT, <!-- 采购重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #contractDate#, #contractNo#, #planNo#,
#inventCode#, #inventName#, #spec#, #material#, #length#,
#purQty#, #purWeight#, #status#
#supCode#, #supName#, #purUserId#, #purUserName#, #inventCode#, #inventName#,
#specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
#purQty#, #purUnitWeight#, #purWeight#, #status#
)
</insert>
......@@ -270,6 +253,7 @@
SET
STATUS = #status#,
RECEIVE_QTY = #receiveQty#,
RECEIVE_WEIGHT = #receiveWeight#,
<include refid="updateRevise"/>
WHERE CONTRACT_NO = #contractNo#
</update>
......
......@@ -23,14 +23,20 @@
SUP_NAME as "supName", <!-- 供应商名称 -->
PUR_USER_ID as "purUserId", <!-- 采购员 -->
PUR_USER_NAME as "purUserName", <!-- 采购员名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
RECEIVE_QTY as "receiveQty", <!-- 收货数量 -->
DELIVER_QTY as "deliverQty", <!-- 退货数量 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
RECEIVE_UNIT_WEIGHT as "receiveUnitWeight", <!-- 收货单重 -->
RECEIVE_WEIGHT as "receiveWeight", <!-- 收货重量 -->
STATUS as "status" <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
</sql>
......@@ -40,33 +46,12 @@
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
......@@ -103,33 +88,18 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deliverQty">
DELIVER_QTY = #deliverQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositQty">
DEPOSIT_QTY = #depositQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveWeight">
RECEIVE_WEIGHT = #receiveWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNo">
RECEIVE_NO = #receiveNo#
</isNotEmpty>
......@@ -139,12 +109,8 @@
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME &gt;= #createdTimeFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeTo">
CREATED_TIME &lt;= #createdTimeTo#
</isNotEmpty>
<include refid="BaseCondition.specCondition"/>
<include refid="BaseCondition.createdTimeCondition"/>
</sql>
<!-- 公共修改字段 -->
......@@ -196,20 +162,27 @@
SUP_NAME, <!-- 供应商名称 -->
PUR_USER_ID, <!-- 采购员 -->
PUR_USER_NAME, <!-- 采购员名称 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
UNIT, <!-- 单位 -->
LENGTH, <!-- 长度 -->
WIDTH, <!-- 宽度 -->
THICK, <!-- 厚度 -->
RECEIVE_QTY, <!-- 收货数量 -->
RECEIVE_UNIT_WEIGHT, <!-- 收货单重 -->
RECEIVE_WEIGHT, <!-- 收货重量 -->
STATUS <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#,
#planNo#, #contractNo#, #supCode#, #supName#, #purUserId#, #purUserName#,
#inventCode#, #inventName#, #spec#, #material#, #length#,
#receiveQty#, #receiveWeight#, #status#
#inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#,
#unit#, #length#, #width#, #thick#, #receiveQty#, #receiveUnitWeight#,
#receiveWeight#, #status#
)
</insert>
......@@ -243,6 +216,18 @@
UPDATE ${hggpSchema}.HGCG003
SET
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</update>
<!-- 修改确认 -->
<update id="updateConfirm">
UPDATE ${hggpSchema}.HGCG003
SET
STATUS = #status#,
DELIVER_QTY = #deliverQty#, <!-- 退货数量 -->
DEPOSIT_QTY = #depositQty#, <!-- 退货数量 -->
<include refid="updateRevise"/>
WHERE RECEIVE_NO = #receiveNo#
</update>
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.AssertUtils;
......@@ -134,13 +135,15 @@ public class HGCGTools {
public static void updateReceive(HGCG002 dbCg002, BigDecimal receiveQty) {
AssertUtils.isNull(dbCg002, "合同号不能为空!");
AssertUtils.isNull(receiveQty, "收货数量不能为空!");
BigDecimal diffQty = dbCg002.getPurQty().subtract(receiveQty.add(dbCg002.getReceiveQty()));
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_4
: HGConstant.CgContractStatus.S_3;
BigDecimal newReceiveQty = receiveQty.add(dbCg002.getReceiveQty());
BigDecimal diffQty = dbCg002.getPurQty().subtract(newReceiveQty);
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(HGCG002.FIELD_CONTRACT_NO, dbCg002.getContractNo());
paramMap.put(HGCG002.FIELD_STATUS, status);
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, receiveQty.add(dbCg002.getReceiveQty()));
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002.getPurUnitWeight()));
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
}
......@@ -217,6 +220,20 @@ public class HGCGTools {
return results.stream().collect(Collectors.toMap(HGCG003::getReceiveNo, item -> item));
}
/**
* 修改状态
*
* @param receiveNo
* @param status
*/
public static void updateStatus(String receiveNo, Integer status) {
AssertUtils.isEmpty(receiveNo, "收货单号不能为空!");
AssertUtils.isNull(status, "状态不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("receiveNo", receiveNo);
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, paramMap);
}
}
}
......@@ -17,7 +17,7 @@ import java.util.Map;
* @author:songx
* @date:2024/5/9,13:50
*/
public class HgCgUtils {
public class HGCGUtils {
/**
* 设置查询条件
......@@ -51,7 +51,7 @@ public class HgCgUtils {
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
HGCGUtils.setCondition(queryRow);
// 计划日期
String planDate = MapUtils.getString(queryRow, HGCG001.FIELD_PLAN_DATE);
if (StringUtils.isNotBlank(planDate)) {
......@@ -76,7 +76,7 @@ public class HgCgUtils {
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
HGCGUtils.setCondition(queryRow);
// 合同日期
String contractDate = MapUtils.getString(queryRow, HGCG002.FIELD_CONTRACT_DATE);
if (StringUtils.isNotBlank(contractDate)) {
......@@ -90,7 +90,7 @@ public class HgCgUtils {
* @param fCg002s
* @return
*/
public static Map<String, HGCG002A> lockGetDataEp(List<HGCG002> fCg002s) {
public static Map<String, HGCG002A> lockGetDataEp(List<? extends HGCG002> fCg002s) {
return lockGetData(ObjectUtils.listEpKey(fCg002s, HGCG002.FIELD_CONTRACT_NO));
}
......@@ -124,7 +124,7 @@ public class HgCgUtils {
* @return
*/
public static void setCondition(Map queryRow) {
HgCgUtils.setCondition(queryRow);
HGCGUtils.setCondition(queryRow);
// 收货日期
String receiveDate = MapUtils.getString(queryRow, HGCG003.FIELD_RECEIVE_DATE);
if (StringUtils.isNotBlank(receiveDate)) {
......@@ -138,7 +138,7 @@ public class HgCgUtils {
* @param fCg003s
* @return
*/
public static Map<String, HGCG003> lockGetDataEp(List<HGCG003> fCg003s) {
public static Map<String, HGCG003> lockGetDataEp(List<? extends HGCG003> fCg003s) {
return lockGetData(ObjectUtils.listEpKey(fCg003s, HGCG003.FIELD_RECEIVE_NO));
}
......
......@@ -95,6 +95,8 @@ public class HGConstant {
public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO";
// 采购收货号
public static final String CG_RECEIVE_NO = "CG_RECEIVE_NO";
// 采购入库号
public static final String CG_DEPOSIT_NO = "CG_DEPOSIT_NO";
// 点检单号
public static final String INSPEC_CODE = "INSPEC_CODE";
// 保养单号
......@@ -111,12 +113,14 @@ public class HGConstant {
// 待审核
public static final Integer S_0 = 0;
// 审核通过
// 审核
public static final Integer S_1 = 1;
// 审核拒绝
// 审核通过
public static final Integer S_2 = 2;
// 生成合同
// 审核拒绝
public static final Integer S_3 = 3;
// 生成合同
public static final Integer S_4 = 4;
}
/**
......@@ -129,14 +133,16 @@ public class HGConstant {
// 待审核
public static final Integer S_0 = 0;
// 审核通过
// 审核
public static final Integer S_1 = 1;
// 审核拒绝
// 审核通过
public static final Integer S_2 = 2;
// 收货中
// 审核拒绝
public static final Integer S_3 = 3;
// 收货完成
// 收货
public static final Integer S_4 = 4;
// 收货完成
public static final Integer S_5 = 5;
}
/**
......@@ -150,13 +156,13 @@ public class HGConstant {
// 待确认
public static final Integer S_0 = 0;
// 已收货
public static final Integer S_1 = 1;
// 质检中
public static final Integer S_2 = 2;
// 质检完成
// 质检
public static final Integer S_3 = 3;
// 已入库
// 质检完成
public static final Integer S_4 = 4;
// 已入库
public static final Integer S_5 = 5;
}
/**
......
......@@ -64,6 +64,38 @@ public class HGSqlConstant {
public static final String UPDATE_STATUS = MODULE_NAME + "updateStatus";
// 修改数量
public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
// 修改数量
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
}
/**
* HGKC001 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgKc001 {
// 模块名称
private static final String MODULE_NAME = "HGKC001.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
}
/**
* HGKC001 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgKc010 {
// 模块名称
private static final String MODULE_NAME = "HGKC010.";
// 锁
public static final String LOCK = MODULE_NAME + "lock";
// 锁
public static final String UPDATE_INV = MODULE_NAME + "updateInv";
}
/**
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGKC001 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购入库", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC001().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);
HGKCUtils.HgKc001.setCondition(queryRow);
inInfo = super.query(inInfo, HGKC001.QUERY, new HGKC001());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购入库", operType = "修改", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGKC001> fCg004s = MapUtils.toDaoEPBase(inInfo, HGKC001.class);
// 采购收货DB数据
Map<String, HGKC001> dbCg004Map = HGKCUtils.HgKc001.lockGetDataEp(fCg004s);
// 数据校验
this.checkSaveData(fCg004s, dbCg004Map);
// 保存数据
this.saveData(fCg004s, dbCg004Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg004s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg004s
* @param dbCg004Map
*/
private void checkSaveData(List<HGKC001> fCg004s, Map<String, HGKC001> dbCg004Map) {
for (HGKC001 fCg004 : fCg004s) {
String depositNo = fCg004.getDepositNo();
HGKC001 dbCg004 = dbCg004Map.get(depositNo);
AssertUtils.isNull(dbCg004, String.format("入库单[%s]不存在", depositNo));
}
}
/**
* 数据保存
*
* @param fCg004s
* @param dbCg004Map
*/
private void saveData(List<HGKC001> fCg004s, Map<String, HGKC001> dbCg004Map) {
for (HGKC001 fCg004 : fCg004s) {
String depositNo = fCg004.getDepositNo();
}
}
/**
* 删除操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购入库", operType = "修改", operDesc = "删除")
public EiInfo remove(EiInfo inInfo) {
try {
List<HGKC001> fKc001s = MapUtils.toDaoEPBase(inInfo, HGKC001.class);
// 采购收货DB数据
Map<String, HGKC001> dbCg004Map = HGKCUtils.HgKc001.lockGetDataEp(fKc001s);
// 数据校验
this.checkRemoveData(fKc001s, dbCg004Map);
// 保存数据
this.removeData(fKc001s, dbCg004Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fKc001s.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fKc001s
* @param dbKc001Map
*/
private void checkRemoveData(List<HGKC001> fKc001s, Map<String, HGKC001> dbKc001Map) {
for (HGKC001 fKc001 : fKc001s) {
String depositNo = fKc001.getDepositNo();
HGKC001 dbCg004 = dbKc001Map.get(depositNo);
AssertUtils.isNull(dbCg004, String.format("入库单[%s]不存在", depositNo));
}
}
/**
* 数据保存
*
* @param fKc001s
* @param dbKc001Map
*/
private void removeData(List<HGKC001> fKc001s, Map<String, HGKC001> dbKc001Map) {
for (HGKC001 fKc001 : fKc001s) {
String depositNo = fKc001.getDepositNo();
HGKC001 dbKc001 = dbKc001Map.get(depositNo);
dbKc001.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGKC001.DELETE, dbKc001);
// 扣减库存
HGKCUtils.HgKc010.updateInv(dbKc001.getCompanyCode(), dbKc001.getWhCode(), dbKc001.getSpecId(),
dbKc001.getDepositQty().negate(), dbKc001.getDepositWeight().negate());
// 更新收货单状态
HGCGTools.HgCg003.updateStatus(dbKc001.getReceiveNo(), HGConstant.CgReceiveStatus.S_2);
}
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003A;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGKC001A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "采购收货", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003A().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);
HGCGUtils.HgCg003.setCondition(queryRow);
// 仅已收货
queryRow.put(HGCG003.FIELD_STATUS, HGConstant.CgReceiveStatus.S_2);
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "采购收货", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<HGCG003A> fCg003As = MapUtils.toDaoEPBase(inInfo, HGCG003A.class);
// db数据
Map<String, HGCG003> dbCg003Map = HGCGUtils.HgCg003.lockGetDataEp(fCg003As);
// 数据校验
this.checkConfirmData(fCg003As, dbCg003Map);
// 保存数据
this.confirmData(fCg003As, dbCg003Map);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003As.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param fCg003As
* @param dbCg003Map
*/
private void checkConfirmData(List<HGCG003A> fCg003As, Map<String, HGCG003> dbCg003Map) {
for (HGCG003A fCg003A : fCg003As) {
String receiveNo = fCg003A.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
AssertUtils.isNull(dbCg003, String.format("收货单号[%s]不存在", receiveNo));
AssertUtils.isNotEquals(HGConstant.CgReceiveStatus.S_2, dbCg003.getStatus(),
String.format("收货单号[%s]状态不是\"已收货\",不允许操作", receiveNo));
AssertUtils.isEmpty(fCg003A.getWhCode(), String.format("收货单号[%s]的仓库名称不能为空", dbCg003.getReceiveNo()));
}
}
/**
* 数据保存
*
* @param fCg003As
* @param dbCg003Map
*/
private void confirmData(List<HGCG003A> fCg003As, Map<String, HGCG003> dbCg003Map) {
for (HGCG003A fCg003A : fCg003As) {
String receiveNo = fCg003A.getReceiveNo();
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
HGKC001 newKc001 = BeanUtils.copy(dbCg003, HGKC001.class);
newKc001.setWhCode(fCg003A.getWhCode());
newKc001.setWhName(fCg003A.getWhName());
newKc001.setDepositDate(DateUtils.shortDate());
newKc001.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_DEPOSIT_NO));
newKc001.setDepositQty(dbCg003.getDepositQty());
newKc001.setDepositUnitWeight(dbCg003.getReceiveUnitWeight());
newKc001.setDepositWeight(dbCg003.getDepositQty().multiply(dbCg003.getReceiveUnitWeight()));
newKc001.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGKC001.INSERT, newKc001);
// 更新库存数量
HGKCUtils.HgKc010.updateInv(newKc001.getCompanyCode(), newKc001.getWhCode(), newKc001.getSpecId(),
newKc001.getDepositQty(), newKc001.getDepositUnitWeight(), newKc001.getDepositWeight());
// 更新收货单状态
HGCGTools.HgCg003.updateStatus(receiveNo, HGConstant.CgReceiveStatus.S_5);
}
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.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.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGKC010 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "综合库存", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC010().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);
inInfo = super.query(inInfo, HGKC010.QUERY, new HGKC010());
} 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="HGKC001">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
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-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
DEPOSIT_DATE as "depositDate", <!-- 入库日期 -->
DEPOSIT_NO as "depositNo", <!-- 入库单号 -->
RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
PLAN_NO as "planNo", <!-- 计划单号 -->
CONTRACT_NO as "contractNo", <!-- 合同号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
DEPOSIT_QTY as "depositQty", <!-- 入库数量 -->
DEPOSIT_UNIT_WEIGHT as "depositUnitWeight", <!-- 入库单重 -->
DEPOSIT_WEIGHT as "depositWeight" <!-- 入库重量 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveNo">
RECEIVE_NO = #receiveNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
CONTRACT_NO = #contractNo#
</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="specId">
SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositNo">
DEPOSIT_NO = #depositNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositNos">
DEPOSIT_NO IN <iterate open="(" close=")" conjunction="," property="depositNos">#depositNos[]#</iterate>
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="BaseCondition.specCondition"/>
<include refid="BaseCondition.createdTimeCondition"/>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.kc.domain.HGKC001">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC001
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC001 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC001 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
DEPOSIT_DATE, <!-- 入库日期 -->
DEPOSIT_NO, <!-- 入库单号 -->
RECEIVE_NO, <!-- 收货单号 -->
PLAN_NO, <!-- 计划单号 -->
CONTRACT_NO, <!-- 合同号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
UNIT, <!-- 单位 -->
LENGTH, <!-- 长度 -->
WIDTH, <!-- 宽度 -->
THICK, <!-- 厚度 -->
DEPOSIT_QTY, <!-- 入库数量 -->
DEPOSIT_UNIT_WEIGHT, <!-- 入库单重 -->
DEPOSIT_WEIGHT <!-- 入库重量 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #depositDate#, #depositNo#,
#receiveNo#, #planNo#, #contractNo#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #specId#, #spec#, #material#,
#unit#, #length#, #width#, #thick#, #depositQty#, #depositUnitWeight#, #depositWeight#
)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGKC001
SET
DELETE_FLAG = #deleteFlag#,
<include refid="updateRevise"/>
WHERE DEPOSIT_NO = #depositNo#
</delete>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGKC001
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
</sqlMap>
<?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="HGKC010">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
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-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
INV_QTY as "invQty", <!-- 库存数量 -->
INV_UNIT_WEIGHT as "invUnitWeight", <!-- 库存单重 -->
INV_WEIGHT as "invWeight", <!-- 库存重量 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName" <!-- 厂区名称 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</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="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</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="specId">
SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="width">
WIDTH = #width#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="thick">
THICK = #thick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invUnitWeight">
INV_UNIT_WEIGHT = #invUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invWeight">
INV_WEIGHT = #invWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.kc.domain.HGKC010">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC010
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC010 WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC010 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 记录创建者 -->
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
UPDATED_BY, <!-- 记录修改者 -->
UPDATED_NAME, <!-- 记录修改名称 -->
UPDATED_TIME, <!-- 记录修改时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
MATERIAL, <!-- 材质 -->
UNIT, <!-- 单位 -->
LENGTH, <!-- 长度 -->
WIDTH, <!-- 宽度 -->
THICK, <!-- 厚度 -->
INV_QTY, <!-- 库存数量 -->
INV_UNIT_WEIGHT, <!-- 库存单重 -->
INV_WEIGHT, <!-- 库存重量 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME <!-- 厂区名称 -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#,
#companyName#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#,
#thick#, #invQty#, #invUnitWeight#, #invWeight#, #factoryCode#, #factoryName#
)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC010 WHERE ID = #id#
</delete>
<!-- 锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGKC010
SET CREATED_TIME = #createdTime#
WHERE 1=1
AND ACCOUNT_CODE = #accountCode#
AND COMPANY_CODE = #companyCode#
AND WH_CODE = #whCode#
AND INVENT_CODE = #inventCode#
AND SPEC_ID = #specId#
</update>
<!-- 更新库存 -->
<update id="updateInv">
UPDATE ${hggpSchema}.HGKC010
SET
INV_QTY = #invQty#, <!-- 库存数量 -->
INV_UNIT_WEIGHT = #invUnitWeight#, <!-- 库存单重 -->
INV_WEIGHT = #invWeight# <!-- 库存重量 -->
WHERE ID = #id#
</update>
</sqlMap>
package com.baosight.hggp.hg.kc.tools;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/5/13,14:56
*/
public class HGKCTools {
/**
* HGKC001 工具类
*
* @author:songx
* @date:2024/5/9,14:33
*/
public static class HgKc001 {
/**
* 锁
*
* @param depositNos
* @return
*/
public static void lock(List<String> depositNos) {
if (CollectionUtils.isEmpty(depositNos)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("depositNos", depositNos);
DaoBase.getInstance().update(HGSqlConstant.HgKc001.LOCK, paramMap);
}
/**
* 查询
*
* @param depositNos
* @return
*/
public static List<HGKC001> list(List<String> depositNos) {
AssertUtils.isEmpty(depositNos, "入库号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("depositNos", depositNos);
return DaoBase.getInstance().query(HGKC001.QUERY, paramMap);
}
/**
* 查询
*
* @param depositNos
* @return
*/
public static Map<String, HGKC001> map(List<String> depositNos) {
List<HGKC001> results = list(depositNos);
return results.stream().collect(Collectors.toMap(HGKC001::getDepositNo, item -> item));
}
}
/**
* HGKC010 工具类
*
* @author:songx
* @date:2024/5/9,14:33
*/
public static class HgKc010 {
/**
* 锁
*
* @param companyCode
* @param whCode
* @param specId
* @return
*/
public static void lock(String companyCode, String whCode, Long specId) {
if (StringUtils.isBlank(companyCode) || StringUtils.isBlank(whCode) || specId == null) {
return;
}
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode);
paramMap.put("specId", specId);
DaoBase.getInstance().update(HGSqlConstant.HgKc010.LOCK, paramMap);
}
/**
* @param companyCode
* @param whCode
* @param specId
*/
public static HGKC010 get(String companyCode, String whCode, Long specId) {
AssertUtils.isEmpty(companyCode, "公司编码不能为空");
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
AssertUtils.isTrue(specId == null || specId == 0, "规格ID不能为空");
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode);
paramMap.put("specId", specId);
List<HGKC010> results = DaoBase.getInstance().query(HGKC010.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
}
package com.baosight.hggp.hg.kc.utils;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/13,14:57
*/
public class HGKCUtils {
/**
* HGKC001 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgKc001 {
/**
* 设置查询条件
*
* @param queryRow 集合
* @return
*/
public static void setCondition(Map queryRow) {
HGCGUtils.setCondition(queryRow);
// 入库日期
String depositDate = MapUtils.getString(queryRow, HGKC001.FIELD_DEPOSIT_DATE);
if (StringUtils.isNotBlank(depositDate)) {
queryRow.put(HGKC001.FIELD_DEPOSIT_DATE, DateUtils.formatShort(depositDate));
}
}
/**
* 锁并且获取数据
*
* @param kc001s
* @return
*/
public static Map<String, HGKC001> lockGetDataEp(List<? extends HGKC001> kc001s) {
return lockGetData(ObjectUtils.listEpKey(kc001s, HGKC001.FIELD_DEPOSIT_NO));
}
/**
* 锁并且获取数据
*
* @param depositNos
* @return
*/
public static Map<String, HGKC001> lockGetData(List<String> depositNos) {
// 锁
HGKCTools.HgKc001.lock(depositNos);
// db数据
return HGKCTools.HgKc001.map(depositNos);
}
}
/**
* HGKC010 工具类
*
* @author:songx
* @date:2024/5/9,16:58
*/
public static class HgKc010 {
/**
* 更新库存
*
* @param companyCode
* @param whCode
* @param specId
* @param qty
* @param weight
*/
public static void updateInv(String companyCode, String whCode, Long specId, BigDecimal qty,
BigDecimal weight) {
updateInv(companyCode, whCode, specId, qty, null, weight);
}
/**
* 更新库存
*
* @param companyCode
* @param whCode
* @param specId
* @param qty
* @param unitWeight
* @param weight
*/
public static void updateInv(String companyCode, String whCode, Long specId, BigDecimal qty,
BigDecimal unitWeight, BigDecimal weight) {
HGKC010 newKc010 = buildBean(companyCode, whCode, specId, qty, unitWeight, weight);
// 参数校验
checkUpdateInv(companyCode, whCode, specId, qty, weight);
// 锁库存
HGKCTools.HgKc010.lock(companyCode, whCode, specId);
// 获取DB数据
HGKC010 dbKc010 = HGKCTools.HgKc010.get(companyCode, whCode, specId);
if (dbKc010 == null) {
addInvData(newKc010);
} else {
updateInvData(newKc010, dbKc010);
}
}
/**
* 构建对象
*
* @param companyCode
* @param whCode
* @param specId
* @param qty
* @param unitWeight
* @param weight
* @return
*/
private static HGKC010 buildBean(String companyCode, String whCode, Long specId, BigDecimal qty,
BigDecimal unitWeight, BigDecimal weight) {
HGKC010 newKc010 = new HGKC010();
newKc010.setCompanyCode(companyCode);
newKc010.setWhCode(whCode);
newKc010.setSpecId(specId);
newKc010.setInvQty(qty);
newKc010.setInvUnitWeight(unitWeight);
newKc010.setInvWeight(weight);
return newKc010;
}
/**
* 参数校验
*
* @param companyCode
* @param whCode
* @param specId
* @param qty
* @param weight
*/
private static void checkUpdateInv(String companyCode, String whCode, Long specId, BigDecimal qty,
BigDecimal weight) {
AssertUtils.isEmpty(companyCode, "公司编码不能为空");
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
AssertUtils.isTrue(specId == null || specId == 0, "规格ID不能为空");
AssertUtils.isNull(qty, "库存变更数量不能为空");
AssertUtils.isNull(weight, "库存变更重量不能为空");
AssertUtils.isTrue(qty.compareTo(BigDecimal.ZERO) == 0
&& weight.compareTo(BigDecimal.ZERO) == 0, "库存变更数量和重量不能为空");
}
/**
* 新增库存
*
* @param newKc010
*/
private static void addInvData(HGKC010 newKc010) {
// 公司
newKc010.setCompanyName(HGXSTools.XsOrg.get(newKc010.getCompanyCode()).getOrgCname());
// 仓库
newKc010.setWhName(HGPZTools.HgPz007.get(newKc010.getWhCode()).getWhName());
// 规格
HGPZ005 dbPz005 = HGPZTools.HgPz005.get(newKc010.getSpecId());
newKc010.setInventType(dbPz005.getInventType());
newKc010.setInventCode(dbPz005.getInventCode());
newKc010.setInventName(dbPz005.getInventName());
newKc010.setSpec(dbPz005.getSpec());
newKc010.setLength(dbPz005.getLength());
newKc010.setWidth(dbPz005.getWidth());
newKc010.setThick(dbPz005.getThick());
newKc010.setMaterial(dbPz005.getMaterial());
newKc010.setUnit(dbPz005.getUnit());
newKc010.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGKC010.INSERT, newKc010);
}
/**
* 修改库存
*
* @param newKc010
* @param dbKc010
*/
private static void updateInvData(HGKC010 newKc010, HGKC010 dbKc010) {
BigDecimal newQty = newKc010.getInvQty().add(dbKc010.getInvQty());
AssertUtils.isGt(BigDecimal.ZERO, newQty, String.format("更新后的库存数量小于0(%s),请检查", newQty));
BigDecimal newWeight = newKc010.getInvWeight().add(dbKc010.getInvWeight());
BigDecimal newUnitWeight = newQty.compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO
: newWeight.divide(newQty, 3, RoundingMode.HALF_UP);
dbKc010.setInvQty(newQty);
dbKc010.setInvWeight(newWeight);
dbKc010.setInvUnitWeight(newUnitWeight);
DaoUtils.update(HGSqlConstant.HgKc010.UPDATE_INV, dbKc010);
}
}
}
......@@ -316,4 +316,16 @@
ORDER BY ID
</select>
<!-- 规格下拉框(无ID) -->
<select id="queryComboBoxSpecName" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
(CASE WHEN COALESCE(SPEC, '') = '' THEN '无规格' ELSE SPEC END) AS "spec"
FROM ${hggpSchema}.HGPZ005
WHERE 1=1
AND DELETE_FLAG = 0
AND STATUS = 1
<include refid="condition"/>
ORDER BY SPEC DESC
</select>
</sqlMap>
......@@ -5,6 +5,7 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.ValidFlagEnum;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
......@@ -33,6 +34,30 @@ import lombok.extern.slf4j.Slf4j;
public class HGPZTools {
/**
* 仓库管理
* HPPZ007 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public static class HgPz007 {
/**
* 查询
*
* @param whCode
* @return
*/
public static HGPZ007 get(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("whCode", whCode);
List<HGPZ007> results = DaoBase.getInstance().query(HGPZ007.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
/**
* HPPZ009 公共DAO定义
*
* @author:songx
......@@ -71,6 +96,7 @@ public class HGPZTools {
}
/**
* 存货管理
* HGPZ005 公共DAO定义
*
* @author:songx
......
......@@ -86,36 +86,38 @@ public class HGSC001 extends DaoEPBase {
public static final String UPDATE = "HGSC001.update";
public static final String DELETE = "HGSC001.delete";
public static final String BATCH_DELETE = "HGSC001.batch_delete";
public static final String BATCH_COMPLETE = "HGSC001.batch_complete";
public static final String BATCH_COMMIT = "HGSC001.batch_commit";
private Long id = new Long(0);
private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
private String depCode = " "; /* 部门编码*/
private String depName = " "; /* 部门名称*/
private String subcontractCode = " "; /* 分包商编码*/
private String subcontractName = " "; /* 分包商名称*/
private String genralContractCode = " "; /* 总包商编码*/
private String genralContractName = " "; /* 总包商名称*/
private String partyPmName = " "; /* 甲方项目经理名称*/
private String partyPmHpone = " "; /* 甲方项目经理联系电话*/
private String contractName = " "; /* 合同名称*/
private String contractWorkTxt = " "; /* 合同工作量*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String projType = " "; /* 项目性质*/
private String companyCode = ""; /* 公司编码*/
private String companyName = ""; /* 公司名称*/
private String depCode = ""; /* 部门编码*/
private String depName = ""; /* 部门名称*/
private String subcontractCode = ""; /* 分包商编码*/
private String subcontractName = ""; /* 分包商名称*/
private String genralContractCode = ""; /* 总包商编码*/
private String genralContractName = ""; /* 总包商名称*/
private String partyPmName = ""; /* 甲方项目经理名称*/
private String partyPmHpone = ""; /* 甲方项目经理联系电话*/
private String contractName = ""; /* 合同名称*/
private String contractWorkTxt = ""; /* 合同工作量*/
private String projCode = ""; /* 项目编码*/
private String projName = ""; /* 项目名称*/
private String projType = ""; /* 项目性质*/
private Integer projStatus = new Integer(0); /* 项目状态\t0:在建;1:完工*/
private Integer approvalStatus = new Integer(0); /* 审批状态\t0:待审;1:审核中;2:已审*/
private String permissStartDate = " "; /* 准许开工日期*/
private String startDate = " "; /* 开工日期*/
private String endDate = " "; /* 完工日期*/
private String accountCode = " "; /* 帐套*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private String permissStartDate = ""; /* 准许开工日期*/
private String startDate = ""; /* 开工日期*/
private String endDate = ""; /* 完工日期*/
private String accountCode = ""; /* 帐套*/
private String createdBy = ""; /* 创建人*/
private String createdName = ""; /* 创建人名称*/
private String createdTime = ""; /* 创建时间*/
private String updatedBy = ""; /* 更新人*/
private String updatedName = ""; /* 修改人名称*/
private String updatedTime = ""; /* 更新时间*/
/**
* initialize the metadata.
......@@ -125,7 +127,7 @@ public class HGSC001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_id);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiColumn.setDescName("");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_company_code);
......
......@@ -34,7 +34,7 @@ public class ServiceHGSC001 extends ServiceBase {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -46,7 +46,7 @@ public class ServiceHGSC001 extends ServiceBase {
try {
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001());
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
......@@ -60,7 +60,7 @@ public class ServiceHGSC001 extends ServiceBase {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC001.FIELD_id);
DaoUtils.update(HGSC001.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
HGSCTools.THGSC001A.deleteByProIds(ids);
inInfo = this.query(inInfo);
......@@ -72,6 +72,36 @@ public class ServiceHGSC001 extends ServiceBase {
return inInfo;
}
public EiInfo complete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
DaoUtils.update(HGSC001.BATCH_COMPLETE, new HashMap<String,Object>(){{put("ids",ids);}});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据完工成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
public EiInfo commit(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC001.FIELD_id);
DaoUtils.update(HGSC001.BATCH_COMMIT, new HashMap<String,Object>(){{put("ids",ids);}});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
......@@ -102,6 +132,10 @@ public class ServiceHGSC001 extends ServiceBase {
* @param hgsc001
*/
private void checkSaveData(HGSC001 hgsc001) {
if(Objects.nonNull(hgsc001.getId())&&hgsc001.getId()>0){
HGSC001 oldHgsc001 = (HGSC001) super.dao.get(HGSC001.QUERY,HGSC001.FIELD_id,hgsc001.getId());
AssertUtils.isTrue(oldHgsc001.getApprovalStatus().compareTo(CommonConstant.YesNo.NO_0) == 1,"项目已提交不可修改!");
}
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(hgsc001.getCompanyCode(), "请选择公司!");
......
......@@ -35,7 +35,7 @@ public class ServiceHGSC001C extends ServiceBase {
EiInfoUtils.addBlock(inInfo,EiConstant.resultBlock,new ArrayList(){{add(hgsc001);}},HGSC001.class);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HGSC001A().eiMetadata);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
......
......@@ -36,7 +36,7 @@ public class ServiceHGSC001D extends ServiceBase {
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
......
......@@ -38,7 +38,7 @@ public class ServiceHGSC001U extends ServiceBase {
Long.valueOf(String.valueOf(resultMap.get(HGSC001.FIELD_id))));
EiInfoUtils.addBlock(inInfo,CommonConstant.Field.DETAIL, hgsc001AList, HGSC001A.class);
Map map = new HashMap();
map.put("accountCode", UserSessionUtils.getAccountCode());
map.put(HGSC001.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_TYPE_BLOCK_ID), map,false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), map,false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
......
......@@ -43,7 +43,7 @@
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name like ('%companyName%')
company_name like ('%$companyName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
......@@ -55,13 +55,13 @@
subcontract_code = #subcontractCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subcontractName">
subcontract_name like ('%subcontractName%')
subcontract_name like ('%$subcontractName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="genralContractCode">
genral_contract_code = #genralContractCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="genralContractName">
genral_contract_name like ('%genralContractName%')
genral_contract_name like ('%$genralContractName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partyPmName">
party_pm_name = #partyPmName#
......@@ -70,7 +70,7 @@
party_pm_hpone = #partyPmHpone#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractName">
contract_name like ('%contractName%')
contract_name like ('%$contractName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractWorkTxt">
contract_work_txt = #contractWorkTxt#
......@@ -327,10 +327,6 @@
permiss_start_date = #permissStartDate#, <!-- 准许开工日期 -->
start_date = #startDate#, <!-- 开工日期 -->
end_date = #endDate#, <!-- 完工日期 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
......@@ -338,4 +334,27 @@
id = #id#
</update>
<update id="batch_complete">
UPDATE ${hggpSchema}.HGSC001
SET
proj_status = 1, <!-- 项目状态 0:在建;1:完工 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
<update id="batch_commit">
UPDATE ${hggpSchema}.HGSC001
SET
approval_status = 2, <!-- 审批状态 0:待审;1:审核中;2:已审 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
</sqlMap>
......@@ -4,10 +4,10 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.ListUtils;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author wwl
......@@ -47,16 +47,21 @@ public class HGSCTools {
*/
public static void checkProjMgData(List<HGSC001A> objList) {
AssertUtils.isEmpty(objList, "项目负责人不能为空!");
AssertUtils.isTrue(ListUtils.allSameProperty(objList,HGSC001A::getUserCode), "项目负责人重复!");
List<String> stringList = objList.stream().map(HGSC001A::getUserCode)
.collect(Collectors.toList());
long count = stringList.stream().distinct().count();
AssertUtils.isTrue(stringList.size() != count, "项目负责人重复!");
}
public static List<HGSC001A> save(List<HGSC001A> hgsc001AList, Long projId){
if(CollectionUtils.isNotEmpty(hgsc001AList)&&Objects.nonNull(projId)) {
//删除历史数据
DaoUtils.update(HGSC001A.DELETE_BY_PROJID, projId);
hgsc001AList.forEach(obj -> {
if(Objects.nonNull(obj.getId())&&obj.getId()>0){
DaoUtils.insert(HGSC001A.UPDATE, obj);
}else {
obj.setProjId(projId);
DaoUtils.insert(HGSC001A.INSERT,obj);
DaoUtils.insert(HGSC001A.INSERT, obj);
}
});
}
return hgsc001AList;
......
......@@ -169,7 +169,7 @@ public class AssertUtils {
* @param b
* @param message
*/
public static void isNotEqual(BigDecimal a, BigDecimal b, String message) {
public static void isNotEquals(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) != 0) {
throw new PlatException(message);
}
......
package com.baosight.hggp.util;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
/**
* @Author wwl
* @Date 2024/5/10 10:11
*/
public class ListUtils {
public static <T> boolean allSameProperty(List<T> list, Function<T, ?> propertyExtractor) {
if (list == null || list.isEmpty()) {
return true;
}
Object firstValue = propertyExtractor.apply(list.get(0));
return list.stream().allMatch(item -> Objects.equals(firstValue, propertyExtractor.apply(item)));
}
}
......@@ -6,6 +6,9 @@
<settings useStatementNamespaces="true" />
<sqlMap resource="resources/ibatis/Dummy.xml" />
<!-- 基础查询条件 -->
<sqlMap resource="com/baosight/hggp/core/dao/BaseCondition.xml"/>
<!-- 数据权限 -->
<sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXSDataAuth.xml"/>
......@@ -14,4 +17,8 @@
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cg/sql/HGCG003.xml"/>
<!-- 库存 -->
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC010.xml"/>
</sqlMapConfig>
......@@ -102,7 +102,7 @@ let submit = function () {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "submit", true);
}
......
......@@ -23,10 +23,10 @@
<div class="row">
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
......@@ -47,16 +47,18 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center"
hidden="true"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" 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']"/>
......
......@@ -10,7 +10,11 @@ $(function () {
columns: [],
loadComplete: function (grid) {
// 提交
$(document.body).on("click", "#SUBMIT", submit);
$("#SUBMIT").on("click", submit);
// change事件
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
});
},
onSave: function (e) {
// 阻止后台请求,使用自定义
......@@ -50,6 +54,26 @@ let query = function () {
}
/**
* 供应商变更
*/
let supCodeChange = function (e) {
if (e.field != "supCode") {
return;
}
let item = e.items[0];
let supRecordRows = __eiInfo.blocks.sup_record_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < supRecordRows.length; i++) {
if (supRecordRows[i][1] === item.supCode) {
let supName = supRecordRows[i][0];
resultGrid.setCellValue(item, 'supName', supName == null ? "" : supName);
return;
}
}
}
}
/**
* 保存
*/
let save = function () {
......@@ -100,7 +124,7 @@ let submit = function () {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG002", "submit", true);
}
......
......@@ -28,7 +28,7 @@
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
......@@ -59,15 +59,20 @@
filter="contains" required="true">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" 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']"/>
......
......@@ -17,7 +17,7 @@
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
......@@ -46,15 +46,16 @@
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="100" align="center" maxLength="100" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center"
hidden="true"/>
<EF:EFColumn ename="sepcId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" 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']"/>
......
......@@ -96,7 +96,7 @@ let confirm = function () {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"确认\"操作? ", {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"收货\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCG003", "confirm", true);
}
......
......@@ -28,7 +28,7 @@
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
......@@ -55,24 +55,30 @@
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supCode" cname="供应商编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="depositQty" cname="入库数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" 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:EFRegion title="提示">
<span style="color: red">1."待确认"状态时,仅能修改收货数量。</span><br/>
<span style="color: red">2."质检完成"状态时,可修改"退货数量"和"入库数量",同时可进行收货确认。</span>
</EF:EFRegion>
</EF:EFPage>
......@@ -2,6 +2,9 @@ $(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
onRowClick: function (e){
setBcReceiveQty();
},
loadComplete: function (grid) {
}
}
......@@ -37,6 +40,14 @@ let resultCheckClick = function (){
if (action != true) {
return;
}
setBcReceiveQty();
});
}
/**
* 设置本次送货量
*/
let setBcReceiveQty = function (){
let checkRows = resultGrid.getCheckedRows();
let checkRowIndexs = resultGrid.getCheckedRowsIndex();
for (let rowNo = 0; rowNo < checkRowIndexs.length; rowNo++) {
......@@ -47,7 +58,6 @@ let resultCheckClick = function (){
resultGrid.setCellValue(index, "bcReceiveQty", bcMaxReceiveQty);
}
}
});
}
/**
......
......@@ -14,7 +14,7 @@
<EF:EFInput cname="计划单号" blockId="inqu_status" ename="planNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('1', '3')"/>
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('2', '4')"/>
</EF:EFSelect>
</div>
<div class="row">
......@@ -28,7 +28,7 @@
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
......@@ -51,28 +51,30 @@
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="bcReceiveQty" cname="本次</br>收货数量" width="100" align="right" format="{0:N3}"
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="bcReceiveQty" cname="本次</br>收货数量" width="100" align="right" format="{0:N0}"
required="true"/>
<EF:EFColumn ename="bcMaxReceiveQty" cname="本次最大</br>收货数量" enable="false" width="100" align="right"
format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N3}"/>
format="{0:N0}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N0}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left" defaultValue=""
filter="contains">
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" 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']"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [],
loadComplete: function (grid) {
// 确认
$("#CONFIRM").on("click", confirm);
// change事件
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
});
},
onSave: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
save();
},
onDelete: function (e) {
// 阻止后台请求,使用自定义
e.preventDefault();
remove();
}
}
}
// 查询
$("#QUERY").on("click", query);
// 选择收货
$("#SELECT_RECEIVE").on("click", selectReceive);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 仓库变更
*/
let supCodeChange = function (e) {
if (e.field != "whCode") {
return;
}
let item = e.items[0];
let whRecordRows = __eiInfo.blocks.wh_record_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < whRecordRows.length; i++) {
if (whRecordRows[i][1] === item.whCode) {
let whName = whRecordRows[i][0];
resultGrid.setCellValue(item, 'whName', whName == null ? "" : whName);
return;
}
}
}
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['whCode'])) {
message("勾选的第" + (i + 1) + "行仓库不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC001", "save", true);
}
});
}
/**
* 删除
*/
let remove = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC001", "remove", true);
}
});
}
/**
* 选择
*/
let selectReceive = function () {
JSColorbox.open({
href: "HGKC001A?methodName=initLoad",
title: "<div style='text-align: center;'>收货查询</div>",
width: "80%",
height: "80%",
callbackName: selectReceiveCallback
});
}
/**
* 选择回调
*/
let selectReceiveCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
<!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:EFDatePicker cname="入库日期" blockId="inqu_status" ename="receiveDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="入库单号" blockId="inqu_status" ename="depositNo" row="0" colWidth="3"/>
<EF:EFInput cname="收货单号" blockId="inqu_status" ename="receiveNo" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<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="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="depositDate" cname="入库日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="depositNo" cname="入库单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFOptions blockId="wh_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositWeight" cname="入库重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" 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:EFRegion title="提示">
<span style="color: red">说明:入库数据仅支持删除,不能修改。</span>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [],
loadComplete: function (grid) {
// change事件
grid.dataSource.bind("change", function (e) {
supCodeChange(e);
});
}
}
}
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 仓库变更
*/
let supCodeChange = function (e) {
if (e.field != "whCode") {
return;
}
let item = e.items[0];
let whRecordRows = __eiInfo.blocks.wh_record_block_id.rows;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) {
for (let i = 0; i < whRecordRows.length; i++) {
if (whRecordRows[i][1] === item.whCode) {
let whName = whRecordRows[i][0];
resultGrid.setCellValue(item, 'whName', whName == null ? "" : whName);
return;
}
}
}
}
/**
* 选择
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let whCode = rows[i]['whCode'];
if (isBlank(whCode)) {
message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return;
}
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购入库\"吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC001A", "confirm",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="收货查询">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="收货日期" blockId="inqu_status" ename="receiveDate" row="0" colWidth="3"
role="date" format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="收货单号" blockId="inqu_status" ename="receiveNo" row="0" colWidth="3"/>
<EF:EFSelect cname="公司名称" blockId="inqu_status" ename="companyCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="供应商名称" blockId="inqu_status" ename="supCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="sup_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" optionLabel="全部"
defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
format="yyyy-MM-dd HH:mm:ss" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiveDate" cname="收货日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="receiveNo" cname="收货单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="supCode" cname="供应商编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" width="120" align="left" defaultValue=""
filter="contains" required="true">
<EF:EFOptions blockId="wh_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" 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:EFPage>
$(function () {
IPLATUI.EFGrid = {
exportGrid: false, // 隐藏右侧自定义导出按钮
"result": {
columns: []
},
};
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
<!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="whCode" row="0" colWidth="3"
optionLabel="全部" filter="contains" defultValue="">
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货类型" blockId="inqu_status" ename="incentType" row="0" colWidth="3" optionLabel="全部"
filter="contains" defultValue="">
<%-- 1.原料,2.耗材,5废料 --%>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '5')"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="incentCode" row="0" colWidth="3" optionLabel="全部"
filter="contains" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3" optionLabel="全部"
filter="contains" defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField">
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="invQty" cname="库存数量" enable="false" width="120" align="right" format="{0:N0}"/>
<EF:EFColumn ename="invUnitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invWeight" cname="库存总重(T)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" 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:EFColumn ename="updatedName" 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>
</EF:EFPage>
......@@ -47,7 +47,13 @@ $(function () {
// 新增
$("#add").click(create);
//修改
$("#BNT_UPDATE").on("click", update);
$("#BNT_MODIFY").on("click", update);
//删除
$("#BNT_REMOVE").on("click", remove);
//删除
$("#BNT_COMPLETE").on("click", complete);
//删除
$("#BNT_COMMIT").on("click", commit);
},
onAdd: function(e) {
e.preventDefault();
......@@ -86,7 +92,11 @@ function create() {
function update() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1||rows.length > 1) {
message("请选择一条需要修改的数据");
message2("修改","请选择一条需要修改的数据");
return;
}
if(rows[0].approvalStatus>0){
message("修改","项目已提交不可修改!");
return;
}
let id = rows[0].id;
......@@ -96,7 +106,101 @@ function update() {
width: "90%",
height: "90%",
callbackName: windowCallback
});}
});
}
function remove() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message2("删除","没有选中的行");
return;
}
IPLAT.confirm({
title:'删除',
message:'确认删除此数据么?',
okFn:function () {
var post = new EiInfo();
post.addBlock(resultGrid.getCheckedBlockData());
post.set("recursion", true);
EiCommunicator.send("HGSC001","delete",post,{
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
})
}
function complete() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message2("完工","没有选中的行");
return;
}
IPLAT.confirm({
title:'完工',
message:'确认完工此数据么?',
okFn:function () {
var post = new EiInfo();
post.addBlock(resultGrid.getCheckedBlockData());
post.set("recursion", true);
EiCommunicator.send("HGSC001","complete",post,{
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
})
}
function commit() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message2("提交","没有选中的行");
return;
}
IPLAT.confirm({
title:'提交',
message:'确认提交此数据么?',
okFn:function () {
var post = new EiInfo();
post.addBlock(resultGrid.getCheckedBlockData());
post.set("recursion", true);
EiCommunicator.send("HGSC001","commit",post,{
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
})
}
function windowCallback() {
// 刷新列表
......
......@@ -32,7 +32,7 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="center"/>
......
......@@ -112,13 +112,9 @@ $(function () {
$("#btn_save").on("click",function(){
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:saveCallback});
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
});
var saveCallback = function(ei){
if (ei.getStatus() >= 0) {
parent.JSColorbox.close();
}
}
});
......@@ -112,13 +112,9 @@ $(function () {
$("#btn_save").on("click",function(){
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:saveCallback});
JSUtils.submitGrid("detail", "HGSC001", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
});
var saveCallback = function(ei){
if (ei.getStatus() >= 0) {
parent.JSColorbox.close();
}
}
});
......@@ -8,6 +8,8 @@
<EF:EFPage title="项目详情">
<EF:EFRegion id="inqu" title="项目信息">
<div class="row">
<EF:EFInput ename="result-0-id" cname="主键ID" type="hidden"/>
<EF:EFInput ename="result-0-approvalStatus" cname="审批状态" type="hidden"/>
<EF:EFInput ename="result-0-companyName" cname="公司名称" type="hidden"/>
<EF:EFSelect cname="公司" ename="result-0-companyCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="-- 请选择 --" value="" />
......
......@@ -81,6 +81,18 @@ function message(msg) {
}
/**
* 消息提示
* @param title
* @param msg
*/
function message2(title,msg) {
WindowUtil({
title: title,
content: "<div class='kendo-del-message'>" + msg + "</div>"
});
}
/**
* 文件下载路径
*
* @param docId
......
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