Commit c73161c2 by 宋祥

Merge branch 'dev' of http://129.211.46.84:8800/platform/hg-smart into dev-sx

 Conflicts:
	src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
	src/main/java/com/baosight/hggp/hg/kc/domain/HGKC014.java
	src/main/java/com/baosight/hggp/hg/kc/domain/HGKC014A.java
	src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
parents f4dfdb66 02fe9ad0
......@@ -87,7 +87,7 @@ public class HGConstant {
//售后维修单号
public static final String HPXS006_PROD_NO = "HPXS006_NUMBER";
//销售单号
public static final String HPPZ017_SALES_CODE = "HPPZ017_SALES_CODE";
public static final String HGPZ017_SALES_CODE = "HGPZ017_SALES_CODE";
//销售计划单号
public static final String PLAN_SALES_CODE = "PLAN_SALES_CODE";
//工序编码
......@@ -161,6 +161,14 @@ public class HGConstant {
public static final String SUGGEST_NO = "SUGGEST_NO";
// 公告号
public static final String NOTICE_NO = "NOTICE_NO";
// 委外单号
public static final String CONTRACT_CODE = "CONTRACT_CODE";
//委外入库单号
public static final String DEPOSIT_CODE = "DEPOSIT_CODE";
//委外出库单号
public static final String OUT_CODE = "OUT_CODE";
}
/**
......@@ -434,6 +442,17 @@ public class HGConstant {
// 已审核
public static final Integer S_1 = 1;
}
public static class ScOutStatus {
// 未出库
public static final Integer S_0 = 0;
// 部分出库
public static final Integer S_1 = 1;
// 全部出库
public static final Integer S_2 = 2;
}
/**
* 处理状态
......
package com.baosight.hggp.hg.kc.constant;
/**
* @author LiuYang
* @version 1.0 2024/9/30
* @description 自定义SQL
*/
public class HgKcSqlConstant {
public static class HgKc014 {
// 模块名称:HGCW003
private static final String MODULE_NAME = "HGKC014.";
public static final String UPDATE_STATUS = MODULE_NAME+"updateByStatus";
}
/**
* HGKC014A SQL定义
*
*/
public static class HgKc014a {
// 模块名称:HGCW003
private static final String MODULE_NAME = "HGKC014A.";
// 父级删除
public static final String DELETE_BY_PARENT_ID = MODULE_NAME+"deleteByParentId";
public static final String UPDATE_STATUS = MODULE_NAME+"Status";
}
public static class HgKc015 {
// 模块名称:HGCW003
private static final String MODULE_NAME = "HGKC015.";
public static final String UPDATE_STATUS = MODULE_NAME+"updateByStatus";
}
/**
* HGKC014A SQL定义
*
*/
public static class HgKc015a {
// 模块名称:HGCW003
private static final String MODULE_NAME = "HGKC015A.";
// 父级删除
public static final String DELETE_BY_PARENT_ID = MODULE_NAME+"deleteByParentId";
public static final String UPDATE_STATUS = MODULE_NAME+"Status";
}
}
......@@ -75,7 +75,7 @@ public class HGKC014 extends DaoEPBase {
private String updatedBy = " "; /* 修改人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 修改时间*/
private Integer deleteFlag; /* 是否删除 0-否1-是*/
private Integer deleteFlag = 0; /* 是否删除 0-否1-是*/
private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
private String depositDate = " "; /* 委托入库日期*/
......@@ -83,7 +83,7 @@ public class HGKC014 extends DaoEPBase {
private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
private String userId = " "; /* 仓库人员*/
private Integer status; /* 提交状态 0-未入库 1-已入库*/
private Integer status = 0; /* 提交状态 0-未入库 1-已入库*/
/**
* initialize the metadata.
......
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.put("status", "1");
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) {
HGSC010A hgsc010a = new HGSC010A();
hgsc010a.fromMap(resultMap);
hgsc010a.setRemainingQty(hgsc010a.getRemainingQty().subtract(hgsc010a.getDepositQty()));
hgsc010a.setRemainingWeight(hgsc010a.getRemainingWeight().subtract(hgsc010a.getDepositWeight()));
DaoUtils.update(HGSC010A.UPDATE, hgsc010a);
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.setWhCode(paramMap.get("whCode").toString());
hgkc014a.setWhName(paramMap.get("whName").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);
}
}
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.HGKC015;
import com.baosight.hggp.hg.kc.domain.HGKC015A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC010;
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 org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/10/6
* @description 委外出库单
*/
public class ServiceHGKC015 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 HGKC015().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 outDate = MapUtils.getString(queryMap, HGKC015.FIELD_OUT_DATE);
if (StringUtils.isNotBlank(outDate)) {
queryMap.put(HGKC015.FIELD_OUT_DATE, StringUtil.removeHorizontalLine(outDate));
}
inInfo = super.query(inInfo, HGKC015.QUERY, new HGKC015());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外出库单", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
List<HGKC015> hgkc015List = MapUtils.toDaoEPBases(inInfo, HGKC015.class);
List<Long> ids = ObjectUtils.listEpKey(hgkc015List, HGKC015.FIELD_ID);
List<HGKC015A> hgkc015As = HGKCTools.HgKc015a.getByParentId(ids);
List<String> contractCodes = ObjectUtils.listEpKey(hgkc015As, HGKC015A.FIELD_CONTRACT_CODE);
List<HGSC010B> hgsc010Bs = HGSCTools.Hgsc010b.getByContractCode(contractCodes);
for (HGKC015 hgkc015: hgkc015List) {
AssertUtils.isTrue(hgkc015.getStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
if (Objects.nonNull(hgkc015As)){
List<HGKC015A> hgkc015AList = hgkc015As.stream().filter(hgkc015A -> hgkc015A.getParentId().equals(hgkc015.getId())).collect(Collectors.toList());
HGKCTools.HgKc015a.deleteByParentId(hgkc015AList, hgsc010Bs);
}
DaoUtils.update(HGKC015.DELETE, hgkc015);
}
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) {
HGKC015 hgkc015 = new HGKC015();
hgkc015.fromMap(resultMap);
if(Objects.nonNull(hgkc015.getId())&&hgkc015.getId()!=0){
this.modify(hgkc015);
}else {
this.add(hgkc015);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC015 hgkc015) {
hgkc015.setOutCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.OUT_CODE));
DaoUtils.insert(HGKC015.INSERT, hgkc015);
}
public void modify(HGKC015 hgkc015) {
DaoUtils.update(HGKC015.UPDATE, hgkc015);
}
@OperationLogAnnotation(operModul = "委外出库单", operType = "提交", operDesc = "提交操作")
public EiInfo updateStatus(EiInfo inInfo) {
int i = 0;
try {
List<HGKC015> resultMaps = MapUtils.toDaoEPBases(inInfo, HGKC015.class);
List<Long> ids = ObjectUtils.listEpKey(resultMaps, HGKC015.FIELD_ID);
List<HGKC015A> hgkc015AList = HGKCTools.HgKc015a.getByParentId(ids);
List<HGSC010B> hgsc010Bs = HGSCTools.Hgsc010b.getByContractCode(ObjectUtils.listEpKey(hgkc015AList, HGKC015A.FIELD_CONTRACT_CODE));
AssertUtils.isTrue(Objects.isNull(hgkc015AList), "请先添加出库明细");
for (HGKC015 hgkc015: resultMaps) {
List<HGKC015A> hgkc15As = hgkc015AList.stream().filter(item -> item.getParentId().equals(hgkc015.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgkc15As.size()<= 0, "请先添加出库明细");
hgkc015.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HgKcSqlConstant.HgKc015.UPDATE_STATUS, hgkc015);
for (HGKC015A hgkc015A: hgkc15As) {
HGSC010 hgsc010 = new HGSC010();
hgsc010.setContractCode(hgkc015A.getContractCode());
BigDecimal remainingQty = hgsc010Bs.stream().filter(item -> item.getContractCode().equals(hgkc015A.getContractCode())).map(HGSC010B::getRemainingQty).reduce(BigDecimal.ZERO,BigDecimal::add);
if (remainingQty.compareTo(BigDecimal.ZERO) == 0){
hgsc010.setOutStatus(HGConstant.ScOutStatus.S_2);
}else if (remainingQty.compareTo(BigDecimal.ZERO) > 0){
hgsc010.setOutStatus(HGConstant.ScOutStatus.S_1);
}else{
hgsc010.setOutStatus(HGConstant.ScOutStatus.S_0);
}
DaoUtils.update(HgScSqlConstant.HgSc010.UPDATE_OUT_STATUS, hgsc010);
}
}
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.HGKC015;
import com.baosight.hggp.hg.kc.domain.HGKC015A;
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.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.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/6
* @description 委外出库单明细
*/
public class ServiceHGKC015A 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
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGKC015A.QUERY, new HGKC015A());
} 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) {
HGKC015A hgkc015a = new HGKC015A();
hgkc015a.fromMap(resultMap);
this.add(hgkc015a);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC015A hgkc015a) {
hgkc015a.setOutCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.OUT_CODE));
DaoUtils.insert(HGKC015A.INSERT, hgkc015a);
}
public void modify(HGKC015A hgkc015a) {
DaoUtils.update(HGKC015A.UPDATE, hgkc015a);
}
@OperationLogAnnotation(operModul = "委外出库单", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
List<HGKC015A> hgkc015List = MapUtils.toDaoEPBases(inInfo, HGKC015A.class);
List<Long> ids = ObjectUtils.listEpKey(hgkc015List, HGKC015A.FIELD_PARENT_ID);
List<HGKC015> hgkc015 = HGKCTools.HgKc015.getByParentId(ids);
AssertUtils.isTrue(hgkc015!=null && hgkc015.get(0).getStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
List<String> contractCodes = ObjectUtils.listEpKey(hgkc015List, HGKC015A.FIELD_CONTRACT_CODE);
List<HGSC010B> hgsc010Bs = HGSCTools.Hgsc010b.getByContractCode(contractCodes);
HGKCTools.HgKc015a.deleteByParentId(hgkc015List, hgsc010Bs);
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.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC015A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/10/6
* @description 选择委外加工单
*/
public class ServiceHGKC015B 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 HGSC010B().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.put("status", "1");
queryMap.remove("parentId");
inInfo = super.query(inInfo, HGSC010B.QUERY, new HGSC010B());
List<HGSC010B> resultBlock = MapUtils.toDaoEPBases(inInfo, HGSC010B.class);
resultBlock.forEach(hgsc010a -> {
hgsc010a.setOutQty(BigDecimal.ZERO);
hgsc010a.setOutWeight(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<HGKC015A> hgkc015AList = HGKCTools.HgKc015a.getByParentId((Arrays.asList(Long.parseLong(paramMap.get("parentId").toString()))));
for (Map resultMap: resultMaps) {
HGSC010B hgsc010B = new HGSC010B();
hgsc010B.fromMap(resultMap);
hgsc010B.setRemainingQty(hgsc010B.getRemainingQty().subtract(hgsc010B.getOutQty()));
hgsc010B.setRemainingWeight(hgsc010B.getRemainingWeight().subtract(hgsc010B.getOutWeight()));
DaoUtils.update(HGSC010B.UPDATE, hgsc010B);
HGKC015A hgkc015a = new HGKC015A();
hgkc015a.fromMap(resultMap);
List<HGKC015A> hgkc015As = new ArrayList<>();
if (hgkc015AList != null){
hgkc015As = hgkc015AList.stream().filter(hgkc015A -> hgkc015A.getContractCode().equals(hgkc015a.getContractCode())
&& hgkc015A.getInventCode().equals(hgkc015a.getInventCode())
&& hgkc015A.getSpec().equals(hgkc015a.getSpec())
&& hgkc015A.getOutCode().equals(paramMap.get(HGKC015A.FIELD_OUT_CODE))
).collect(Collectors.toList());
}
if (hgkc015As.size() > 0){
HGKC015A kc015a = hgkc015As.get(0);
kc015a.setOutQty(kc015a.getOutQty().add(hgkc015a.getOutQty()));
kc015a.setOutWeight(kc015a.getOutWeight().add(hgkc015a.getOutWeight()));
DaoUtils.update(HGKC015A.UPDATE, kc015a);
}else {
hgkc015a.setParentId(Long.parseLong(paramMap.get("parentId").toString()));
hgkc015a.setCompanyCode(paramMap.get("companyCode").toString());
hgkc015a.setCompanyName(paramMap.get("companyName").toString());
hgkc015a.setWhCode(paramMap.get("whCode").toString());
hgkc015a.setWhName(paramMap.get("whName").toString());
hgkc015a.setOutCode(paramMap.get("outCode").toString());
this.add(hgkc015a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGKC015A hgkc015a) {
hgkc015a.setId(null);
hgkc015a.setUpdatedBy(null);
hgkc015a.setUpdatedName(null);
hgkc015a.setUpdatedTime(null);
hgkc015a.setCreatedBy(null);
hgkc015a.setCreatedName(null);
hgkc015a.setCreatedTime(null);
hgkc015a.setDepCode(null);
DaoUtils.insert(HGKC015A.INSERT, hgkc015a);
}
}
<?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>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</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">
DEPOSIT_DATE desc, ID desc
</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>
<?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 : HGKC015
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,
OUT_DATE VARCHAR,
OUT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
USER_ID VARCHAR,
STATUS TINYINT
-->
<sqlMap namespace="HGKC015">
<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="outDate">
OUT_DATE = #outDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outCode">
OUT_CODE LIKE CONCAT('%',#outCode#,'%')
</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>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC015">
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", <!-- 公司名称 -->
OUT_DATE as "outDate", <!-- 委托入库日期 -->
OUT_CODE as "outCode", <!-- 委托入库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
USER_ID as "userId", <!-- 仓库人员 -->
STATUS as "status" <!-- 提交状态 0-未出库 1-已出库 -->
FROM ${hggpSchema}.HGKC015 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
OUT_DATE DESC, ID DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC015 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="outDate">
OUT_DATE = #outDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outCode">
OUT_CODE = #outCode#
</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}.HGKC015 (ID, <!-- ID -->
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
OUT_DATE, <!-- 委托入库日期 -->
OUT_CODE, <!-- 委托入库单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
USER_ID, <!-- 仓库人员 -->
STATUS <!-- 提交状态 0-未出库 1-已出库 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#companyCode#, #companyName#, #outDate#, #outCode#, #whCode#, #whName#, #userId#,#status#
)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hggpSchema}.HGKC015
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC015 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGKC015
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
OUT_DATE = #outDate#, <!-- 委托入库日期 -->
OUT_CODE = #outCode#, <!-- 委托入库单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
USER_ID = #userId#, <!-- 仓库人员 -->
STATUS = #status# <!-- 提交状态 0-未出库 1-已出库 -->
WHERE
ID = #id#
</update>
<update id="updateByStatus">
UPDATE ${hggpSchema}.HGKC015
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
STATUS = #status# <!-- 提交状态 0-未出库 1-已出库 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?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 : HGKC015A
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,
PARENT_ID BIGINT NOT NULL,
OUT_CODE VARCHAR,
INVENT_TYPE TINYINT,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
SPEC VARCHAR,
UNIT VARCHAR,
OUT_QTY DECIMAL,
OUT_WEIGHT DECIMAL
-->
<sqlMap namespace="HGKC015A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractCode">
CONTRACT_CODE = #contractCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outCode">
OUT_CODE = #outCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="specId">
SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outQty">
OUT_QTY = #outQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outWeight">
OUT_WEIGHT = #outWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractCodes">
CONTRACT_CODE IN <iterate close=")" open="(" conjunction="," property="contractCodes">#contractCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.kc.domain.HGKC015A">
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", <!-- 公司名称 -->
WH_CODE as "whCode",
WH_NAME as "whName",
PARENT_ID as "parentId", <!-- 委外ID -->
CONTRACT_CODE as "contractCode",
OUT_CODE as "outCode", <!-- 委外单号 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 原料编码 -->
INVENT_NAME as "inventName", <!-- 原料名称 -->
SPEC_ID as "specId",
SPEC as "spec", <!-- 规格 -->
UNIT as "unit", <!-- 单位 -->
OUT_QTY as "outQty", <!-- 出库数量 -->
OUT_UNIT_WEIGHT as "outUnitWeight", <!-- 出库单位重量 -->
OUT_WEIGHT as "outWeight" <!-- 出库重量 -->
FROM ${hggpSchema}.HGKC015A 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}.HGKC015A 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="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outCode">
OUT_CODE = #outCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outQty">
OUT_QTY = #outQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="outWeight">
OUT_WEIGHT = #outWeight#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC015A (ID, <!-- ID -->
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
WH_CODE,
WH_NAME,
PARENT_ID, <!-- 委外ID -->
CONTRACT_CODE, <!-- 委外单号 -->
OUT_CODE, <!-- 委外出库单号 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 原料编码 -->
INVENT_NAME, <!-- 原料名称 -->
SPEC_ID,
SPEC, <!-- 规格 -->
UNIT, <!-- 单位 -->
OUT_QTY, <!-- 出库数量 -->
OUT_UNIT_WEIGHT,
OUT_WEIGHT <!-- 出库重量 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,#deleteFlag#,
#companyCode#, #companyName#, #whCode#, #whName#, #parentId#, #contractCode#,#outCode#, #inventType#, #inventCode#,
#inventName#, #specId#, #spec#, #unit#, #outQty#, #outUnitWeight#, #outWeight#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC015A WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGKC015A
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除 0-否1-是 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
WH_CODE = #whCode#,
WH_NAME = #whName#,
PARENT_ID = #parentId#, <!-- 委外ID -->
CONTRACT_CODE = #contractCode#,
OUT_CODE = #outCode#, <!-- 委外单号 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 原料编码 -->
INVENT_NAME = #inventName#, <!-- 原料名称 -->
SPEC_ID = #specId#,
SPEC = #spec#, <!-- 规格 -->
UNIT = #unit#, <!-- 单位 -->
OUT_QTY = #outQty#, <!-- 出库数量 -->
OUT_UNIT_WEIGHT = #outUnitWeight#,
OUT_WEIGHT = #outWeight# <!-- 出库重量 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -35,6 +35,9 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
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.domain.HGSC010B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.hg.zl.domain.HGZL002;
......@@ -51,6 +54,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
......@@ -1510,6 +1514,17 @@ public class HGKCTools {
DaoBase.getInstance().update(HgKcSqlConst.HgKc014.UPDATE_STATUS, paramMap);
}
public static List<HGKC014> getByParentId(List<Long> ids) {
if (Objects.isNull(ids)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids);
paramMap.put("deleteFlag", 0);
List<HGKC014> list = DaoBase.getInstance().query(HGKC014.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
}
/**
......@@ -1559,6 +1574,92 @@ public class HGKCTools {
List<HGKC014A> results = list(ids);
return results.stream().collect(Collectors.toMap(HGKC014A::getId, item -> item));
}
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);
}
}
}
}
public static class HgKc015a {
public static List<HGKC015A> getByParentId(List<Long> parentIds) {
if (Objects.isNull(parentIds)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("parentIds", parentIds);
paramMap.put("deleteFlag", CommonConstant.YesNo.NO_0);
List<HGKC015A> list = DaoBase.getInstance().query(HGKC015A.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
public static List<HGKC015A> getByContractCodes(List<String> contractCodes) {
if (Objects.isNull(contractCodes)){
return new ArrayList<>();
}
Map<String, Object> paramMap = new HashMap();
paramMap.put("contractCodes", contractCodes);
paramMap.put("deleteFlag", CommonConstant.YesNo.NO_0);
List<HGKC015A> list = DaoBase.getInstance().query(HGKC015A.QUERY, paramMap);
return CollectionUtils.isEmpty(list)? null : list;
}
public static void deleteByParentId(List<HGKC015A> hgkc015As, List<HGSC010B> hgsc010Bs) {
if (CollectionUtils.isNotEmpty(hgkc015As)){
for (HGKC015A hgkc015A: hgkc015As) {
hgsc010Bs.stream().filter(hgsc010B ->
hgsc010B.getContractCode().equals(hgkc015A.getContractCode())
&& hgsc010B.getInventCode().equals(hgkc015A.getInventCode())
&& hgsc010B.getSpec().equals(hgkc015A.getSpec())
).forEach(hgsc010B -> {
hgsc010B.setRemainingQty(hgsc010B.getRemainingQty().add(hgkc015A.getOutQty()));
hgsc010B.setRemainingWeight(hgsc010B.getRemainingWeight().add(hgkc015A.getOutWeight()));
hgsc010B.setOutQty(hgsc010B.getOutQty().subtract(hgkc015A.getOutQty()));
hgsc010B.setOutWeight(hgsc010B.getOutWeight().subtract(hgkc015A.getOutWeight()));
DaoUtils.update(HGSC010B.UPDATE, hgsc010B);
});
DaoUtils.update(HgKcSqlConstant.HgKc015a.DELETE_BY_PARENT_ID, hgkc015A);
}
}
}
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ017;
import com.baosight.hggp.hg.pz.domain.HGPZ018;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
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 java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/26
* @description 销售目标
*/
public class ServiceHGPZ017 extends ServiceEPBase {
public static final String[] MONTHS = {"01","02","03","04","05","06","07","08","09","10","11","12"};
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ017.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
final EiInfo outEiInfo = super.query(inInfo, HGPZ017.QUERY, new HGPZ017());
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ017.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo,HGPZ017.QUERY);
}
@OperationLogAnnotation(operModul = "销售目标",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGPZ017 hppz017 = new HGPZ017();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz017.fromMap(map);
hppz017.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hppz017.getStatus() == 1) {
//判断销售目标的销售计划是否有审批通过
HGPZTools.HgPz018.getPanentId(hppz017.getId(),1);
DaoUtils.update(HGPZ018.DELETE_BY_PARENT_ID,new HashMap<String,Object>(){{
put(HGPZ018.FIELD_PARENT_ID,hppz017.getId());
put(HGPZ018.FIELD_DELETE_FLAG,CommonConstant.YesNo.YES_1);
}});
}
DaoUtils.update(HGPZ017.DELETE_FLAG, hppz017);
}
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> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGPZ017 hppz017 = new HGPZ017();
hppz017.fromMap(resultRows.get(i));
if (hppz017.getId() == null || hppz017.getId() == 0) {
this.add(hppz017);
} else {
this.modify(hppz017);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGPZ017 hppz017) {
hppz017.setSalesCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGPZ017_SALES_CODE));
List<HGPZ017> hppz017s = HGPZTools.HgPz017.getYear(hppz017.getYear());
AssertUtils.isNotEmpty(hppz017s, String.format("年度[%s]销售目标已存在,添加失败!", hppz017.getYear()));
DaoUtils.insert(HGPZ017.INSERT, hppz017);
}
/**
* 修改操作
*/
public void modify(HGPZ017 hppz017) {
DaoUtils.update(HGPZ017.UPDATE, hppz017);
}
/**
* 分解销售目标
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售目标",operType = "分解",operDesc = "分解销售目标")
public EiInfo resolve(EiInfo inInfo){
try {
//List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
//修改状态 1已分解
String id = inInfo.getCellStr(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGPZ017.FIELD_ID);
String status = inInfo.getCellStr(EiConstant.queryBlock,ACConstants.ROW_CODE_0,HGPZ017.FIELD_STATUS);
HGPZ017 hppz017 = HGPZTools.HgPz017.getId(Long.valueOf(id));
hppz017.setStatus(Integer.valueOf(status));
DaoUtils.update(HGPZ017.UPDATE,hppz017);
//分解目标
HGPZ018 hppz018 = new HGPZ018();
hppz018.toMap();
hppz018.setYear(hppz017.getYear());
hppz018.setParentId(Long.valueOf(id));
hppz018.setSalesCode(hppz017.getSalesCode());
BigDecimal bigDecimal = hppz017.getSalesAmount().divide(new BigDecimal(12),2, RoundingMode.UP);
for (String months:MONTHS) {
hppz018.setMonth(months);
hppz018.setPlanSalesCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PLAN_SALES_CODE));
hppz018.setSalesAmount(bigDecimal);
DaoUtils.insert(HGPZ018.INSERT, hppz018);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次数据分解成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "分解失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ018;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
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 java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/26
* @description 销售计划
*/
public class ServiceHGPZ018 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ018.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
final EiInfo outEiInfo = super.query(inInfo, HGPZ018.QUERY, new HGPZ018());
return outEiInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGPZ018.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo,HGPZ018.QUERY);
}
@OperationLogAnnotation(operModul = "销售计划",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
HGPZ018 hppz018 = new HGPZ018();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz018.fromMap(map);
hppz018.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGPZ018.DELETE_FLAG, hppz018);
}
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> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGPZ018 hppz018 = new HGPZ018();
hppz018.fromMap(resultRows.get(i));
if (hppz018.getId() == null || hppz018.getId() == 0) {
this.add(hppz018);
} else {
this.modify(hppz018);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGPZ018 hppz018) {
hppz018.setPlanSalesCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PLAN_SALES_CODE));
List<HGPZ018> hppz018s = HGPZTools.HgPz018.getYear(hppz018.getYear());
AssertUtils.isNotEmpty(hppz018s, String.format("年度[%s]已存在", hppz018.getYear()));
DaoUtils.insert(HGPZ018.INSERT, hppz018);
}
/**
* 修改操作
*/
public void modify(HGPZ018 hppz018) {
DaoUtils.update(HGPZ018.UPDATE, hppz018);
}
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGPZ018 hppz018 = new HGPZ018();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz018.fromMap(map);
hppz018.setStatus(HGConstant.WlApprovalStatu.S_1);
DaoUtils.update(HGPZ018.UPDATE_STATUS, hppz018);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
}
<?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-26 18:55:30
Version : 1.0
schema : hggp
tableName : HGPZ017
ID INTEGER 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,
YEAR VARCHAR,
SALES_CODE VARCHAR,
SALES_AMOUNT DECIMAL,
TARGET_EXPLAIN VARCHAR,
STATUS TINYINT
-->
<sqlMap namespace="HGPZ017">
<typeAlias alias="HGPZ017" type="com.baosight.hggp.hg.pz.domain.HGPZ017"/>
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 帐套编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0.否1.是 -->
YEAR as "year", <!-- 年度 -->
SALES_CODE as "salesCode", <!-- 销售单号 -->
SALES_AMOUNT as "salesAmount", <!-- 销售额 -->
TARGET_EXPLAIN as "targetExplain", <!-- 目标说明 -->
STATUS as "status" <!-- 状态:0未分解 1已分解 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="year">
YEAR = #year#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="salesCode">
SALES_CODE LIKE CONCAT('%',#salesCode#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="salesAmount">
SALES_AMOUNT LIKE CONCAT('%',#salesAmount#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="targetExplain">
TARGET_EXPLAIN = #targetExplain#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="HGPZ017">
SELECT
<include refid="column" />
FROM ${hggpSchema}.HGPZ017 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
YEAR DESC
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGPZ017 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="year">
YEAR = #year#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="salesCode">
SALES_CODE = #salesCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="salesAmount">
SALES_AMOUNT = #salesAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="targetExplain">
TARGET_EXPLAIN = #targetExplain#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGPZ017 (ID,
ACCOUNT_CODE, <!-- 帐套编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
YEAR, <!-- 年度 -->
SALES_CODE, <!-- 销售单号 -->
SALES_AMOUNT, <!-- 销售额 -->
TARGET_EXPLAIN, <!-- 目标说明 -->
STATUS <!-- 状态:0未分解 1已分解 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #year#, #salesCode#, #salesAmount#, #targetExplain#, #status#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) FROM ${hggpSchema}.HGPZ017
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGPZ017 WHERE
ID = #id#
</delete>
<!--逻辑删除-->
<update id="deleteFlag">
UPDATE ${hggpSchema}.HGPZ017
SET
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 修改时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0:否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGPZ017
SET
ACCOUNT_CODE = #accountCode#, <!-- 帐套编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
YEAR = #year#, <!-- 年度 -->
SALES_CODE = #salesCode#, <!-- 销售单号 -->
SALES_AMOUNT = #salesAmount#, <!-- 销售额 -->
TARGET_EXPLAIN = #targetExplain#, <!-- 目标说明 -->
STATUS = #status# <!-- 状态:0未分解 1已分解 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -799,5 +799,70 @@ public class HGPZTools {
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
public static class HgPz017 {
/**
* 查询年份信息
*
* @param year
* @return
*/
public static List<HGPZ017> getYear(String year) {
AssertUtils.isNull(year, String.format("年份不能为空", year));
Map queryMap = new HashMap();
queryMap.put("year", year);
queryMap.put(HGPZ017.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
List<HGPZ017> results = DaoBase.getInstance().query(HGPZ017.QUERY, queryMap);
return results;
}
public static HGPZ017 getId(Long id){
AssertUtils.isNull(id, "ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HGPZ017> results = DaoBase.getInstance().query(HGPZ017.QUERY, queryMap);
AssertUtils.isEmpty(results, String.format("ID[%s]不存在", id));
return results.get(0);
}
}
public static class HgPz018 {
/**
* 查询年份信息
*
* @param year
* @return
*/
public static List<HGPZ018> getYear(String year) {
AssertUtils.isNull(year, String.format("年份不能为空", year));
Map queryMap = new HashMap();
queryMap.put("year", year);
queryMap.put(HGPZ018.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
List<HGPZ018> results = DaoBase.getInstance().query(HGPZ018.QUERY, queryMap);
return results;
}
public static List<HGPZ018> getPanentId(Long id){
AssertUtils.isNull(id, String.format("id不能为空", id));
return getPanentId(id,null);
}
public static List<HGPZ018> getPanentId(Long id,Integer status){
AssertUtils.isNull(id, String.format("id不能为空", id));
Map queryMap = new HashMap();
queryMap.put(HGPZ018.FIELD_PARENT_ID, id);
if (status != null) {
queryMap.put(HGPZ018.FIELD_STATUS,status);
}
List<HGPZ018> results = DaoBase.getInstance().query(HGPZ018.QUERY, queryMap);
AssertUtils.isNotEmpty(results, String.format("销售目标分解的销售计划已经审批通过,无法删除"));
return results;
}
}
}
......@@ -74,5 +74,12 @@ public class HgScSqlConstant {
// 根据订单清除
public static final String DELETE_BY_ORDER = "HGSC007B.deleteByOrder";
}
public static class HgSc010 {
// 修改出库状态
public static final String UPDATE_OUT_STATUS = "HGSC010.updateByOutStatus";
// 修改入库状态
public static final String UPDATE_DEPOSIT_STATUS = "HGSC010.updateByDepositStatus";
}
}
package com.baosight.hggp.hg.sc.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.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.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/29
* @description 委托加工
*/
public class ServiceHGSC010 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID, DdynamicEnum.USER_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC010().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);
String contractDate = MapUtils.getString(queryMap, HGSC010.FIELD_CONTRACT_DATE);
if (StringUtils.isNotBlank(contractDate)) {
queryMap.put(HGSC010.FIELD_CONTRACT_DATE, StringUtil.removeHorizontalLine(contractDate));
}
inInfo = super.query(inInfo, HGSC010.QUERY, new HGSC010());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外加工", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(map);
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许删除!");
DaoUtils.update(HGSC010.DELETE_FLAG, hgsc010.toMap());
Map<String,Object> params = new HashMap<>();
params.put(HGSC010A.FIELD_PARENT_ID, hgsc010.getId());
DaoUtils.update(HGSC010A.DELETE, params);
DaoUtils.update(HGSC010B.DELETE, params);
}
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) {
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(resultMap);
if(Objects.nonNull(hgsc010.getId())&&hgsc010.getId()!=0){
this.modify(hgsc010);
}else {
this.add(hgsc010);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void add(HGSC010 hgsc010) {
hgsc010.setContractCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CONTRACT_CODE));
DaoUtils.insert(HGSC010.INSERT, hgsc010);
}
public void modify(HGSC010 hgsc010) {
DaoUtils.update(HGSC010.UPDATE, hgsc010);
}
@OperationLogAnnotation(operModul = "委外加工", operType = "提交", operDesc = "提交操作")
public EiInfo updateStatus(EiInfo inInfo) {
int i = 0;
try {
List<HGSC010> resultMaps = MapUtils.toDaoEPBases(inInfo, HGSC010.class);
List<Long> ids = ObjectUtils.listEpKey(resultMaps, HGSC010.FIELD_ID);
List<HGSC010A> hgsc010As = HGSCTools.Hgsc010a.getByParentIds(ids);
List<HGSC010B> hgsc010Bs = HGSCTools.Hgsc010b.getByParentIds(ids);
for (HGSC010 hgsc010: resultMaps) {
List<HGSC010A> hgsc010AList = hgsc010As.stream().filter(item -> item.getParentId().equals(hgsc010.getId())).collect(Collectors.toList());
List<HGSC010B> hgsc010BList = hgsc010Bs.stream().filter(item -> item.getParentId().equals(hgsc010.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgsc010AList.size()<= 0 || hgsc010BList.size()<= 0, "请先添加成本委托明细或者原料委托明细");
hgsc010.setSubStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update("HGSC010.updateBySubStatus", hgsc010.toMap());
}
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.sc.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.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.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.*;
/**
* @author LiuYang
* @version 1.0 2024/9/29
* @description 委托加工成本
*/
public class ServiceHGSC010A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.SUP_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, HGSC010A.QUERY, new HGSC010A());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外加工", operType = "删除", operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010A hgsc010a = new HGSC010A();
hgsc010a.fromMap(map);
DaoUtils.update(HGSC010A.DELETE, hgsc010a);
}
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 {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGSC010 hgsc010 = HGSCTools.Hgsc010.getById(Long.parseLong(queryMap.get("parentId").toString()));
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委托任务已提交,不允许修改保存!");
List<Map> resultMaps = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultMap: resultMaps) {
HGSC010A hgsc010a = new HGSC010A();
hgsc010a.fromMap(resultMap);
if(Objects.nonNull(hgsc010a.getId())&&hgsc010a.getId()!=0){
this.modifyHgsc010a(hgsc010a);
}else {
hgsc010a.setCompanyCode(queryMap.get("companyCode").toString());
hgsc010a.setCompanyName(queryMap.get("companyName").toString());
hgsc010a.setParentId(Long.parseLong(queryMap.get("parentId").toString()));
hgsc010a.setContractCode(queryMap.get("contractCode").toString());
this.addHgsc010a(hgsc010a);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
public void addHgsc010a(HGSC010A hgsc010a) {
DaoUtils.insert(HGSC010A.INSERT, hgsc010a);
}
public void modifyHgsc010a(HGSC010A hgsc010a) {
DaoUtils.update(HGSC010A.UPDATE, hgsc010a);
}
public void addHgsc010b(HGSC010B hgsc010b) {
DaoUtils.insert(HGSC010A.INSERT, hgsc010b);
}
public void modifyHgsc010b(HGSC010B hgsc010a) {
DaoUtils.update(HGSC010A.UPDATE, hgsc010a);
}
}
package com.baosight.hggp.hg.sc.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.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.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 java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/9/29
* @description 委托加工原料
*/
public class ServiceHGSC010B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo,
Arrays.asList(
DdynamicEnum.SUP_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 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, HGSC010B.QUERY, new HGSC010B(),false,new HGSC010B().eiMetadata,EiConstant.queryBlock, CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "委外加工",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(CommonConstant.Field.DETAIL);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010B hgsc010B = new HGSC010B();
hgsc010B.fromMap(map);
DaoUtils.update(HGSC010B.DELETE, hgsc010B.toMap());
}
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 {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGSC010 hgsc010 = HGSCTools.Hgsc010.getById(Long.parseLong(queryMap.get("parentId").toString()));
AssertUtils.isTrue(hgsc010.getSubStatus().equals(CommonConstant.YesNo.YES_1), "当前委外任务已提交,不允许修改保存!");
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HGSC010B hgsc010B = new HGSC010B();
hgsc010B.fromMap(resultRow);
if (hgsc010B.getId() == null || hgsc010B.getId() == 0) {
hgsc010B.setCompanyCode(queryMap.get("companyCode").toString());
hgsc010B.setCompanyName(queryMap.get("companyName").toString());
hgsc010B.setParentId(Long.parseLong(queryMap.get("parentId").toString()));
hgsc010B.setContractCode(queryMap.get("contractCode").toString());
this.add(hgsc010B);
} else {
this.modify(hgsc010B);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGSC010B hgsc010B) {
DaoUtils.insert(HGSC010B.INSERT, hgsc010B);
}
/**
* 修改操作
*/
public void modify(HGSC010B hgsc010B) {
DaoUtils.update(HGSC010B.UPDATE, hgsc010B);
}
}
......@@ -17,22 +17,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.domain.HGSC004B;
import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.zl.domain.HGZL002;
......@@ -1954,4 +1939,97 @@ public class HGSCTools {
}
}
public static class Hgsc010 {
public static HGSC010 getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010)DaoBase.getInstance().get(HGSC010.QUERY, HGSC010A.FIELD_ID, id);
}
}
public static class Hgsc010a {
public static HGSC010A getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工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){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentId",parentId);
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> getByParentIds(List<Long> parentIds){
AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentIds",parentIds);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010A> list = DaoBase.getInstance().query(HGSC010A.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
}
public static class Hgsc010b {
public static HGSC010B getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010B) DaoBase.getInstance().get(HGSC010B.QUERY, HGSC010B.FIELD_ID, id);
}
public static List<HGSC010B> 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<HGSC010B> list = DaoBase.getInstance().query(HGSC010B.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
public static List<HGSC010B> getByParentId(Long parentId){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentId",parentId);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010B> list = DaoBase.getInstance().query(HGSC010B.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
public static List<HGSC010B> getByParentIds(List<Long> parentIds){
AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentIds",parentIds);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010B> list = DaoBase.getInstance().query(HGSC010B.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
}
}
......@@ -63,6 +63,8 @@
<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/HGKC013A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC014.xml"/>
<sqlMap resource="com/baosight/hggp/hg/kc/sql/HGKC015.xml"/>
<!-- 质量 -->
<sqlMap resource="com/baosight/hggp/hg/zl/sql/HGZL001.xml"/>
......@@ -88,6 +90,7 @@
<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/HGSC101.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC010.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;
}
let flag = true;
rows.forEach(function (item,index){
if (item.status == '1'){
message("选中的第" + (index + 1) + "行\"状态\"\"已提交\",不能进行操作!");
flag = false;
return;
}
})
if (flag){
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-whName=" + rows[0].whName +
"&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%",
callbackName: function (){
// 关闭弹窗
JSColorbox.close();
}
});
}
}
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 remainingUnitWeight = e.items[0]['remainingUnitWeight'];
let remainingQty = e.items[0]['remainingQty'];
if (depositQty > remainingQty){
message("选中行\"入库数量\",不能大于\"剩余数量\"!");
return;
}
remainingQty = remainingQty - depositQty;
resultGrid.setCellValue(e.items[0],"depositUnitWeight",remainingUnitWeight);
resultGrid.setCellValue(e.items[0],"depositWeight",depositQty * remainingUnitWeight);
//resultGrid.setCellValue(e.items[0],"remainingQty",remainingQty);
//resultGrid.setCellValue(e.items[0],"remainingWeight",remainingQty * remainingUnitWeight);
}else if (e.field == "depositWeight"){
let depositWeight = e.items[0]['depositWeight'];
let remainingWeight = e.items[0]['remainingWeight'];
let remainingUnitWeight = e.items[0]['remainingUnitWeight'];
if (depositWeight > remainingWeight){
message("选中行\"入库重量\",不能大于\"剩余重量\"!");
return;
}
remainingWeight = remainingWeight - depositWeight;
resultGrid.setCellValue(e.items[0],"depositUnitWeight",remainingUnitWeight);
resultGrid.setCellValue(e.items[0],"depositQty",(depositWeight / remainingUnitWeight).toFixed(0));
//resultGrid.setCellValue(e.items[0],"remainingQty",remainingWeight / remainingUnitWeight);
//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");
let remainingQty = item.get("remainingQty");
if (isBlank(depositQty) || !isNumber(depositQty) || 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 (depositQty > remainingQty) {
message("选中的第" + (index + 1) + "行\"入库数量\",不能大于\"剩余数量\"!");
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();
}
<%--
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 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="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="whName" 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_type_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="depositUnitWeight" cname="入库单量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.00" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false" hidden="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<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="remainingUnitWeight" 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" hidden="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<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>
$(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: "outDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},
],
beforeEdit: function (e) {
let item = e.model;
if(item.Status == '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();
}
},
onAdd: function (e) {
$.each(e.items, function(index, item){
if (isBlank(item['outDate'])){
item['outDate'] = currShortDate();
}
});
},
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: "HGKC015A?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;
}
let flag = true;
rows.forEach(function (item,index){
if (item.status == '1'){
message("选中的第" + (index + 1) + "行\"状态\"\"已提交\",不能进行操作!");
flag = false;
return;
}
})
if (flag){
JSColorbox.open({
href: "HGKC015B?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-whName=" + rows[0].whName +
"&inqu_status-0-outCode=" + rows[0].outCode +
"&inqu_status-0-parentId=" + rows[0].id ,
title: "<div style='text-align: center;'>委外出库详情</div>",
width: "90%",
height: "80%",
callbackName: function (){
// 关闭弹窗
JSColorbox.close();
}
});
}
}
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 outDate = item.get("outDate");
let whCode = item.get("whCode");
if (isBlank(companyName)) {
message("选中的第" + (index + 1) + "行\"公司\",不能为空!");
flag = false;
return false;
}
if (isBlank(outDate)) {
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", "HGKC015", "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", "HGKC015", "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="outDate" cname="委外出库日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="outCode" 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="outDate" cname="委外出库日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="outCode" 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: "inventCode",
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['inventCode']) {
return inventRecordBox[i]['valueField'];
}
}
return dataItem["inventCode"];
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
if (e.field == "inventCode") {
for (let i = 0; i < inventRecordBox.length; i++) {
if (inventRecordBox[i]['valueField'] === e.items[0]['inventCode']) {
resultGrid.setCellValue(e.items[0],"inventName",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 inventCode = item.get("inventCode");
if (isBlank(inventType)) {
message("选中的第" + (index + 1) + "行\"存货类型\",不能为空!");
flag = false;
return false;
}
if (isBlank(inventCode)) {
message("选中的第" + (index + 1) + "行\"原料编码\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC015A", "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="outDate" cname="委外入库单号" type="hidden"/>
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventCode" 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="inventName" 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="outQty" 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="outWeight" 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 == "outQty"){
let outQty = e.items[0]['outQty'];
let remainingUnitWeight = e.items[0]['remainingUnitWeight'];
let remainingQty = e.items[0]['remainingQty'];
if (outQty > remainingQty){
message("选中行\"入库数量\",不能大于\"剩余数量\"!");
return;
}
remainingQty = remainingQty - outQty;
resultGrid.setCellValue(e.items[0],"outUnitWeight",remainingUnitWeight);
resultGrid.setCellValue(e.items[0],"outWeight",outQty * remainingUnitWeight);
//resultGrid.setCellValue(e.items[0],"remainingQty",remainingQty);
//resultGrid.setCellValue(e.items[0],"remainingWeight",remainingQty * remainingUnitWeight);
}else if (e.field == "outWeight"){
let outWeight = e.items[0]['outWeight'];
let remainingWeight = e.items[0]['remainingWeight'];
let remainingUnitWeight = e.items[0]['remainingUnitWeight'];
if (outWeight > remainingWeight){
message("选中行\"入库重量\",不能大于\"剩余重量\"!");
return;
}
remainingWeight = remainingWeight - outWeight;
resultGrid.setCellValue(e.items[0],"outUnitWeight",remainingUnitWeight);
resultGrid.setCellValue(e.items[0],"outQty",(outWeight / remainingUnitWeight).toFixed(0));
//resultGrid.setCellValue(e.items[0],"remainingQty",remainingWeight / remainingUnitWeight);
//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 outQty = item.get("outQty");
let outWeight = item.get("outWeight");
if (isBlank(outQty) || !isNumber(outQty) || outQty <= 0) {
message("选中的第" + (index + 1) + "行\"出库数量\",不能为空并且不能为0!");
flag = false;
return false;
}
if (isBlank(outWeight) || !isNumber(outWeight) || outWeight <= 0) {
message("选中的第" + (index + 1) + "行\"出库重量\",不能为空并且不能为0!");
flag = false;
return false;
}
if (outQty > outWeight) {
message("选中的第" + (index + 1) + "行\"出库数量\",不能大于\"剩余数量\"!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC015B", "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="whName" cname="仓库名称" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="上级ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="outCode" 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="inventCode" 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="inventName" cname="原料名称" width="120" align="center" readonly="true" required="false"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="flase" readonly="true"
blockName="invent_type_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="outQty" 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="outUnitWeight" cname="出库单量" width="120" enable="true" format="{0:N3}" editType="text"
displayType="0.00" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" readonly="false" hidden="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="outWeight" 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="remainingUnitWeight" 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" hidden="true"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<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>
$(function () {
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
/* 页面查询框的尺寸设置 */
$.extend(true, IPLATUI.Config, {
EFGrid: {
height: $(document).height() - $("#inqu").height() - $("#ef_form_head").height() - 100,
/*pageable: {
input: true,
numeric: false,
pageSizes: [10, 50 , 100 , 200]
}*/
}
});
IPLATUI.EFDatePicker = {
"inqu_status-0-year":{
start:"decade",
depth:"decade",
format:"yyyy",
}
}
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let status = item.status;
let template = '';
if (!isBlank(item.id) && status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="taskResolve(' + item.id + ')" >分解</a>';
}
return template;
}
}, {
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}
],
loadComplete: function(grid) {
},
beforeEdit:function (e) {
if (e.model["status"] === "1") {
e.preventDefault();
}
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
item['year'] = currShortDate().substring(0, 4)
});
},
//单元格数据储存时回调
afterEdit:function (e) {
/*if (e.field === "groupCode" && e.model["factoryCode"].length === 0){
for (let i = 0; i < groupCodeBox.length; i++) {
if (e.model[e.field] === groupCodeBox[i]["valueField"]){
e.model["factoryCode"]=groupCodeBox[i]["param1Field"]
break;
}
}
}*/
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
exportGrid : {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "销售目标_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls",
exportBlockId: "result",
}
}
}
downKeyUp();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
/*$.each(rows, function(index, item) {
let factoryCode= item.get("factoryCode");
if(isBlank(factoryCode)){
message("选中的第"+(index+1)+"行\"工厂\",不能为空!");
flag = false;
return false;
}
});*/
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGPZ017", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
/**
* 分解销售目标
*
* @param id
*/
function taskResolve(id) {
JSUtils.confirm("确定对数据做\"分解\"操作? ", {
ok: function () {
var info = new EiInfo();
info.set("inqu_status-0-id",id);
info.set("inqu_status-0-status",1);
EiCommunicator.send("HGPZ017", "resolve", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
}
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