Commit a8a4c433 by wuwenlong

通过生产任务ID查询工序质检单

parent 8ef74d24
...@@ -877,7 +877,7 @@ public class HGSCTools { ...@@ -877,7 +877,7 @@ public class HGSCTools {
} }
private static void checkDeleteDate(List<Long> ids){ private static void checkDeleteDate(List<Long> ids){
List<HGZL002> hgzl002s = HGZLTools.THGZL002.list(ids); List<HGZL002> hgzl002s = HGZLTools.THGZL002.listByWorkIds(ids);
List<String> workCodes = hgzl002s.stream().filter(o -> o.getCheckStatus().compareTo(CheckStatusEnum.CHECKED.getCode())==0).map(HGZL002::getWorkCode).collect(Collectors.toList()); List<String> workCodes = hgzl002s.stream().filter(o -> o.getCheckStatus().compareTo(CheckStatusEnum.CHECKED.getCode())==0).map(HGZL002::getWorkCode).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(workCodes)){ if(CollectionUtils.isNotEmpty(workCodes)){
AssertUtils.isNotEmpty(workCodes,String.format("生产报工单[%s]已经质检完成,无法删除!",String.join(",",workCodes))); AssertUtils.isNotEmpty(workCodes,String.format("生产报工单[%s]已经质检完成,无法删除!",String.join(",",workCodes)));
......
...@@ -5,6 +5,9 @@ import com.baosight.hggp.common.CheckStatusEnum; ...@@ -5,6 +5,9 @@ import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.tools.HGKCTools; import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.zl.domain.HGZL002; import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.tools.HGZLTools; import com.baosight.hggp.hg.zl.tools.HGZLTools;
...@@ -12,8 +15,10 @@ import com.baosight.hggp.util.*; ...@@ -12,8 +15,10 @@ import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
...@@ -32,6 +37,7 @@ public class ServiceHGZL002 extends ServiceBase { ...@@ -32,6 +37,7 @@ public class ServiceHGZL002 extends ServiceBase {
@OperationLogAnnotation(operModul = "工序质检单", operType = "查询", operDesc = "初始化查询") @OperationLogAnnotation(operModul = "工序质检单", operType = "查询", operDesc = "初始化查询")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
handleQueryParam(inInfo);
inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002()); inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002());
EiInfoUtils.addBlock(inInfo,"userBlockId", UserSessionUtils.getUser(), User.class); EiInfoUtils.addBlock(inInfo,"userBlockId", UserSessionUtils.getUser(), User.class);
} catch (Exception e) { } catch (Exception e) {
...@@ -40,6 +46,17 @@ public class ServiceHGZL002 extends ServiceBase { ...@@ -40,6 +46,17 @@ public class ServiceHGZL002 extends ServiceBase {
return inInfo; return inInfo;
} }
private void handleQueryParam(EiInfo inInfo){
Long taskId = MapUtils.getLong(EiInfoUtils.getFirstRow(inInfo),HGSC008.FIELD_task_id);
if(Objects.nonNull(taskId)&&taskId>0){
List<HGSC008> hgsc008s = HGSCTools.THGSC008.getByTaskId(taskId);
List<Long> workIds = Optional.ofNullable(hgsc008s).orElse(new ArrayList<>()).stream().map(HGSC008::getId).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(workIds)){
EiInfoUtils.setFirstRow(inInfo,"workIds",workIds);
}
}
}
/** /**
* 查询操作 * 查询操作
* *
...@@ -50,6 +67,7 @@ public class ServiceHGZL002 extends ServiceBase { ...@@ -50,6 +67,7 @@ public class ServiceHGZL002 extends ServiceBase {
@OperationLogAnnotation(operModul = "工序质检单", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "工序质检单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
handleQueryParam(inInfo);
inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002()); inInfo = super.query(inInfo, HGZL002.QUERY, new HGZL002());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -125,7 +125,7 @@ public class HGZLTools { ...@@ -125,7 +125,7 @@ public class HGZLTools {
hgzl002.setId(null); hgzl002.setId(null);
} }
public static List<HGZL002> list(List<Long> workIds) { public static List<HGZL002> listByWorkIds(List<Long> workIds) {
if (CollectionUtils.isEmpty(workIds)) { if (CollectionUtils.isEmpty(workIds)) {
return null; return null;
} }
...@@ -135,7 +135,7 @@ public class HGZLTools { ...@@ -135,7 +135,7 @@ public class HGZLTools {
} }
public static void deleteByWorkIds(List<Long> workIds) { public static void deleteByWorkIds(List<Long> workIds) {
List<HGZL002> hgzl002s = list(workIds); List<HGZL002> hgzl002s = listByWorkIds(workIds);
THGZL004.deleteByCheckIds(hgzl002s.stream().map(HGZL002::getId).collect(Collectors.toList()), CheckTypeEnum.PROCESS_CHECK); THGZL004.deleteByCheckIds(hgzl002s.stream().map(HGZL002::getId).collect(Collectors.toList()), CheckTypeEnum.PROCESS_CHECK);
DaoUtils.update(HGZL002.DELETE_BY_WORKS, new HashMap<String, Object>() {{ DaoUtils.update(HGZL002.DELETE_BY_WORKS, new HashMap<String, Object>() {{
put("workIds", workIds); put("workIds", workIds);
......
...@@ -92,6 +92,17 @@ public class EiInfoUtils { ...@@ -92,6 +92,17 @@ public class EiInfoUtils {
public static void setFirstRow(EiInfo eiInfo, String key, String value) { public static void setFirstRow(EiInfo eiInfo, String key, String value) {
setFirstRow(eiInfo, EiConstant.queryBlock, key, value); setFirstRow(eiInfo, EiConstant.queryBlock, key, value);
} }
/**
* inqu_status 填充值
*
* @param eiInfo
* @param key
* @param value
*/
public static void setFirstRow(EiInfo eiInfo, String key, Object value) {
setFirstRow(eiInfo, EiConstant.queryBlock, key, value);
}
/** /**
* inqu_status 填充值 * inqu_status 填充值
...@@ -109,6 +120,23 @@ public class EiInfoUtils { ...@@ -109,6 +120,23 @@ public class EiInfoUtils {
} }
rowMap.put(key, value); rowMap.put(key, value);
} }
/**
* inqu_status 填充值
*
* @param eiInfo
* @param blockId
* @param key
* @param value
*/
public static void setFirstRow(EiInfo eiInfo, String blockId, String key, Object value) {
Map rowMap = eiInfo.getRow(blockId, 0);
if (rowMap == null) {
rowMap = new HashMap();
eiInfo.addRow(blockId, rowMap);
}
rowMap.put(key, value);
}
/** /**
* eiinfo中新增block * eiinfo中新增block
......
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