Commit 273f4975 by YG6494

材料计划详情

parent c5f6d661
......@@ -122,6 +122,9 @@ public class HGConstant {
public static final String CW_COLLECTION_NO = "CW_COLLECTION_NO";
//材料计划订单号
public static final String PLAN_MATERIAL_CODE = "PLAN_MATERIAL_CODE";
}
/**
......
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.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sb.tools.HGSBTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
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.*;
/**
* @author ZhangJiHui
* @version 1.0 2024/5/28
*/
public class ServiceHGSC009 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = super.initLoad(inInfo,new HGSC009());
outInfo = super.query(inInfo, HGSC009.QUERY, new HGSC009());
Map qarma = new HashMap();
List<Org> orgList = HGXSTools.XsOrg.queryByUser();
if (orgList.size()>0) {
qarma.put(Org.FIELD_ORG_ID,orgList.get(0).getOrgId());
}
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.COMPANY_RECORD_BOX_BLOCK_ID),qarma);
qarma.clear();
Map userCompany = HGSBTools.getUserCompany();
qarma.put(HGSC009.FIELD_COMPANY_CODE,userCompany.get(HGSC009.FIELD_COMPANY_CODE));
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID),qarma);
qarma.clear();
List<String> orgIds = HGSBTools.getOrgId();
qarma.put(Org.FIELD_ORG_ID,orgIds);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.USER_ID_BOX_BLOCK_ID),qarma);
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.queryBlock);
return super.query(inInfo, HGSC009.QUERY,new HGSC009());
}
@OperationLogAnnotation(operModul = "材料计划",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGSC009 hgsc009 = new HGSC009();
hgsc009.fromMap(resultRows.get(i));
// 校验是否提交
int count = hgsc009.getStatus();
if (count == 1) {
throw new PlatException(String.format("[%s]已提交清单,不可删除", hgsc009.getProjName()));
}
DaoUtils.update(HGSC009.DELETE, hgsc009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
@Override
public EiInfo insert(EiInfo inInfo) {
return super.insert(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++) {
HGSC009 hgsc009 = new HGSC009();
hgsc009.fromMap(resultRows.get(i));
if (hgsc009.getId() == null || hgsc009.getId() == 0) {
this.add(hgsc009);
} else {
this.modify(hgsc009);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HGSC009 hgsc009) {
// 校验数据
hgsc009.setPlanMaterialCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PLAN_MATERIAL_CODE));
DaoUtils.insert(HGSC009.INSERT, hgsc009);
}
/**
* 修改操作
*/
public void modify(HGSC009 hgsc009) {
DaoUtils.update(HGSC009.UPDATE, hgsc009);
}
@OperationLogAnnotation(operModul = "材料计划",operType = "修改",operDesc = "修改状态操作")
public EiInfo updateStatus(EiInfo inInfo){
int i = 0;
try {
HGSC009 hgsc009 = new HGSC009();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgsc009.fromMap(map);
DaoUtils.update(HGSC009.UPDATE_BLUEPRINT_STATUS, hgsc009);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "修改")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author:
* @date:2024/1/15,11:20
*/
public class ServiceHGSC009A extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "材料计划详情", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC009A().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "材料计划详情", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC009A.QUERY, new HGSC009A());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "材料计划详情", operType = "插入", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGSC009A hgsc009A = new HGSC009A();
hgsc009A.fromMap(resultRows.get(i));
if (hgsc009A.getId() == null || hgsc009A.getId() == 0) {
Map queryMap = new HashMap();
hgsc009A.setCompanyCode(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_COMPANY_CODE));
hgsc009A.setCompanyName(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_COMPANY_NAME));
hgsc009A.setPlanMaterialCode(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_PLAN_MATERIAL_CODE));
hgsc009A.setPlanMaterialName(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_PLAN_MATERIAL_NAME));
hgsc009A.setProjCode(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_PROJ_CODE));
hgsc009A.setProjName(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_PROJ_NAME));
add(hgsc009A);
} else {
this.modify(hgsc009A);
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
// 数据校验
for (int i = 0; i < resultRows.size(); i++) {
HGSC009A hgsc009A = new HGSC009A();
hgsc009A.fromMap(resultRows.get(i));
//AssertUtils.isNull(hgsc009A.s(), "是否启用不能为空");
}
}
/**
* 新增
*
* @param hgsc009A
* @throws Exception
*/
private void add(HGSC009A hgsc009A) throws Exception {
DaoUtils.insert(HGSC009A.INSERT, hgsc009A);
}
/**
* 修改数据
*
* @param hgsc009A
*/
private void modify(HGSC009A hgsc009A) {
DaoUtils.update(HGSC009A.UPDATE, hgsc009A);
}
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "材料计划详情", operType = "修改", operDesc = "修改操作")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
for (int i = 0; i < resultRows.size(); i++) {
HGSC009A hppz009 = new HGSC009A();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update(HGSC009A.UPDATE, hppz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单明细", operType = "删除", operDesc = "删除操作")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGSC009A hgsc009A = new HGSC009A();
hgsc009A.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HGXSTools.XsUser.countByAccount(hgsc009A.getAccountCode());
if (count > 0) {
// throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", hgsc009A.getAccountName()));
}
DaoUtils.update(HGSC009A.DELETE, hgsc009A);
// 扣减库存
/*Map queryMap = new HashMap();
queryMap.put("id",inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGSC009A.FIELD_PRIMARY_ID));
List<HGSC009> list = this.dao.query(HGSC009.QUERY,queryMap);
HGKCUtils.HgKc010.updateInv(list.get(0).getCompanyCode(), list.get(0).getWhCode(), hgsc009A.getInventRecordId(),
hgsc009A.getInvQty().negate(), hgsc009A.getInvWeight().negate());*/
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "采购计划", operType = "采购计划", operDesc = "采购计划")
public EiInfo insertcg(EiInfo inInfo) {
try {
String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(",");
List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getById(orderDetailIds);
for (HGSC009A hgsc009 : hgsc009AList) {
// 写入子表数据
HGCG001 hgcg001 = new HGCG001();
BeanUtils.copyProperties(hgsc009,hgcg001);
hgcg001.setCompanyCode(hgsc009.getCompanyCode());
hgcg001.setCompanyName(hgsc009.getCompanyName());
hgcg001.setInventCode(hgsc009.getInventCode());
hgcg001.setInventName(hgsc009.getInventName());
//hgcg001.setInventName(hgsc009.getSpec()); //规格
hgcg001.setSpec(hgsc009.getSpec());
hgcg001.setLength(hgsc009.getLength());
hgcg001.setWidth(hgsc009.getWidth());
hgcg001.setThick(hgsc009.getThick());
hgcg001.setStatus(0);
hgcg001.setPlanDate(DateUtils.formatShort(DateUtils.date()));
hgcg001.setPlanUnitWeight(hgsc009.getSingleWeight());//总量
hgcg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO));
DaoUtils.insert(HGCG001.INSERT, hgcg001);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据生成采购计划成功!");
} catch (Exception e) {
LogUtils.setMsg(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-05-28 11:47:21
Version : 1.0
schema : hggp
tableName : HGSC009
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PLAN_MATERIAL_CODE VARCHAR,
PLAN_MATERIAL_NAME VARCHAR,
STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR
-->
<sqlMap namespace="HGSC009">
<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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME LIKE CONCAT('%', #companyName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planMaterialCode">
PLAN_MATERIAL_CODE = #planMaterialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planMaterialName">
PLAN_MATERIAL_NAME = #planMaterialName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</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>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC009">
SELECT
ID as "id", <!-- 主键id -->
ACCOUNT_CODE as "accountCode", <!-- 账套 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PLAN_MATERIAL_CODE as "planMaterialCode", <!-- 材料计划编码 -->
PLAN_MATERIAL_NAME as "planMaterialName", <!-- 材料计划名称 -->
STATUS as "status", <!-- 提交状态 0-未提交 1-已提交 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
FROM ${hggpSchema}.HGSJ003 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}.HGSJ003 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="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planMaterialCode">
PLAN_MATERIAL_CODE = #planMaterialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planMaterialName">
PLAN_MATERIAL_NAME = #planMaterialName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</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>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSJ003 (ID, <!-- 主键id -->
ACCOUNT_CODE, <!-- 账套 -->
DEP_CODE, <!-- 部门编码 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PLAN_MATERIAL_CODE, <!-- 材料计划编码 -->
PLAN_MATERIAL_NAME, <!-- 材料计划名称 -->
STATUS, <!-- 提交状态 0-未提交 1-已提交 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 修改人 -->
UPDATED_NAME, <!-- 修改人名称 -->
UPDATED_TIME <!-- 修改时间 -->
)
VALUES (#id#, #accountCode#, #depCode#, #companyCode#, #companyName#, #projCode#, #projName#, #planMaterialCode#, #planMaterialName#, #status#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSJ003 WHERE
ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSJ003
SET
ACCOUNT_CODE = #accountCode#, <!-- 账套 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
PLAN_MATERIAL_CODE = #planMaterialCode#, <!-- 材料计划编码 -->
PLAN_MATERIAL_NAME = #planMaterialName#, <!-- 材料计划名称 -->
STATUS = #status#, <!-- 提交状态 0-未提交 1-已提交 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
WHERE
ID = #id#
</update>
<update id="updateBlueprintStatus">
UPDATE ${hggpSchema}.HGSJ003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 提交状态 0-未提交 1-已提交 -->
WHERE
ID = #id#
</update>
<select id="queryProcessComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
PLAN_MATERIAL_CODE as "planMaterialCode",
PLAN_MATERIAL_NAME as "planMaterialName"
FROM ${hggpSchema}.HGSJ003
WHERE PLAN_MATERIAL_CODE = #planMaterialCode#
<isNotEmpty prepend=" AND " property="accountCode">
PLAN_MATERIAL_NAME = #planMaterialName#
</isNotEmpty>
ORDER BY planMaterialCode
</select>
</sqlMap>
package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.copier.SrcToDestCopier;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
......@@ -888,8 +889,44 @@ public class HGSCTools {
}
}
}
public static class HGSC009{
/* public static void generatorOrder(List<HGSC005> hgsc005List, List<HGSC005A> hgsc005AList){
Map<String, Optional<HGSC005>> hgsc005Map = hgsc005List.stream().collect(Collectors.groupingBy(HGSC005::getPlanCode,Collectors.maxBy(
Comparator.comparingLong(HGSC005::getId))));
Map<String,List<HGSC005A>> hgsc005aMap = hgsc005AList.stream().collect(Collectors.groupingBy(HGSC005A::getPlanCode));
hgsc005Map.forEach((k,v) -> {
HGSC005 hgsc005 = v.get();
HGSC006 hgsc006 = constructObj(hgsc005);
List<HGSC006A> hgsc006AList = THGSC006A.constructObj(hgsc006,hgsc005aMap.get(hgsc005.getPlanCode()));
DaoUtils.insert(HGSC006.INSERT,hgsc006);
DaoUtils.insert(HGSC006A.INSERT,hgsc006AList);
});
}*/
/*public static HGSC006 constructObj(HGSC005 hgsc005){
HGSC006 hgsc006 = new HGSC006();
hgsc006.setOrderCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGSC006_ORDER_CODE));
hgsc006.setMatId(hgsc005.getMatId());
hgsc006.setPlanId(hgsc005.getId());
hgsc006.setCompanyCode(hgsc005.getCompanyCode());
hgsc006.setCompanyName(hgsc005.getCompanyName());
hgsc006.setProjCode(hgsc005.getProjCode());
hgsc006.setProjName(hgsc005.getProjName());
hgsc006.setAssignStatus(UNASSIGN.getCode());
return hgsc006;
}*/
public static List<HGSC009A> getById(String[] orderDetailId){
AssertUtils.isTrue(Objects.isNull(orderDetailId)||orderDetailId.length<=0, "订单明细ID不能为空!");
Map map = new HashMap<>();
map.put("planMaterialCodes",orderDetailId);
List<HGSC009A> results = DaoBase.getInstance().query(HGSC009A.QUERYList, map);
AssertUtils.isEmpty(results,"材料明细不能为空!");
return results;
}
}
}
$(function () {
var companyCodeBox = __eiInfo.getBlock("company_record_box_block_id").getMappedRows();
var groupCodeBox = __eiInfo.getBlock("proj_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 auditStatus = item.status;
let template = '';
if (item.companyCode && item.projCode) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(\'' + item.companyCode + '\',\'' + item.companyName + '\',\'' + item.projCode + '\',\'' + item.projName + '\'' +
',\'' + item.planMaterialCode + '\',\'' + item.planMaterialName + '\')" >计划详情</a>';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >提交</a>';
} else if (auditStatus == 1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="updateStatus(' + item.id + ',1)" >已提交</a>';
}
}
return template;
}
}, {
field: "companyCode",
title: "公司名称",
template: function (dataItem) {
for (let i = 0; i < companyCodeBox.length; i++) {
if (companyCodeBox[i]['valueField'] === dataItem['companyCode']) {
dataItem['companyName'] = companyCodeBox[i]['textField']
return companyCodeBox[i]['textField'];
}
}
return dataItem["companyCode"];
}
}, {
field: "projCode",
title: "项目编码",
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['valueField'] === dataItem['projCode']) {
dataItem['projName'] = groupCodeBox[i]['textField']
return groupCodeBox[i]['valueField'];
}
}
return dataItem["projCode"];
}
},
{
field: "projName",
title: "项目名称",
template: function (dataItem) {
for (let i = 0; i < groupCodeBox.length; i++) {
if (groupCodeBox[i]['textField'] === dataItem['projName']) {
dataItem['projCode'] = groupCodeBox[i]['valueField']
return groupCodeBox[i]['textField'];
}
}
return dataItem["projName"];
}
}, {
field: "createdTime",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
},
],
loadComplete: function (grid) {
$("#INSERTCG").on("click", INSERTCG);
grid.dataSource.bind("change", function (e) {
// 判断父级节点是否发生变化
if (e.field == "projCode") {
loadChange(grid, e, "projName");
loadChange(grid, e, "planMaterialName");
} else if (e.field == "projName") {
loadChange(grid, e, "projCode");
loadChange(grid, e, "planMaterialName");
}
});
},
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);
}
}
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 companyName = item.get("companyName");
let createdTime = item.get("createdTime");
if (isBlank(companyName)) {
message("选中的第" + (index + 1) + "行\"公司\",不能为空!");
flag = false;
return false;
}
if (isBlank(createdTime)) {
message("选中的第" + (index + 1) + "行\"创建时间\",不能为空!");
flag = false;
return false;
}
});
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC009", "save", true);
btnNode.attr("disabled", false);
}
});
}
};
});
/**
* 显示附件详情
*
* @param id
*/
function showUploadFile(companyCode,companyName,projCode,projName,planMaterialCode,planMaterialName) {
JSColorbox.open({
href: "HGSC009A?methodName=initLoad&" +
"inqu_status-0-companyCode=" + companyCode +
"&inqu_status-0-companyName=" + companyName +
"&inqu_status-0-planMaterialCode=" + planMaterialCode +
"&inqu_status-0-planMaterialName="+ planMaterialName +
"&inqu_status-0-projCode=" + projCode +
"&inqu_status-0-projName=" + projName ,
title: "<div style='text-align: center;'>材料计划清单</div>",
width: "80%",
height: "80%",
});
}
function updateStatus(id,status) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", status);
EiCommunicator.send('HGSC009', 'updateStatus', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
function INSERTCG() {
let inEiInfo = new EiInfo();
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要分派的数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
if (item.get("status")==0){
message("未提交,无法选中!");
return false;
}
ids.push(item.planMaterialCode)
});
inEiInfo.set("planMaterialCodes",ids.join(','));
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
});
inEiInfo.set("planMaterialCodes", ids.join(','));
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/5/6
Time: 16:24
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}"/>
<EF:EFPage title="材料计划">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="projName" cname="项目名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="提交状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<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="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="company_record_box_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="projCode" cname="项目编码"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="120"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="proj_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="projName" cname="项目名称" width="100" enable="true" readonly="true" align="center">
</EF:EFComboColumn>
<EF:EFColumn ename="createdTime" cname="材料计划日期" width="120" enable="true" readonly="false" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="planMaterialCode" cname="材料计划编码" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="planMaterialName" cname="材料计划名称" width="120" enable="true" readonly="false" align="center"/>
<EF:EFComboColumn ename="status" cname="提交状态" width="80" enable="true" readonly="false" align="center" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
let InventNameGlobalData = [];
let inventAllGlobalData = [];
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [{
field: "inventCode",
filter: function (options) {
return _.filter(InventNameGlobalData, function (item) {
return item["param1Field"] == "true";
})
},
template: function (dataItem) {
for (let i = 0; i < InventNameGlobalData.length; i++) {
if (InventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
dataItem['inventName'] = InventNameGlobalData[i]['textField'];
return InventNameGlobalData[i]['textField'];
}
}
return dataItem['inventCode'];
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-isSplicingSymbol", true);
inInfo.set("serviceName", "HGPZ005");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "invent_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "spec",
filter: function (options) {
return _.filter(inventAllGlobalData, function (item) {
return item["param7Field"] == "true";
})
},
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['spec']) {
return inventAllGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("serviceName", "HGPZ005");
inInfo.set("methodName", "queryInventBoxAll");
inInfo.set("blockId", "invent_all_box_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function (e) {
//数量发生变化进行计算
if(e.field === "quantity"){
if(e.items[0].singleWeight != null){
let grossAmount = e.items[0].quantity * e.items[0].singleWeight;
resultGrid.setCellValue(e.items[0], 'grossAmount', grossAmount);
}
}
if(e.field === "singleWeight"){
if(e.items[0].quantity != null){
let grossAmount = e.items[0].quantity * e.items[0].singleWeight;
resultGrid.setCellValue(e.items[0], 'grossAmount', grossAmount);
}
}
if (e.field === "inventCode") {
for (let i = 0; i < InventNameGlobalData.length; i++) {
if (InventNameGlobalData[i]['valueField'] === e.items[0].inventCode) {
resultGrid.setCellValue(e.items[0], 'inventName', InventNameGlobalData[i]['textField'])
}
}
loadChange(grid, e, "spec");
} else if (e.field == "spec") {
var tr, index;
// 获取此model元素信息
var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === item.spec) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field'])
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field'])
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field'])
}
}
}
})
},
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);
initInvent();
initSpec();
}
/**
* 初始化存货
*/
let initInvent = function () {
let inInfo = new EiInfo();
EiCommunicator.send("HGPZ005", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
InventNameGlobalData = ei.getBlock("invent_record_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
//inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HGPZ005", "queryInventBoxAll", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_all_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let inventCode= item.get("inventCode");
let spec= item.get("spec");
if(isBlank(inventCode)){
message("选中的第"+(index+1)+"行\"存货编号\",不能为空!");
flag = false;
return false;
}
if(isBlank(spec)){
message("选中的第"+(index+1)+"行\"规格\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC009A", "save", true);
}
});
}
}
/**
* 删除
*/
let deleteFunc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC009A", "delete", true);
}
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="材料计划详情">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<%-- <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains"
defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_record_box_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>--%>
<EF:EFInput cname="公司编码" ename="companyCode" blockId="inqu_status" row="0" readonly="true" type="hidden" colWidth="3" />
<EF:EFInput cname="公司名称" ename="companyName" blockId="inqu_status" row="0" readonly="true" type="hidden" colWidth="3" />
<EF:EFInput cname="计划编号" ename="planMaterialCode" blockId="inqu_status" row="0" readonly="true" colWidth="3" />
<EF:EFInput cname="计划名称" ename="planMaterialName" blockId="inqu_status" row="0" readonly="true" colWidth="3"/>
<EF:EFInput cname="项目编码" ename="projCode" blockId="inqu_status" row="0" readonly="true" type="hidden" colWidth="3" />
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" readonly="true" type="hidden" colWidth="3" />
</div>
<%-- <div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>--%>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<%--<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>--%>
<EF:EFComboColumn ename="inventCode" cname="存货编码" width="120" align="center" required="true"
blockName="invent_record_block_id" textField="valueField" valueField="valueField"
columnTemplate="#=valueField#" itemTemplate="#=valueField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" readonly="true" required="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false" readonly="true" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="quantity" cname="数量" width="120" align="right" format="{0:N0}"
defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="singleWeight" cname="单重" width="120" align="right" format="{0:N3}"
defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/>
<EF:EFColumn ename="grossAmount" cname="总重" width="120" align="right" enable="false" format="{0:N3}"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment