Commit 30d4345a by wuwenlong

工序质检单dev

parent 2aceb4f9
package com.baosight.hggp.common;
/**
* @author wwl
* @version 1.0 2024/5/21
*/
public enum CheckTypeEnum {
PROCESS_CHECK(1,"工序质检单"),
POLLING_CHECK(2,"日常巡检单");
private Integer code;
private String value;
CheckTypeEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static CheckTypeEnum getEnumByCode(Integer code){
for (CheckTypeEnum en : CheckTypeEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.baosight.hggp.common;
/**
* @author wwl
* @version 1.0 2024/5/21
*/
public enum HandleStatusEnum {
UNPROCESS(0,"待处理"),
processing(1,"处理中"),
processed(1,"已处理");
private Integer code;
private String value;
HandleStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static HandleStatusEnum getEnumByCode(Integer code){
for (HandleStatusEnum en : HandleStatusEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -271,4 +271,15 @@ public class HGConstant {
public static final Integer SC = 3;
}
/**
* 文件类型*
*/
public static class FileBizType {
//项目人员
public static final String XMRY = "XMRY";
//质检问题照片
public static final String CHECK_DEFECT = "CHECK_DEFECT";
//质检问题处理照片
public static final String CHECK_HANDLE = "CHECK_HANDLE";
}
}
......@@ -4,8 +4,10 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC002;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HGSCUtil;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
......@@ -53,6 +55,7 @@ public class ServiceHGSC002 extends ServiceBase {
return inInfo;
}
@Override
@OperationLogAnnotation(operModul = "项目人员", operType = "删除", operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
......@@ -61,6 +64,9 @@ public class ServiceHGSC002 extends ServiceBase {
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC002.FIELD_id);
DaoUtils.update(HGSC002.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
ids.forEach( id -> {
HGSCTools.THGSC099.deleteByMatId(id, HGConstant.FileBizType.XMRY);
});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......
......@@ -4,6 +4,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.ds.domain.HGDS002;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ProjectInfo;
......@@ -97,7 +98,7 @@ public class ServiceHGSC099 extends ServiceEPBase {
hgsc099.fromMap(resultRows.get(i));
DaoUtils.update(HGSC099.DELETE, hgsc099);
if (!hgsc099.getDocId().isEmpty()) {
this.delectDoc(hgsc099.getDocId());
HGSCTools.THGSC099.delectDoc(hgsc099.getDocId());
}
}
inInfo = this.query(inInfo);
......@@ -109,43 +110,5 @@ public class ServiceHGSC099 extends ServiceEPBase {
return inInfo;
}
/**
* 删除文件
* @param docId 文件ID
*/
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HGDS002> list = this.dao.query(HGDS002.QUERY,map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HGSC099.FIELD_doc_id,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
this.dao.delete(HGDS002.DELETE,map);
}
}
}
......@@ -11,6 +11,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.ds.domain.HGDS002;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
......@@ -19,14 +20,14 @@ import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.tools.HGSJTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.hg.zl.tools.HGZLTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.DateUtil;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ProjectInfo;
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.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
......@@ -819,6 +820,70 @@ public class HGSCTools {
}
}
}
public static class THGSC099{
public static List<HGSC099> listByMatId(Long matId, String bizType) {
Map queryMap = new HashMap();
queryMap.put(HGSC099.FIELD_mat_id, matId);
queryMap.put(HGSC099.FIELD_biz_type, bizType);
return DaoBase.getInstance().query(HGSC099.QUERY, queryMap);
}
public static void deleteByMatId(Long matId, String bizType){
List<HGSC099> hgsc099List = listByMatId(matId,bizType);
for (int i = 0; i < hgsc099List.size(); i++) {
HGSC099 hgsc099 = hgsc099List.get(i);
DaoUtils.update(HGSC099.DELETE, hgsc099);
if (!hgsc099.getDocId().isEmpty()) {
delectDoc(hgsc099.getDocId());
}
}
}
/**
* 删除文件
* @param docId 文件ID
*/
public static void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HGDS002> list = DaoBase.getInstance().query(HGDS002.QUERY,map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HGSC099.FIELD_doc_id,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
DaoBase.getInstance().delete(HGDS002.DELETE,map);
}
}
}
}
......@@ -52,8 +52,8 @@ public class HGZL002 extends DaoEPBase {
public static final String FIELD_work_by = "workBy"; /* 生产人*/
public static final String FIELD_work_name = "workName"; /* 生产人名称*/
public static final String FIELD_quantity = "quantity"; /* 数量*/
public static final String FIELD_passQuantity = "passquantity"; /* 合格数量*/
public static final String FIELD_unpassQuantity = "unpassquantity"; /* 不合格数量*/
public static final String FIELD_pass_quantity = "passQuantity"; /* 合格数量*/
public static final String FIELD_unpass_quantity = "unpassQuantity"; /* 不合格数量*/
public static final String FIELD_single_weight = "singleWeight"; /* 单重*/
public static final String FIELD_total_weight = "totalWeight"; /* 总重*/
public static final String FIELD_check_by = "checkBy"; /* 质检人*/
......@@ -97,8 +97,8 @@ public class HGZL002 extends DaoEPBase {
public static final String COL_work_by = "work_by"; /* 生产人*/
public static final String COL_work_name = "work_name"; /* 生产人名称*/
public static final String COL_quantity = "quantity"; /* 数量*/
public static final String COL_passQuantity = "passQuantity"; /* 合格数量*/
public static final String COL_unpassQuantity = "unpassQuantity"; /* 不合格数量*/
public static final String COL_pass_quantity = "pass_quantity"; /* 合格数量*/
public static final String COL_unpass_quantity = "unpass_quantity"; /* 不合格数量*/
public static final String COL_single_weight = "single_weight"; /* 单重*/
public static final String COL_total_weight = "total_weight"; /* 总重*/
public static final String COL_check_by = "check_by"; /* 质检人*/
......@@ -150,8 +150,8 @@ public class HGZL002 extends DaoEPBase {
private String workBy = " "; /* 生产人*/
private String workName = " "; /* 生产人名称*/
private Integer quantity = new Integer(0); /* 数量*/
private Integer passquantity = new Integer(0); /* 合格数量*/
private Integer unpassquantity = new Integer(0); /* 不合格数量*/
private Integer passQuantity = new Integer(0); /* 合格数量*/
private Integer unpassQuantity = new Integer(0); /* 不合格数量*/
private BigDecimal singleWeight = new BigDecimal("0"); /* 单重*/
private BigDecimal totalWeight = new BigDecimal("0"); /* 总重*/
private String checkBy = " "; /* 质检人*/
......@@ -289,11 +289,11 @@ public class HGZL002 extends DaoEPBase {
eiColumn.setDescName("数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_passQuantity);
eiColumn = new EiColumn(FIELD_pass_quantity);
eiColumn.setDescName("合格数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_unpassQuantity);
eiColumn = new EiColumn(FIELD_unpass_quantity);
eiColumn.setDescName("不合格数量");
eiMetadata.addMeta(eiColumn);
......@@ -830,36 +830,36 @@ public class HGZL002 extends DaoEPBase {
this.quantity = quantity;
}
/**
* get the passquantity - 合格数量.
* @return the passquantity
* get the passQuantity - 合格数量.
* @return the passQuantity
*/
public Integer getPassquantity() {
return this.passquantity;
public Integer getPassQuantity() {
return this.passQuantity;
}
/**
* set the passquantity - 合格数量.
* set the passQuantity - 合格数量.
*
* @param passquantity - 合格数量
* @param passQuantity - 合格数量
*/
public void setPassquantity(Integer passquantity) {
this.passquantity = passquantity;
public void setPassQuantity(Integer passQuantity) {
this.passQuantity = passQuantity;
}
/**
* get the unpassquantity - 不合格数量.
* @return the unpassquantity
* get the unpassQuantity - 不合格数量.
* @return the unpassQuantity
*/
public Integer getUnpassquantity() {
return this.unpassquantity;
public Integer getUnpassQuantity() {
return this.unpassQuantity;
}
/**
* set the unpassquantity - 不合格数量.
* set the unpassQuantity - 不合格数量.
*
* @param unpassquantity - 不合格数量
* @param unpassQuantity - 不合格数量
*/
public void setUnpassquantity(Integer unpassquantity) {
this.unpassquantity = unpassquantity;
public void setUnpassQuantity(Integer unpassQuantity) {
this.unpassQuantity = unpassQuantity;
}
/**
* get the singleWeight - 单重.
......@@ -1106,8 +1106,8 @@ public class HGZL002 extends DaoEPBase {
setWorkBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_by)), workBy));
setWorkName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_work_name)), workName));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity));
setPassquantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_passQuantity)), passquantity));
setUnpassquantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unpassQuantity)), unpassquantity));
setPassQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_pass_quantity)), passQuantity));
setUnpassQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_unpass_quantity)), unpassQuantity));
setSingleWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_single_weight)), singleWeight));
setTotalWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_total_weight)), totalWeight));
setCheckBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_check_by)), checkBy));
......@@ -1159,8 +1159,8 @@ public class HGZL002 extends DaoEPBase {
map.put(FIELD_work_by, StringUtils.toString(workBy, eiMetadata.getMeta(FIELD_work_by)));
map.put(FIELD_work_name, StringUtils.toString(workName, eiMetadata.getMeta(FIELD_work_name)));
map.put(FIELD_quantity, StringUtils.toString(quantity, eiMetadata.getMeta(FIELD_quantity)));
map.put(FIELD_passQuantity, StringUtils.toString(passquantity, eiMetadata.getMeta(FIELD_passQuantity)));
map.put(FIELD_unpassQuantity, StringUtils.toString(unpassquantity, eiMetadata.getMeta(FIELD_unpassQuantity)));
map.put(FIELD_pass_quantity, StringUtils.toString(passQuantity, eiMetadata.getMeta(FIELD_pass_quantity)));
map.put(FIELD_unpass_quantity, StringUtils.toString(unpassQuantity, eiMetadata.getMeta(FIELD_unpass_quantity)));
map.put(FIELD_single_weight, StringUtils.toString(singleWeight, eiMetadata.getMeta(FIELD_single_weight)));
map.put(FIELD_total_weight, StringUtils.toString(totalWeight, eiMetadata.getMeta(FIELD_total_weight)));
map.put(FIELD_check_by, StringUtils.toString(checkBy, eiMetadata.getMeta(FIELD_check_by)));
......
package com.baosight.hggp.hg.zl.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.tools.HGZLTools;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.List;
/**
* @author wwl
* @date 2025年05月29日 17:18
*/
public class ServiceHGZL002 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "工序质检单", operType = "查询", operDesc = "初始化查询")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002());
EiInfoUtils.addBlock(inInfo,"userBlockId", UserSessionUtils.getUser(), User.class);
} catch (Exception 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, HGZL002.QUERY, new HGZL002());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "工序质检单", operType = "保存", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<HGZL002> hgzl002List = MapUtils.toDaoEPBase(inInfo,HGZL002.class);
hgzl002List.forEach( o -> {
o.setCheckStatus(CheckStatusEnum.CHECKED.getCode());
DaoUtils.update(HGZL002.UPDATE,o);
HGZLTools.THGZL004.addByHGZL002(o);
});
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgzl002List.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.zl.tools;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.CheckTypeEnum;
import com.baosight.hggp.common.HandleStatusEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.domain.HGZL001;
import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
......@@ -84,9 +89,9 @@ public class HGZLTools {
public static class THGZL002 {
public static HGZL002 add(HGSC008 hgsc008){
public static HGZL002 add(HGSC008 hgsc008) {
HGZL002 hgzl002 = new HGZL002();
BeanUtils.copyProperties(hgsc008,hgzl002);
BeanUtils.copyProperties(hgsc008, hgzl002);
cleanBaseInfo(hgzl002);
hgzl002.setCheckStatus(CheckStatusEnum.CHECKING.getCode());
hgzl002.setWorkId(hgsc008.getId());
......@@ -94,11 +99,11 @@ public class HGZLTools {
hgzl002.setWorkBy(hgsc008.getCreatedBy());
hgzl002.setWorkName(hgsc008.getCreatedName());
hgzl002.setCheckCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGZL002_CHECK_CODE));
DaoUtils.insert(HGZL002.INSERT,hgzl002);
DaoUtils.insert(HGZL002.INSERT, hgzl002);
return hgzl002;
}
private static void cleanBaseInfo(HGZL002 hgzl002){
private static void cleanBaseInfo(HGZL002 hgzl002) {
hgzl002.setCreatedBy(null);
hgzl002.setCreatedName(null);
hgzl002.setCreatedTime(null);
......@@ -109,6 +114,7 @@ public class HGZLTools {
hgzl002.setDepName(null);
hgzl002.setId(null);
}
public static List<HGZL002> list(List<Long> workIds) {
if (CollectionUtils.isEmpty(workIds)) {
return null;
......@@ -119,7 +125,55 @@ public class HGZLTools {
}
public static void deleteByWorkIds(List<Long> workIds) {
DaoUtils.update(HGZL002.DELETE_BY_WORKS, new HashMap<String,Object>(){{put("workIds",workIds);}});
DaoUtils.update(HGZL002.DELETE_BY_WORKS, new HashMap<String, Object>() {{
put("workIds", workIds);
}});
}
}
public static class THGZL004 {
public static void addByHGZL002(HGZL002 hgzl002) {
List<HGZL004> hgzl004DbList = listByCheckId(hgzl002.getId(),CheckTypeEnum.PROCESS_CHECK.getCode());
if(hgzl002.getUnpassQuantity()>0&&CollectionUtils.isEmpty(hgzl004DbList)) {
HGZL004 hgzl004 = new HGZL004();
BeanUtils.copyProperties(hgzl002, hgzl004);
cleanBaseInfo(hgzl004);
hgzl004.setCheckId(hgzl002.getId());
hgzl004.setCheckType(CheckTypeEnum.PROCESS_CHECK.getCode());
hgzl004.setHandleStatus(HandleStatusEnum.UNPROCESS.getCode());
hgzl004.setCheckCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.HGZL002_CHECK_CODE));
DaoUtils.insert(HGZL004.INSERT, hgzl004);
}
//修改质检单问题数量为0的情况下,删除通知单,并删除相应附件照片
// if(hgzl002.getUnpassQuantity()==0&&CollectionUtils.isNotEmpty(hgzl004DbList)){
// List<Long> ids = hgzl004DbList.stream().map(HGZL004::getId).collect(Collectors.toList());
// DaoUtils.update(HGZL004.DELETE_BY_IDS,new HashMap<String,Object>(){{put("ids",ids);}});
// ids.forEach( id -> {
// HGSCTools.THGSC099.deleteByMatId(id,HGConstant.FileBizType.CHECK_DEFECT);
// HGSCTools.THGSC099.deleteByMatId(id,HGConstant.FileBizType.CHECK_HANDLE);
// });
// }
}
private static void cleanBaseInfo(HGZL004 hgzl004) {
hgzl004.setCreatedBy(null);
hgzl004.setCreatedName(null);
hgzl004.setCreatedTime(null);
hgzl004.setUpdatedBy(null);
hgzl004.setUpdatedName(null);
hgzl004.setUpdatedTime(null);
hgzl004.setDepCode(null);
hgzl004.setDepName(null);
hgzl004.setId(null);
}
public static List<HGZL004> listByCheckId(Long checkId, Integer checkType) {
Map queryMap = new HashMap();
queryMap.put(HGZL004.FIELD_check_id, checkId);
queryMap.put(HGZL004.FIELD_check_type, checkType);
return DaoBase.getInstance().query(HGZL004.QUERY, queryMap);
}
}
}
\ No newline at end of file
$(function () {
var loginUser = __eiInfo.getBlock("userBlockId").getMappedRows();
IPLATUI.EFGrid = {
"result": {
pageable: {
input: true,
numeric: false,
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "unpassQuantity",
template: function (item) {
let template = "";
if (item.unpassQuantity&&isNumber(item.unpassQuantity)) {
item['passQuantity'] = item['quantity'] - item.unpassQuantity;
}
return item.unpassQuantity;
}
},{
field: "passQuantity",
template: function (item) {
let template = "";
if (item.passQuantity&&isNumber(item.passQuantity)) {
item['unpassQuantity'] = item['quantity'] - item.passQuantity;
}
return item.passQuantity;
}
}],
onSuccess: function (e) {
},
loadComplete: function(grid) {
// 此 grid 对象
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field == "unpassQuantity") {
loadChange(grid,e,"passQuantity");
}
// 判断父级节点是否发生变化
if (e.field == "passQuantity") {
loadChange(grid,e,"unpassQuantity");
}
});
},
onCheckRow: function (e){
if(e.checked){
if(e.model.checkStatus === '0') {
var now = new Date()
resultGrid.setCellValue(e.row, "checkDate", now.getFullYear() + "-" + now.getMonth() + "-" + now.getDay());
}
resultGrid.setCellValue(e.row, "checkBy", loginUser[0].userId);
resultGrid.setCellValue(e.row, "checkName", loginUser[0].userName);
}
// else{
// if(e.model.checkStatus === '0'){
// resultGrid.setCellValue(e.row,"checkDate","");
// }
//
// }
},
onSave: function(e){
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 提交操作
*
* @param id
* @param checkNo
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let passQuantity = rows[i]['passQuantity'];
let unpassQuantity = rows[i]['unpassQuantity'];
let quantity = rows[i]['quantity'];
if (!isNumber(passQuantity)||!isNumber(unpassQuantity)) {
message("第" + (i + 1) + "行合格数量与不合格数量必须是大于等于0的数字!");
return;
}
if (passQuantity > quantity) {
message("第" + (i + 1) + "行合格数量不能大于报工数量!");
return;
}
if (unpassQuantity > quantity) {
message("第" + (i + 1) + "行不合格数量不能大于报工数量!");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做质检完成操作吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGZL002", "save", 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:EFDateSpan startCname="质检日期" endCname="到" blockId="inqu_status"
startName="checkDateFrom" endName="checkDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="true">
</EF:EFDateSpan>
<EF:EFInput blockId="inqu_status" row="0" ename="checkCode" cname="质检单号" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="checkName" cname="质检员" placeholder="模糊查询" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFSelect cname="质检状态" ename="checkStatus" blockId="inqu_status" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.checkStatus" />
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="checkBy" cname="质检员" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="workCode" cname="生产报工单号" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="checkCode" cname="质检单号" width="130" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="processName" cname="工序" width="100" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="workName" cname="生产人员" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productCode" cname="存货编码" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="productName" cname="存货名称" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="quantity" cname="报工数量" width="90" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="passQuantity" cname="合格数量" width="90" align="center" required="true"/>
<EF:EFColumn ename="unpassQuantity" cname="不合格数量" width="100" align="center" required="true"/>
<EF:EFColumn ename="checkDate" cname="质检日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true"/>
<EF:EFColumn ename="checkName" cname="质检员" width="100" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="checkStatus" cname="质检状态" width="80" align="center" enable="false"
readonly="true">
<EF:EFCodeOption codeName="hggp.checkStatus"/>
</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