Commit de5887cb by 江和松

生产领料单增加选择产品清单功能

parent ddb9b1f4
......@@ -549,4 +549,18 @@ public class HGConstant {
// 已开票
public static final Integer S2 = 2;
}
/**
* 领料来源
*
* @author:jhs
* @date:2024/10/27,13:57
*/
public static class ReceiveDataSource {
// 库存
public static final Integer S1 = 1;
// 产品清单
public static final Integer S2 = 2;
}
}
......@@ -108,13 +108,13 @@ public class HGSqlConstant {
// 收货完成
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
}
/**
* @author:songx
* @date:2024/8/30,16:25
*/
public class HgCg003A {
// 模块名称:HGCW003A
private static final String MODULE_NAME = "HGCG003A.";
//
......@@ -560,6 +560,22 @@ public class HGSqlConstant {
}
/**
* HGKC010 SQL 定义
*
* @author:jhs
* @date:2024/10/27,16:45
*/
public class HGSC004A {
// 模块名称
private static final String MODULE_NAME = "HGSC004A.";
// 物料清单查询
public static final String QUERY_MATERIAL = MODULE_NAME + "queryMaterial";
// 锁
public static final String LOCKS = MODULE_NAME + "locks";
}
/**
* @author:songx
* @date:2024/2/5,10:16
*/
......@@ -614,7 +630,7 @@ public class HGSqlConstant {
* @date:2024/10/22,16:05
*/
public class HGZL004 {
// 锁
public static final String LOCK = "HGZL004.lock";
}
......@@ -626,7 +642,7 @@ public class HGSqlConstant {
* @date:2024/5/8,10:55
*/
public class HgXsUser {
// 查询
public static final String GET_BY_LOGIN = "HGXSUser.getByLogin";
// 查询
......@@ -656,7 +672,7 @@ public class HGSqlConstant {
* @date:2024/1/20,16:45
*/
public class HgXsOrg {
// 查询组织机构
public static final String GET = "HGXSOrg.get";
// 查询组织机构
......
......@@ -44,6 +44,7 @@ public class HGKC008 extends DaoEPBase {
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_RECEIVE_USER_ID = "receiveUserId"; /* 领用人ID*/
public static final String FIELD_RECEIVE_USER_NAME = "receiveUserName"; /* 领用人姓名*/
public static final String FIELD_DATA_SOURCE= "dataSource"; /* 数据来源 1存货 2产品清单*/
public static final String COL_ID = "ID"; /* 主键id*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 账套*/
......@@ -98,6 +99,7 @@ public class HGKC008 extends DaoEPBase {
private String projName = " "; /* 项目名称*/
private String receiveUserId = " "; /* 领用人ID*/
private String receiveUserName = " "; /* 领用人姓名*/
private Integer dataSource = new Integer(0); /* 数据来源 1存货 2产品清单*/
/**
* initialize the metadata.
......@@ -184,14 +186,18 @@ public class HGKC008 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_USER_ID);
eiColumn.setDescName("领用人ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_RECEIVE_USER_NAME);
eiColumn.setDescName("领用人姓名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DATA_SOURCE);
eiColumn.setDescName("数据来源 1存货 2产品清单");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -505,23 +511,31 @@ public class HGKC008 extends DaoEPBase {
public void setProjName(String projName) {
this.projName = projName;
}
public String getReceiveUserId() {
return receiveUserId;
}
public void setReceiveUserId(String receiveUserId) {
this.receiveUserId = receiveUserId;
}
public String getReceiveUserName() {
return receiveUserName;
}
public void setReceiveUserName(String receiveUserName) {
this.receiveUserName = receiveUserName;
}
public Integer getDataSource() {
return dataSource;
}
public void setDataSource(Integer dataSource) {
this.dataSource = dataSource;
}
/**
* get the value from Map.
*
......@@ -552,6 +566,7 @@ public class HGKC008 extends DaoEPBase {
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setReceiveUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_USER_ID)), receiveUserId));
setReceiveUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIVE_USER_NAME)), receiveUserName));
setDataSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DATA_SOURCE)), dataSource));
}
/**
......@@ -583,6 +598,7 @@ public class HGKC008 extends DaoEPBase {
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_RECEIVE_USER_ID, StringUtils.toString(receiveUserId, eiMetadata.getMeta(FIELD_RECEIVE_USER_ID)));
map.put(FIELD_RECEIVE_USER_NAME, StringUtils.toString(receiveUserName, eiMetadata.getMeta(FIELD_RECEIVE_USER_NAME)));
map.put(FIELD_DATA_SOURCE, StringUtils.toString(dataSource, eiMetadata.getMeta(FIELD_DATA_SOURCE)));
return map;
}
......
......@@ -117,7 +117,7 @@ public class ServiceHGKC008B extends ServiceBase {
}
return inInfo;
}
/**
* 确认数量
*
......@@ -149,10 +149,11 @@ public class ServiceHGKC008B extends ServiceBase {
newKc008A.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newKc008A.setAccountCode("");
newKc008A.setDepCode("");
newKc008A.setDataSource(HGConstant.ReceiveDataSource.S1);
DaoUtils.insert(HGKC008A.INSERT, newKc008A);
}
}
/**
* 数据校验
*
......@@ -187,5 +188,5 @@ public class ServiceHGKC008B extends ServiceBase {
}
}
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.constant.HgKcConst;
import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGKC008D extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "产品清单", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map map = new HashMap();
map.put("inventTypeDetails", InventTypeDetailEnum.getInentTypeTwo());
map.put(HGKC008.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID,
DdynamicEnum.PROJ_RECORD_BLOCK_ID, DdynamicEnum.PROJ_RECORD_BY_ROLE_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID, DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_BLOCK_ID
), map, false
);
EiInfoUtils.addBlock(inInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC004A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "产品清单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGSqlConstant.HGSC004A.QUERY_MATERIAL, new HGSC004A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 确认操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "产品清单", operType = "查询", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0,
HGKC008A.FIELD_RECEIVE_ID);
List<HGSC004A> hgsc004as = MapUtils.toDaoEPBases(inInfo, HGSC004A.class);
// db数据
Map<Long, HGSC004A> dbSc004aMap = HgScUtils.HgSc004A.lockGetDataEp(hgsc004as);
// 领料明细
List<HGKC008A> dbKc008As = HGKCUtils.HgKc008A.listByPrimaryId(receiveId);
// 领料主信息
HGKC008 hgkc008 = HGKCUtils.HgKc008.get(receiveId);
List<String> inventCodes = new LinkedList<>();
dbSc004aMap.forEach((k,v) ->{
inventCodes.add(v.getProductCode());
});
// 实时库存数据
List<HGKC010> dbKc010s = HGKCTools.HgKc010.getListByBussiness(hgkc008.getCompanyCode(),
hgkc008.getWhCode(), inventCodes);
// 数据校验
this.checkConfirmData(hgsc004as, dbKc008As, dbSc004aMap, hgkc008,dbKc010s);
// 保存数据
this.confirmData(hgsc004as, dbKc010s, hgkc008);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgsc004as.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 确认数量
*
* @param hgsc004As
* @param dbKc010s
* @param dbKc008
*/
private void confirmData(List<HGSC004A> hgsc004As, List<HGKC010> dbKc010s, HGKC008 dbKc008) {
for (HGSC004A hgsc004A : hgsc004As) {
HGKC010 dbKc010 = dbKc010s.stream().filter(o -> o.getInventCode().equals(hgsc004A.getProductCode())).findAny().orElse(null);
HGKC008A newKc008A = BeanUtils.copy(dbKc010, HGKC008A.class);
newKc008A.setApplyCode(dbKc008.getApplyCode());
newKc008A.setApplyLineCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.SC_APPLY_LINE_CODE,
new String[]{dbKc008.getApplyCode()}));
newKc008A.setProjCode(dbKc008.getProjCode());
newKc008A.setProjName(dbKc008.getProjName());
newKc008A.setCompanyCode(dbKc008.getCompanyCode());
newKc008A.setCompanyName(dbKc008.getCompanyName());
newKc008A.setReceiveId(dbKc008.getId());
newKc008A.setInvId(dbKc010.getId());
newKc008A.setInvQty(hgsc004A.getApplyQty());
newKc008A.setInvWeight(hgsc004A.getApplyQty().multiply(dbKc010.getInvUnitWeight()));
newKc008A.setInvWidth(dbKc010.getWidth());
newKc008A.setInvLength(dbKc010.getLength());
newKc008A.setInvThick(dbKc010.getThick());
newKc008A.setInvSpec(dbKc010.getSpec());
newKc008A.setInvSpecId(dbKc010.getSpecId());
newKc008A.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newKc008A.setAccountCode("");
newKc008A.setDepCode("");
newKc008A.setMatId(hgsc004A.getMaterialId());
newKc008A.setMatDetailId(hgsc004A.getId());
newKc008A.setDataSource(HGConstant.ReceiveDataSource.S2);
DaoUtils.insert(HGKC008A.INSERT, newKc008A);
}
}
/**
* 数据校验
*
* @param sc004As
* @param dbKc008As
* @param dbSc004Map
* @param dbKc008
*/
private void checkConfirmData(List<HGSC004A> sc004As, List<HGKC008A> dbKc008As, Map<Long, HGSC004A> dbSc004Map,
HGKC008 dbKc008,List<HGKC010> dbKc010s) {
AssertUtils.isEquals(dbKc008.getStatus(), HGConstant.ProductStatus.YTJ, "领料单已提交,不可修改");
for (HGSC004A sc004A : sc004As) {
HGKC010 hgkc010 = dbKc010s.stream().filter(o -> o.getInventCode().equals(sc004A.getProductCode())).findAny().orElse(null);
AssertUtils.isNull(hgkc010, String.format("库存【%s】不存在",
sc004A.getProductCode()));
AssertUtils.isGe(BigDecimal.ZERO, sc004A.getApplyQty(), String.format("库存【%s】申请数量必须大于0",
sc004A.getProductCode()));
// 查询已申请未提交的领料数量
List<HGKC008A> qtyKc008As = HGKCTools.HgKc008A.listByInv(hgkc010.getCompanyCode(), hgkc010.getWhCode(),
hgkc010.getInventCode());
BigDecimal applyQtySum = CollectionUtils.isEmpty(qtyKc008As) ? BigDecimal.ZERO
: qtyKc008As.stream().filter(item -> HgKcConst.HgKc008.Status.S0.equals(item.getStatus()))
.map(HGKC008A::getInvQty).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal totalApplyQty = applyQtySum.add(sc004A.getApplyQty());
AssertUtils.isGt(totalApplyQty, hgkc010.getInvQty(), String.format("存货【%s(%s)】累计申请数量【%s】超过库存数量【%s】",
hgkc010.getInventCode(), hgkc010.getInventName(),
totalApplyQty.stripTrailingZeros().toPlainString(), hgkc010.getInvQty()));
HGKC008A hgkc008a = dbKc008As.stream().filter(o -> o.getMatDetailId().intValue() == sc004A.getId().intValue()).findAny().orElse(null);
AssertUtils.isNotNull(hgkc008a,String.format("此领料单已选择存货:%s", sc004A.getProductCode()));
}
}
}
......@@ -24,7 +24,8 @@
PROJ_NAME as "projName", <!-- 项目名称 -->
RECEIVE_TYPE as "receiveType", <!-- 领料单类型 0:正常,1:退库 -->
RECEIVE_USER_ID as "receiveUserId", <!-- 领料人ID -->
RECEIVE_USER_NAME as "receiveUserName" <!-- 领料人姓名 -->
RECEIVE_USER_NAME as "receiveUserName", <!-- 领料人姓名 -->
DATA_SOURCE as "dataSource" <!-- 数据来源 1存货 2产品清单 -->
</sql>
<sql id="condition">
......@@ -87,6 +88,9 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME like ('%$projName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dataSource">
DATA_SOURCE = #dataSource#
</isNotEmpty>
</sql>
<sql id="customCondition">
......@@ -154,11 +158,12 @@
STATUS, <!-- 状态 0未提交,1已提交 -->
RECEIVE_TYPE, <!-- 领料单类型 0:正常,1:退库 -->
RECEIVE_USER_ID,
RECEIVE_USER_NAME
RECEIVE_USER_NAME,
DATA_SOURCE
) VALUES (
#projCode#, #projName#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #receiptDate#,
#applyCode#, #whCode#, #whName#, #status#, #receiveType#, #receiveUserId#, #receiveUserName#)
#applyCode#, #whCode#, #whName#, #status#, #receiveType#, #receiveUserId#, #receiveUserName#, #dataSource#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC008
</selectKey>
......
......@@ -39,7 +39,10 @@
AMOUNT as "amount", <!-- 金额 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
QUALITY_NO as "qualityNo", <!-- 质检单号 -->
INV_ID as "invId" <!-- 库存ID -->
INV_ID as "invId", <!-- 库存ID -->
MAT_ID as "matId", <!-- 物料清单ID -->
MAT_DETAIL_ID as "matDetailId", <!-- 物料清单明细ID -->
DATA_SOURCE as "dataSource" <!-- 数据来源 1存货 2产品清单 -->
</sql>
<sql id="condition">
......@@ -130,6 +133,16 @@
<isNotEmpty prepend=" AND " property="invId">
INV_ID = #invId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matDetailId">
MAT_DETAIL_ID = #matDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dataSource">
DATA_SOURCE = #dataSource#
</isNotEmpty>
</sql>
<sql id="idCondition">
......@@ -236,12 +249,15 @@
AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL,
QUALITY_NO,
INV_ID
INV_ID,
MAT_ID,
MAT_DETAIL_ID,
DATA_SOURCE
) VALUES (#accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #status#, #applyLineCode#, #applyCode#, #receiveId#, #companyCode#, #companyName#, #whCode#,
#whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#,
#invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#, #inventTypeDetail#,
#qualityNo#, #invId#)
#qualityNo#, #invId#, #matId#, #matDetailId#, #dataSource#)
</insert>
<delete id="delete">
......
......@@ -66,6 +66,7 @@ public class HGSC004A extends DaoEPBase {
public static final String FIELD_invent_source = "inventSource"; /* 物料来源 1加工 2外购*/
public static final String COL_id = "id"; /* 主键*/
public static final String COL_company_code = "company_code"; /* 公司编码(预留)*/
public static final String COL_company_name = "company_name"; /* 公司名称(预留)*/
......@@ -176,6 +177,11 @@ public class HGSC004A extends DaoEPBase {
private String projCodePrefix = " "; /*项目前缀*/
@ExcelAnno(index = 15)
private String projNamePrefix = " ";
//生产领料申请
public static final String FIELD_APPLY_QTY = "applyQty"; /* 申请数量*/
public static final String COL_APPLY_QTY = "APPLY_QTY"; /* 申请数量*/
private BigDecimal applyQty = new BigDecimal(0.000); /* 申请数量*/
/**
* initialize the metadata.
*/
......@@ -407,6 +413,13 @@ public class HGSC004A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_invent_source);
eiColumn.setDescName("物料来源 1加工 2外购");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_APPLY_QTY);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(15);
eiColumn.setDescName("申请数量");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -973,7 +986,13 @@ public class HGSC004A extends DaoEPBase {
public void setInventSource(Integer inventSource) {
this.inventSource = inventSource;
}
public BigDecimal getApplyQty() {
return applyQty;
}
public void setApplyQty(BigDecimal applyQty) {
this.applyQty = applyQty;
}
/**
* get the value from Map.
*
......@@ -1023,6 +1042,8 @@ public class HGSC004A extends DaoEPBase {
setProjCodePrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_proj_code_prefix)), projCodePrefix));
setProjNamePrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_proj_name_prefix)), projNamePrefix));
setInventSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_invent_source)), inventSource));
setApplyQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_APPLY_QTY)), applyQty));
}
/**
......@@ -1073,6 +1094,8 @@ public class HGSC004A extends DaoEPBase {
map.put(FIELD_proj_code_prefix, StringUtils.toString(projCodePrefix, eiMetadata.getMeta(FIELD_proj_code_prefix)));
map.put(FIELD_proj_name_prefix, StringUtils.toString(projNamePrefix, eiMetadata.getMeta(FIELD_proj_name_prefix)));
map.put(FIELD_invent_source, StringUtils.toString(inventSource, eiMetadata.getMeta(FIELD_invent_source)));
map.put(FIELD_APPLY_QTY, StringUtils.toString(applyQty, eiMetadata.getMeta(FIELD_APPLY_QTY)));
return map;
}
}
......@@ -164,6 +164,15 @@
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004A">
SELECT
......@@ -518,6 +527,98 @@
</update>
<select id="queryMaterial" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004A">
SELECT
a.id as "id", <!-- 主键 -->
a.company_code as "companyCode", <!-- 公司编码(预留) -->
a.company_name as "companyName", <!-- 公司名称(预留) -->
a.dep_code as "depCode", <!-- 部门编号(预留) -->
a.dep_name as "depName", <!-- 部门名称(预留) -->
a.proj_code as "projCode", <!-- 项目编码(预留) -->
a.proj_name as "projName", <!-- 项目名称(预留) -->
a.parent_prod_code as "parentProdCode", <!-- 父节点-产品编码 -->
a.parent_prod_name as "parentProdName", <!-- 父节点-产品名称 -->
a.material_id as "materialId", <!-- 物料清单id -->
a.product_id as "productId", <!-- 产品id -->
a.product_type as "productType", <!-- 产品类别 -->
a.product_code as "productCode", <!-- 产品编号 -->
a.product_name as "productName", <!-- 产品名称 -->
a.invent_type as "inventType", <!-- 档案类型 -->
a.invent_source as "inventSource", <!-- 物料来源 1加工 2外购 -->
a.spec as "spec",
a.length as "length", <!-- 长 -->
a.width as "width", <!-- 宽 -->
a.thick as "thick", <!-- 厚 -->
a.product_status as "productStatus", <!-- 产品状态 0:未提交,1:已提交 -->
a.change_type as "changeType", <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
a.quantity as "quantity", <!-- 数量 -->
a.single_weight as "singleWeight", <!-- 单重 -->
a.total_weight as "totalWeight", <!-- 总重 -->
a.approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
a.leaf as "leaf", <!-- 是否有叶子节点 -->
a.sort as "sort", <!-- 排序字段 -->
a.lv as "lv", <!-- 层级 -->
a.account_code as "accountCode", <!-- 帐套 -->
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" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC004A a
left join ${hggpSchema}.HGSC004 b on a.material_id = b.id
WHERE 1=1
and a.lv NOT IN (1,2)
and b.material_status = 2
<isNotEmpty prepend=" AND " property="projName">
a.proj_name like CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
a.proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
a.company_code = #companyCode#
</isNotEmpty>
<!-- 材料名称查询 -->
<isNotEmpty prepend=" AND " property="materialName">
(a.lv = 4
and a.product_name like CONCAT('%', #materialName#, '%')
)
</isNotEmpty>
<!-- 产品名称查询 -->
<isNotEmpty prepend=" AND " property="productName">
(a.lv = 3
and a.product_name like CONCAT('%', #productName#, '%')
)
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
a.id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
a.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
a.CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
<!-- 锁 -->
<update id="locks">
UPDATE ${hggpSchema}.HGSC004A
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<include refid="idCondition"/>
</update>
</sqlMap>
......@@ -399,6 +399,46 @@ public class HGSCTools {
}
public static class THGSC004A{
/**
* 锁
*
* @param ids
* @return
*/
public static void lock(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map paramMap = new HashMap();
paramMap.put("ids", ids);
DaoBase.getInstance().update(HGSqlConstant.HGSC004A.LOCKS, paramMap);
}
/**
* 查询
*
* @param ids
* @return
*/
public static Map<Long, HGSC004A> map(List<Long> ids) {
List<HGSC004A> results = list(ids);
return results.stream().collect(Collectors.toMap(HGSC004A::getId, item -> item));
}
/**
* 查询
*
* @param ids
* @return
*/
public static List<HGSC004A> list(List<Long> ids) {
AssertUtils.isEmpty(ids, "物料ID不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGSC004A.QUERY, paramMap);
}
public static void checkFatherSubmitStatus(Long matId) {
HGSC005 hgsc005 = THGSC005.queryByMatId(matId);
AssertUtils.isTrue(hgsc005.getCommitStatus().compareTo(CommonConstant.YesNo.NO_0)==1, "生产计划已提交,不能操作!");
......
......@@ -4,7 +4,10 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
......@@ -29,11 +32,40 @@ import java.util.stream.Collectors;
public class HgScUtils {
/**
* @author:jhs
* @date:2024/10/27,16:17
*/
public static class HgSc004A {
/**
* 锁并且获取数据
*
* @param sc004a
* @return
*/
public static Map<Long, HGSC004A> lockGetDataEp(List<? extends HGSC004A> sc004a) {
return lockGetData(ObjectUtils.listEpKey(sc004a, HGSC004A.FIELD_id));
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public static Map<Long, HGSC004A> lockGetData(List<Long> ids) {
// 锁
HGSCTools.THGSC004A.lock(ids);
// db数据
return HGSCTools.THGSC004A.map(ids);
}
}
/**
* @author:songx
* @date:2024/8/22,16:17
*/
public static class HgSc007 {
/**
* 设置组织机构查询条件
*
......@@ -65,7 +97,7 @@ public class HgScUtils {
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
}
}
/**
* HGSC007B 定义
*
......@@ -73,7 +105,7 @@ public class HgScUtils {
* @date:2024/9/14,14:35
*/
public static class HgSc007B {
/**
* 新增组人员
*
......@@ -94,7 +126,7 @@ public class HgScUtils {
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
/**
* 更新组人员
*
......@@ -117,15 +149,15 @@ public class HgScUtils {
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
}
/**
* @author:songx
* @date:2024/8/22,16:17
*/
public static class HgSc010A {
/**
* 锁并获取数据
*
......
......@@ -47,6 +47,9 @@
<EF:EFComboColumn cname="类型" ename="receiveType" width="80" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.receiveType"/>
</EF:EFComboColumn>
<EF:EFComboColumn cname="领料来源" ename="dataSource" width="80" align="center" required="true" enable="true" >
<EF:EFCodeOption codeName="hggp.receiveDataSource"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......
......@@ -5,6 +5,7 @@ $(function (){
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
var receiveDataSource = $("#main-0-dataSource").val();
/* 页面查询框的尺寸设置 */
$.extend(true, IPLATUI.Config, {
EFGrid: {
......@@ -18,6 +19,13 @@ $(function (){
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
toolbarConfig: {
// hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
add: receiveDataSource === 2 ? false : true, // 不显示新增按钮
add: receiveDataSource === 2 ? false : true, // 不显示取消按钮
save: receiveDataSource === 2 ? false : true // 不显示保存按钮
// delete: false, // 显示删除按钮
},
beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val();
//如果提交了,则不能修改
......@@ -137,8 +145,12 @@ $(function (){
},
}
}
// 选择合同
$("#SELECT_INVENT").on("click", selectInvent);
// 选择产品清单
$("#SELECT_MBOM").on("click", selectMbom);
downKeyUp();
})
......@@ -148,17 +160,27 @@ $(function (){
* 页面加载时执行
*/
$(window).load(function () {
// 按钮显示
let status = $("#main-0-status").val();
//如果提交了,则不能修改
if (isBlank(status) || status != "0") {
$('#add').hide();
$('#save-changes').hide();
$('#cancel-changes').hide();
$('#delete').hide();
}
let receiveDataSource = $("#main-0-dataSource").val();
//选择产品时
if(receiveDataSource == 2){
$("#SELECT_INVENT").hide();
$('#add').hide();
$('#save-changes').hide();
$('#cancel-changes').hide();
}else{
$("#SELECT_MBOM").hide();
}
// 查询
query();
// 按钮显示
let status = $("#main-0-status").val();
//如果提交了,则不能修改
if (isBlank(status) || status != "0") {
$('#add').hide();
$('#save-changes').hide();
$('#cancel-changes').hide();
$('#delete').hide();
}
});
/**
......@@ -240,6 +262,29 @@ let selectInvent = function () {
}
/**
* 选择
*/
let selectMbom = function () {
let params = {
"inqu_status-0-receiveId": $("#inqu_status-0-receiveId").val(),
"inqu_status-0-companyCode": $("#main-0-companyCode").val(),
"inqu_status-0-whCode": $("#main-0-whCode").val(),
"inqu_status-0-whName": $("#main-0-whName").val(),
"inqu_status-0-companyName": $("#main-0-companyName").val(),
"inqu_status-0-projCode": $("#main-0-projCode").val(),
"inqu_status-0-projName": $("#main-0-projName").val()
}
JSColorbox.open({
href: "HGKC008D",
title: "<div style='text-align: center;'>产品清单</div>",
width: "90%",
height: "90%",
params: params,
callbackName: selectInventCallback
});
}
/**
* 选择回调
*/
let selectInventCallback = function () {
......
......@@ -12,8 +12,13 @@
<EF:EFInput ename="main-0-applyCode" cname="领料单号" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-status" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-companyCode" cname="公司编码" colWidth="3" type="hidden"/>
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="main-0-whName" cname="仓库名称" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-companyCode" cname="公司编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-companyName" cname="公司名称" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-projCode" cname="项目编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-projName" cname="项目名称" colWidth="3" type="hidden"/>
<EF:EFInput ename="main-0-dataSource" cname="领料来源" colWidth="3" type="hidden"/>
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-applyCode" cname="申请编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-receiveId" cname="领料单id" colWidth="3" type="hidden"/>
<div class="row">
......
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
columns: [{
field: "whCode",
template: function (dataItem) {
return $("#inqu_status-0-whCode").val();
}
},
{
field: "whCode",
template: function (dataItem) {
return $("#inqu_status-0-whCode").val();
}
},
{
field: "whName",
template: function (dataItem) {
return $("#inqu_status-0-whName").val();
}
},
{
field: "companyCode",
template: function (dataItem) {
return $("#inqu_status-0-companyCode").val();
}
},
{
field: "companyName",
template: function (dataItem) {
return $("#inqu_status-0-companyName").val();
}
},
{
field: "projCode",
template: function (dataItem) {
return $("#inqu_status-0-projCode").val();
}
},
{
field: "projName",
template: function (dataItem) {
return $("#inqu_status-0-projName").val();
}
}
// {
// field: "productCode",
// template: function (dataItem) {
// let lv = dataItem.lv;
// let template = dataItem.productCode;
// if(lv == 4){
// template = dataItem.parentProdCode;
// }
// return template;
// }
// },
// {
// field: "productName",
// template: function (dataItem) {
// let lv = dataItem.lv;
// let template = dataItem.productName;
// if(lv == 4){
// template = dataItem.parentProdName;
// }
// return template;
// }
// },
// {
// field: "materialCode",
// template: function (dataItem) {
// let lv = dataItem.lv;
// let template = '';
// if(lv == 4){
// template = dataItem.productCode;
// }
// return template;
// }
// },
// {
// field: "materialtName",
// template: function (dataItem) {
// let lv = dataItem.lv;
// let template = '';
// if(lv == 4){
// template = dataItem.productName;
// }
// return template;
// }
// }
]
},
};
// 查询
$("#QUERY").on("click", query);
// 确认
$("#CONFIRM").on("click", confirm);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
//存货编号查询条件
// initInventCode();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
/**
* 选择
*/
let confirm = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let applyQty = rows[i]['applyQty'];
let invQty = rows[i]['invQty'];
if (!isPositiveNumber(applyQty)) {
message("勾选的第" + (i + 1) + "行申请数量必须大于0");
return;
}
if (parseFloat(invQty) < parseFloat(applyQty)) {
message("勾选的第" + (i + 1) + "行申请数量不能大于库存数量");
return;
}
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据进行\"生产领料\"操作吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC008D", "confirm",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
/**
* 存货编号
*/
let initInventCode = function () {
//物料信息下拉
var inInfo=new EiInfo();
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
let dataSource;
var input=$("#inqu_status-0-inventCode");
dataSource=ei.getBlock("invent_record_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataSource,
template: "[#:valueField#]#:textField#|#:param2Field#",
filter: "contains"
});
}, onFail: function (ei) {
}
}, {async: false});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="综合库存管理">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-companyCode" cname="公司编号" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-companyName" cname="公司编号" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-receiveId" cname="领料单id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projCode" cname="项目编号" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-whName" cname="仓库名称" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="仓库名称" ename="whName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="材料名称" ename="materialName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="成品名称" ename="productName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="whCode" cname="仓库编号" enable="false" width="130" align="center" hidden="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="130" align="center" />
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center"
blockName="invent_type_block_id" textField="textField" valueField="valueField">
</EF:EFComboColumn>
<EF:EFColumn ename="productCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="productName" cname="存货名称" enable="false" width="100" align="center"/>
<%-- <EF:EFColumn ename="productCode" cname="成品编码" enable="false" width="100" align="center"/>--%>
<%-- <EF:EFColumn ename="productName" cname="成品名称" enable="false" width="100" align="center"/>--%>
<%-- <EF:EFColumn ename="materialCode" cname="材料编码" enable="false" width="100" align="center"/>--%>
<%-- <EF:EFColumn ename="materialtName" cname="材料名称" enable="false" width="100" align="center"/>--%>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="applyQty" cname="申请数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="quantity" cname="数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="totalWeight" cname="重量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
<EF:EFColumn ename="updatedName" cname="更新人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="updatedTime" cname="更新时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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