Commit 4bae64d6 by liuyang

2024-06-11 库存盘点单

parent 6fdf5c1d
...@@ -104,16 +104,14 @@ public enum DdynamicEnum { ...@@ -104,16 +104,14 @@ public enum DdynamicEnum {
* 用途:存货档案下拉框 * 用途:存货档案下拉框
* 编写: * 编写:
*/ */
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick", INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick", "coefficient", "HGPZ005.queryComboBoxAll"),
"coefficient", "HGPZ005.queryComboBoxAll"),
/** /**
* 模块:存货档案(ALL 不默认状态) * 模块:存货档案(ALL 不默认状态)
* 用途:存货档案下拉框 * 用途:存货档案下拉框
* 编写: * 编写:
*/ */
INVENT_ALL_BOX_BLOCK_ID("invent_all_box_block_id", "id", "spec", "material", "unit", "length", "width", "thick", INVENT_ALL_BOX_BLOCK_ID("invent_all_box_block_id", "id", "spec", "material", "unit", "length", "width", "thick", "coefficient","status", "HGPZ005.queryInventBoxAll"),
"coefficient","status", "HGPZ005.queryInventBoxAll"),
/** /**
* 模块:规格下拉框 * 模块:规格下拉框
......
...@@ -106,47 +106,14 @@ public class HGSqlConstant { ...@@ -106,47 +106,14 @@ public class HGSqlConstant {
* @author:songx * @author:songx
* @date:2024/1/20,16:45 * @date:2024/1/20,16:45
*/ */
public class HgKc003 { /*public class HgKc003 {
// 模块名称 // 模块名称
private static final String MODULE_NAME = "HGKC003."; private static final String MODULE_NAME = "HGKC003.";
// 锁 // 锁
public static final String LOCK = MODULE_NAME + "lock"; public static final String LOCK = MODULE_NAME + "lock";
} }*/
/**
* HPKC005 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgKc005 {
// 查询
public static final String QUERY_SUM = "HGKC005.querySum";
// 锁
public static final String LOCK = "HGKC005.lock";
// 统计
public static final String STAT_DATE = "HGKC005.statDate";
}
/**
* HGKC010 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 LOCKS = MODULE_NAME + "locks";
// 修改库存
public static final String UPDATE_INV = MODULE_NAME + "updateInv";
}
/** /**
* HGKC011 SQL 定义 * HGKC011 SQL 定义
...@@ -338,8 +305,14 @@ public class HGSqlConstant { ...@@ -338,8 +305,14 @@ public class HGSqlConstant {
*/ */
public class HGKC010 { public class HGKC010 {
// 模块名称
private static final String MODULE_NAME = "HGKC010.";
// 锁 // 锁
public static final String LOCK = "HGKC010.lock"; public static final String LOCK = MODULE_NAME + "lock";
// 锁
public static final String LOCKS = MODULE_NAME + "locks";
// 修改库存
public static final String UPDATE_INV = MODULE_NAME + "updateInv";
} }
/** /**
......
...@@ -54,6 +54,7 @@ public class HGKC005 extends DaoEPBase { ...@@ -54,6 +54,7 @@ public class HGKC005 extends DaoEPBase {
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/ public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/ public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/ public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String FIELD_IS_AMOUNT = "isAmount";
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......
...@@ -283,7 +283,7 @@ public class ServiceHGKC009 extends ServiceBase { ...@@ -283,7 +283,7 @@ public class ServiceHGKC009 extends ServiceBase {
Map<String, HGPZ007> mapPz007 = HGPZTools.HgPz007.map(whCodes); Map<String, HGPZ007> mapPz007 = HGPZTools.HgPz007.map(whCodes);
// 存货名称 // 存货名称
List<Long> recordIds = kc009s.stream().map(HGKC009::getInventRecordId).collect(Collectors.toList()); List<Long> recordIds = kc009s.stream().map(HGKC009::getInventRecordId).collect(Collectors.toList());
Map<Long, HGPZ005> mapPz005 = HGPZTools.HgPz005.map(recordIds); Map<Long, HGPZ005> mapPz005 = HGPZTools.HgPz005.maps(recordIds);
for (HGKC009 kc009 : kc009s) { for (HGKC009 kc009 : kc009s) {
// 仓库名称 // 仓库名称
String whCode = kc009.getWhCode(); String whCode = kc009.getWhCode();
......
...@@ -2,8 +2,11 @@ package com.baosight.hggp.hg.kc.service; ...@@ -2,8 +2,11 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC010; import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
...@@ -13,10 +16,14 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -13,10 +16,14 @@ import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays; import java.math.BigDecimal;
import java.util.HashMap; import java.util.*;
import java.util.Map;
/** /**
* @author:songx * @author:songx
...@@ -105,4 +112,166 @@ public class ServiceHGKC010 extends ServiceBase { ...@@ -105,4 +112,166 @@ public class ServiceHGKC010 extends ServiceBase {
} }
/**
* 更新库存
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "实时库存管理", operType = "修改", operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo) {
String whCode = inInfo.getString(HGKC010.FIELD_WH_CODE);
String whName = inInfo.getString(HGKC010.FIELD_WH_NAME);
Long inventRecordId = Long.parseLong(inInfo.getString(HGKC010.FIELD_SPEC_ID));
BigDecimal amount = new BigDecimal(inInfo.getString(HGKC010.FIELD_INV_QTY));
BigDecimal weight = new BigDecimal(inInfo.getString(HGKC010.FIELD_INV_WEIGHT));
String unitWeightStr = inInfo.getString(HGKC010.FIELD_INV_UNIT_WEIGHT);
BigDecimal unitWeight = unitWeightStr == null ? BigDecimal.ZERO : new BigDecimal(unitWeightStr);
String companyCode = inInfo.getString(HGKC010.FIELD_COMPANY_CODE);
String companyName = inInfo.getString(HGKC010.FIELD_COMPANY_NAME);
try {
checkUpdateStockParam(companyCode, whCode, inventRecordId, amount, weight);
HGKC010 newObj = generatorBaseInfo(companyCode, companyName, whCode, whName, inventRecordId, amount, unitWeight, weight);
List<HGKC010> list = dao.query(HGKC010.QUERY, new HashMap<String, Object>() {{
put(HGKC010.FIELD_COMPANY_CODE, companyCode);
put(HGKC010.FIELD_WH_CODE, whCode);
put(HGKC010.FIELD_SPEC_ID, inventRecordId);
}});
if (CollectionUtils.isEmpty(list)) {
//新增
if (amount.compareTo(BigDecimal.ZERO) < 0
|| weight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
generatorBaseInfo(newObj);
newObj.setCompanyCode(companyCode);
newObj.setCompanyName(companyName);
DaoUtils.insert(HGKC010.INSERT, newObj);
} else {
//修改
HGKC010 oldObj = list.get(0);
BigDecimal afterAmout = oldObj.getInvQty().add(amount);
BigDecimal afterWeight = oldObj.getInvWeight().add(weight);
if (afterAmout.compareTo(BigDecimal.ZERO) < 0 || afterWeight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
}
oldObj.setInvQty(afterAmout);
oldObj.setInvWeight(afterWeight);
oldObj.setUpdatedBy(newObj.getUpdatedBy());
oldObj.setUpdatedName(newObj.getUpdatedName());
oldObj.setUpdatedTime(newObj.getUpdatedTime());
int result = DaoUtils.update(HGKC010.UPDATE_INV,oldObj);
if(result!=1){
throw new PlatException("库存更新失败,库存已发生变更或系统异常,请重试!");
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("库存更新成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
}
return inInfo;
}
/**
* 生成库存对象
*
* @param companyCode
* @param whCode
* @param inventRecordId
* @param amout
* @param weight
* @reutrn HPKC010
*/
private HGKC010 generatorBaseInfo(String companyCode,String companyName,String whCode, String whName, Long inventRecordId, BigDecimal amout,
BigDecimal unitWeight, BigDecimal weight) {
HGKC010 hpkc010 = new HGKC010();
hpkc010.setCompanyCode(companyCode);
hpkc010.setCompanyName(companyName);
hpkc010.setWhName(whName);
hpkc010.setWhCode(whCode);
hpkc010.setSpecId(inventRecordId);
hpkc010.setInvQty(amout);
hpkc010.setInvUnitWeight(unitWeight);
hpkc010.setInvWeight(weight);
String userId = UserSession.getLoginName();
String userName = UserSession.getLoginCName();
String time = DateUtils.curDateTimeStr14();
hpkc010.setCreatedBy(userId);
hpkc010.setCreatedName(userName);
hpkc010.setCreatedTime(time);
hpkc010.setUpdatedBy(userId);
hpkc010.setUpdatedName(userName);
hpkc010.setUpdatedTime(time);
return hpkc010;
}
private void generatorBaseInfo(HGKC010 hpkc010) {
String whName = "";
String inventType = "";
String inventCode = "";
String inventName = "";
EiInfo inInfo = new EiInfo();
try {
inInfo.set(HGKC010.FIELD_WH_CODE, hpkc010.getWhCode());
inInfo.set(EiConstant.serviceName, "HPPZ007");
inInfo.set(EiConstant.methodName, "queryByWhCode");
EiInfo outInfo = XLocalManager.call(inInfo);
List<HGPZ007> whNameList = (List) outInfo.get("list");
whName = whNameList.get(0).getWhName();
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("仓库编码异常,找不到对应的仓库档案!");
}
try {
inInfo.setRows(EiConstant.queryBlock,new ArrayList(){{add(new HashMap<String,Object>(){{put("id",hpkc010.getSpecId());}});}});
inInfo.set(EiConstant.serviceName, "HPPZ005");
inInfo.set(EiConstant.methodName, "query");
EiInfo outInfo = XLocalManager.call(inInfo);
HGPZ005 hppz005 = new HGPZ005();
List<Map> inventList = outInfo.getBlock(EiConstant.resultBlock).getRows();
hppz005.fromMap(inventList.get(0));
inventType = hppz005.getInventType();
inventCode = hppz005.getInventCode();
inventName = hppz005.getInventName();
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "库存更新失败!");
throw new PlatException("存货档案ID异常,找不到对应的存货档案!");
}
hpkc010.setWhName(whName);
hpkc010.setInventType(inventType.toString());
hpkc010.setInventCode(inventCode);
hpkc010.setInventName(inventName);
//hpkc010.setVersion(new Integer(1));
}
/**
* 校验库存变更请求参数
* @param companyCode
* @param whCode
* @param inventRecordId
* @param amout
* @param weight
*/
private void checkUpdateStockParam(String companyCode, String whCode, Long inventRecordId
, BigDecimal amout, BigDecimal weight){
if(StringUtils.isBlank(companyCode)){
throw new PlatException("企业编码不能为空!");
}
if(StringUtils.isBlank(whCode)){
throw new PlatException("仓库编码不能为空!");
}
if(Objects.isNull(inventRecordId)||inventRecordId==0){
throw new PlatException("存货档案ID不能为空!");
}
if(Objects.isNull(amout)||
Objects.isNull(amout)){
throw new PlatException("库存变更数量或重量不能为空!");
}
if(amout.compareTo(BigDecimal.ZERO)==0
&&weight.compareTo(BigDecimal.ZERO)==0){
throw new PlatException("库存变更数量或重量不能为0)!");
}
}
} }
...@@ -86,6 +86,9 @@ ...@@ -86,6 +86,9 @@
<isNotEmpty prepend=" AND " property="factoryName"> <isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName# FACTORY_NAME = #factoryName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="isAmount">
INV_QTY != 0
</isNotEmpty>
</sql> </sql>
<sql id="idCondition"> <sql id="idCondition">
...@@ -95,6 +98,9 @@ ...@@ -95,6 +98,9 @@
<isNotEmpty prepend=" AND " property="ids"> <isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypes">
INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
...@@ -108,7 +114,7 @@ ...@@ -108,7 +114,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID DESC CREATED_TIME DESC, ID DESC
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</sql> </sql>
...@@ -194,6 +200,9 @@ ...@@ -194,6 +200,9 @@
<update id="updateInv"> <update id="updateInv">
UPDATE ${hggpSchema}.HGKC010 UPDATE ${hggpSchema}.HGKC010
SET SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
INV_QTY = #invQty#, <!-- 库存数量 --> INV_QTY = #invQty#, <!-- 库存数量 -->
INV_UNIT_WEIGHT = #invUnitWeight#, <!-- 库存单重 --> INV_UNIT_WEIGHT = #invUnitWeight#, <!-- 库存单重 -->
INV_WEIGHT = #invWeight# <!-- 库存重量 --> INV_WEIGHT = #invWeight# <!-- 库存重量 -->
......
...@@ -291,7 +291,7 @@ public class HGKCTools { ...@@ -291,7 +291,7 @@ public class HGKCTools {
} }
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("depositNos", depositNos); paramMap.put("depositNos", depositNos);
DaoBase.getInstance().update(HGSqlConstant.HgKc003.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HGKC003.LOCK, paramMap);
} }
/** /**
...@@ -465,7 +465,7 @@ public class HGKCTools { ...@@ -465,7 +465,7 @@ public class HGKCTools {
* @author:songx * @author:songx
* @date:2024/1/31,16:36 * @date:2024/1/31,16:36
*/ */
public static class HpKc005 { public static class HgKc005 {
/** /**
* 锁 * 锁
...@@ -479,7 +479,7 @@ public class HGKCTools { ...@@ -479,7 +479,7 @@ public class HGKCTools {
} }
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("checkNos", checkNos); queryMap.put("checkNos", checkNos);
DaoBase.getInstance().update(HGSqlConstant.HgKc005.LOCK, queryMap); DaoBase.getInstance().update(HGSqlConstant.HGKC005.LOCK, queryMap);
} }
/** /**
...@@ -521,8 +521,8 @@ public class HGKCTools { ...@@ -521,8 +521,8 @@ public class HGKCTools {
* @param amount * @param amount
* @param weight * @param weight
*/ */
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight,String factCode) { public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight,String companyCode,String companyName) {
updateStock(whCode, inventRecordId, amount,weight, weight,factCode); updateStock(whCode, inventRecordId, amount,weight, weight,companyCode,companyName);
} }
/** /**
...@@ -535,17 +535,39 @@ public class HGKCTools { ...@@ -535,17 +535,39 @@ public class HGKCTools {
* @param weight * @param weight
*/ */
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal unitWeight, public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal unitWeight,
BigDecimal weight,String factoryCode) { BigDecimal weight,String companyCode,String companyName) {
if (amount.compareTo(BigDecimal.ZERO) == 0) { if (amount.compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("入库数量不能为空"); throw new PlatException("入库数量不能为空");
} }
EiInfo inInfo = new EiInfo(); EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode); inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId); inInfo.set("specId", inventRecordId);
inInfo.set("amount", amount); inInfo.set("invQty", amount);
inInfo.set("unitWeight", unitWeight); inInfo.set("invUnitWeight", unitWeight);
inInfo.set("weight", weight); inInfo.set("invWeight", weight);
inInfo.set("factoryCode", factoryCode); inInfo.set("companyCode", companyCode);
inInfo.set("companyName", companyName);
inInfo.set(EiConstant.serviceName, "HGKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
public static void updateStock(HGKC005 hgKc005) {
if (hgKc005.getDiffAmount().compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("入库数量不能为空");
}
EiInfo inInfo = new EiInfo();
inInfo.set("companyCode", hgKc005.getCompanyCode());
inInfo.set("companyName", hgKc005.getCompanyName());
inInfo.set("whCode", hgKc005.getWhCode());
inInfo.set("whName", hgKc005.getWhName());
inInfo.set("specId", hgKc005.getInventRecordId());
inInfo.set("invQty", hgKc005.getDiffAmount());
inInfo.set("invUnitWeight", hgKc005.getBookUnitWeight());
inInfo.set("invWeight", hgKc005.getDiffWeight());
inInfo.set(EiConstant.serviceName, "HGKC010"); inInfo.set(EiConstant.serviceName, "HGKC010");
inInfo.set(EiConstant.methodName, "updateStock"); inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo); EiInfo outInfo = XLocalManager.call(inInfo);
...@@ -645,7 +667,7 @@ public class HGKCTools { ...@@ -645,7 +667,7 @@ public class HGKCTools {
} }
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("ids", ids); paramMap.put("ids", ids);
DaoBase.getInstance().update(HGSqlConstant.HgKc010.LOCKS, paramMap); DaoBase.getInstance().update(HGSqlConstant.HGKC010.LOCKS, paramMap);
} }
...@@ -665,7 +687,7 @@ public class HGKCTools { ...@@ -665,7 +687,7 @@ public class HGKCTools {
paramMap.put("companyCode", companyCode); paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode); paramMap.put("whCode", whCode);
paramMap.put("specId", specId); paramMap.put("specId", specId);
DaoBase.getInstance().update(HGSqlConstant.HgKc010.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HGKC010.LOCK, paramMap);
} }
/** /**
......
...@@ -336,7 +336,7 @@ public class HGKCUtils { ...@@ -336,7 +336,7 @@ public class HGKCUtils {
dbKc010.setInvQty(newQty); dbKc010.setInvQty(newQty);
dbKc010.setInvWeight(newWeight); dbKc010.setInvWeight(newWeight);
dbKc010.setInvUnitWeight(newUnitWeight); dbKc010.setInvUnitWeight(newUnitWeight);
DaoUtils.update(HGSqlConstant.HgKc010.UPDATE_INV, dbKc010); DaoUtils.update(HGSqlConstant.HGKC010.UPDATE_INV, dbKc010);
} }
/** /**
......
...@@ -58,6 +58,7 @@ public class HGPZ007 extends DaoEPBase { ...@@ -58,6 +58,7 @@ public class HGPZ007 extends DaoEPBase {
public static final String INSERT = "HGPZ007.insert"; public static final String INSERT = "HGPZ007.insert";
public static final String UPDATE = "HGPZ007.update"; public static final String UPDATE = "HGPZ007.update";
public static final String DELETE = "HGPZ007.delete"; public static final String DELETE = "HGPZ007.delete";
public static final String QUERY_BY_WH_CODE = "HGPZ007.queryByWhCode";
private Long id = new Long(0); /* 主键ID*/ private Long id = new Long(0); /* 主键ID*/
private String accountCode = " "; /* 帐套编码*/ private String accountCode = " "; /* 帐套编码*/
......
...@@ -247,5 +247,20 @@ public class ServiceHGPZ007 extends ServiceBase { ...@@ -247,5 +247,20 @@ public class ServiceHGPZ007 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 根据仓库CODE找对象
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "根据仓库CODE找对象")
public EiInfo queryByWhCode(EiInfo inInfo) {
Map params = new HashMap<>();
params.put(HGPZ007.FIELD_WH_CODE, inInfo.getString(HGPZ007.FIELD_WH_CODE));
List query = dao.query(HGPZ007.QUERY_BY_WH_CODE, params);
inInfo.set("list", query);
return inInfo;
}
} }
...@@ -28,7 +28,33 @@ ...@@ -28,7 +28,33 @@
--> -->
<sqlMap namespace="HGPZ005"> <sqlMap namespace="HGPZ005">
<typeAlias alias="HGPZ005" type="com.baosight.hggp.hg.pz.domain.HGPZ005"/>
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
MATERIAL as "material", <!-- 材质 -->
COEFFICIENT as "coefficient", <!-- 系数 -->
UNIT as "unit", <!-- 单位 -->
STATUS as "status", <!-- 状态 0未启用 1启用 -->
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.是 -->
FLOW_ID as "flowId"
</sql>
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -98,56 +124,21 @@ ...@@ -98,56 +124,21 @@
<isNotEmpty prepend=" AND " property="inventCodes"> <isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate> INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotNull prepend=" AND " property="notSpec">
<isEqual property="notSpec" compareValue="Y">
SPEC = ''
</isEqual>
</isNotNull>
<isNotEmpty prepend=" AND " property="inventTypes">
INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="authCondition"> <select id="query" parameterClass="java.util.HashMap" resultClass="HGPZ005">
<!-- 无权限时使用 -->
<isNotEmpty prepend=" AND " property="authDepCode">
DEP_CODE = #authDepCode#
</isNotEmpty>
<!-- 仅本人和部门组合 -->
<isEqual prepend=" AND " property="authCombination" compareValue="1">
(CREATED_BY = #authOnlyPeople# OR DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>)
</isEqual>
<!-- 仅本人或部门 -->
<isNotEqual prepend=" AND " property="authCombination" compareValue="1">
<isNotEmpty property="authOnlyPeople">
CREATED_BY = #authOnlyPeople#
</isNotEmpty>
<isNotEmpty property="authDepCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="authDepCodes">#authDepCodes[]#</iterate>
</isNotEmpty>
</isNotEqual>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.pz.domain.HGPZ005">
SELECT SELECT
ID as "id", <include refid="column"/>
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC as "spec", <!-- 规格 -->
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
MATERIAL as "material", <!-- 材质 -->
COEFFICIENT as "coefficient", <!-- 系数 -->
UNIT as "unit", <!-- 单位 -->
STATUS as "status", <!-- 状态 0未启用 1启用 -->
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.是 -->
FLOW_ID as "flowId"
FROM ${hggpSchema}.HGPZ005 WHERE 1=1 AND DELETE_FLAG = 0 FROM ${hggpSchema}.HGPZ005 WHERE 1=1 AND DELETE_FLAG = 0
<include refid="condition" /> <include refid="condition" />
<include refid="authCondition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -156,15 +147,20 @@ ...@@ -156,15 +147,20 @@
CREATED_TIME desc CREATED_TIME desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ005 WHERE 1=1 AND DELETE_FLAG = 0 SELECT COUNT(*) FROM ${hggpSchema}.HGPZ005 WHERE 1=1 AND DELETE_FLAG = 0
<include refid="condition" /> <include refid="condition" />
<include refid="authCondition" />
</select> </select>
<!--<select id="get" resultClass="HGPZ005">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGPZ005 WHERE 1=1
<include refid="condition"/>
</select>-->
<!-- <!--
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
...@@ -301,8 +297,7 @@ ...@@ -301,8 +297,7 @@
ID = #id# ID = #id#
</update> </update>
<select id="queryComboBox" parameterClass="java.util.HashMap" <select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
INVENT_CODE as "inventCode", INVENT_CODE as "inventCode",
INVENT_NAME as "inventName" INVENT_NAME as "inventName"
...@@ -318,8 +313,7 @@ ...@@ -318,8 +313,7 @@
ORDER BY INVENT_CODE ORDER BY INVENT_CODE
</select> </select>
<select id="queryInventCodeBox" parameterClass="java.util.HashMap" <select id="queryInventCodeBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
INVENT_CODE as "inventCode", INVENT_CODE as "inventCode",
INVENT_NAME as "inventName", INVENT_NAME as "inventName",
...@@ -338,8 +332,7 @@ ...@@ -338,8 +332,7 @@
ORDER BY INVENT_CODE ORDER BY INVENT_CODE
</select> </select>
<select id="queryProductComboBox" parameterClass="java.util.HashMap" <select id="queryProductComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
a.ID as "id", a.ID as "id",
a.INVENT_TYPE as "inventType", a.INVENT_TYPE as "inventType",
...@@ -368,21 +361,19 @@ ...@@ -368,21 +361,19 @@
</isNotEmpty> </isNotEmpty>
ORDER BY INVENT_CODE ORDER BY INVENT_CODE
</select> </select>
<!-- 缺省下拉框 --> <!-- 缺省下拉框 -->
<select id="queryComboBoxAll" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryComboBoxAll" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
ID AS "id", ID AS "id",
(CASE WHEN SPEC = '' THEN '无规格' ELSE SPEC END) AS "spec", (CASE WHEN SPEC = '' THEN '无规格' ELSE SPEC END) AS "spec",
LENGTH AS "length" , <!-- 长 --> MATERIAL AS "material", <!-- 材质 -->
WIDTH AS "width" , <!-- 宽 --> UNIT AS "unit", <!-- 单位 -->
THICK AS "thick" , <!-- 厚 --> LENGTH AS "length", <!-- 长 -->
COEFFICIENT AS "coefficient" , <!-- 系数 --> WIDTH AS "width", <!-- 宽 -->
MATERIAL AS "material" , <!-- 材质 --> THICK AS "thick", <!-- 厚 -->
UNIT AS "unit" <!-- 单位 --> COEFFICIENT AS "coefficient" <!-- 系数 -->
FROM ${hggpSchema}.HGPZ005 FROM ${hggpSchema}.HGPZ005
WHERE DELETE_FLAG = 0 WHERE DELETE_FLAG = 0 AND STATUS = 1
AND STATUS = 1
<include refid="condition"/> <include refid="condition"/>
ORDER BY ID ORDER BY ID
</select> </select>
...@@ -422,15 +413,13 @@ ...@@ -422,15 +413,13 @@
<include refid="condition"/> <include refid="condition"/>
ORDER BY ID ORDER BY ID
</select> </select>
<!-- 规格下拉框(无ID) --> <!-- 规格下拉框(无ID) -->
<select id="queryComboBoxSpecName" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryComboBoxSpecName" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
(CASE WHEN COALESCE(SPEC, '') = '' THEN '无规格' ELSE SPEC END) AS "spec" (CASE WHEN COALESCE(SPEC, '') = '' THEN '无规格' ELSE SPEC END) AS "spec"
FROM ${hggpSchema}.HGPZ005 FROM ${hggpSchema}.HGPZ005
WHERE 1=1 WHERE 1=1
AND DELETE_FLAG = 0 AND DELETE_FLAG = 0 AND STATUS = 1
AND STATUS = 1
<include refid="condition"/> <include refid="condition"/>
ORDER BY SPEC DESC ORDER BY SPEC DESC
</select> </select>
......
...@@ -258,4 +258,12 @@ ...@@ -258,4 +258,12 @@
ORDER BY WH_CODE ORDER BY WH_CODE
</select> </select>
<!-- 根据编码查名称 -->
<select id="queryByWhCode" resultClass="com.baosight.hggp.hg.pz.domain.HGPZ007">
SELECT WH_NAME as "whName"
FROM ${hggpSchema}.HGPZ007
WHERE DELETE_FLAG = 0
AND WH_CODE = #whCode#
</select>
</sqlMap> </sqlMap>
...@@ -642,66 +642,4 @@ public class HGPZTools { ...@@ -642,66 +642,4 @@ 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
* @date:2024/2/6,13:37
*/
public static class HgPz009 {
/**
* 查询企业信息
*
* @param accountCode
* @return
*/
public static HGPZ009 getByCode(String accountCode) {
AssertUtils.isEmpty(accountCode, "企业编码不能为空");
Map queryMap = new HashMap();
queryMap.put("accountCode", accountCode);
List<HGPZ009> pz009s = DaoBase.getInstance().query(HGPZ009.QUERY, queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
}
/**
* 企业是否启用
*
* @param accountCode
* @return
*/
public static boolean isValid(String accountCode) {
HGPZ009 pz009 = getByCode(accountCode);
if (pz009 == null) {
return false;
}
return !ValidFlagEnum.STOP.getCode().equals(pz009.getValidFlag());
}
}
} }
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC003.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC005.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC006.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC006A.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC006A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC007.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC007.xml"/>
...@@ -69,6 +70,7 @@ ...@@ -69,6 +70,7 @@
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW017.xml"/> <sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW017.xml"/>
<!--配置--> <!--配置-->
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005.xml"/>
<sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/> <sqlMap resource="com/baosight/hggp/hg/pz/sql/HGPZ005A.xml"/>
<!--销售--> <!--销售-->
......
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