Commit b70abca8 by “zhangzhichao_123”

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

parents 7cb2ed91 c4b2eecd
......@@ -155,6 +155,12 @@
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
</dependencies>
<build>
......
package com.baosight.hpjx.aspect;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.data.ibatis.dao.SqlMapDaoLogProxy;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.util.HashMap;
import java.util.Map;
/**
* 切面处理类,操作日志异常日志记录处理
*/
@Aspect //记录日志实现性能跟踪以及用户行为分析
@Component
public class OperationLogAspect {
private static Dao dao = (Dao) PlatApplicationContext.getBean("dao");
/**
* 设置操作日志切入点 记录操作日志 在注解的位置切入代码
*/
@Pointcut("@annotation(com.baosight.hpjx.aspect.annotation.OperationLogAnnotation)")
public void operLogPointCut() {
}
/**
* 设置操作异常切入点记录异常日志 扫描所有dc包下操作
*/
@Pointcut("execution(* com.baosight.hpjx.hp.*.service..*.*(..))")
public void operExceptionLogPointCut() {
}
/**
* 正常返回通知,拦截用户操作日志,连接点正常执行完成后执行, 如果连接点抛出异常,则不会执行
*
* @param joinPoint 切入点
* @param keys 返回结果
*/
@AfterReturning(value = "operLogPointCut()", returning = "keys")
public void saveOperLog(JoinPoint joinPoint, Object keys) {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
OperationLogAnnotation opLog = method.getAnnotation(OperationLogAnnotation.class);
if (opLog != null) {
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
String userId = UserSession.getLoginName();
String loginName = UserSession.getLoginCName();
String operModul = opLog.operModul();
String operType = opLog.operType();
String operDesc = opLog.operDesc();
boolean saveContet = opLog.saveContent();
String sql = "INSERT INTO hpjx.SYS_OPERATION_LOG (OPER_MODUL,OPER_TYPE,OPER_DESC," +
"OPER_CONTENT,COMPANY_CODE,CREATED_BY,CREATED_NAME,CREATED_TIME)" +
" VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement ps = ((SqlMapDaoLogProxy) dao).getSqlMapClient().getDataSource().getConnection().prepareStatement(sql);
ps.setString(1,operModul);
ps.setString(2,operType);
ps.setString(3,operDesc);
if(saveContet && joinPoint.getArgs() != null) {
String strBlock = EiConstant.resultBlock;
EiInfo result = ((EiInfo) joinPoint.getArgs()[0]);
ps.setString(4, JSONObject.toJSONString(((EiInfo) joinPoint.getArgs()[0]).getBlock(strBlock).getRows().get(0)));
}else {
ps.setString(4, "");
}
ps.setString(5,companyCode);
ps.setString(6,userId);
ps.setString(7,loginName);
ps.setString(8,DateUtils.shortDateTime());
ps.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 异常返回通知,用于拦截异常日志信息 连接点抛出异常后执行
*
* @param joinPoint 切入点
* @param e 异常信息
*/
@AfterThrowing(pointcut = "operExceptionLogPointCut()", throwing = "e")
public void saveExceptionLog(JoinPoint joinPoint, Throwable e) {
// 获取RequestAttributes
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
// 从获取RequestAttributes中获取HttpServletRequest的信息
HttpServletRequest request = (HttpServletRequest) requestAttributes
.resolveReference(RequestAttributes.REFERENCE_REQUEST);
try {
// 从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// 获取切入点所在的方法
Method method = signature.getMethod();
// 获取请求的类名
String className = joinPoint.getTarget().getClass().getName();
// 获取请求的方法名
String methodName = method.getName();
methodName = className + "." + methodName;
// 请求的参数
Map<String, String> rtnMap = converMap(request.getParameterMap());
// 将参数所在的数组转换成json
String params = JSON.toJSONString(rtnMap);
// 异常信息
String errorMsg = stackTraceToString(e.getClass().getName(), e.getMessage(), e.getStackTrace());
//TODO 异常信息持久化
System.out.println(params);
System.out.println(errorMsg);
} catch (Exception e2) {
e2.printStackTrace();
}
}
/**
* 转换request 请求参数
*
* @param paramMap request获取的参数数组
*/
public Map<String, String> converMap(Map<String, String[]> paramMap) {
Map<String, String> rtnMap = new HashMap<String, String>();
for (String key : paramMap.keySet()) {
rtnMap.put(key, paramMap.get(key)[0]);
}
return rtnMap;
}
/**
* 转换异常信息为字符串
*
* @param exceptionName 异常名称
* @param exceptionMessage 异常信息
* @param elements 堆栈信息
*/
public String stackTraceToString(String exceptionName, String exceptionMessage, StackTraceElement[] elements) {
StringBuffer strbuff = new StringBuffer();
for (StackTraceElement stet : elements) {
strbuff.append(stet + "\n");
}
String message = exceptionName + ":" + exceptionMessage + "\n\t" + strbuff.toString();
return message;
}
}
\ No newline at end of file
package com.baosight.hpjx.aspect.annotation;
import java.lang.annotation.*;
/**
* @description: 自定义操作日志注解
*/
@Target(ElementType.METHOD) //方法
@Retention(RetentionPolicy.RUNTIME) //生命周期
@Documented
public @interface OperationLogAnnotation {
String operModul() default ""; // 操作模块
String operType() default ""; // 操作类型
String operDesc() default ""; // 操作说明
boolean saveContent() default false;
}
......@@ -184,8 +184,23 @@ public enum DdynamicEnum {
* 用途:物料清单部件类型 耗材 零件 部件
* 编写:ly
*/
CODESET_CODE_BLOCK_ID("codeset_code_block_id","itemCode","itemCname","HPSC002.querySmallCode");
CODESET_CODE_BLOCK_ID("codeset_code_block_id","itemCode","itemCname","HPSC002.querySmallCode"),
/**
* 模块:日志管理
* 用途:日志查询
* 编写:wan
*/
OPER_MODUL_BLOCK_ID("oper_modul_block_id","operModul","operModul","HPRZ001.queryOperModulComboBox"),
/**
* 模块:日志管理
* 用途:日志查询
* 编写:wan
*/
OPER_TYPE_BLOCK_ID("oper_type_block_id","operType","operType","HPRZ001.queryOperTypeComboBox");
/** 将结果集放入的块名 */
private final String blockId;
/** 字段名 */
......
package com.baosight.hpjx.common;
/**
* ErrorCodeEnum
*
* @author 张弘毅
* @date 2018-10-31 14:21
*/
public enum ErrorCodeEnum {
//数据库常见异常列表
DB_ERROR_CODE_F803("-803","数据库中已有相同主键的条目,错误编码:-803"),//不能插入行,因为这将违反唯一索引的约束
DB_ERROR_CODE_Z204("+204","命名的对象未在DB2中定义,错误编码:+204"),
DB_ERROR_CODE_F204("-204","没有定义的对象名,错误编码:-204"),
DB_ERROR_CODE_F302("-302","新增或修改中有数据不符合要求,错误编码:-302"),//输入的变量值对指定的列无效
DB_ERROR_CODE_F402("-402","算术函数不能用于字符或日期时间数据,错误编码:-402"),
DB_ERROR_CODE_F119("-119","HAVING语句中的列的列表与GROUP BY语句中的列列表不匹配,错误编码:-119"),
DB_ERROR_CODE_F117("-117","待插入的数值的个数于被插入的行中的列数不相等,错误编码:-117"),
DB_ERROR_CODE_F407("-407","主键不能有空或全为空,错误编码:-407"),
;
private String code;
private String description;
ErrorCodeEnum(String code, String description) {
this.code = code;
this.description = description;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
}
......@@ -54,5 +54,9 @@ public class HPConstants {
/** 前后台交互下拉框字段 字段名 dzg */
public static final String VALUE_FIELD = "valueField";
public static final String PARAM_FILENAME = "fileName";
/** domain字段 PARAM_FILENAME 导入文件暂存路径 LC*/
public static final String PARAM_CLASSNAME = "className";
}
......@@ -38,4 +38,22 @@ public class CommonConstant {
public static final String DAY = "DAY";
}
/**
* 常用字段常量
*
* @author:songx
* @date:2024/2/22,15:33
*/
public static class Field {
// DETAIL
public static final String DETAIL = "detail";
// ID
public static final String ID = "id";
// 生产订单号
public static final String PROD_ORDER_NO = "prodOrderNo";
// 生产订单号2
public static final String PRODUCTTION_ORDER_NO = "productionOrderNo";
}
}
......@@ -62,7 +62,7 @@ public class HPBI001 extends DaoEPBase {
private String yearValue = " "; /* 供应商编码*/
private String janValue = " "; /* 供应商名称*/
private String febValue = " "; /* 地址*/
private Integer marValue = 1; /* 状态 0禁用 1启用*/
private String marValue = " "; /* 状态 0禁用 1启用*/
private String aprValue = " "; /* 创建人*/
private String mayValue = " "; /* 创建人名称*/
private String junValue = " "; /* 创建时间*/
......@@ -252,7 +252,7 @@ public class HPBI001 extends DaoEPBase {
* get the marValue - 状态 0禁用 1启用.
* @return the marValue
*/
public Integer getmarValue() {
public String getmarValue() {
return this.marValue;
}
......@@ -261,7 +261,7 @@ public class HPBI001 extends DaoEPBase {
*
* @param marValue - 状态 0禁用 1启用
*/
public void setmarValue(Integer marValue) {
public void setmarValue(String marValue) {
this.marValue = marValue;
}
/**
......@@ -427,7 +427,7 @@ public class HPBI001 extends DaoEPBase {
setyearValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(YEARVALUE)), yearValue));
setjanValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(JANVALUE)), janValue));
setfebValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FEBVALUE)), febValue));
setmarValue(NumberUtils.toInteger(StringUtils.toString(map.get(MARVLAUE)), marValue));
setmarValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(MARVLAUE)), marValue));
setaprValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(APRVALUE)), aprValue));
setmayValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(MAYVALUE)), mayValue));
setjunValue(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(JUNVALUE)), junValue));
......
......@@ -72,5 +72,19 @@ public class HPConstant {
// 其他
public static final String QT = "QT";
}
/**
* 计划状态常量
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class planStatus {
// 计划中
public static final Integer S_0 = 0;
// 生产中
public static final Integer S_1 = 1;
}
}
......@@ -153,6 +153,22 @@ public class HPSqlConstant {
}
/**
* HPKC009A SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC009A {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC009A.deleteByTime";
// 查询
public static final String QUERY = "HPKC009A.query";
// 查询统计
public static final String QUERY_SUM = "HPKC009A.querySum";
}
/**
* HPKC010 SQL 定义
*
* @author:songx
......@@ -173,7 +189,7 @@ public class HPSqlConstant {
public class HPKC010A {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC009.deleteByTime";
public static final String DELETE_BY_TIME = "HPKC010A.deleteByTime";
// 备份数量
public static final String BACKUP = "HPKC010A.backup";
}
......@@ -191,6 +207,32 @@ public class HPSqlConstant {
}
/**
* HPKC011A SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC011A {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC011A.deleteByTime";
// 备份数量
public static final String BACKUP = "HPKC011A.backup";
}
/**
* HPKC012 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC012 {
// 锁
public static final String QUERY = "HPKC012.query";
}
/**
* HPPZ010 SQL 定义
*
* @author:songx
......@@ -217,6 +259,23 @@ public class HPSqlConstant {
}
/**
* HPSC003 SQL名称定义
*
* @author:songx
* @date:2024/2/5,10:16
*/
public class HPSC003 {
// 修改状态
public static final String UPDATE_STATUS = "HPSC003.updateStatus";
// 修改时间
public static final String UPDATE_DATE = "HPSC003.updateDate";
public static final String DELETE_BY_MAT = "HPSC003.deleteByMat";
}
/**
* HPSC004 SQL名称定义
*
* @author:songx
......@@ -226,8 +285,14 @@ public class HPSqlConstant {
// 锁
public static final String LOCK = "HPSC004.lock";
// 更新时间完工情况
// 根据材料号删除
public static final String DELETE_BY_MAT = "HPSC004.deleteByMat";
// 更新计划完工情况
public static final String UPDATE_PLAN_DATE = "HPSC004.updatePlanDate";
// 更新实际完工情况
public static final String UPDATE_COMPLETE = "HPSC004.updateComplete";
// 更新订单号
public static final String UPDATE_PROD_ORDER_NO = "HPSC004.updateProdOrderNo";
}
/**
......@@ -240,6 +305,9 @@ public class HPSqlConstant {
public static final String LOCK = "HPSC005.lock";
// 查询
public static final String UPDATE_ASSIGN_NUM = "HPSC005.updateAssignNum";
public static final String DELETE_BY_MAT = "HPSC005.deleteByMat";
}
/**
......
package com.baosight.hpjx.hp.ff.service;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.util.ExcelUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
import java.util.Map;
public class ServiceHPFF001 extends ServiceEPBase {
/**
* 根据模板导入数据
*/
public EiInfo importDate(EiInfo inInfo) {
String fileName = inInfo.getString(HPConstants.PARAM_FILENAME);
String className = inInfo.getString(HPConstants.PARAM_CLASSNAME);
//解析文件,将文件中数据传入到inInfo中
switch (className){
/**
* 物料
*/
case "HPSC002":
String parentId = inInfo.getString("parentId");
String parentPrdtName = inInfo.getString("parentPrdtName");
String projCode = inInfo.getString("projCode");
String projName = inInfo.getString("projName");
int lv = inInfo.getInt("lv");
Map map = new HashMap<>();
map.put("parentId",parentId);
map.put("parentPrdtName",parentPrdtName);
map.put("projCode",projCode);
map.put("projName",projName);
map.put("lv",lv+1);
ExcelUtils.importFromExcel(inInfo, fileName,map, new HPSC002());
break;
case "HPSC006":
String projCode1 = inInfo.getString("projCode");
String projName1 = inInfo.getString("projName");
String productionOrderNo = inInfo.getString("productionOrderNo");
Map map1 = new HashMap<>();
map1.put("projCode",projCode1);
map1.put("projName",projName1);
map1.put("productionOrderNo",productionOrderNo);
map1.put("inventType","7");
ExcelUtils.importFromExcel(inInfo, fileName,map1, new HPSC006());
}
return inInfo;
}
}
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 23:15:22 create
* @history 2024-02-27 14:22:00 create
*/
public class HPKC002 extends DaoEPBase {
......@@ -40,6 +40,7 @@ public class HPKC002 extends DaoEPBase {
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
......@@ -64,6 +65,7 @@ public class HPKC002 extends DaoEPBase {
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 存货名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
......@@ -76,7 +78,7 @@ public class HPKC002 extends DaoEPBase {
public static final String UPDATE = "HPKC002.update";
public static final String DELETE = "HPKC002.delete";
private Long id = null; /* 主键id*/
private Long id; /* 主键id*/
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/
private String createdBy = " "; /* 创建人*/
......@@ -92,11 +94,12 @@ public class HPKC002 extends DaoEPBase {
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.00); /* 数量*/
private BigDecimal weight = new BigDecimal(0.00); /* 重量*/
private Long inventRecordId; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private String remark = " "; /* 备注*/
private Long kcId = new Long(0); /* 库存ID*/
private Long kcId; /* 库存ID*/
private String oldReqNo = " "; /* 原领料单号*/
private Integer deleteFlag; /* 是否删除0.否1.是*/
......@@ -177,15 +180,22 @@ public class HPKC002 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(2);
eiColumn.setFieldLength(10);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......@@ -504,6 +514,22 @@ public class HPKC002 extends DaoEPBase {
this.amount = amount;
}
/**
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the unitWeight - 单重.
*
* @param unitWeight - 单重
*/
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the weight - 重量.
* @return the weight
*/
......@@ -609,6 +635,7 @@ public class HPKC002 extends DaoEPBase {
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
......@@ -641,6 +668,7 @@ public class HPKC002 extends DaoEPBase {
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
......
......@@ -16,7 +16,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 17:57:24 create
* @history 2024-02-27 14:11:00 create
*/
public class HPKC010 extends DaoEPBase {
......@@ -32,6 +32,7 @@ public class HPKC010 extends DaoEPBase {
public static final String FIELD_INVENT_NAME = "inventName"; /* 物料名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 存货档案ID*/
public static final String FIELD_AMOUNT = "amount"; /* 数量*/
public static final String FIELD_UNIT_WEIGHT = "unitWeight"; /* 单重*/
public static final String FIELD_WEIGHT = "weight"; /* 重量*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
......@@ -51,6 +52,7 @@ public class HPKC010 extends DaoEPBase {
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 物料名称*/
public static final String COL_INVENT_RECORD_ID = "INVENT_RECORD_ID"; /* 存货档案ID*/
public static final String COL_AMOUNT = "AMOUNT"; /* 数量*/
public static final String COL_UNIT_WEIGHT = "UNIT_WEIGHT"; /* 单重*/
public static final String COL_WEIGHT = "WEIGHT"; /* 重量*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
......@@ -66,7 +68,7 @@ public class HPKC010 extends DaoEPBase {
public static final String UPDATE = "HPKC010.update";
public static final String DELETE = "HPKC010.delete";
private Long id = null;
private Long id;
private String companyCode = " "; /* 企业编码*/
private String depCode = " "; /* 部门编码*/
private String whCode = " "; /* 仓库编码*/
......@@ -74,16 +76,17 @@ public class HPKC010 extends DaoEPBase {
private String inventType = " "; /* 物料类型*/
private String inventCode = " "; /* 物料编码*/
private String inventName = " "; /* 物料名称*/
private Long inventRecordId = null; /* 存货档案ID*/
private BigDecimal amount = new BigDecimal("0"); /* 数量*/
private BigDecimal weight = new BigDecimal("0"); /* 重量*/
private Long inventRecordId = new Long(0); /* 存货档案ID*/
private BigDecimal amount = new BigDecimal(0.000); /* 数量*/
private BigDecimal unitWeight = new BigDecimal(0.000); /* 单重*/
private BigDecimal weight = new BigDecimal(0.000); /* 重量*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer version = null; /* 版本号*/
private Integer version; /* 版本号*/
/**
* initialize the metadata.
......@@ -130,15 +133,22 @@ public class HPKC010 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_UNIT_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("单重");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(15);
eiColumn.setDescName("重量");
eiMetadata.addMeta(eiColumn);
......@@ -341,6 +351,22 @@ public class HPKC010 extends DaoEPBase {
this.amount = amount;
}
/**
* get the unitWeight - 单重.
* @return the unitWeight
*/
public BigDecimal getUnitWeight() {
return this.unitWeight;
}
/**
* set the unitWeight - 单重.
*
* @param unitWeight - 单重
*/
public void setUnitWeight(BigDecimal unitWeight) {
this.unitWeight = unitWeight;
}
/**
* get the weight - 重量.
* @return the weight
*/
......@@ -486,6 +512,7 @@ public class HPKC010 extends DaoEPBase {
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setUnitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_UNIT_WEIGHT)), unitWeight));
setWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WEIGHT)), weight));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
......@@ -513,6 +540,7 @@ public class HPKC010 extends DaoEPBase {
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_UNIT_WEIGHT, StringUtils.toString(unitWeight, eiMetadata.getMeta(FIELD_UNIT_WEIGHT)));
map.put(FIELD_WEIGHT, StringUtils.toString(weight, eiMetadata.getMeta(FIELD_WEIGHT)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THpkc010.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-25 17:57:24 create
*/
public class HPKC012 extends HPKC010 {
private static final long serialVersionUID = 1L;
public static final String FIELD_WARN_NUM = "warnNum"; /* 预警数量*/
public static final String COL_WARN_NUM = "WARN_NUM"; /* 预警数量*/
public static final String QUERY = "HPKC012.query";
private BigDecimal warnNum = new BigDecimal("0"); /* 预警数量*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_WARN_NUM);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(12);
eiColumn.setDescName("预警数量");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HPKC012() {
super.initMetaData();
initMetaData();
}
/**
* get the warnNum - 预警数量.
* @return the warnNum
*/
public BigDecimal getWarnNum() {
return this.warnNum;
}
/**
* set the warnNum - 预警数量.
*
* @param warnNum - 预警数量
*/
public void setWarnNum(BigDecimal warnNum) {
this.warnNum = warnNum;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setWarnNum(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_WARN_NUM)), warnNum));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_WARN_NUM, StringUtils.toString(warnNum, eiMetadata.getMeta(FIELD_WARN_NUM)));
return map;
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -38,6 +39,7 @@ public class ServiceHPKC002 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "生产领料单",operType = "查询",operDesc = "初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
......@@ -62,6 +64,7 @@ public class ServiceHPKC002 extends ServiceBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产领料单",operType = "查询",operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -76,13 +79,13 @@ public class ServiceHPKC002 extends ServiceBase {
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产领料单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -107,7 +110,7 @@ public class ServiceHPKC002 extends ServiceBase {
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存
HPKCTools.updateStock(dbKc002.getWhCode(), dbKc002.getInventRecordId(),
dbKc002.getAmount().negate(), dbKc002.getWeight().negate());
dbKc002.getAmount().negate(), dbKc002.getUnitWeight(), dbKc002.getWeight().negate());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -46,6 +47,7 @@ public class ServiceHPKC002A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "生产领料单-库存查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -68,6 +70,7 @@ public class ServiceHPKC002A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "生产领料单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -85,6 +88,7 @@ public class ServiceHPKC002A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "插入",operDesc = "生产领料单-库存查询-生成出库单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -95,42 +99,57 @@ public class ServiceHPKC002A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
AssertUtils.isGt(applyAmount, dbKc010.getAmount(),
"库存号[" + id + "]可用数量不足!");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
AssertUtils.isGt(applyWeight, dbKc010.getWeight(),
"库存号[" + id + "]可用重量不足!");
}
this.checkData(resultRows, dbKc010Map);
// 生成销售库单
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC002 newKc002 = BeanUtils.copy(dbKc010, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setReceiptDate(DateUtils.shortDate());
newKc002.setAmount(applyAmount);
newKc002.setWeight(applyWeight);
newKc002.setRemark(applyRemark);
newKc002.setKcId(kcId);
newKc002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存数量
HPKCTools.updateStock(newKc002.getWhCode(), newKc002.getInventRecordId(),
newKc002.getAmount().negate(), newKc002.getWeight().negate());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成领料单失败");
LogUtils.setMsg(inInfo, e, "生成领料单失败");
}
return inInfo;
}
/**
* 数据校验
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
AssertUtils.isGt(applyAmount, dbKc010.getAmount(),
"库存号[" + id + "]可用数量不足!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC002 newKc002 = BeanUtils.copy(dbKc010, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setReceiptDate(DateUtils.shortDate());
newKc002.setAmount(applyAmount);
newKc002.setWeight(dbKc010.getUnitWeight().multiply(applyAmount));
newKc002.setRemark(applyRemark);
newKc002.setKcId(kcId);
newKc002.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存数量
HPKCTools.updateStock(newKc002.getWhCode(), newKc002.getInventRecordId(),
newKc002.getAmount().negate(), dbKc010.getUnitWeight(), newKc002.getWeight().negate());
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -44,6 +45,7 @@ public class ServiceHPKC003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), new HashMap<String,Object>(){{put("inventTypes",new String[]{"2","3"});}}, false);
......@@ -61,6 +63,7 @@ public class ServiceHPKC003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -81,6 +84,7 @@ public class ServiceHPKC003 extends ServiceBase {
* @param eiInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
try {
List<Map> resultRows = eiInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
......@@ -49,6 +50,7 @@ public class ServiceHPKC003A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务查询",operType = "查询",operDesc = "生产入库单-生产任务查询-初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
......@@ -68,6 +70,7 @@ public class ServiceHPKC003A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务查询",operType = "查询",operDesc = "生产入库单-生产任务查询-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -86,6 +89,7 @@ public class ServiceHPKC003A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产任务查询",operType = "插入",operDesc = "生产入库单-生产任务查询-生成入库单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -41,6 +42,7 @@ public class ServiceHPKC004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -62,6 +64,7 @@ public class ServiceHPKC004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -83,6 +86,7 @@ public class ServiceHPKC004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -42,6 +43,7 @@ public class ServiceHPKC004A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "销售出库单-库存查询-初始化")
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
......@@ -58,6 +60,7 @@ public class ServiceHPKC004A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "查询",operDesc = "销售出库单-库存查询-查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -74,6 +77,7 @@ public class ServiceHPKC004A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "插入",operDesc = "销售出库单-库存查询-生成出库单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -22,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -40,9 +42,11 @@ public class ServiceHPKC005 extends ServiceBase {
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
......@@ -60,6 +64,7 @@ public class ServiceHPKC005 extends ServiceBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -82,9 +87,9 @@ public class ServiceHPKC005 extends ServiceBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
......@@ -108,31 +113,6 @@ public class ServiceHPKC005 extends ServiceBase {
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc005);
DaoUtils.update(HPKC005.UPDATE, fKc005);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 设置基础信息
*
* @param fKc005
......@@ -144,6 +124,13 @@ public class ServiceHPKC005 extends ServiceBase {
fKc005.setWhName(HPPZTools.HpPz007.getByCode(fKc005.getWhCode()).getWhName());
// 存货名称
fKc005.setInventName(HPPZTools.HpPz004.getByCode(fKc005.getInventCode()).getInventName());
// 根据规格计算账面单重
BigDecimal unitWeight = HPPZTools.HpPz006.calcUnitWeight(fKc005.getInventRecordId());
fKc005.setBookUnitWeight(unitWeight);
fKc005.setEntityUnitWeight(unitWeight);
// 计算总重
fKc005.setBookWeight(fKc005.getBookAmount().multiply(unitWeight));
fKc005.setEntityWeight(fKc005.getEntityAmount().multiply(unitWeight));
// 差异数量
fKc005.setDiffAmount(fKc005.getEntityAmount().subtract(fKc005.getBookAmount()));
// 差异重量
......@@ -156,6 +143,7 @@ public class ServiceHPKC005 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -165,24 +153,8 @@ public class ServiceHPKC005 extends ServiceBase {
HPKCTools.HpKc005.lock(checkNos);
// 查询数据库记录
Map<String, HPKC005> mapKc005 = HPKCTools.HpKc005.map(checkNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
DaoUtils.update(HPKC005.DELETE, fKc005);
// 原盘点单
HPKC005 dbKc005 = mapKc005.get(fKc005.getCheckNo());
// 生成红冲记录
HPKC005 newKc005 = BeanUtils.copy(dbKc005, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setDiffAmount(dbKc005.getDiffAmount().negate());
newKc005.setDiffWeight(dbKc005.getDiffWeight().negate());
newKc005.setOldCheckNo(dbKc005.getCheckNo());
newKc005.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
// 删除数据
this.deleteData(resultRows, mapKc005);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -192,4 +164,31 @@ public class ServiceHPKC005 extends ServiceBase {
return inInfo;
}
/**
* 删除数据
*
* @param resultRows
* @param mapKc005
*/
private void deleteData(List<Map> resultRows, Map<String, HPKC005> mapKc005) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC005 fKc005 = new HPKC005();
fKc005.fromMap(resultRows.get(i));
DaoUtils.update(HPKC005.DELETE, fKc005);
// 原盘点单
HPKC005 dbKc005 = mapKc005.get(fKc005.getCheckNo());
// 生成红冲记录
HPKC005 newKc005 = BeanUtils.copy(dbKc005, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setDiffAmount(dbKc005.getDiffAmount().negate());
newKc005.setDiffWeight(dbKc005.getDiffWeight().negate());
newKc005.setOldCheckNo(dbKc005.getCheckNo());
newKc005.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
......@@ -39,6 +41,7 @@ public class ServiceHPKC005A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
......@@ -59,6 +62,7 @@ public class ServiceHPKC005A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "库存盘点单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -75,6 +79,7 @@ public class ServiceHPKC005A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "插入",operDesc = "库存盘点单-库存查询-生成盘点单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -85,44 +90,61 @@ public class ServiceHPKC005A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
AssertUtils.isGt(BigDecimal.ZERO, entityAmount, "库存号[" + id + "]实物数量不能小于0!");
BigDecimal entityWeight = MapUtils.getBigDecimal(row, "entityWeight");
AssertUtils.isGt(BigDecimal.ZERO, entityWeight, "库存号[" + id + "]实物重量不能小于0!");
}
this.checkData(resultRows, dbKc010Map);
// 生成盘点单
for (Map row : resultRows) {
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
BigDecimal entityWeight = MapUtils.getBigDecimal(row, "entityWeight");
String entityRemark = MapUtils.getString(row, "entityRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
// 生成盘点单
HPKC005 newKc005 = BeanUtils.copy(dbKc010, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setReceiptDate(DateUtils.shortDate());
newKc005.setEntityAmount(entityAmount);
newKc005.setEntityWeight(entityWeight);
newKc005.setBookAmount(dbKc010.getAmount());
newKc005.setBookWeight(dbKc010.getWeight());
newKc005.setDiffAmount(entityAmount.subtract(dbKc010.getAmount()));
newKc005.setDiffWeight(entityWeight.subtract(dbKc010.getWeight()));
newKc005.setKcId(kcId);
newKc005.setRemark(entityRemark);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存数量
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成盘点单失败");
}
return inInfo;
}
/**
* 校验数据
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
AssertUtils.isGt(BigDecimal.ZERO, entityAmount, "库存号[" + id + "]实物数量不能小于0!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal entityAmount = MapUtils.getBigDecimal(row, "entityAmount");
String entityRemark = MapUtils.getString(row, "entityRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
// 生成盘点单
HPKC005 newKc005 = BeanUtils.copy(dbKc010, HPKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
newKc005.setReceiptDate(DateUtils.shortDate());
newKc005.setEntityAmount(entityAmount);
newKc005.setEntityWeight(dbKc010.getUnitWeight().multiply(entityAmount));
newKc005.setBookAmount(dbKc010.getAmount());
newKc005.setBookWeight(dbKc010.getWeight());
newKc005.setDiffAmount(entityAmount.subtract(dbKc010.getAmount()));
newKc005.setDiffWeight(newKc005.getEntityWeight().subtract(dbKc010.getWeight()));
newKc005.setKcId(kcId);
newKc005.setRemark(entityRemark);
newKc005.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC005.INSERT, newKc005);
// 修改库存数量
HPKCTools.updateStock(newKc005.getWhCode(), newKc005.getInventRecordId(),
newKc005.getDiffAmount(), newKc005.getDiffWeight());
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -49,6 +50,7 @@ public class ServiceHPKC006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -71,6 +73,7 @@ public class ServiceHPKC006 extends ServiceBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "其他入库单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -94,6 +97,7 @@ public class ServiceHPKC006 extends ServiceBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "其他入库单", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -107,7 +111,7 @@ public class ServiceHPKC006 extends ServiceBase {
this.setBaseInfo(fKc006);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
HPPZ006 hppz006= HPPZTools.checkAndSavePZ06(
HPPZ006 hppz006 = HPPZTools.checkAndSavePZ06(
Integer.parseInt(resultRows.get(i).get("inventType").toString()),
resultRows.get(i).get("inventName").toString(),
NumberUtils.toBigDecimal(resultRows.get(i).get("length")),
......@@ -117,6 +121,10 @@ public class ServiceHPKC006 extends ServiceBase {
resultRows.get(i).get("material").toString(),
resultRows.get(i).get("unit").toString()
);
// 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(hppz006.getId()));
// 计算总重
fKc006.setWeight(fKc006.getAmount().multiply(fKc006.getUnitWeight()));
fKc006.setInventRecordId(hppz006.getId());
fKc006.setInventCode(hppz006.getInventCode());
DaoUtils.insert(HPKC006.INSERT, fKc006);
......@@ -134,45 +142,6 @@ public class ServiceHPKC006 extends ServiceBase {
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 入库单号
List<String> otherEnterNos = ObjectUtils.listKey(resultRows, "otherEnterNo");
// 锁记录
HPKCTools.HpKc006.lock(otherEnterNos);
// 查询数据库记录
Map<String, HPKC006> mapKc006 = HPKCTools.HpKc006.map(otherEnterNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc006);
DaoUtils.update(HPKC006.UPDATE, fKc006);
// 计算差异数量与重量
HPKC006 dbKc006 = mapKc006.get(fKc006.getOtherEnterNo());
BigDecimal diffAmount = fKc006.getAmount().subtract(dbKc006.getAmount());
BigDecimal diffWeight = fKc006.getWeight().subtract(dbKc006.getWeight());
// 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), diffAmount, diffWeight);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
......@@ -209,6 +178,7 @@ public class ServiceHPKC006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -47,6 +48,7 @@ public class ServiceHPKC007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他出库单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -68,6 +70,7 @@ public class ServiceHPKC007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他出库单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -89,6 +92,7 @@ public class ServiceHPKC007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他出库单",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -123,6 +127,7 @@ public class ServiceHPKC007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他出库单",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -194,6 +199,7 @@ public class ServiceHPKC007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他出库单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
......@@ -45,6 +47,7 @@ public class ServiceHPKC007A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "其他出库单-库存查询-初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -67,6 +70,7 @@ public class ServiceHPKC007A extends ServiceEPBase {
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "其他出库单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -84,6 +88,7 @@ public class ServiceHPKC007A extends ServiceEPBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "插入",operDesc = "其他出库单-库存查询-生成出库单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -94,41 +99,58 @@ public class ServiceHPKC007A extends ServiceEPBase {
// 获取库存信息
Map<Long, HPKC010> dbKc010Map = HPKCTools.HpKc010.map(ids);
// 状态校验
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
AssertUtils.isGt(applyAmount, dbKc010.getAmount(),
"库存号[" + id + "]可用数量不足!");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
AssertUtils.isGt(applyWeight, dbKc010.getWeight(),
"库存号[" + id + "]可用重量不足!");
}
this.checkData(resultRows, dbKc010Map);
// 生成出库单
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
BigDecimal applyWeight = MapUtils.getBigDecimal(row, "applyWeight");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC007 kc007 = BeanUtils.copy(dbKc010, HPKC007.class);
kc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
kc007.setReceiptDate(DateUtils.shortDate());
kc007.setAmount(applyAmount);
kc007.setWeight(applyWeight);
kc007.setKcId(kcId);
kc007.setRemark(applyRemark);
DaoUtils.insert(HPKC007.INSERT, kc007);
// 修改库存数量
HPKCTools.updateStock(kc007.getWhCode(), kc007.getInventRecordId(), kc007.getAmount().negate(),
kc007.getWeight().negate());
}
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成出库单失败");
}
return inInfo;
}
/**
* 校验数据
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
AssertUtils.isGt(applyAmount, dbKc010.getAmount(),
"库存号[" + id + "]可用数量不足!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HPKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal applyAmount = MapUtils.getBigDecimal(row, "applyAmount");
String applyRemark = MapUtils.getString(row, "applyRemark");
Long kcId = MapUtils.getLong(row, "id");
HPKC010 dbKc010 = dbKc010Map.get(kcId);
HPKC007 kc007 = BeanUtils.copy(dbKc010, HPKC007.class);
kc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
kc007.setReceiptDate(DateUtils.shortDate());
kc007.setAmount(applyAmount);
kc007.setWeight(dbKc010.getUnitWeight().multiply(applyAmount));
kc007.setKcId(kcId);
kc007.setRemark(applyRemark);
kc007.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC007.INSERT, kc007);
// 修改库存数量
HPKCTools.updateStock(kc007.getWhCode(), kc007.getInventRecordId(), kc007.getAmount().negate(),
kc007.getWeight().negate());
}
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -38,6 +39,7 @@ public class ServiceHPKC008 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "数据统计单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -57,6 +59,7 @@ public class ServiceHPKC008 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "数据统计单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -80,6 +83,7 @@ public class ServiceHPKC008 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "数据统计单",operType = "查询",operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -111,6 +115,7 @@ public class ServiceHPKC008 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "数据统计单",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -140,6 +145,7 @@ public class ServiceHPKC008 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "数据统计单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.constant.HPConstant;
......@@ -54,6 +55,7 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
......@@ -73,6 +75,7 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -96,6 +99,7 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "插入",operDesc = "按天统计")
public EiInfo statDay(EiInfo inInfo) {
try {
// 取昨天的日期
......@@ -130,6 +134,7 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "插入",operDesc = "按月统计")
public EiInfo statMonth(EiInfo inInfo) {
try {
// 上个月的日期
......@@ -178,10 +183,10 @@ public class ServiceHPKC009 extends ServiceBase {
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.3、生产入库
List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getPartType(), item.getPartCode(),
item.getWhCode(), null), item -> item));
// List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
// Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getPartType(), item.getPartCode(),
// item.getWhCode(), null), item -> item));
// 1.4、其他入库
List<HPKC006> qtRks = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> qtRkMap = qtRks.stream().collect(Collectors.toMap(item ->
......@@ -193,10 +198,10 @@ public class ServiceHPKC009 extends ServiceBase {
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.6、销售出库
List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventCode(), item.getSubInventCode(),
item.getWhCode(), ""), item -> item));
// List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
// Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventCode(), item.getSubInventCode(),
// item.getWhCode(), ""), item -> item));
// 1.7、其它出库
List<HPKC007> qtCks = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> qtCkMap = qtCks.stream().collect(Collectors.toMap(item ->
......@@ -228,7 +233,7 @@ public class ServiceHPKC009 extends ServiceBase {
kc009.setCgEnterAmount(cgRk == null ? BigDecimal.ZERO : cgRk.getAmount());
kc009.setCgEnterWeight(cgRk == null ? BigDecimal.ZERO : cgRk.getWeight());
// 1.3、生产入库
HPKC003 scRk = scRkMap.get(key);
HPKC003 scRk = null;//scRkMap.get(key);
kc009.setScEnterAmount(scRk == null ? BigDecimal.ZERO : scRk.getAmount());
kc009.setScEnterWeight(scRk == null ? BigDecimal.ZERO : scRk.getWeight());
// 1.3、其他入库
......@@ -245,7 +250,7 @@ public class ServiceHPKC009 extends ServiceBase {
kc009.setScOuterAmount(scCk == null ? BigDecimal.ZERO : scCk.getAmount());
kc009.setScOuterWeight(scCk == null ? BigDecimal.ZERO : scCk.getWeight());
// 1.6、销售出库
HPKC004 xsCk = xsCkMap.get(key);
HPKC004 xsCk = null;//xsCkMap.get(key);
kc009.setXsOuterAmount(xsCk == null ? BigDecimal.ZERO : xsCk.getAmount());
kc009.setXsOuterWeight(xsCk == null ? BigDecimal.ZERO : xsCk.getWeight());
// 1.7、其他出库
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
......@@ -27,33 +29,39 @@ import java.util.Map;
import java.util.Objects;
/**
*
* @author:wwl
* @date:2024/1/23,10:51
*/
public class ServiceHPKC010 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.WASTE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "实时库存管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPKC010 HPKC010 = new HPKC010();
EiInfo outInfo = super.initLoad(inInfo, HPKC010);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
return outInfo;
inInfo.getBlock(EiConstant.resultBlock).addBlockMeta(new HPKC010().eiMetadata);
Map queryMap = new HashMap();
queryMap.put("inventCodes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
return inInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "实时库存管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPKC010.query", new HPKC010());
......@@ -67,6 +75,7 @@ public class ServiceHPKC010 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "实时库存管理",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -84,42 +93,45 @@ public class ServiceHPKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 更新库存
*
* @param inInfo
* @return
*/
public EiInfo updateStock(EiInfo inInfo){
@OperationLogAnnotation(operModul = "实时库存管理", operType = "修改", operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo) {
String whCode = inInfo.getString("whCode");
Long inventRecordId = Long.parseLong(inInfo.getString("inventRecordId"));
BigDecimal amount = new BigDecimal(inInfo.getString("amount"));
BigDecimal weight = new BigDecimal(inInfo.getString("weight"));
String unitWeightStr = inInfo.getString("unitWeight");
BigDecimal unitWeight = unitWeightStr == null ? BigDecimal.ZERO : new BigDecimal(unitWeightStr);
String companyCode = UserSessionUtils.getCompanyCode();
try {
checkUpdateStockParam(companyCode,whCode,inventRecordId,amount,weight);
HPKC010 newObj = generatorBaseInfo(companyCode,whCode,inventRecordId,amount,weight);
List<Map> list = dao.query("HPKC010.queryByCondition",new HashMap<String,Object>(){{
put("companyCode",companyCode);
put("whCode",whCode);
put("inventRecordId",inventRecordId);
checkUpdateStockParam(companyCode, whCode, inventRecordId, amount, weight);
HPKC010 newObj = generatorBaseInfo(companyCode, whCode, inventRecordId, amount, unitWeight, weight);
List<Map> list = dao.query("HPKC010.queryByCondition", new HashMap<String, Object>() {{
put("companyCode", companyCode);
put("whCode", whCode);
put("inventRecordId", inventRecordId);
}});
if(CollectionUtils.isEmpty(list)){
if (CollectionUtils.isEmpty(list)) {
//新增
if(amount.compareTo(BigDecimal.ZERO)<0
||weight.compareTo(BigDecimal.ZERO)<0){
if (amount.compareTo(BigDecimal.ZERO) < 0
|| weight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
generatorBaseInfo(newObj);
DaoUtils.insert("HPKC010.insert",newObj);
}else{
DaoUtils.insert("HPKC010.insert", newObj);
} else {
//修改
HPKC010 oldObj = new HPKC010();
oldObj.fromMap(list.get(0));
BigDecimal afterAmout = oldObj.getAmount().add(amount);
BigDecimal afterWeight = oldObj.getWeight().add(weight);
if(afterAmout.compareTo(BigDecimal.ZERO)<0||afterWeight.compareTo(BigDecimal.ZERO)<0){
if (afterAmout.compareTo(BigDecimal.ZERO) < 0 || afterWeight.compareTo(BigDecimal.ZERO) < 0) {
throw new PlatException("库存更新失败,出库数量与重量不能大于当前库存!");
}
oldObj.setAmount(afterAmout);
......@@ -139,9 +151,10 @@ public class ServiceHPKC010 extends ServiceBase {
}
return inInfo;
}
/**
* 生成库存对象
*
* @param companyCode
* @param whCode
* @param inventRecordId
......@@ -149,12 +162,14 @@ public class ServiceHPKC010 extends ServiceBase {
* @param weight
* @reutrn HPKC010
*/
private HPKC010 generatorBaseInfo(String companyCode, String whCode, Long inventRecordId, BigDecimal amout, BigDecimal weight) {
private HPKC010 generatorBaseInfo(String companyCode, String whCode, Long inventRecordId, BigDecimal amout,
BigDecimal unitWeight, BigDecimal weight) {
HPKC010 hpkc010 = new HPKC010();
hpkc010.setCompanyCode(companyCode);
hpkc010.setWhCode(whCode);
hpkc010.setInventRecordId(inventRecordId);
hpkc010.setAmount(amout);
hpkc010.setUnitWeight(unitWeight);
hpkc010.setWeight(weight);
String userId = UserSession.getLoginName();
String userName = UserSession.getLoginCName();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
......@@ -23,6 +24,7 @@ public class ServiceHPKC010A extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存管理",operType = "插入",operDesc = "实时库存管理-备份数据")
public EiInfo backup(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -37,6 +38,7 @@ public class ServiceHPKC011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品库存管理",operType = "查润",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPKC011 HPKC011 = new HPKC011();
EiInfo outInfo = super.initLoad(inInfo, HPKC011);
......@@ -52,6 +54,7 @@ public class ServiceHPKC011 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "产品库存管理",operType = "查润",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -66,6 +69,7 @@ public class ServiceHPKC011 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "产品库存管理",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -90,6 +94,7 @@ public class ServiceHPKC011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品库存管理",operType = "修改",operDesc = "更新库存")
public EiInfo updateStock(EiInfo inInfo){
String whCode = inInfo.getString("whCode");
String prodNo = inInfo.getString("prodNo");
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/25,18:49
*/
public class ServiceHPKC011A extends ServiceBase {
/**
* 备份数据
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存管理",operType = "插入",operDesc = "产品库存管理-备份数据")
public EiInfo backup(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("dateProc", LocalDate.now().minusDays(1).format(DateUtils.SHORT_DATE));
// 清除数据
dao.delete(HPSqlConstant.HPKC011A.DELETE_BY_TIME, queryMap);
// 备份数据
dao.insert(HPSqlConstant.HPKC011A.BACKUP, queryMap);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("备份数据成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.hp.kc.domain.HPKC012;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* @author YK
* @date 2024年01月09日 10:18
*/
public class ServiceHPKC012 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC012().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警查询", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC012.QUERY, new HPKC012());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -14,6 +15,7 @@ public class ServiceHPKC099 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "生产订单",operType = "查询 ",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPSC005 HPSC005 = new HPSC005();
inInfo.set("inqu_status-0-status", "1");
......@@ -26,6 +28,7 @@ public class ServiceHPKC099 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "生产订单",operType = "查询 ",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
......
......@@ -13,7 +13,6 @@
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
PURCHASE_NO as "purchaseNo", <!-- 采购单号 -->
OLD_PURCHASE_NO as "oldPurchaseNo", <!-- 原采购单号 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
......@@ -22,8 +21,10 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
OLD_PURCHASE_NO as "oldPurchaseNo", <!-- 原采购单号 -->
DELETE_FLAG as "deleteFlag" <!-- 是否删除0.否1.是 -->
</sql>
......@@ -113,27 +114,31 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT <include refid="column"/>
FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT
<include refid="column"/>
FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPKC001 (
......@@ -152,13 +157,14 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#purchaseNo#,#oldPurchaseNo#, #receiptDate#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#remark#, #deleteFlag#
)
</insert>
......@@ -174,25 +180,6 @@
WHERE ID = #id#
</update>
<update id="update">
UPDATE hpjx.t_hpkc001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARK = #remark# <!-- 备注 -->
WHERE ID = #id#
</update>
<!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT
......
......@@ -21,6 +21,7 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
KC_ID as "kcId", <!-- 库存ID -->
......@@ -114,7 +115,7 @@
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$orderBy$
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
......@@ -152,6 +153,7 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
KC_ID, <!-- 库存ID -->
......@@ -160,7 +162,7 @@
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#reqNo#, #receiptDate#, #whCode#, #whName#, #inventType#, #inventCode#,
#inventName#, #inventRecordId#, #amount#, #weight#, #remark#, #kcId#,
#inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldReqNo#, #deleteFlag#
)
</insert>
......
......@@ -187,9 +187,9 @@
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
PROJ_CODE AS "projCode",
PRDT_CODE AS "prdtCode",
PART_CODE AS "partCode",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC003
......@@ -197,7 +197,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, PRDT_CODE, PART_CODE
</select>
</sqlMap>
......@@ -241,9 +241,9 @@
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
INVENT_TYPE AS "inventType",
PROJ_CODE AS "projCode",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
SUB_INVENT_CODE AS "subInventCode",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC004
......@@ -251,7 +251,7 @@
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, INVENT_CODE, SUB_INVENT_CODE
</select>
</sqlMap>
......@@ -15,6 +15,7 @@
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格 -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
STATUS as "status", <!-- 状态 0提交 1保存 -->
KC_ID as "kcId", <!-- 库存ID -->
......@@ -80,10 +81,10 @@
</isNotEqual>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
A.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
A.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
......@@ -139,6 +140,7 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 规格 -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
KC_ID, <!-- 库存ID -->
REMARK, <!-- 备注 -->
......@@ -149,7 +151,7 @@
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #otherOuterNo#, #whCode#, #whName#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventType#, #inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#kcId#, #remark#, #oldOuterNo#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#
)
</insert>
......@@ -159,19 +161,6 @@
UPDATE hpjx.t_hpkc007 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPKC007
SET
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
AMOUNT = #amount#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
REMARK = #remark#, <!-- 备注 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPKC007
......
<?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="HPKC009A">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DATE_TYPE as "dateType", <!-- 日期类型:DAY:天,MONTH:月 -->
DATE_PROC as "dateProc", <!-- 日期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
INIT_AMOUNT as "initAmount", <!-- 期初数量 -->
INIT_WEIGHT as "initWeight", <!-- 期初重量 -->
ENTER_AMOUNT as "enterAmount", <!-- 入库数量 -->
ENTER_WEIGHT as "enterWeight", <!-- 入库重量 -->
OUTER_AMOUNT as "outerAmount", <!-- 出库数量 -->
OUTER_WEIGHT as "outerWeight", <!-- 出库重量 -->
PD_DIFF_AMOUNT as "pdDiffAmount", <!-- 盘点差异数量 -->
PD_DIFF_WEIGHT as "pdDiffWeight", <!-- 盘点差异重量 -->
END_AMOUNT as "endAmount", <!-- 期末数量 -->
END_WEIGHT as "endWeight" <!-- 期末重量 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateType">
DATE_TYPE = #dateType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME = #subInventName#
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPKC009A
WHERE 1=1
<include refid="condition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPKC009A WHERE 1=1
<include refid="condition"/>
</select>
<!-- 查询统计 -->
<select id="querySum" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009A">
SELECT
COALESCE(SUM(INIT_AMOUNT), 0) AS "initAmount", <!-- 期初数量 -->
COALESCE(SUM(INIT_WEIGHT), 0) AS "initWeight", <!-- 期初重量 -->
COALESCE(SUM(ENTER_AMOUNT), 0) AS "enterAmount", <!-- 入库数量 -->
COALESCE(SUM(ENTER_WEIGHT), 0) AS "enterWeight", <!-- 入库重量 -->
COALESCE(SUM(OUTER_AMOUNT), 0) AS "outerAmount", <!-- 出库数量 -->
COALESCE(SUM(OUTER_WEIGHT), 0) AS "outerWeight", <!-- 出库重量 -->
COALESCE(SUM(PD_DIFF_AMOUNT), 0) AS "pdDiffAmount", <!-- 盘点差异数量 -->
COALESCE(SUM(PD_DIFF_WEIGHT), 0) AS "pdDiffWeight", <!-- 盘点差异重量 -->
COALESCE(SUM(END_AMOUNT), 0) AS "endAmount", <!-- 期末数量 -->
COALESCE(SUM(END_WEIGHT), 0) AS "endWeight" <!-- 期末重量 -->
FROM ${hpjxSchema}.T_HPKC009A
WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPKC009A (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DATE_TYPE, <!-- 日期类型:DAY:天,MONTH:月 -->
DATE_PROC, <!-- 日期 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
INVENT_CODE, <!-- 部件编码 -->
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 -->
INIT_AMOUNT, <!-- 期初数量 -->
INIT_WEIGHT, <!-- 期初重量 -->
ENTER_AMOUNT, <!-- 入库数量 -->
ENTER_WEIGHT, <!-- 入库重量 -->
OUTER_AMOUNT, <!-- 出库数量 -->
OUTER_WEIGHT, <!-- 出库重量 -->
PD_DIFF_AMOUNT, <!-- 盘点差异数量 -->
PD_DIFF_WEIGHT, <!-- 盘点差异重量 -->
END_AMOUNT, <!-- 期末数量 -->
END_WEIGHT <!-- 期末重量 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#dateType#, #dateProc#, #whCode#, #whName#, #projCode#, #projName#,
#inventCode#, #inventName#, #subInventCode#, #subInventName#, #initAmount#, #initWeight#,
#enterAmount#, #enterWeight#, #outerAmount#, #outerWeight#, #pdDiffAmount#,
#pdDiffWeight#, #endAmount#, #endWeight#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPKC009A WHERE ID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete id="deleteByTime">
DELETE FROM ${hpjxSchema}.T_HPKC009A WHERE DATE_PROC = #dateProc#
</delete>
</sqlMap>
......@@ -13,6 +13,7 @@
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -125,23 +126,23 @@
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
UPDATED_NAME, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
VERSION
) VALUES (
#companyCode#, #depCode#, #whCode#, #whName#, #inventType#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #weight#,
#inventCode#, #inventName#, #inventRecordId#, #amount#, #unitWeight#, #weight#,
#createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #version#
)
</insert>
<update id="updateStock">
UPDATE hpjx.T_HPKC010
SET
......
......@@ -14,6 +14,7 @@
INVENT_NAME as "inventName", <!-- 物料名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
......@@ -118,13 +119,13 @@
<insert id="backup">
INSERT INTO ${hpjxSchema}.T_HPKC010A (
COMPANY_CODE, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, UNIT_WEIGHT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
)
SELECT
COMPANY_CODE, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, UNIT_WEIGHT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
FROM ${hpjxSchema}.T_HPKC010
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC011A">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
DATE_PROC as "dateProc", <!-- 日期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
PROD_NO as "prodNo", <!-- 生产单号 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
AMOUNT as "amount", <!-- 数量 -->
UNIT_WEIGHT as "unitWeight", <!-- 单重 -->
WEIGHT as "weight", <!-- 重量 -->
REMARK as "remark", <!-- 备注 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
VERSION as "version" <!-- 版本号 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodNo">
PROD_NO = #prodNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME = #subInventName#
</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="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unitWeight">
UNIT_WEIGHT = #unitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</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="version">
VERSION = #version#
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
</isEmpty>
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC011A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPKC011A
WHERE 1=1
<include refid="condition" />
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPKC011A WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPKC011A (
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
DATE_PROC, <!-- 日期 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
PROD_NO, <!-- 生产单号 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
INVENT_CODE, <!-- 部件编码 -->
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 -->
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK, <!-- 厚 -->
AMOUNT, <!-- 数量 -->
UNIT_WEIGHT, <!-- 单重 -->
WEIGHT, <!-- 重量 -->
REMARK, <!-- 备注 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
VERSION <!-- 版本号 -->
) VALUES (
#companyCode#, #depCode#, #dateProc#, #whCode#, #whName#, #prodNo#, #projCode#,
#projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#, #length#,
#width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #createdBy#, #createdName#,
#createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #version#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPKC011A WHEREID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete id="deleteByTime">
DELETE FROM ${hpjxSchema}.T_HPKC011A WHERE DATE_PROC = #dateProc#
</delete>
<!-- 备份数据 -->
<insert id="backup">
INSERT INTO ${hpjxSchema}.T_HPKC011A (
COMPANY_CODE, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, PROD_NO, PROJ_CODE,
PROJ_NAME, INVENT_CODE, INVENT_NAME, SUB_INVENT_CODE, SUB_INVENT_NAME, LENGTH,
WIDTH, THICK, AMOUNT, UNIT_WEIGHT, WEIGHT, REMARK, CREATED_BY, CREATED_NAME,
CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME, VERSION
)
SELECT
COMPANY_CODE, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, PROD_NO, PROJ_CODE,
PROJ_NAME, INVENT_CODE, INVENT_NAME, SUB_INVENT_CODE, SUB_INVENT_NAME, LENGTH,
WIDTH, THICK, AMOUNT, UNIT_WEIGHT, WEIGHT, REMARK, CREATED_BY, CREATED_NAME,
CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME, VERSION
FROM ${hpjxSchema}.T_HPKC011
</insert>
</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="HPKC012">
<sql id="column">
A.ID as "id",
A.COMPANY_CODE as "companyCode", <!-- 企业编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.WH_CODE as "whCode", <!-- 仓库编码 -->
A.WH_NAME as "whName", <!-- 仓库名称 -->
A.INVENT_TYPE as "inventType", <!-- 物料类型 -->
A.INVENT_CODE as "inventCode", <!-- 物料编码 -->
A.INVENT_NAME as "inventName", <!-- 物料名称 -->
A.INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
A.AMOUNT as "amount", <!-- 数量 -->
A.WEIGHT as "weight", <!-- 重量 -->
A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 更新人 -->
A.UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
A.VERSION as "version", <!-- 版本号 -->
B.WARN_NUM as warnNum <!-- 预警值 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="inventRecordId">
A.INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
A.WH_NAME LIKE '%' || #whName# || '%'
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
A.INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
A.INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
A.INVENT_NAME = #inventName#
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="inventTypes">
A.INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
A.INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
A.INVENT_RECORD_ID IN (SELECT ID FROM ${hpjxSchema}.T_HPPZ006 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="order">
$order$
</isNotEmpty>
<isEmpty property="order">
A.ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC012">
SELECT <include refid="column"/>
FROM hpjx.T_HPKC010 A
INNER JOIN hpjx.T_HPPZ012 B ON A.INVENT_RECORD_ID = B.INVENT_RECORD_ID
WHERE 1=1
AND A.AMOUNT &lt;= B.WARN_NUM
<include refid="condition"/>
<include refid="customCondition"/>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.T_HPKC012
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</sqlMap>
......@@ -3,7 +3,15 @@ package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -433,12 +441,24 @@ public class HPKCTools {
}
/**
* HPKC010公共DAO方法定义
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight) {
updateStock(whCode, inventRecordId, amount, BigDecimal.ZERO, weight);
}
/**
* HPKC011公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc010 {
public static class HpKc011 {
/**
* 查询库存信息
......@@ -446,13 +466,13 @@ public class HPKCTools {
* @param ids
* @return
*/
public static List<HPKC010> list(List<Long> ids) {
public static List<HPKC011> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
return DaoBase.getInstance().query(HPKC011.QUERY, queryMap);
}
/**
......@@ -461,12 +481,12 @@ public class HPKCTools {
* @param ids
* @return
*/
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
public static Map<Long, HPKC011> map(List<Long> ids) {
List<HPKC011> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
return results.stream().collect(Collectors.toMap(HPKC011::getId, item -> item));
}
/**
......@@ -481,18 +501,61 @@ public class HPKCTools {
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
DaoBase.getInstance().update(HPSqlConstant.HPKC011.LOCK, queryMap);
}
}
/**
* HPKC011公共DAO方法定义
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param unitWeight
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal unitWeight,
BigDecimal weight) {
if (amount.compareTo(BigDecimal.ZERO) == 0) {
throw new PlatException("入库数量不能为空");
}
EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId);
inInfo.set("amount", amount);
inInfo.set("unitWeight", unitWeight);
inInfo.set("weight", weight);
inInfo.set(EiConstant.serviceName, "HPKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
/**
* HPKC010公共DAO方法定义
*
* @author:songx
* @date:2024/1/31,16:42
*/
public static class HpKc011 {
public static class HpKc010 {
/**
* 查询
*
* @param inventRecordId
* @return
*/
public static List<HPKC010> listBySpec(Long inventRecordId) {
if (inventRecordId != null) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("inventRecordId", inventRecordId);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
/**
* 查询库存信息
......@@ -500,13 +563,13 @@ public class HPKCTools {
* @param ids
* @return
*/
public static List<HPKC011> list(List<Long> ids) {
public static List<HPKC010> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC011.QUERY, queryMap);
return DaoBase.getInstance().query(HPKC010.QUERY, queryMap);
}
/**
......@@ -515,12 +578,12 @@ public class HPKCTools {
* @param ids
* @return
*/
public static Map<Long, HPKC011> map(List<Long> ids) {
List<HPKC011> results = list(ids);
public static Map<Long, HPKC010> map(List<Long> ids) {
List<HPKC010> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC011::getId, item -> item));
return results.stream().collect(Collectors.toMap(HPKC010::getId, item -> item));
}
/**
......@@ -535,37 +598,12 @@ public class HPKCTools {
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPKC011.LOCK, queryMap);
DaoBase.getInstance().update(HPSqlConstant.HPKC010.LOCK, queryMap);
}
}
/**
* 更新库存
*
* @param whCode
* @param inventRecordId
* @param amount
* @param weight
*/
public static void updateStock(String whCode, Long inventRecordId, BigDecimal amount, BigDecimal weight) {
if (amount.compareTo(BigDecimal.ZERO) == 0 && weight.compareTo(BigDecimal.ZERO) == 0) {
return;
}
EiInfo inInfo = new EiInfo();
inInfo.set("whCode", whCode);
inInfo.set("inventRecordId", inventRecordId);
inInfo.set("amount", amount);
inInfo.set("weight", weight);
inInfo.set(EiConstant.serviceName, "HPKC010");
inInfo.set(EiConstant.methodName, "updateStock");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException("跟新库存失败:" + outInfo.getMsg());
}
}
/**
* 查询产品库存信息
*
......
......@@ -35,6 +35,9 @@ public class HPPZ002 extends DaoEPBase {
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司*/
public static final String FIELD_HEAD_NAME = "headName"; /* 负责人*/
public static final String FIELD_PHONE_NAME = "phoneName"; /* 负责人联系方式*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -50,6 +53,9 @@ public class HPPZ002 extends DaoEPBase {
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司*/
public static final String HEAD_NAME = "HEAD_NAME"; /* 负责人*/
public static final String PHONE_NAME = "PHONE_NAME"; /* 负责人联系方式*/
public static final String QUERY = "HPPZ002.query";
public static final String COUNT = "HPPZ002.count";
......@@ -71,6 +77,9 @@ public class HPPZ002 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private String companyName = " "; /* 公司*/
private String headName = " "; /* 负责人*/
private String phoneName = " "; /* 负责人联系方式*/
/**
* initialize the metadata.
......@@ -135,6 +144,18 @@ public class HPPZ002 extends DaoEPBase {
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("公司");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_HEAD_NAME);
eiColumn.setDescName("负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PHONE_NAME);
eiColumn.setDescName("负责人联系方式");
eiMetadata.addMeta(eiColumn);
}
......@@ -369,6 +390,31 @@ public class HPPZ002 extends DaoEPBase {
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getHeadName() {
return headName;
}
public void setHeadName(String headName) {
this.headName = headName;
}
public String getPhoneName() {
return phoneName;
}
public void setPhoneName(String phoneName) {
this.phoneName = phoneName;
}
/**
* get the value from Map.
*
......@@ -391,6 +437,9 @@ public class HPPZ002 extends DaoEPBase {
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setHeadName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_HEAD_NAME)), headName));
setPhoneName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PHONE_NAME)), phoneName));
}
/**
......@@ -414,7 +463,9 @@ public class HPPZ002 extends DaoEPBase {
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_HEAD_NAME, StringUtils.toString(headName, eiMetadata.getMeta(FIELD_HEAD_NAME)));
map.put(FIELD_PHONE_NAME, StringUtils.toString(phoneName, eiMetadata.getMeta(FIELD_PHONE_NAME)));
return map;
}
}
......@@ -37,6 +37,10 @@ public class HPPZ003 extends DaoEPBase {
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司*/
public static final String FIELD_HEAD_NAME = "headName"; /* 负责人*/
public static final String FIELD_PHONE_NAME = "phoneName"; /* 负责人联系方式*/
public static final String FIELD_PUT_ADDRESS = "putAddress"; /* 收货地址*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -52,6 +56,9 @@ public class HPPZ003 extends DaoEPBase {
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司*/
public static final String HEAD_NAME = "HEAD_NAME"; /* 负责人*/
public static final String PHONE_NAME = "PHONE_NAME"; /* 负责人联系方式*/
public static final String QUERY = "HPPZ003.query";
public static final String COUNT = "HPPZ003.count";
......@@ -73,6 +80,10 @@ public class HPPZ003 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private String companyName = " "; /* 公司*/
private String headName = " "; /* 负责人*/
private String phoneName = " "; /* 负责人联系方式*/
private String putAddress = " "; /* 收货地址*/
/**
* initialize the metadata.
......@@ -137,6 +148,22 @@ public class HPPZ003 extends DaoEPBase {
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_COMPANY_NAME);
eiColumn.setDescName("公司");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_HEAD_NAME);
eiColumn.setDescName("负责人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PHONE_NAME);
eiColumn.setDescName("负责人联系方式");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PUT_ADDRESS);
eiColumn.setDescName("收货地址");
eiMetadata.addMeta(eiColumn);
}
......@@ -371,6 +398,39 @@ public class HPPZ003 extends DaoEPBase {
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getHeadName() {
return headName;
}
public void setHeadName(String headName) {
this.headName = headName;
}
public String getPhoneName() {
return phoneName;
}
public void setPhoneName(String phoneName) {
this.phoneName = phoneName;
}
public String getPutAddress() {
return putAddress;
}
public void setPutAddress(String putAddress) {
this.putAddress = putAddress;
}
/**
* get the value from Map.
*
......@@ -393,6 +453,10 @@ public class HPPZ003 extends DaoEPBase {
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setHeadName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_HEAD_NAME)), headName));
setPhoneName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PHONE_NAME)), phoneName));
setPutAddress(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PUT_ADDRESS)), putAddress));
}
/**
......@@ -416,6 +480,10 @@ public class HPPZ003 extends DaoEPBase {
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_HEAD_NAME, StringUtils.toString(headName, eiMetadata.getMeta(FIELD_HEAD_NAME)));
map.put(FIELD_PHONE_NAME, StringUtils.toString(phoneName, eiMetadata.getMeta(FIELD_PHONE_NAME)));
map.put(FIELD_PUT_ADDRESS, StringUtils.toString(putAddress, eiMetadata.getMeta(FIELD_PUT_ADDRESS)));
return map;
}
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -22,6 +23,7 @@ public class ServiceHPPZ001 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "客商类型",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
Thppz001 hppz001 = new Thppz001();
EiInfo outInfo = super.initLoad(inInfo, hppz001);
......@@ -33,6 +35,7 @@ public class ServiceHPPZ001 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "客商类型",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
......@@ -44,6 +47,7 @@ public class ServiceHPPZ001 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "客商类型",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -76,6 +80,7 @@ public class ServiceHPPZ001 extends ServiceBase {
/**
* 修改操作.
*/
@OperationLogAnnotation(operModul = "客商类型",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
......@@ -103,6 +108,7 @@ public class ServiceHPPZ001 extends ServiceBase {
/**
* 删除操作.
*/
@OperationLogAnnotation(operModul = "客商类型",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
Thppz001 hppz001 = new Thppz001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.CompanyTypeEnum;
import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -36,6 +37,7 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.setBlock(CompanyTypeEnum.generatorEiBlock());
......@@ -53,6 +55,7 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -69,6 +72,7 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
......@@ -97,6 +101,7 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try {
......@@ -121,6 +126,7 @@ public class ServiceHPPZ002 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "供应商档案",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.CompanyTypeEnum;
import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -33,6 +34,7 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.setBlock(CompanyTypeEnum.generatorEiBlock());
......@@ -50,6 +52,7 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -66,6 +69,7 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -93,6 +97,7 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -116,6 +121,7 @@ public class ServiceHPPZ003 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "客户档案",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
......@@ -36,6 +37,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.setBlock(InitiateModeEnum.generatorEiBlock());
......@@ -52,6 +54,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -68,6 +71,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -95,6 +99,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -117,6 +122,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "查询",operDesc = "判断存货名称是否存在,如果存在返回编码,否则新增并返回编码")
public EiInfo checkAndSave(EiInfo inInfo){
String inventType = inInfo.getString("inventType");
String inventName = inInfo.getString("inventName");
......@@ -150,6 +156,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -177,6 +184,7 @@ public class ServiceHPPZ004 extends ServiceBase {
* @param eiInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货类型",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType"));
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.hp.pz.domain.HPPZ005;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -14,7 +15,7 @@ import java.util.Date;
import java.util.Map;
public class ServiceHPPZ005 extends ServiceBase {
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
HPPZ005 hppz005 = new HPPZ005();
EiInfo outInfo = super.initLoad(inInfo, hppz005);
......@@ -26,6 +27,7 @@ public class ServiceHPPZ005 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
......@@ -37,6 +39,7 @@ public class ServiceHPPZ005 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -69,6 +72,7 @@ public class ServiceHPPZ005 extends ServiceBase {
/**
* 修改操作.
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
......@@ -96,6 +100,7 @@ public class ServiceHPPZ005 extends ServiceBase {
/**
* 删除操作.
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
HPPZ005 hppz005 = new HPPZ005();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InitiateModeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -22,7 +25,11 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
......@@ -36,6 +43,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null,false);
......@@ -50,6 +58,7 @@ public class ServiceHPPZ006 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -66,6 +75,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -119,15 +129,19 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkUpdateData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006);
}
inInfo = this.query(inInfo);
......@@ -138,13 +152,29 @@ public class ServiceHPPZ006 extends ServiceBase {
}
return inInfo;
}
/**
* 修改数据校验
*
* @param resultRows
*/
private void checkUpdateData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
// 校验是否存在库存
List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId());
AssertUtils.isEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId()));
}
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案", operType = "删除", operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -166,6 +196,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "判断存货档案是否存在,如果存在返回ID,否则新增并返回ID")
public EiInfo checkAndSave(EiInfo inInfo){
inInfo.setCell(EiConstant.queryBlock,0,HPPZ006.FIELD_INVENT_TYPE,inInfo.getString("inventType"));
inInfo.setCell(EiConstant.queryBlock,0,HPPZ006.FIELD_INVENT_CODE,inInfo.getString("inventCode"));
......@@ -207,6 +238,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "规格下拉框")
public EiInfo queryComboBoxSpec(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......@@ -224,18 +256,21 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param eiInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "存货名称下拉框")
public EiInfo queryMaterialComboBox(EiInfo eiInfo) {
Map map = EiInfoUtils.getFirstRow(eiInfo);
if (ObjectUtils.isEmpty(map.get("inventType"))) {
map.put("inventType", eiInfo.getString("inventType"));
Map queryRow = EiInfoUtils.getFirstRow(eiInfo);
if (ObjectUtils.isEmpty(queryRow.get("inventType"))) {
queryRow.put("inventType", eiInfo.getString("inventType"));
}
boolean isSplicingSymbol = true;
if (eiInfo.getString("isSplicingSymbol") != null) {
isSplicingSymbol = Boolean.parseBoolean(eiInfo.getString("isSplicingSymbol"));
} else if (queryRow.get("isSplicingSymbol") != null) {
isSplicingSymbol = MapUtils.getBoolean(queryRow, "isSplicingSymbol");
}
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map,isSplicingSymbol);
CommonMethod.initBlock(eiInfo, list, queryRow, isSplicingSymbol);
return eiInfo;
}
......@@ -245,6 +280,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBoxAll(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......@@ -262,6 +298,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "单位下拉框")
public EiInfo queryComboBoxUnit(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......@@ -279,6 +316,7 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "查询",operDesc = "下拉框")
public EiInfo queryPrdtComboBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
......@@ -7,6 +8,7 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -31,6 +33,7 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null,true);
......@@ -47,6 +50,7 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -60,6 +64,7 @@ public class ServiceHPPZ007 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -87,6 +92,7 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -110,6 +116,7 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -131,6 +138,7 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "根据仓库CODE找对象")
public EiInfo queryByWhCode(EiInfo inInfo) {
Map params = new HashMap<>();
params.put("whCode", inInfo.getString("whCode"));
......@@ -145,14 +153,18 @@ public class ServiceHPPZ007 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "仓库档案",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBox(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.WH_RECORD_BLOCK_ID);
boolean isSplicingSymbol = true;
if (inInfo.getString("isSplicingSymbol") != null) {
isSplicingSymbol = Boolean.parseBoolean(inInfo.getString("isSplicingSymbol"));
} else if (queryRow.get("isSplicingSymbol") != null) {
isSplicingSymbol = MapUtils.getBoolean(queryRow, "isSplicingSymbol");
}
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo),isSplicingSymbol);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), isSplicingSymbol);
return inInfo;
}
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -22,6 +23,7 @@ public class ServiceHPPZ008 extends ServiceBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "库存预警值档案",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
Thppz008 hppz008 = new Thppz008();
EiInfo outInfo = super.initLoad(inInfo, hppz008);
......@@ -33,6 +35,7 @@ public class ServiceHPPZ008 extends ServiceBase {
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "库存预警值档案",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
......@@ -44,6 +47,7 @@ public class ServiceHPPZ008 extends ServiceBase {
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "库存预警值档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -79,6 +83,7 @@ public class ServiceHPPZ008 extends ServiceBase {
/**
* 修改操作.
*/
@OperationLogAnnotation(operModul = "库存预警值档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
......@@ -106,6 +111,7 @@ public class ServiceHPPZ008 extends ServiceBase {
/**
* 删除操作.
*/
@OperationLogAnnotation(operModul = "库存预警值档案",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo eiInfo) {
Thppz008 hppz008 = new Thppz008();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
......@@ -36,6 +37,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ009().eiMetadata);
......@@ -51,6 +53,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -67,6 +70,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "插入",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -142,6 +146,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -221,6 +226,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "修改",operDesc = "修改操作")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -246,6 +252,7 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "删除",operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
......@@ -35,6 +36,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ010().eiMetadata);
......@@ -50,6 +52,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "查询",operDesc = "查询数据列表")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -66,6 +69,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -137,6 +141,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "新增操作")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
......@@ -216,6 +221,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "修改",operDesc = "修改操作")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -241,6 +247,7 @@ public class ServiceHPPZ010 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "删除",operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
......@@ -37,6 +38,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
......@@ -56,6 +58,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
......@@ -72,6 +75,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "新增",operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -147,6 +151,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "删除",operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -168,6 +173,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......@@ -178,7 +184,7 @@ public class ServiceHPPZ011 extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "厂区管理",operType = "查询",operDesc = "下拉框")
public EiInfo queryComboBoxAll(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......@@ -194,6 +200,7 @@ public class ServiceHPPZ011 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "厂区管理",operType = "查询",operDesc = "下拉框")
public EiInfo queryGroupComboBox(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
......
package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ012;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 库存预警值管理
*
* @author:songx
* @date:2024/1/18,17:15
*/
public class ServiceHPPZ012 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_ALL_BLOCK_ID), queryMap, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ012().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存预警管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPPZ012.QUERY, new HPPZ012());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存预警管理", operType = "新增", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
this.saveData(resultRows);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRows.get(i));
AssertUtils.isNull(fPz012.getWhCode(), "请选择仓库");
AssertUtils.isEmpty(fPz012.getInventCode(), "请选择存货");
AssertUtils.isNull(fPz012.getInventRecordId(), "请选择规格");
AssertUtils.isNull(fPz012.getWarnNum(), "预警数量不能为空");
}
}
/**
* 保存数据
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRow);
// 设置基础信息
this.setBaseInfo(fPz012);
if (fPz012.getId() == null || fPz012.getId() == 0) {
this.add(fPz012);
} else {
this.modify(fPz012);
}
}
}
/**
* 设置基础信息
*
* @param fPz012
*/
private void setBaseInfo(HPPZ012 fPz012) {
// 仓库名称
fPz012.setWhName(HPPZTools.HpPz007.getByCode(fPz012.getWhCode()).getWhName());
// 存货名称
fPz012.setInventName(HPPZTools.HpPz004.getByCode(fPz012.getInventCode()).getInventName());
}
/**
* 新增企业信息
*
* @param fPz012
*/
private void add(HPPZ012 fPz012) {
fPz012.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ012.INSERT, fPz012);
}
/**
* 修改数据
*
* @param fPz012
*/
private void modify(HPPZ012 fPz012) {
DaoUtils.update(HPPZ012.UPDATE, fPz012);
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存预警管理", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPPZ012 fPz012 = new HPPZ012();
fPz012.fromMap(resultRow);
fPz012.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ012.DELETE, fPz012);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
......@@ -16,7 +16,10 @@
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
COMPANY_NAME as "companyName", <!--公司 -->
HEAD_NAME as "headName", <!--负责人-->
PHONE_NAME as "phoneName" <!--负责人联系方式-->
</sql>
<sql id="condition">
......@@ -45,6 +48,15 @@
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="headName">
HEAD_NAME LIKE CONCAT('%', #headName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="phoneName">
PHONE_NAME = #phoneName#
</isNotEmpty>
</sql>
<sql id="order">
......@@ -83,10 +95,14 @@
STATUS, <!-- 状态 0禁用 1启用 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
CREATED_TIME, <!-- 创建时间 -->
COMPANY_NAME,
HEAD_NAME,
PHONE_NAME
) VALUES (
#companyCode#, #depCode#, #custType#, #custCode#, #custName#, #address#,
#status#, #createdBy#, #createdName#, #createdTime#
#status#, #createdBy#, #createdName#, #createdTime# , #companyName# , #headName#
, #phoneName#
)
</insert>
......@@ -104,7 +120,10 @@
STATUS = #status#, <!-- 状态 0禁用 1启用 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
COMPANY_NAME = #companyName#,
HEAD_NAME = #headName#,
PHONE_NAME = #phoneName#
WHERE ID = #id#
</update>
......
......@@ -16,7 +16,11 @@
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
COMPANY_NAME as "companyName", <!--公司 -->
HEAD_NAME as "headName", <!--负责人-->
PHONE_NAME as "phoneName", <!--负责人联系方式-->
PUT_ADDRESS as "putAddress" <!--收货地址-->
</sql>
<sql id="condition">
......@@ -45,6 +49,18 @@
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="headName">
HEAD_NAME LIKE CONCAT('%', #headName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="phoneName">
PHONE_NAME = #phoneName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="putAddress">
PUT_ADDRESS = #putAddress#
</isNotEmpty>
</sql>
<sql id="order">
......@@ -82,10 +98,15 @@
STATUS, <!-- 状态 0未启用 1启用 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
CREATED_TIME, <!-- 创建时间 -->
COMPANY_NAME,
HEAD_NAME,
PHONE_NAME,
PUT_ADDRESS
) VALUES (
#companyCode#, #depCode#, #custType#, #custCode#, #custName#, #address#,
#status#, #createdBy#, #createdName#, #createdTime#
#status#, #createdBy#, #createdName#, #createdTime# , #companyName# , #headName#
, #phoneName# , #putAddress#
)
</insert>
......@@ -103,7 +124,11 @@
STATUS = #status#, <!-- 状态 0未启用 1启用 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
COMPANY_NAME = #companyName#,
HEAD_NAME = #headName#,
PHONE_NAME = #phoneName#,
PUT_ADDRESS = #putAddress#
WHERE ID = #id#
</update>
......
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