Commit c87d4d1c by 宋祥

1.生产下料复页

parent 451dee5c
......@@ -368,9 +368,9 @@ public class HPSqlConstant {
// 更新完成数量
public static final String UPDATE_COMPLETE_NUM = "HPSC005A.updateCompleteNum";
}
public class HPSC006 {
// 锁
public static final String LOCK = "HPSC006.lock";
// 更新完成数量
......@@ -378,6 +378,18 @@ public class HPSqlConstant {
}
/**
* HPSC0061 定义
*
* @author:songx
* @date:2024/9/26,10:08
*/
public class HPSC0061 {
// 锁
public static final String LOCK = "HPSC0061.lock";
}
/**
* 质量巡检单
*
* @author:songx
......
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.constant.HpScConst;
import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC0061;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.sc.utils.HpScUtils;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ProjectInfo;
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.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
* @date:2024/9/26,9:37
*/
public class ServiceHPSC0061 extends ServiceBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005().eiMetadata);
inInfo.addBlock(CommonConstant.Field.DETAIL).addBlockMeta(new HPSC006().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HPSC003.FIELD_DELIVERY_DATE, DateUtils.formatShort(queryMap.get(HPSC003.FIELD_DELIVERY_DATE)));
queryMap.put(HPSC005.FIELD_WORK_DATE, DateUtils.formatShort(queryMap.get(HPSC005.FIELD_WORK_DATE)));
queryMap.put(HPSC005.FIELD_PLAN_COMPLETION_DATE,
DateUtils.formatShort(queryMap.get(HPSC005.FIELD_PLAN_COMPLETION_DATE)));
inInfo = super.query(inInfo, "HPSC005.query", new HPSC005());
// 统计各个状态数量
List<Map> statusStats = dao.query("HPSC005.statByCompleteStatus", queryMap);
inInfo.set("statusStat", statusStats);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 明细
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "查询", operDesc = "查询明细")
public EiInfo queryDetail(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", inInfo.getString("prodOrderNo"));
List<HPSC0061> dbSc0061s = dao.query("HPSC0061.queryDetail", queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(dbSc0061s);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询明细失败");
}
return inInfo;
}
/**
* 刷新主信息
*
* @param inInfo
* @param prodOrderNo
* @return
*/
private EiInfo refreshMain(EiInfo inInfo, String prodOrderNo) {
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
List<HPSC0061> dbSc0061s = dao.query("HPSC0061.queryDetail", queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(dbSc0061s);
return inInfo;
}
/**
* 保存操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产下料", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
String prodOrderNo = inInfo.getString("prodOrderNo");
List<HPSC0061> fSc0061s = MapUtils.toDaoEPBases(inInfo, CommonConstant.Field.DETAIL, HPSC0061.class);
for (HPSC0061 fSc0061 : fSc0061s) {
String groupCode = fSc0061.getGroupCode();
AssertUtils.isEmpty(groupCode, String.format("物料【%s】的生产组不能为空,请检查", fSc0061.getInventName()));
Org groupOrg = HPXSTools.XsOrg.get(groupCode);
fSc0061.setGroupName(groupOrg.getOrgCname());
fSc0061.setFactoryCode(groupOrg.getFactoryCode());
fSc0061.setFactoryName(groupOrg.getFactoryName());
fSc0061.setProdOrderNo(prodOrderNo);
if (fSc0061.getId() == null || fSc0061.getId() == 0) {
this.add(fSc0061);
} else {
this.modify(fSc0061);
}
}
// 更新主订单状态
this.updateMainStatus(prodOrderNo);
inInfo = this.queryDetail(inInfo);
inInfo.setMsg("操作成功!本次对[" + fSc0061s.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param fSc0061
*/
public void add(HPSC0061 fSc0061) {
fSc0061.setCompleteStatus(HpScConst.CompleteStatus.S0);
fSc0061.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPSC0061.INSERT, fSc0061);
}
/**
* 修改操作.
*/
public void modify(HPSC0061 fSc006) {
DaoUtils.update(HPSC0061.UPDATE, fSc006);
}
/**
* 完成
*
* @param inInfo
* @return
*/
public EiInfo complete(EiInfo inInfo) {
try {
String prodOrderNo = inInfo.getString("prodOrderNo");
List<HPSC0061> fSc0061s = MapUtils.toDaoEPBases(inInfo, CommonConstant.Field.DETAIL, HPSC0061.class);
Map<Long, HPSC0061> dbSc0061Map = HpScUtils.HpSc0061.lockAndGet(fSc0061s);
// 检查数据
this.checkCompleteData(fSc0061s, dbSc0061Map);
// 写入数据
this.saveCompleteData(fSc0061s, dbSc0061Map);
// 更新主订单状态
this.updateMainStatus(prodOrderNo);
// 刷新页面数据
inInfo = this.query(inInfo);
inInfo = this.refreshMain(inInfo, prodOrderNo);
inInfo.setMsg("操作成功,本次完成" + fSc0061s.size() + "条数据");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
/**
* @param fSc0061s
* @param dbSc0061Map
*/
private void checkCompleteData(List<HPSC0061> fSc0061s, Map<Long, HPSC0061> dbSc0061Map) {
AssertUtils.isEmpty(dbSc0061Map, "请先设置生产组后,再进行\"完成\"操作");
for (HPSC0061 fSc0061 : fSc0061s) {
Long id = fSc0061.getId();
HPSC0061 dbSc0061 = dbSc0061Map.get(id);
AssertUtils.isNull(dbSc0061, String.format("标识【%s】不存在,请检查", id));
AssertUtils.isNotEquals(dbSc0061.getCompleteStatus(), CommonConstant.YesNo.NO_0,
String.format("标识【%s】状态的不是\"未完成\",", id));
}
}
/**
* 写入数据
*
* @param fSc0061s
* @param dbSc0061Map
*/
private void saveCompleteData(List<HPSC0061> fSc0061s, Map<Long, HPSC0061> dbSc0061Map) {
for (HPSC0061 fSc0061 : fSc0061s) {
Map paramMap = new HashMap();
paramMap.put(HPSC0061.FIELD_ID, fSc0061.getId());
paramMap.put(HPSC0061.FIELD_COMPLETE_STATUS, HpScConst.CompleteStatus.S1);
DaoUtils.update("HPSC0061.updateCompleteStatus", paramMap);
}
}
/**
* 更新主订单状态
*
* @param prodOrderNo
*/
private void updateMainStatus(String prodOrderNo) {
Integer completeStatus = calcCompleteStatus(prodOrderNo);
Map paramMap = new HashMap();
paramMap.put(HPSC005.FIELD_PROD_ORDER_NO, prodOrderNo);
paramMap.put(HPSC0061.FIELD_COMPLETE_STATUS, completeStatus);
DaoUtils.update("HPSC005.updateCompleteStatus", paramMap);
}
/**
* 计算完成状态
*
* @param prodOrderNo
* @return
*/
private Integer calcCompleteStatus(String prodOrderNo) {
List<HPSC0061> dbSc0061s = HPSCTools.HpSc0061.getDetailByOrder(prodOrderNo);
List<Integer> statuses = dbSc0061s.stream().map(HPSC0061::getCompleteStatus).distinct()
.collect(Collectors.toList());
if (statuses.size() > 1) {
return HpScConst.CompleteStatus.S2;
} else {
return statuses.get(0);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC0061">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
PROD_ORDER_NO as "prodOrderNo", <!-- 生产订单号 -->
INVENT_CODE as "inventCode", <!-- 物料编码 -->
INVENT_NAME as "inventName", <!-- 物料名称 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
GROUP_CODE as "groupCode", <!-- 生产组编码 -->
GROUP_NAME as "groupName", <!-- 生产组名称 -->
COMPLETE_STATUS as "completeStatus" <!-- 完成状态,0.未完成,1.已完成 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNo">
PROD_ORDER_NO = #prodOrderNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
GROUP_NAME = #groupName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="completeStatus">
COMPLETE_STATUS = #completeStatus#
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC0061">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPSC0061 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 ${hpjxSchema}.T_HPSC0061 WHERE 1=1
<include refid="condition"/>
</select>
<select id="queryDetail" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC0061">
SELECT
B.ID as "id",
B.PROD_ORDER_NO as "prodOrderNo",
A.INVENT_CODE as "inventCode",
A.INVENT_NAME as "inventName",
B.FACTORY_CODE as "factoryCode",
B.FACTORY_NAME as "factoryName",
B.GROUP_CODE as "groupCode",
B.GROUP_NAME as "groupName",
IFNULL(B.COMPLETE_STATUS, 0) as "completeStatus"
FROM ${hpjxSchema}.T_HPSC0061A A
LEFT JOIN ${hpjxSchema}.T_HPSC0061 B
ON A.INVENT_CODE = B.INVENT_CODE AND B.PROD_ORDER_NO = #prodOrderNo#
ORDER BY A.INVENT_CODE ASC
</select>
<select id="countDetail" resultClass="int">
SELECT COUNT(1)
FROM ${hpjxSchema}.T_HPSC0061A A
LEFT JOIN ${hpjxSchema}.T_HPSC0061 B
ON A.INVENT_CODE = B.INVENT_CODE
WHERE B.PROD_ORDER_NO = #prodOrderNo#
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPSC0061 (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
PROD_ORDER_NO, <!-- 生产订单号 -->
INVENT_CODE, <!-- 物料编码 -->
INVENT_NAME, <!-- 物料名称 -->
FACTORY_CODE, <!-- 厂区编码 -->
FACTORY_NAME, <!-- 厂区名称 -->
GROUP_CODE, <!-- 生产组编码 -->
GROUP_NAME, <!-- 生产组名称 -->
COMPLETE_STATUS <!-- 完成状态,0.未完成,1.已完成 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #prodOrderNo#, #inventCode#, #inventName#,
#factoryCode#, #factoryName#, #groupCode#, #groupName#, #completeStatus#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPSC0061 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPSC0061
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
FACTORY_CODE = #factoryCode#, <!-- 厂区编码 -->
FACTORY_NAME = #factoryName#, <!-- 厂区名称 -->
GROUP_CODE = #groupCode#, <!-- 生产组编码 -->
GROUP_NAME = #groupName#, <!-- 生产组名称 -->
WHERE ID = #id#
</update>
<update id="lock">
UPDATE ${hpjxSchema}.T_HPSC0061
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</update>
<!-- 修改完成状态 -->
<update id="updateCompleteStatus">
UPDATE ${hpjxSchema}.T_HPSC0061
SET
COMPLETE_STATUS = #completeStatus#,
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC0061A">
<sql id="column">
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
INVENT_CODE as "inventCode", <!-- 物料编码 -->
INVENT_NAME as "inventName" <!-- 物料名称 -->
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
</sql>
<select id="query" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC0061A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPSC0061A 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 ${hpjxSchema}.T_HPSC0061A WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPSC0061A (
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG, <!-- 0-未删除,1-已删除 -->
INVENT_CODE, <!-- 物料编码 -->
INVENT_NAME <!-- 物料名称 -->
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #deleteFlag#, #inventCode#, #inventName#
)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPSC0061A WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hpjxSchema}.T_HPSC0061A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
INVENT_CODE = #inventCode#, <!-- 物料编码 -->
INVENT_NAME = #inventName# <!-- 物料名称 -->
WHERE ID = #id#
</update>
</sqlMap>
......@@ -1293,7 +1293,111 @@ public class HPSCTools {
}
}
/**
*
* @author:songx
* @date:2024/9/25,9:32
*/
public static class HpSc0061 {
/**
* 锁
*
* @param id
* @return
*/
public static void lock(Long id) {
AssertUtils.isNull(id, "生产下料号不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
DaoBase.getInstance().update(HPSqlConstant.HPSC0061.LOCK, queryMap);
}
/**
* 锁
*
* @param ids
* @return
*/
public static void lock(List<Long> ids) {
AssertUtils.isEmpty(ids, "生产下料号不能为空");
Map queryMap = new HashMap();
queryMap.put("ids", ids);
DaoBase.getInstance().update(HPSqlConstant.HPSC0061.LOCK, queryMap);
}
/**
* 查询
*
* @param id
* @return
*/
public static HPSC0061 getById(Long id) {
AssertUtils.isNull(id, "生产下料ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPSC0061> results = DaoBase.getInstance().query(HPSC0061.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param prodOrderNo
* @return
*/
public static List<HPSC0061> getByOrder(String prodOrderNo) {
AssertUtils.isEmpty(prodOrderNo, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
return DaoBase.getInstance().query(HPSC0061.QUERY, queryMap);
}
/**
* 查询
*
* @param prodOrderNo
* @return
*/
public static List<HPSC0061> getDetailByOrder(String prodOrderNo) {
AssertUtils.isEmpty(prodOrderNo, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
return DaoBase.getInstance().query("HPSC0061.queryDetail", queryMap);
}
/**
* 查询其他入库信息
*
* @param ids
* @return
*/
public static List<HPSC0061> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPSC0061.QUERY, queryMap);
}
/**
* 查询其他入库信息
*
* @param ids
* @return
*/
public static Map<Long, HPSC0061> map(List<Long> ids) {
List<HPSC0061> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPSC0061::getId, item -> item));
}
}
public static class Hpsc007 {
/**
* 查询
......
package com.baosight.hpjx.hp.sc.utils;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC0061;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.ObjectUtils;
......@@ -47,4 +48,38 @@ public class HpScUtils {
}
}
/**
* @author:songx
* @date:2024/9/24,18:07
*/
public static class HpSc0061 {
/**
* 锁并获取数据
*
* @param fSc0061s
* @return
*/
public static Map<Long, HPSC0061> lockAndGet(List<HPSC0061> fSc0061s) {
List<Long> ids = ObjectUtils.listEpKey(fSc0061s, HPSC0061.FIELD_ID);
// 锁
HPSCTools.HpSc0061.lock(ids);
// 查询数据
return HPSCTools.HpSc0061.map(ids);
}
/**
* 锁并获取数据
*
* @param id
* @return
*/
public static HPSC0061 lockAndGet(Long id) {
// 锁
HPSCTools.HpSc0061.lock(id);
// 查询数据
return HPSCTools.HpSc0061.getById(id);
}
}
}
$(function () {
IPLATUI.EFGrid = {
"result": {
exportGrid: false,
pageable: {
pageSize: 10,
pageSizes: [10, 50, 70, 100],
},
onRowClick: function (e) {
var block = detailGrid.getEiBlock();
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
let prodOrderNo = e.model['prodOrderNo'];
var inInfo = new EiInfo()
inInfo.set("prodOrderNo", prodOrderNo);
EiCommunicator.send("HPSC0061", "queryDetail", inInfo, {
onSuccess: function (res) {
if (res.status > -1) {
detailGrid.setEiInfo(res);
$('#prodOrderNo').val(prodOrderNo);
} else {
message(res.msg);
}
}, onFail: function (ei) {
}
}, {async: false});
},
columns: []
},
"detail": {
exportGrid: false,
columns: []
}
}
// 查询
$("#QUERY").on("click", query);
// 保存
$("#SAVE").on("click", save);
// 完成
$("#COMPLETE").on("click", complete);
// 键盘按键
downKeyUp();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 保存
*/
function save() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
let item = rows[i];
let completeStatus = item['completeStatus'];
let inventName = item['inventName'];
let groupCode = item['groupCode'];
if (completeStatus === "1") {
message("物料【" + inventName + "】的状态不是\"未完成\",不能进行修改");
return;
}
if (isBlank(groupCode)) {
message("物料【" + inventName + "】的生产组不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPSC0061", "save", true);
}
});
}
/**
* 完成
*/
let complete = function () {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
let item = rows[i];
let id = item['id'];
let completeStatus = item['completeStatus'];
let inventName = item['inventName'];
let groupCode = item['groupCode'];
if (isBlank(id) || id == 0) {
message("物料【" + inventName + "】请先设置生产组,且保存后再进行\"完成\"操作");
return;
}
if (completeStatus === "1") {
message("物料【" + inventName + "】的状态不是\"未完成\",不能进行操作");
return;
}
if (isBlank(groupCode)) {
message("物料【" + inventName + "】的生产组不能为空");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"完成\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result,detail", "HPSC0061", "complete", 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:EFInput ename="projCode" cname="项目号" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="projName" cname="项目名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="prodOrderNo" cname="生产订单号" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect ename="completeStatus" cname="状态" blockId="inqu_status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFOption label="未完成" value="0"/>
<EF:EFOption label="部分完成" value="2"/>
<EF:EFOption label="已完成" value="1"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="生产任务集">
<EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="40vh" checkMode="row,single"
isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" align="center" width="100"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" align="left" width="180"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" align="center" width="80"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="120" align="left"/>
<EF:EFComboColumn ename="completeStatus" cname="状态" enable="false" width="100" align="center">
<EF:EFOption label="未完成" value="0"/>
<EF:EFOption label="已完成" value="1"/>
<EF:EFOption label="部分完成" value="2"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="detail" title="下料清单">
<EF:EFInput ename="prodOrderNo" type="hidden"/>
<EF:EFGrid blockId="detail" autoDraw="override" showCount="true" checkMode="row">
<EF:EFColumn ename="id" cname="标识" enable="false" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="材料编码" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="inventName" cname="材料名称" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="groupCode" cname="生产组" width="180" align="center" defaultValue="" required="true"
filter="contains" copy="true">
<EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="completeStatus" cname="状态" enable="false" align="center" width="80">
<EF:EFOption label="未完成" value="0"/>
<EF:EFOption label="已完成" value="1"/>
</EF:EFComboColumn>
</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