Commit 338f1452 by liuyang

2024-09-29 委托入库单

parent 805a7559
...@@ -143,9 +143,10 @@ public class HGConstant { ...@@ -143,9 +143,10 @@ public class HGConstant {
// 维修单号 // 维修单号
public static final String REP_ORDER_NO = "REP_ORDER_NO"; public static final String REP_ORDER_NO = "REP_ORDER_NO";
// 委单号 // 委单号
public static final String CONTRACT_CODE = "CONTRACT_CODE"; public static final String CONTRACT_CODE = "CONTRACT_CODE";
//委外入库单号
public static final String DEPOSIT_CODE = "DEPOSIT_CODE";
} }
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.constant.HgKcSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC014;
import com.baosight.hggp.hg.kc.domain.HGKC014A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/30
* @description 委外入库单
*/
public class ServiceHGKC014 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID, DdynamicEnum.USER_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC014().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String contractDate = MapUtils.getString(queryMap, HGKC014.FIELD_DEPOSIT_DATE);
if (StringUtils.isNotBlank(contractDate)) {
queryMap.put(HGKC014.FIELD_DEPOSIT_DATE, StringUtil.removeHorizontalLine(contractDate));
}
inInfo = super.query(inInfo, HGKC014.QUERY, new HGKC014());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外入库单", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
List<HGKC014> hgkc014List = MapUtils.toDaoEPBases(inInfo, HGKC014.class);
List<Long> ids = ObjectUtils.listEpKey(hgkc014List, HGKC014.FIELD_ID);
List<HGKC014A> hgkc014As = HGKCTools.HgKc014a.getByParentId(ids);
List<String> contractCodes = ObjectUtils.listEpKey(hgkc014As, HGKC014A.FIELD_CONTRACT_CODE);
List<HGSC010A> hgsc010As = HGSCTools.Hgsc010a.getByContractCode(contractCodes);
for (HGKC014 hgkc014: hgkc014List) {
AssertUtils.isTrue(hgkc014.getStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
if (Objects.nonNull(hgkc014As)){
List<HGKC014A> hgkc014AList = hgkc014As.stream().filter(hgkc014A -> hgkc014A.getParentId().equals(hgkc014.getId())).collect(Collectors.toList());
HGKCTools.HgKc014a.deleteByParentId(hgkc014AList, hgsc010As);
}
DaoUtils.update(HGKC014.DELETE, hgkc014);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外加工", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap: resultMaps) {
HGKC014 hgkc014 = new HGKC014();
hgkc014.fromMap(resultMap);
if(Objects.nonNull(hgkc014.getId())&&hgkc014.getId()!=0){
this.modify(hgkc014);
}else {
this.add(hgkc014);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC014 hgkc014) {
hgkc014.setDepositCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.DEPOSIT_CODE));
DaoUtils.insert(HGKC014.INSERT, hgkc014);
}
public void modify(HGKC014 hgkc014) {
DaoUtils.update(HGKC014.UPDATE, hgkc014);
}
/*@OperationLogAnnotation(operModul = "委外入库单", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
Map resultMap = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HGKC014 hgkc014 = new HGKC014();
hgkc014.fromMap(resultMap);
AssertUtils.isTrue(hgkc014.getStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许修改保存!");
if(Objects.nonNull(hgkc014.getId())&&hgkc014.getId()!=0){
this.modify(hgkc014);
}else {
this.add(hgkc014);
}
List<Map> detailMaps = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
for (Map detailMap: detailMaps) {
HGKC014A hgkc014a = new HGKC014A();
hgkc014a.fromMap(detailMap);
hgkc014a.setCompanyCode(hgkc014.getCompanyCode());
hgkc014a.setCompanyName(hgkc014.getCompanyName());
if(Objects.nonNull(hgkc014.getId())&&hgkc014.getId()!=0){
hgkc014a.setDepositCode(hgkc014.getDepositCode());
hgkc014a.setParentId(hgkc014.getId());
DaoUtils.insert(HGKC014A.INSERT, hgkc014a);
}else {
DaoUtils.update(HGKC014A.UPDATE, hgkc014a);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC014 hgkc014) {
hgkc014.setDepositCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.DEPOSIT_CODE));
DaoUtils.insert(HGKC014.INSERT, hgkc014);
}
public void modify(HGKC014 hgkc014) {
DaoUtils.update(HGKC014.UPDATE, hgkc014);
}*/
@OperationLogAnnotation(operModul = "委外加工", operType = "提交", operDesc = "提交操作")
public EiInfo updateStatus(EiInfo inInfo) {
int i = 0;
try {
List<HGKC014> resultMaps = MapUtils.toDaoEPBases(inInfo, HGKC014.class);
List<Long> ids = ObjectUtils.listEpKey(resultMaps, HGKC014.FIELD_ID);
List<HGKC014A> hgkc014AList = HGKCTools.HgKc014a.getByParentId(ids);
AssertUtils.isTrue(Objects.isNull(hgkc014AList), "请先添加入库明细");
for (HGKC014 hgkc014: resultMaps) {
List<HGKC014A> hgkc14As = hgkc014AList.stream().filter(item -> item.getParentId().equals(hgkc014.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgkc14As.size()<= 0, "请先添加入库明细");
hgkc014.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HgKcSqlConstant.HgKc014.UPDATE_STATUS, hgkc014);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(resultMaps.size()), I18nMessages.getText("label.update", "提交")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "提交失败");
}
return inInfo;
}
}
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.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC014;
import com.baosight.hggp.hg.kc.domain.HGKC014A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
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.resource.I18nMessages;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/30
* @description 委外入库明细
*/
public class ServiceHGKC014A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_BLOCK_ID));
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),
new HashMap<String, Object>(){{
put(HGPZ005.FIELD_STATUS,1);
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, Arrays.asList(InventTypeDetailEnum.COMPONENT.getCode(),InventTypeDetailEnum.RAW.getCode()));
}}, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010A().eiMetadata);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HGSC010B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "委外加工", operType = "查询", operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGKC014A.QUERY, new HGKC014A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外入库单", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap: resultMaps) {
HGKC014A hgkc014a = new HGKC014A();
hgkc014a.fromMap(resultMap);
this.add(hgkc014a);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC014A hgkc014a) {
hgkc014a.setDepositCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.DEPOSIT_CODE));
DaoUtils.insert(HGKC014A.INSERT, hgkc014a);
}
public void modify(HGKC014A hgkc014a) {
DaoUtils.update(HGKC014A.UPDATE, hgkc014a);
}
@OperationLogAnnotation(operModul = "委外入库单", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
List<HGKC014A> hgkc014List = MapUtils.toDaoEPBases(inInfo, HGKC014A.class);
List<Long> ids = ObjectUtils.listEpKey(hgkc014List, HGKC014A.FIELD_PARENT_ID);
List<HGKC014> hgkc014 = HGKCTools.HgKc014.getByParentId(ids);
AssertUtils.isTrue(hgkc014!=null && hgkc014.get(0).getStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
List<String> contractCodes = ObjectUtils.listEpKey(hgkc014List, HGKC014A.FIELD_CONTRACT_CODE);
List<HGSC010A> hgsc010As = HGSCTools.Hgsc010a.getByContractCode(contractCodes);
HGKCTools.HgKc014a.deleteByParentId(hgkc014List, hgsc010As);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "删除")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
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.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.constant.HgKcSqlConstant;
import com.baosight.hggp.hg.kc.domain.HGKC014;
import com.baosight.hggp.hg.kc.domain.HGKC014A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
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.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/30
* @description 选择委外加工
*/
public class ServiceHGKC014B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID, DdynamicEnum.USER_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put("isRemainingQty", "true");
queryMap.remove("parentId");
inInfo = super.query(inInfo, HGSC010A.QUERY, new HGSC010A());
List<HGSC010A> resultBlock = MapUtils.toDaoEPBases(inInfo, HGSC010A.class);
resultBlock.forEach(hgsc010a -> {
hgsc010a.setDepositQty(BigDecimal.ZERO);
hgsc010a.setDepositWeight(BigDecimal.ZERO);
});
inInfo.getBlock(EiConstant.resultBlock).setRows(resultBlock);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外入库单", operType = "保存", operDesc = "保存操作")
public EiInfo save(EiInfo inInfo){
try {
Map paramMap = EiInfoUtils.getFirstRow(inInfo);
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
//List<String> contractCodes = ObjectUtils.listKey(resultMaps, HGKC014A.FIELD_CONTRACT_CODE);
List<HGKC014A> hgkc014AList = HGKCTools.HgKc014a.getByParentId((Arrays.asList(Long.parseLong(paramMap.get("parentId").toString()))));
for (Map resultMap: resultMaps) {
DaoUtils.update(HGSC010A.UPDATE, resultMap);
HGKC014A hgkc014a = new HGKC014A();
hgkc014a.fromMap(resultMap);
List<HGKC014A> hgkc014As = new ArrayList<>();
if (hgkc014AList != null){
hgkc014As = hgkc014AList.stream().filter(hgkc014A -> hgkc014A.getContractCode().equals(hgkc014a.getContractCode())
&& hgkc014A.getProductCode().equals(hgkc014a.getProductCode())
&& hgkc014A.getSpec().equals(hgkc014a.getSpec())
&& hgkc014A.getDepositCode().equals(paramMap.get(HGKC014A.FIELD_DEPOSIT_CODE))
).collect(Collectors.toList());
}
if (hgkc014As.size() > 0){
HGKC014A kc014a = hgkc014As.get(0);
kc014a.setDepositQty(kc014a.getDepositQty().add(hgkc014a.getDepositQty()));
kc014a.setDepositWeight(kc014a.getDepositWeight().add(hgkc014a.getDepositWeight()));
DaoUtils.update(HGKC014A.UPDATE, kc014a);
}else {
hgkc014a.setParentId(Long.parseLong(paramMap.get("parentId").toString()));
hgkc014a.setCompanyCode(paramMap.get("companyCode").toString());
hgkc014a.setCompanyName(paramMap.get("companyName").toString());
hgkc014a.setDepositCode(paramMap.get("depositCode").toString());
this.add(hgkc014a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC014A hgkc014a) {
hgkc014a.setId(null);
hgkc014a.setUpdatedBy(null);
hgkc014a.setUpdatedName(null);
hgkc014a.setUpdatedTime(null);
hgkc014a.setCreatedBy(null);
hgkc014a.setCreatedName(null);
hgkc014a.setCreatedTime(null);
hgkc014a.setDepCode(null);
DaoUtils.insert(HGKC014A.INSERT, hgkc014a);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-29 14:12:44
Version : 1.0
schema : hggp
tableName : HGKC014
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
DEPOSIT_DATE VARCHAR,
DEPOSIT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
USER_ID VARCHAR,
STATUS TINYINT
-->
<sqlMap namespace="HGKC014">
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE LIKE CONCAT('%',#depositCode#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC014">
SELECT
ID as "id", <!-- ID -->
ACCOUNT_CODE as "accountCode", <!-- 账套 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除 0-否1-是 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
DEPOSIT_DATE as "depositDate", <!-- 委托入库日期 -->
DEPOSIT_CODE as "depositCode", <!-- 委托入库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
USER_ID as "userId", <!-- 仓库人员 -->
STATUS as "status" <!-- 提交状态 0-未入库 1-已入库 -->
FROM ${hggpSchema}.HGKC014 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC014 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE = #depositCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC014 (ID, <!-- ID -->
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME, <!-- 修改时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
DEPOSIT_DATE, <!-- 委托入库日期 -->
DEPOSIT_CODE, <!-- 委托入库单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
USER_ID, <!-- 仓库人员 -->
STATUS <!-- 提交状态 0-未入库 1-已入库 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #depositDate#, #depositCode#, #whCode#, #whName#,
#userId#, #status#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hggpSchema}.HGKC014
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC014 WHERE
ID = #id#
</delete>
<update id="updateByStatus">
UPDATE ${hggpSchema}.HGKC014
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
STATUS = #status# <!-- 提交状态 0-未入库 1-已入库 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGKC014
SET
ACCOUNT_CODE = #accountCode#, <!-- 账套 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
DEPOSIT_DATE = #depositDate#, <!-- 委托入库日期 -->
DEPOSIT_CODE = #depositCode#, <!-- 委托入库单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
USER_ID = #userId#, <!-- 仓库人员 -->
STATUS = #status# <!-- 提交状态 0-未入库 1-已入库 -->
WHERE
ID = #id#
</update>
</sqlMap>
...@@ -13,6 +13,7 @@ import com.baosight.hggp.hg.cg.utils.HGCGUtils; ...@@ -13,6 +13,7 @@ import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.constant.HgKcSqlConstant;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.utils.HGKCUtils; import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
...@@ -20,6 +21,8 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005A; ...@@ -20,6 +21,8 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.domain.HGPZ007; import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001; import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.hg.zl.domain.HGZL002; import com.baosight.hggp.hg.zl.domain.HGZL002;
...@@ -1194,4 +1197,61 @@ public class HGKCTools { ...@@ -1194,4 +1197,61 @@ public class HGKCTools {
} }
} }
public static class HgKc014 {
public static List<HGKC014> getByParentId(List<Long> parentIds) {
if (Objects.isNull(parentIds)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("parentIds", parentIds);
paramMap.put("deleteFlag", 0);
List<HGKC014> list = DaoBase.getInstance().query(HGKC014.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
}
public static class HgKc014a {
public static List<HGKC014A> getByParentId(List<Long> parentIds) {
if (Objects.isNull(parentIds)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("parentIds", parentIds);
paramMap.put("deleteFlag", 0);
List<HGKC014A> list = DaoBase.getInstance().query(HGKC014A.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
public static List<HGKC014A> getByContractCodes(List<String> contractCodes) {
if (Objects.isNull(contractCodes)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("contractCodes", contractCodes);
paramMap.put("deleteFlag", 0);
List<HGKC014A> list = DaoBase.getInstance().query(HGKC014A.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
public static void deleteByParentId(List<HGKC014A> hgkc014As, List<HGSC010A> hgsc010As) {
if (CollectionUtils.isNotEmpty(hgkc014As)){
for (HGKC014A hgkc014A: hgkc014As) {
hgsc010As.stream().filter(hgsc010A ->
hgsc010A.getContractCode().equals(hgkc014A.getContractCode())
&& hgsc010A.getProductCode().equals(hgkc014A.getProductCode())
&& hgsc010A.getSpec().equals(hgkc014A.getSpec())
).forEach(hgsc010A -> {
hgsc010A.setRemainingQty(hgsc010A.getRemainingQty().add(hgkc014A.getDepositQty()));
hgsc010A.setRemainingWeight(hgsc010A.getRemainingWeight().add(hgkc014A.getDepositWeight()));
hgsc010A.setDepositQty(hgsc010A.getDepositQty().subtract(hgkc014A.getDepositQty()));
hgsc010A.setDepositWeight(hgsc010A.getDepositWeight().subtract(hgkc014A.getDepositWeight()));
DaoUtils.update(HGSC010A.UPDATE, hgsc010A);
});
DaoUtils.update(HgKcSqlConstant.HgKc014a.DELETE_BY_PARENT_ID, hgkc014A);
}
}
}
}
} }
...@@ -75,6 +75,7 @@ public class ServiceHGSC010 extends ServiceEPBase { ...@@ -75,6 +75,7 @@ public class ServiceHGSC010 extends ServiceEPBase {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
HGSC010 hgsc010 = new HGSC010(); HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(map); hgsc010.fromMap(map);
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
DaoUtils.update(HGSC010.DELETE_FLAG, hgsc010.toMap()); DaoUtils.update(HGSC010.DELETE_FLAG, hgsc010.toMap());
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put(HGSC010A.FIELD_PARENT_ID, hgsc010.getId()); params.put(HGSC010A.FIELD_PARENT_ID, hgsc010.getId());
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<sqlMap namespace="HGSC010"> <sqlMap namespace="HGSC010">
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
......
...@@ -111,6 +111,12 @@ ...@@ -111,6 +111,12 @@
<isNotEmpty prepend=" AND " property="parentIds"> <isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate> PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractCodes">
CONTRACT_CODE IN <iterate close=")" open="(" conjunction="," property="contractCodes">#contractCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="isRemainingQty">
REMAINING_QTY > 0
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -1956,6 +1956,18 @@ public class HGSCTools { ...@@ -1956,6 +1956,18 @@ public class HGSCTools {
return (HGSC010A) DaoBase.getInstance().get(HGSC010A.QUERY, HGSC010A.FIELD_ID, id); return (HGSC010A) DaoBase.getInstance().get(HGSC010A.QUERY, HGSC010A.FIELD_ID, id);
} }
public static List<HGSC010A> getByContractCode(List<String> contractCodes){
if (CollectionUtils.isEmpty(contractCodes)){
return new ArrayList<>();
}
Map queryMap = new HashMap<String,Object>(){{
put("contractCodes",contractCodes);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010A> list = DaoBase.getInstance().query(HGSC010A.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
public static List<HGSC010A> getByParentId(Long parentId){ public static List<HGSC010A> getByParentId(Long parentId){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!"); AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{ Map queryMap = new HashMap<String,Object>(){{
...@@ -1966,6 +1978,7 @@ public class HGSCTools { ...@@ -1966,6 +1978,7 @@ public class HGSCTools {
return CollectionUtils.isEmpty(list)? new ArrayList<>():list; return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
} }
public static List<HGSC010A> getByParentIds(List<Long> parentIds){ public static List<HGSC010A> getByParentIds(List<Long> parentIds){
AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!"); AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{ Map queryMap = new HashMap<String,Object>(){{
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC011.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC011.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013A.xml"/> <sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC013A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC014.xml"/>
<!-- 质量 --> <!-- 质量 -->
<sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL001.xml"/> <sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL001.xml"/>
...@@ -77,6 +78,7 @@ ...@@ -77,6 +78,7 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC101.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC101.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC010.xml"/>
<!-- 財務 --> <!-- 財務 -->
<sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW001.xml"/> <sqlMap resource="com/baosight/hggp/hg/cw/sql/HGCW001.xml"/>
......
$(function () {
var companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
var whRecordCodeBox = __eiInfo.getBlock("wh_record_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let template = '';
if (item.companyCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showFunc(\'' + item.companyCode + '\',\'' + item.companyName + '\',\'' + item.id + '\')" >详情</a>';
}
return template;
}
}, {
field: "depositDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},
],
beforeEdit: function (e) {
let item = e.model;
if(item.subStatus == '1'){
e.preventDefault();
}
},
loadComplete: function (grid) {
$("#BNT_SUBMIT").on("click", updateStatus);
$("#BNT_SELECT").on("click", selectFunc);
grid.dataSource.bind("change", function (e) {
if (e.field == "companyCode") {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['companyCode'] === e.items[0]['companyCode']) {
resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']);
break;
}
}
}
if (e.field == "whCode") {
for (let i = 0; i < whRecordCodeBox.length; i++) {
if (whRecordCodeBox[i]['valueField'] === e.items[0]['whCode']) {
resultGrid.setCellValue(e.items[0],"whName",whRecordCodeBox[i]['textField']);
break;
}
}
}
});
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
}
}
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 显示附件详情
* @param companyCode 公司编码
* @param companyName 公司名称
* @param parentId 父级ID
* @param contractCode 委托编号
*/
function showFunc(companyCode,companyName,parentId) {
JSColorbox.open({
href: "HGKC014A?methodName=initLoad" +
"&inqu_status-0-companyCode=" + companyCode +
"&inqu_status-0-companyName=" + companyName +
"&inqu_status-0-parentId=" + parentId ,
title: "<div style='text-align: center;'>委外入库详情</div>",
width: "90%",
height: "80%",
callbackName: function (){
// 关闭弹窗
JSColorbox.close();
}
});
}
function cancelFunc() {
// 关闭弹窗
JSColorbox.close();
}
/**
* 显示附件详情
* @param companyCode 公司编码
* @param companyName 公司名称
* @param parentId 父级ID
* @param contractCode 委托编号
*/
function selectFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length !== 1) {
message("请选择一条委外入库单");
return;
}
JSColorbox.open({
href: "HGKC014B?methodName=initLoad" +
"&inqu_status-0-companyCode=" + rows[0].companyCode +
"&inqu_status-0-companyName=" + rows[0].companyName +
"&inqu_status-0-whCode=" + rows[0].whCode +
"&inqu_status-0-depositCode=" + rows[0].depositCode +
"&inqu_status-0-parentId=" + rows[0].id ,
title: "<div style='text-align: center;'>委外入库详情</div>",
width: "90%",
height: "80%",
});
}
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let companyName = item.get("companyName");
let depositDate = item.get("depositDate");
let whCode = item.get("whCode");
if (isBlank(companyName)) {
message("选中的第" + (index + 1) + "行\"公司\",不能为空!");
flag = false;
return false;
}
if (isBlank(depositDate)) {
message("选中的第" + (index + 1) + "行\"委托入库日期\",不能为空!");
flag = false;
return false;
}
if (isBlank(whCode)) {
message("选中的第" + (index + 1) + "行\"仓库名称\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC014", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
function updateStatus() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let subStatus = item.get("status");
if (subStatus == '1') {
message("选中的第" + (index + 1) + "行\"委外任务已提交\",不能重复提交!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC014", "updateStatus", true,
function (e) {
var status = e.getStatus();
if (status !== -1) {
query();
}
});
}
});
}
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/30
Time: 9:20
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %><
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="委外入库单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="depositDate" cname="委外入库日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="depositCode" cname="委外入库单号" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="userId" cname="仓管人员" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="提交状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hpkc.submitStatus"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="companyName" valueField="companyCode"
maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" hidden="true"/>
<EF:EFColumn ename="depositDate" cname="委外入库日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="depositCode" cname="委外入库单号" width="120" enable="false" readonly="false" align="center"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" hidden="true"/>
<EF:EFComboColumn ename="userId" cname="仓管人员" defaultValue="${loginName}"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="提交状态" width="80" enable="true" readonly="true" align="center"
required="false" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hpkc.submitStatus"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var inventRecordBox = __eiInfo.getBlock("invent_record_box_block_id").getMappedRows();
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid = {
"result":{
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "productCode",
filter: function (option) {
let inventType = option.model['inventType'];
if (inventType){
return _.filter(inventRecordBox, function (item) {
return item["param3Field"]==inventType && item["param1Field"]=='1';
})
}else {
return _.filter(inventRecordBox, function (item) {
return item["param1Field"]=='1';
})
}
},
template: function (dataItem) {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === dataItem['productCode']) {
return inventRecordBox[i]['valueField'];
}
}
return dataItem["productCode"];
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
if (e.field == "productCode") {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === e.items[0]['productCode']) {
resultGrid.setCellValue(e.items[0],"productName",inventRecordBox[i]['textField']);
resultGrid.setCellValue(e.items[0],"spec",inventRecordBox[i]['param4Field']);
resultGrid.setCellValue(e.items[0],"unit",inventRecordBox[i]['param6Field']);
if (isBlank(e.items[0]['inventType'])){
resultGrid.setCellValue(e.items[0],"inventType",inventRecordBox[i]['param3Field']);
}
}
}
loadChange(grid, e, "pcsQty");
}else if (e.field == "pcsQty"){
resultGrid.setCellValue(e.items[0],"remainingQty",e.items[0]['pcsQty']);
}else if (e.field == "pcsWeight"){
resultGrid.setCellValue(e.items[0],"remainingWeight",e.items[0]['pcsWeight']);
}
});
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveResult(btnNode);
}
}
}
})
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
let saveResult = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let inventType = item.get("inventType");
let productCode = item.get("productCode");
if (isBlank(inventType)) {
message("选中的第" + (index + 1) + "行\"存货类型\",不能为空!");
flag = false;
return false;
}
if (isBlank(productCode)) {
message("选中的第" + (index + 1) + "行\"成品编码\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC014A", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/30
Time: 9:21
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ 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}"/>
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="委外入库明细">
<EF:EFRegion id="result" title="成本信息">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="委托ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="depositDate" cname="委外入库单号" type="hidden"/>
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="productCode" cname="成品编码" width="120" align="center" required="true" readonly="false"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="productName" cname="成品名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center"/>
<EF:EFColumn ename="depositQty" cname="入库数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="depositWeight" cname="入库重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid = {
"result":{
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
if (e.field == "depositQty"){
let depositQty = e.items[0]['depositQty'];
let remainingQty = e.items[0]['remainingQty'];
if (depositQty > remainingQty){
message("选中行\"入库数量\",不能大于\"剩余数量\"!");
return;
}
remainingQty = remainingQty - depositQty;
resultGrid.setCellValue(e.items[0],"remainingQty",remainingQty);
}else if (e.field == "depositWeight"){
let depositWeight = e.items[0]['depositWeight'];
let remainingWeight = e.items[0]['remainingWeight'];
if (depositWeight > remainingWeight){
message("选中行\"入库重量\",不能大于\"剩余重量\"!");
return;
}
remainingWeight = remainingWeight - depositWeight;
resultGrid.setCellValue(e.items[0],"remainingWeight",remainingWeight);
}
});
$("#BNT_SELECT").on("click", saveResult)
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveResult();
}
}
}
$("#cancel").on("click", function () {
cancelFunc();
});
$("#btn_save").on("click", function () {
saveResult();
});
IPLATUI.EFSelect = {
"result-0-companyCode": {
// 点击下拉选项时触发
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var companyCode = dataItem['companyCode'];
$("#inqu_status-0-companyCode").val(companyCode);
query()
}
}
}
})
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
$("#depositDate").val(currShortDate);
});
let query = function () {
resultGrid.dataSource.page(1);
}
let saveResult = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function (index, item) {
let depositQty = item.get("depositQty");
let depositWeight = item.get("depositWeight");
if (isBlank(depositQty) || !isNumber(depositWeight) || depositQty <= 0) {
message("选中的第" + (index + 1) + "行\"入库数量\",不能为空并且不能为0!");
flag = false;
return false;
}
if (isBlank(depositWeight) || !isNumber(depositWeight) || depositWeight <= 0) {
message("选中的第" + (index + 1) + "行\"入库重量\",不能为空并且不能为0!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC014B", "save", true,
function (e) {
let status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.close()
}
});
}
});
}
};
function cancelFunc() {
// 关闭弹窗
parent.JSColorbox.close();
}
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %><%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/30
Time: 9:23
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="选择委外加工">
<EF:EFRegion id="result" title="委外加工">
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司编码" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="whCode" cname="仓库编码" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="depositCode" cname="委外入库单号" type="hidden"/>
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="productCode" cname="成品编码" width="120" align="center" required="true" readonly="true"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="productName" cname="成品名称" width="120" align="center" readonly="true" required="false"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="flase" readonly="true"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50" readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="depositQty" cname="入库数量" width="100" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="depositWeight" cname="入库重量" width="100" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="remainingQty" cname="剩余数量" width="100" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数!"/>
<EF:EFColumn ename="remainingWeight" cname="剩余重量" width="100" enable="false" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</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