Commit 947ef27d by 宋祥

1.质量巡检单更具生产任务生成

parent 352b58e0
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.tools.HPZLTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
......@@ -77,6 +82,18 @@ public class ServiceHPKC003 extends ServiceBase {
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
for (Map resultRow : resultRows) {
HPKC003 fKc003 = new HPKC003();
fKc003.fromMap(resultRow);
// 校验是否存在巡检单
Map queryMap = new HashMap();
queryMap.put("prodNo", fKc003.getProductionOrderNo());
queryMap.put("status", CommonConstant.YesNo.NO_0);
List<HPZL001> dbZl001s = dao.query(HPZL001.QUERY, queryMap);
AssertUtils.isNotEmpty(dbZl001s, String.format("入库失败,生产订单号[%s]有未处理的巡检单,请先处理巡检单",
fKc003.getProductionOrderNo()));
}
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPKC003 fKc003 = new HPKC003();
......
......@@ -22,7 +22,7 @@ public class HPSC005 extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_ID = "id";
public static final String FIELD_ID = "id";
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
......@@ -52,7 +52,7 @@ public class HPSC005 extends DaoEPBase {
public static final String FIELD_FACTORY_CODE = "factoryCode"; /* 厂区编码*/
public static final String FIELD_FACTORY_NAME = "factoryName"; /* 厂区名称*/
public static final String COL_ID = "ID";
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
......@@ -83,13 +83,13 @@ public class HPSC005 extends DaoEPBase {
public static final String COL_FACTORY_CODE = "FACTORY_CODE"; /* 厂区编码*/
public static final String COL_FACTORY_NAME = "FACTORY_NAME"; /* 厂区名称*/
public static final String QUERY = "t_hpsc005.query";
public static final String COUNT = "t_hpsc005.count";
public static final String INSERT = "t_hpsc005.insert";
public static final String UPDATE = "t_hpsc005.update";
public static final String DELETE = "t_hpsc005.delete";
public static final String QUERY = "HPSC005.query";
public static final String COUNT = "HPSC005.count";
public static final String INSERT = "HPSC005.insert";
public static final String UPDATE = "HPSC005.update";
public static final String DELETE = "HPSC005.delete";
private Long id = new Long(0);
private Long id = new Long(0);
private String companyCode = " "; /* 企业编码 预留*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
......@@ -489,7 +489,7 @@ public class HPSC005 extends DaoEPBase {
/**
* set the id .
*
* @param id
* @param id
*/
public void setId(Long id) {
this.id = id;
......
package com.baosight.hpjx.hp.sc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:THpsc005.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-22 15:35:04 create
*/
public class HPSC005B extends HPSC005 {
private static final long serialVersionUID = 1L;
public static final String FIELD_CHILD_ID = "childId";
public static final String COL_CHILD_ID = "CHILD_ID";
public static final String QUERY = "HPSC005B.query";
public static final String COUNT = "HPSC005B.count";
public static final String INSERT = "HPSC005B.insert";
public static final String UPDATE = "HPSC005B.update";
public static final String DELETE = "HPSC005B.delete";
private Long childId;
/**
* the constructor.
*/
public HPSC005B() {
super.initMetaData();
initMetaData();
}
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_CHILD_ID);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
}
/**
* get the childId .
*
* @return the childId
*/
public Long getChildId() {
return this.childId;
}
/**
* set the childId .
*
* @param childId
*/
public void setChildId(Long childId) {
this.childId = childId;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
super.fromMap(map);
setChildId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_CHILD_ID)), childId));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = super.toMap();
map.put(FIELD_CHILD_ID, StringUtils.toString(childId, eiMetadata.getMeta(FIELD_CHILD_ID)));
return map;
}
}
<?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="HPSC005B">
<sql id="column">
A.ID as "id",
B.ID as "childId",
A.PROJ_CODE as "projCode", <!-- 项目编码 -->
A.PROJ_NAME as "projName", <!-- 项目名称 -->
A.PRODUCTION_ORDER_NO as "productionOrderNo", <!-- 生产订单号 -->
A.PRDT_CODE as "prdtCode", <!-- 部件编码 -->
A.PRDT_NAME as "prdtName", <!-- 部件名称 -->
A.PRDT_SPEC as "prdtSpec",
A.PART_CODE as "partCode",
A.PART_NAME as "partName",
A.PART_SPEC as "partSpec",
A.PRDT_LENGTH as "prdtLength", <!-- 长 -->
A.PRDT_WIDTH as "prdtWidth", <!-- 宽 -->
A.PRDT_THICK as "prdtThick", <!-- 厚 -->
A.PART_LENGTH as "partLength", <!-- 长 -->
A.PART_WIDTH as "partWidth", <!-- 宽 -->
A.PART_THICK as "partThick", <!-- 厚 -->
A.FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
A.FACTORY_NAME as "factoryName", <!-- 厂区名称 -->
A.STATUS as "status", <!-- 状态 -->
(CASE WHEN A.DOCUMENT_TYPE = 1 THEN B.NUM ELSE A.NUM END) AS "num",
(CASE WHEN A.DOCUMENT_TYPE = 1 THEN B.TOTAL_WT ELSE A.TOTAL_WT END) AS "totalWt",
(CASE WHEN A.DOCUMENT_TYPE = 1 THEN B.ORG_NO ELSE A.ORG_NO END) AS "orgNo",
(CASE WHEN A.DOCUMENT_TYPE = 1 THEN B.ORG_NAME ELSE A.ORG_NAME END) AS "orgName"
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="childId">
B.ID = #childId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productionOrderNo">
A.PRODUCTION_ORDER_NO LIKE CONCAT('%', #productionOrderNo#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
A.PROJ_NAME LIKE CONCAT('%', #projName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
A.PRDT_CODE = #prdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
A.PRDT_NAME LIKE CONCAT('%', #prdtName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partCode">
A.PART_CODE = #partCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partName">
A.PART_NAME LIKE CONCAT('%', #partName#, '%')
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
A.ID IN <iterate close=")" open="(" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="statuses">
A.STATUS IN <iterate close=")" open="(" conjunction="," property="statuses">#statuses[]#</iterate>
</isNotEmpty>
</sql>
<!-- 选择生产任务 -->
<select id="query" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC005B">
SELECT
<include refid="column"/>
FROM HPJX.T_HPSC005 A
LEFT JOIN HPJX.T_HPSC005A B ON A.PRODUCTION_ORDER_NO = B.PRODUCTION_ORDER_NO
<include refid="condition"/>
<include refid="customCondition"/>
</select>
</sqlMap>
......@@ -2,12 +2,14 @@ package com.baosight.hpjx.hp.sc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
......@@ -16,6 +18,7 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class HPSCTools {
......@@ -105,4 +108,76 @@ public class HPSCTools {
return results.get(0);
}
}
/**
* HPSC005公共DAO定义
*
* @author:songx
* @date:2024/2/4,10:17
*/
public static class HpSc005 {
/**
* 查询
*
* @param id
* @return
*/
public static HPSC005 getById(Long id) {
AssertUtils.isNull(id, "生产任务ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPSC005> results = DaoBase.getInstance().query("HPSC005.query", queryMap);
AssertUtils.isNull(results, String.format("生产任务ID[%s]信息不存在", id));
return results.get(0);
}
/**
* 查询
*
* @param id
* @param childId
* @return
*/
public static HPSC005B getById(Long id, Long childId) {
AssertUtils.isNull(id, "生产任务ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
queryMap.put("childId", childId);
List<HPSC005B> results = DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
AssertUtils.isNull(results, String.format("生产任务ID[%s]信息不存在", id));
return results.get(0);
}
/**
* 查询其他入库信息
*
* @param ids
* @return
*/
public static List<HPSC005> listById(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPSC005.QUERY, queryMap);
}
/**
* 查询其他入库信息
*
* @param ids
* @return
*/
public static Map<Long, HPSC005> mapById(List<Long> ids) {
List<HPSC005> results = listById(ids);
if (org.springframework.util.CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPSC005::getId, item -> item));
}
}
}
......@@ -26,6 +26,7 @@ public class HPZL001 extends DaoEPBase {
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码*/
public static final String FIELD_RECEIPT_DATE = "receiptDate"; /* 单据日期*/
public static final String FIELD_CHECK_NO = "checkNo"; /* 检查单号*/
public static final String FIELD_PROD_NO = "prodNo"; /* 生产任务号*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目号*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 部件编码*/
......@@ -52,6 +53,7 @@ public class HPZL001 extends DaoEPBase {
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
public static final String COL_RECEIPT_DATE = "RECEIPT_DATE"; /* 单据日期*/
public static final String COL_CHECK_NO = "CHECK_NO"; /* 检查单号*/
public static final String COL_PROD_NO = "PROD_NO"; /* 生产任务号*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目号*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 部件编码*/
......@@ -84,6 +86,7 @@ public class HPZL001 extends DaoEPBase {
private String depCode = " "; /* 部门编码*/
private String receiptDate = " "; /* 单据日期*/
private String checkNo = " "; /* 检查单号*/
private String prodNo = " "; /* 生产任务号*/
private String projCode = " "; /* 项目号*/
private String projName = " "; /* 项目名称*/
private String inventCode = " "; /* 部件编码*/
......@@ -132,6 +135,10 @@ public class HPZL001 extends DaoEPBase {
eiColumn.setDescName("检查单号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROD_NO);
eiColumn.setDescName("生产任务号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_CODE);
eiColumn.setDescName("项目号");
eiMetadata.addMeta(eiColumn);
......@@ -300,6 +307,15 @@ public class HPZL001 extends DaoEPBase {
public void setCheckNo(String checkNo) {
this.checkNo = checkNo;
}
public String getProdNo() {
return prodNo;
}
public void setProdNo(String prodNo) {
this.prodNo = prodNo;
}
/**
* get the projCode - 项目号.
* @return the projCode
......@@ -633,6 +649,7 @@ public class HPZL001 extends DaoEPBase {
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode));
setReceiptDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIPT_DATE)), receiptDate));
setCheckNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CHECK_NO)), checkNo));
setProdNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROD_NO)), prodNo));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
......@@ -667,6 +684,7 @@ public class HPZL001 extends DaoEPBase {
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE)));
map.put(FIELD_RECEIPT_DATE, StringUtils.toString(receiptDate, eiMetadata.getMeta(FIELD_RECEIPT_DATE)));
map.put(FIELD_CHECK_NO, StringUtils.toString(checkNo, eiMetadata.getMeta(FIELD_CHECK_NO)));
map.put(FIELD_PROD_NO, StringUtils.toString(prodNo, eiMetadata.getMeta(FIELD_PROD_NO)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
......
......@@ -16,6 +16,7 @@ import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
......@@ -37,10 +38,10 @@ public class ServiceHPZL001 extends ServiceBase {
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_PROD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUB_INVENT_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ORG_PROD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.ORG_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPZL001().eiMetadata);
} catch (Exception e) {
......@@ -137,15 +138,16 @@ public class ServiceHPZL001 extends ServiceBase {
*/
private void setBaseInfo(HPZL001 fZl001) {
// 项目名称
fZl001.setProjName(HPSCTools.HpSc001.get(fZl001.getProjCode()).getProjName());
// fZl001.setProjName(HPSCTools.HpSc001.get(fZl001.getProjCode()).getProjName());
// 部件名称
fZl001.setInventName(HPSCTools.HpSc002.get(fZl001.getInventCode()).getPrdtName());
// fZl001.setInventName(HPSCTools.HpSc002.get(fZl001.getInventCode()).getPrdtName());
// 零部件名称
fZl001.setSubInventName(HPSCTools.HpSc002.get(fZl001.getSubInventCode()).getPrdtName());
// fZl001.setSubInventName(HPSCTools.HpSc002.get(fZl001.getSubInventCode()).getPrdtName());
// 生产组名称
fZl001.setOrgName(HPXSTools.XsOrg.get(fZl001.getOrgNo()).getOrgCname());
// fZl001.setOrgName(HPXSTools.XsOrg.get(fZl001.getOrgNo()).getOrgCname());
// 检查人名称
fZl001.setCheckUserName(HPXSTools.XsUser.get(fZl001.getCheckUser()).getUserName());
// fZl001.setCheckUser(UserSession.getLoginName());
// fZl001.setCheckUserName(UserSession.getLoginCName());
}
/**
......@@ -185,6 +187,8 @@ public class ServiceHPZL001 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HPZL001 fZl001 = new HPZL001();
fZl001.fromMap(resultRows.get(i));
fZl001.setCheckUser(UserSession.getLoginName());
fZl001.setCheckUserName(UserSession.getLoginCName());
fZl001.setStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPSqlConstant.HPZL001.DO_PROCESS, fZl001);
}
......
......@@ -79,7 +79,7 @@ public class ServiceHPZL001A extends ServiceEPBase {
// 校验质检单是否已处理
HPZL001 dbZl001 = HPZLTools.getById(fZl001A.getCheckId());
AssertUtils.isTrue(CommonConstant.YesNo.YES_1.equals(dbZl001.getStatus()),
String.format("质检单[%s]状态为\"已处理\",不能上传附件"));
String.format("质检单[%s]状态为\"已处理\",不能上传附件", dbZl001.getCheckNo()));
DaoUtils.insert(HPZL001A.INSERT, fZl001A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.hpjx.hp.zl.service;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 选择生产任务
*
* @author:songx
* @date:2022/7/11,11:08
*/
public class ServiceHPZL001B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005B().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);
// 1.部分派工,2.全部派工
queryMap.put("statuses", new Integer[]{1, 2});
inInfo = super.query(inInfo, HPSC005B.QUERY, new HPSC005B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 生成巡检单
*
* @param inInfo
* @return
*/
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map<String, HPSC005B> dbSc005bMap = new HashMap<>();
// 数据校验
for (Map row : resultRows) {
HPSC005B fSc005b = new HPSC005B();
fSc005b.fromMap(row);
HPSC005B dbSc005b = HPSCTools.HpSc005.getById(fSc005b.getId(), fSc005b.getChildId());
AssertUtils.isTrue(dbSc005b.getStatus() != 1 && dbSc005b.getStatus() != 2,
String.format("生产任务ID[%s]状态不是已分派,不允许操作", fSc005b.getId()));
dbSc005bMap.put(dbSc005b.getId() + "@#@" + dbSc005b.getChildId(), dbSc005b);
}
// 生成巡检单
for (Map row : resultRows) {
HPSC005B fSc005b = new HPSC005B();
fSc005b.fromMap(row);
HPSC005 dbSc005 = dbSc005bMap.get(fSc005b.getId() + "@#@" + fSc005b.getChildId());
HPZL001 newZl001 = BeanUtils.copy(dbSc005, HPZL001.class);
newZl001.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPZL001_NUMBER));
newZl001.setReceiptDate(DateUtils.shortDate());
newZl001.setStatus(CommonConstant.YesNo.NO_0);
newZl001.setInventCode(dbSc005.getPrdtCode());
newZl001.setInventName(dbSc005.getPrdtName());
newZl001.setSubInventCode(dbSc005.getPartCode());
newZl001.setSubInventName(dbSc005.getPartName());
newZl001.setProdNo(dbSc005.getProductionOrderNo());
newZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPZL001.INSERT, newZl001);
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成出库单失败");
}
return inInfo;
}
}
......@@ -8,6 +8,7 @@
DEP_CODE as "depCode", <!-- 部门编码 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
CHECK_NO as "checkNo", <!-- 检查单号 -->
PROD_NO as "prodNo", <!-- 生产任务号 -->
PROJ_CODE as "projCode", <!-- 项目号 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
......@@ -46,6 +47,9 @@
<isNotEmpty prepend=" AND " property="checkNo">
CHECK_NO = #checkNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodNo">
PROD_NO = #prodNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
......@@ -121,6 +125,7 @@
DEP_CODE, <!-- 部门编码 -->
RECEIPT_DATE, <!-- 单据日期 -->
CHECK_NO, <!-- 检查单号 -->
PROD_NO, <!-- 生产任务号 -->
PROJ_CODE, <!-- 项目号 -->
PROJ_NAME, <!-- 项目名称 -->
INVENT_CODE, <!-- 部件编码 -->
......@@ -139,7 +144,7 @@
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG
) VALUES (
#companyCode#, #depCode#, #receiptDate#, #checkNo#, #projCode#, #projName#,
#companyCode#, #depCode#, #receiptDate#, #checkNo#, #prodNo#, #projCode#, #projName#,
#inventCode#, #inventName#, #subInventCode#, #subInventName#, #orgNo#, #orgName#,
#poorType#, #problemDesc#, #checkUser#, #checkUserName#, #status#, #createdBy#,
#createdName#, #createdTime#, #deleteFlag#
......@@ -148,7 +153,7 @@
<!-- 逻辑删除-->
<delete id="delete">
UPDATE FROM hpjx.t_hpzl001
UPDATE hpjx.t_hpzl001
SET DELETE_FLAG = 1,
<include refid="updateRevise"/>
WHERE ID = #id#
......@@ -157,15 +162,6 @@
<update id="update">
UPDATE hpjx.t_hpzl001
SET
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
PROJ_CODE = #projCode#, <!-- 项目号 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
INVENT_CODE = #inventCode#, <!-- 部件编码 -->
INVENT_NAME = #inventName#, <!-- 部件名称 -->
SUB_INVENT_CODE = #subInventCode#, <!-- 零部件编码 -->
SUB_INVENT_NAME = #subInventName#, <!-- 零部件名称 -->
ORG_NO = #orgNo#, <!-- 生产组编码 -->
ORG_NAME = #orgName#, <!-- 生产组名称 -->
POOR_TYPE = #poorType#, <!-- 不良品类 -->
PROBLEM_DESC = #problemDesc#, <!-- 质量问题描述 -->
CHECK_USER = #checkUser#, <!-- 检查人 -->
......@@ -181,6 +177,8 @@
UPDATE hpjx.t_hpzl001
SET
STATUS = #status#,
CHECK_USER = #checkUser#, <!-- 检查人 -->
CHECK_USER_NAME = #checkUserName#, <!-- 检查人名称 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
......
......@@ -50,87 +50,89 @@ $(function () {
return "";
}
}
}, {
field: "projCode",
template: function (dataItem) {
for (let i = 0; i < projNameGlobalData.length; i++) {
if (projNameGlobalData[i]['valueField'] === dataItem['projCode']) {
return projNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
// 1.部分分派,2.全部分派
inInfo.set("inqu_status-0-statuses", [1, 2]);
inInfo.set("serviceName", "HPSC005");
inInfo.set("methodName", "queryProjComboBox");
inInfo.set("blockId", "proj_prod_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let projCode = options.model["projCode"];
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-projCode", isBlank(projCode) ? " " : projCode);
inInfo.set("serviceName", "HPSC003");
inInfo.set("methodName", "queryInventComboBox");
inInfo.set("blockId", "invent_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "subInventCode",
template: function (dataItem) {
for (let i = 0; i < subInventNameGlobalData.length; i++) {
if (subInventNameGlobalData[i]['valueField'] === dataItem['subInventCode']) {
return subInventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inventCode = options.model["inventCode"];
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentPrdtCode", isBlank(inventCode) ? " " : inventCode);
inInfo.set("serviceName", "HPSC004");
inInfo.set("methodName", "queryInventComboBox");
inInfo.set("blockId", "sub_invent_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "orgNo",
template: function (dataItem) {
for (let i = 0; i < orgNameGlobalData.length; i++) {
if (orgNameGlobalData[i]['valueField'] === dataItem['orgNo']) {
return orgNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let subInventCode = options.model["subInventCode"];
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-prdtCode", isBlank(subInventCode) ? " " : subInventCode);
inInfo.set("serviceName", "HPSC005");
inInfo.set("methodName", "queryOrgComboBox");
inInfo.set("blockId", "org_prod_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
},
// {
// field: "projCode",
// template: function (dataItem) {
// for (let i = 0; i < projNameGlobalData.length; i++) {
// if (projNameGlobalData[i]['valueField'] === dataItem['projCode']) {
// return projNameGlobalData[i]['textField'];
// }
// }
// return "";
// },
// editor: function (container, options) {
// let inInfo = new EiInfo();
// // 1.部分分派,2.全部分派
// inInfo.set("inqu_status-0-statuses", [1, 2]);
// inInfo.set("serviceName", "HPSC005");
// inInfo.set("methodName", "queryProjComboBox");
// inInfo.set("blockId", "proj_prod_block_id");
// inInfo.set("field", options.field);
// refreshSelect(container, inInfo);
// }
// }, {
// field: "inventCode",
// template: function (dataItem) {
// for (let i = 0; i < inventNameGlobalData.length; i++) {
// if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
// return inventNameGlobalData[i]['textField'];
// }
// }
// return "";
// },
// editor: function (container, options) {
// let projCode = options.model["projCode"];
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-projCode", isBlank(projCode) ? " " : projCode);
// inInfo.set("serviceName", "HPSC003");
// inInfo.set("methodName", "queryInventComboBox");
// inInfo.set("blockId", "invent_record_block_id");
// inInfo.set("field", options.field);
// refreshSelect(container, inInfo);
// }
// }, {
// field: "subInventCode",
// template: function (dataItem) {
// for (let i = 0; i < subInventNameGlobalData.length; i++) {
// if (subInventNameGlobalData[i]['valueField'] === dataItem['subInventCode']) {
// return subInventNameGlobalData[i]['textField'];
// }
// }
// return "";
// },
// editor: function (container, options) {
// let inventCode = options.model["inventCode"];
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-parentPrdtCode", isBlank(inventCode) ? " " : inventCode);
// inInfo.set("serviceName", "HPSC004");
// inInfo.set("methodName", "queryInventComboBox");
// inInfo.set("blockId", "sub_invent_record_block_id");
// inInfo.set("field", options.field);
// refreshSelect(container, inInfo);
// }
// }, {
// field: "orgNo",
// template: function (dataItem) {
// for (let i = 0; i < orgNameGlobalData.length; i++) {
// if (orgNameGlobalData[i]['valueField'] === dataItem['orgNo']) {
// return orgNameGlobalData[i]['textField'];
// }
// }
// return "";
// },
// editor: function (container, options) {
// let subInventCode = options.model["subInventCode"];
// let inInfo = new EiInfo();
// inInfo.set("inqu_status-0-prdtCode", isBlank(subInventCode) ? " " : subInventCode);
// inInfo.set("serviceName", "HPSC005");
// inInfo.set("methodName", "queryOrgComboBox");
// inInfo.set("blockId", "org_prod_block_id");
// inInfo.set("field", options.field);
// refreshSelect(container, inInfo);
// }
// },
{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
......@@ -142,6 +144,8 @@ $(function () {
// 查询
$("#QUERY").on("click", query);
// 选择生产任务
$("#SELECT_PROD").on("click", selectProd);
});
/**
......@@ -149,38 +153,38 @@ $(function () {
*/
$(window).load(function () {
// 项目名称
let inInfo = new EiInfo();
EiCommunicator.send("HPSC001", "queryComboBox", inInfo, {
onSuccess: function (ei) {
projNameGlobalData = ei.getBlock("proj_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 部件名称
EiCommunicator.send("HPSC003", "queryInventComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 零部件名称
EiCommunicator.send("HPSC004", "queryInventComboBox", inInfo, {
onSuccess: function (ei) {
subInventNameGlobalData = ei.getBlock("sub_invent_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 生产组名称
EiCommunicator.send("HPSC005", "queryOrgComboBox", inInfo, {
onSuccess: function (ei) {
orgNameGlobalData = ei.getBlock("org_prod_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// let inInfo = new EiInfo();
// EiCommunicator.send("HPSC001", "queryComboBox", inInfo, {
// onSuccess: function (ei) {
// projNameGlobalData = ei.getBlock("proj_record_block_id").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
// // 部件名称
// EiCommunicator.send("HPSC003", "queryInventComboBox", inInfo, {
// onSuccess: function (ei) {
// inventNameGlobalData = ei.getBlock("invent_record_block_id").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
// // 零部件名称
// EiCommunicator.send("HPSC004", "queryInventComboBox", inInfo, {
// onSuccess: function (ei) {
// subInventNameGlobalData = ei.getBlock("sub_invent_record_block_id").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
// // 生产组名称
// EiCommunicator.send("HPSC005", "queryOrgComboBox", inInfo, {
// onSuccess: function (ei) {
// orgNameGlobalData = ei.getBlock("org_prod_block_id").getMappedRows();
// },
// onFail: function (ei) {
// }
// }, {async: false});
// 查询
query();
});
......@@ -221,3 +225,26 @@ let doProcess = function (id, checkNo) {
}
});
}
/**
* 挑选生产任务
*/
let selectProd = function () {
JSColorbox.open({
href: "HPZL001B?methodName=initLoad",
title: "<div style='text-align: center;'>生产任务查询</div>",
width: "90%",
height: "80%",
callbackName: selectStockCallback
});
}
/**
* 挑选生产任务回调
*/
let selectStockCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
......@@ -32,28 +32,34 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="100" readonly="false"/>
<EF:EFColumn ename="checkNo" cname="检查单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" readonly="false"/>
<EF:EFColumn ename="checkNo" cname="检查单号" locked="true" enable="false" width="130" align="center"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center">
<EF:EFOption label="1-已处理" value="1"></EF:EFOption>
<EF:EFOption label="0-未处理" value="0"></EF:EFOption>
</EF:EFComboColumn>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="projCode" cname="项目名称" width="140" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="部件名称" width="140" align="center" required="true"/>
<EF:EFColumn ename="subInventCode" cname="零部件名称" width="140" align="center" required="true"/>
<EF:EFColumn ename="orgNo" cname="生产组名称" width="140" align="center" required="true"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="inventName" cname="部件名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="subInventName" cname="零部件名称" enable="false" width="130" align="center"/>
<EF:EFColumn ename="orgName" cname="生产组名称" enable="false" width="130" align="center"/>
<EF:EFComboColumn ename="poorType" cname="不良品类" width="100" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hpjx.poorType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="problemDesc" cname="质量问题描述" width="140" align="center"/>
<EF:EFColumn ename="problemPhoto" cname="问题照片" enable="false" width="100" align="center"/>
<EF:EFColumn ename="processPhoto" cname="处理照片" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="checkUser" cname="检查人" width="120" align="center"
<EF:EFColumn ename="problemDesc" cname="质量问题描述" width="140" align="center" required="true"/>
<EF:EFColumn ename="problemPhoto" cname="问题照片" enable="false" width="100" align="center" required="true"/>
<EF:EFColumn ename="processPhoto" cname="处理照片" enable="false" width="100" align="center" required="true"/>
<EF:EFComboColumn ename="checkUser" cname="检查人" enable="false" width="120" align="center"
blockName="user_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="prodNo" cname="生产单号" width="140" align="center" required="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="130" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="130" align="center"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="130" align="center"/>
<EF:EFColumn ename="orgNo" cname="生产组编码" enable="false" width="130" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="150" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="150" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']" dateFormat="yyyy-MM-dd HH:mm:ss"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 选择
$("#BTN_SELECT").on("click", select);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let select = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成巡检单吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPZL001B", "select",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!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="查询区域" type="query">
<div class="row">
<div class="row">
<EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件编码" ename="inventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="生产订单号" ename="productionOrderNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件编码" ename="subInventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="生产任务ID" enable="false" width="90" align="center"/>
<EF:EFColumn ename="childId" cname="生产任务子ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partName" cname="零部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partSpec" cname="零部件规格" enable="false" width="150" align="center"/>
<EF:EFColumn ename="orgName" cname="生产组" enable="false" width="150" align="center"/>
<EF:EFColumn ename="num" cname="计划数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="totalWt" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="orgNo" cname="生产组编码" enable="false" width="150"/>
<EF:EFColumn ename="productionOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
</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