Commit 3f6be941 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents cd84a3e2 46b6a0c5
...@@ -36,6 +36,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -36,6 +36,7 @@ public class HGCG001A extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/ public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PLAN_DATE = "planDate"; /* 计划日期*/ public static final String FIELD_PLAN_DATE = "planDate"; /* 计划日期*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/ public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
public static final String FIELD_PLAN_LINE_NO = "planLineNo"; /* 计划单行号*/
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/ public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/ public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/ public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
...@@ -122,6 +123,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -122,6 +123,7 @@ public class HGCG001A extends DaoEPBase {
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String planDate = " "; /* 计划日期*/ private String planDate = " "; /* 计划日期*/
private String planNo = " "; /* 计划单号*/ private String planNo = " "; /* 计划单号*/
private String planLineNo = " "; /* 计划单行号*/
private String inventType = " "; /* 存货类型*/ private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
...@@ -217,6 +219,10 @@ public class HGCG001A extends DaoEPBase { ...@@ -217,6 +219,10 @@ public class HGCG001A extends DaoEPBase {
eiColumn.setDescName("计划单号"); eiColumn.setDescName("计划单号");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_LINE_NO);
eiColumn.setDescName("计划单行号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE); eiColumn = new EiColumn(FIELD_INVENT_TYPE);
eiColumn.setDescName("存货类型"); eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -984,6 +990,14 @@ public class HGCG001A extends DaoEPBase { ...@@ -984,6 +990,14 @@ public class HGCG001A extends DaoEPBase {
this.calculationMethod = calculationMethod; this.calculationMethod = calculationMethod;
} }
public String getPlanLineNo() {
return planLineNo;
}
public void setPlanLineNo(String planLineNo) {
this.planLineNo = planLineNo;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1006,6 +1020,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1006,6 +1020,7 @@ public class HGCG001A extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setPlanDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_DATE)), planDate)); setPlanDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_DATE)), planDate));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo)); setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
setPlanLineNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_LINE_NO)), planLineNo));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
...@@ -1059,6 +1074,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1059,6 +1074,7 @@ public class HGCG001A extends DaoEPBase {
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME))); map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PLAN_DATE, StringUtils.toString(planDate, eiMetadata.getMeta(FIELD_PLAN_DATE))); map.put(FIELD_PLAN_DATE, StringUtils.toString(planDate, eiMetadata.getMeta(FIELD_PLAN_DATE)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO))); map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
map.put(FIELD_PLAN_LINE_NO, StringUtils.toString(planLineNo, eiMetadata.getMeta(FIELD_PLAN_LINE_NO)));
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE))); map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE))); map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME))); map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
......
...@@ -22,6 +22,7 @@ import com.baosight.hggp.util.contants.ACConstants; ...@@ -22,6 +22,7 @@ import com.baosight.hggp.util.contants.ACConstants;
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 com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -127,19 +128,27 @@ public class ServiceHGCG001A extends ServiceBase { ...@@ -127,19 +128,27 @@ public class ServiceHGCG001A extends ServiceBase {
* *
* @param fCg001s * @param fCg001s
*/ */
private void saveData(List<HGCG001A> fCg001s,HGCG001 cg001) { private void saveData(List<HGCG001A> fCg001s, HGCG001 dbCg001) {
for (HGCG001A fCg001a : fCg001s) { for (HGCG001A fCg001a : fCg001s) {
fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP)); fCg001a.setPurUnitWeight(fCg001a.getPurWeight().divide(fCg001a.getPurQty(), 3, RoundingMode.HALF_UP));
if(fCg001a.getId() == null || fCg001a.getId() == 0){ if (fCg001a.getId() == null || fCg001a.getId() == 0) {
BeanUtils.copyProperties(cg001,fCg001a,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime", fCg001a.setPlanDate(dbCg001.getPlanDate());
"inventType","inventTypeDetail","inventCode","inventName","spec","material","unit","length","width","thick","purQty","purUnitWeight","purWeight"); fCg001a.setPlanNo(dbCg001.getPlanNo());
fCg001a.setPlanLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_LINE_NO,
new String[]{dbCg001.getPlanNo()}));
fCg001a.setCompanyCode(dbCg001.getCompanyCode());
fCg001a.setCompanyName(dbCg001.getCompanyName());
fCg001a.setProjCode(dbCg001.getProjCode());
fCg001a.setProjName(dbCg001.getProjName());
fCg001a.setStatus(HGConstant.CgPlanStatus.S_0);
fCg001a.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGCG001A.INSERT, fCg001a); DaoUtils.insert(HGCG001A.INSERT, fCg001a);
}else{ } else {
DaoUtils.update(HGCG001A.UPDATE, fCg001a); DaoUtils.update(HGCG001A.UPDATE, fCg001a);
} }
} }
//修改主表数量 //修改主表数量
updateCg001Pur(cg001); updateCg001Pur(dbCg001);
} }
private void updateCg001Pur(HGCG001 cg001) { private void updateCg001Pur(HGCG001 cg001) {
......
...@@ -99,6 +99,8 @@ public class HGConstant { ...@@ -99,6 +99,8 @@ public class HGConstant {
public static final String APPLY_CODE = "APPLY_CODE"; public static final String APPLY_CODE = "APPLY_CODE";
// 采购计划号 // 采购计划号
public static final String CG_PLAN_NO = "CG_PLAN_NO"; public static final String CG_PLAN_NO = "CG_PLAN_NO";
// 采购计划行号
public static final String CG_PLAN_LINE_NO = "CG_PLAN_LINE_NO";
// 采购合同号 // 采购合同号
public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO"; public static final String CG_CONTRACT_NO = "CG_CONTRACT_NO";
// 采购合同行号 // 采购合同行号
......
...@@ -58,4 +58,21 @@ public class HgScSqlConstant { ...@@ -58,4 +58,21 @@ public class HgScSqlConstant {
//app 查询生产任务数量 //app 查询生产任务数量
public static final String COUNT_APP = "HGSC007.countApp"; public static final String COUNT_APP = "HGSC007.countApp";
} }
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:43
*/
public static class HgSc007B {
// 去重查询
public static final String QUERY_DISTINCT = "HGSC007B.queryDistinct";
// 批量新增
public static final String BATCH_INSERT = "HGSC007B.batchInsert";
// 根据订单清除
public static final String DELETE_BY_ORDER = "HGSC007B.deleteByOrder";
}
} }
...@@ -7,8 +7,12 @@ import com.baosight.hggp.core.dao.DaoBase; ...@@ -7,8 +7,12 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
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.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils; import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -115,6 +119,8 @@ public class ServiceHGSC006A extends ServiceBase { ...@@ -115,6 +119,8 @@ public class ServiceHGSC006A extends ServiceBase {
hgsc007.setFactoryCode(factoryCode); hgsc007.setFactoryCode(factoryCode);
hgsc007.setFactoryName(factoryName); hgsc007.setFactoryName(factoryName);
DaoUtils.insert(HGSC007.INSERT, hgsc007); DaoUtils.insert(HGSC007.INSERT, hgsc007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(hgsc007);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!"); inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!");
......
...@@ -4,17 +4,26 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,17 +4,26 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.AssignStatusEnum; import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.ProductTypeEnum; import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
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.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -24,11 +33,15 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -24,11 +33,15 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.baosight.hggp.common.AssignStatusEnum.*;
/** /**
* 拆单派工 * 拆单派工
* *
...@@ -217,6 +230,8 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -217,6 +230,8 @@ public class ServiceHGSC006B extends ServiceBase {
add007.setLength(hgpz005.getLength()); add007.setLength(hgpz005.getLength());
} }
DaoUtils.insert(HGSC007.INSERT, add007); DaoUtils.insert(HGSC007.INSERT, add007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(add007);
} }
private void cleanBaseInfo(HGSC007 hgsc007){ private void cleanBaseInfo(HGSC007 hgsc007){
...@@ -260,9 +275,10 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -260,9 +275,10 @@ public class ServiceHGSC006B extends ServiceBase {
sc007.setUnfinishWeight(sc007.getTotalWeight()); sc007.setUnfinishWeight(sc007.getTotalWeight());
DaoUtils.update(HGSC007.UPDATE, sc007); DaoUtils.update(HGSC007.UPDATE, sc007);
// 更新派工人员
HgScUtils.HgSc007B.modifyGroupUser(hgsc007);
} }
/** /**
* 删除操作. * 删除操作.
* *
...@@ -286,6 +302,8 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -286,6 +302,8 @@ public class ServiceHGSC006B extends ServiceBase {
HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity()); HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity());
// 删除子单 // 删除子单
DaoUtils.update(HGSC007.DELETE, hgsc007); DaoUtils.update(HGSC007.DELETE, hgsc007);
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, hgsc007);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
// 刷新主订单信息 // 刷新主订单信息
...@@ -333,11 +351,11 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -333,11 +351,11 @@ public class ServiceHGSC006B extends ServiceBase {
// 0.未派工,1.部分派工,2.全部派工 // 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum orderDetailAssignStatus ; AssignStatusEnum orderDetailAssignStatus ;
if (jhNum - totalNum==0) { if (jhNum - totalNum==0) {
orderDetailAssignStatus = ASSIGNED; orderDetailAssignStatus = AssignStatusEnum.ASSIGNED;
} else if (totalNum>0) { } else if (totalNum>0) {
orderDetailAssignStatus = PARTIAL_ASSIGN; orderDetailAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} else { } else {
orderDetailAssignStatus = UNASSIGN; orderDetailAssignStatus = AssignStatusEnum.UNASSIGN;
} }
updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode()); updateMap.put(HGSC006A.FIELD_assign_status, orderDetailAssignStatus.getCode());
DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap); DaoUtils.update(HGSC006A.UPDATE_ASSIGN_NUM, updateMap);
...@@ -358,19 +376,19 @@ public class ServiceHGSC006B extends ServiceBase { ...@@ -358,19 +376,19 @@ public class ServiceHGSC006B extends ServiceBase {
switch (orderDetailAssignStatus){ switch (orderDetailAssignStatus){
case UNASSIGN: case UNASSIGN:
if(unassignQuantity == totalQuantity){ if(unassignQuantity == totalQuantity){
orderAssignStatus = UNASSIGN; orderAssignStatus = AssignStatusEnum.UNASSIGN;
}else{ }else{
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} }
break; break;
case PARTIAL_ASSIGN: case PARTIAL_ASSIGN:
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
break; break;
case ASSIGNED: case ASSIGNED:
if(assignQuantity == totalQuantity){ if(assignQuantity == totalQuantity){
orderAssignStatus = ASSIGNED; orderAssignStatus = AssignStatusEnum.ASSIGNED;
}else{ }else{
orderAssignStatus = PARTIAL_ASSIGN; orderAssignStatus = AssignStatusEnum.PARTIAL_ASSIGN;
} }
break; break;
default: default:
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* 派工人员信息
*
* @author:songx
* @date:2024/9/14,14:30
*/
public class ServiceHGSC007B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007B().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 去重查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo queryDistinct(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
...@@ -268,6 +268,8 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -268,6 +268,8 @@ public class ServiceHGSC009A extends ServiceBase {
cg001A.setPlanWeight(hgsc009A.getGrossAmount()); cg001A.setPlanWeight(hgsc009A.getGrossAmount());
cg001A.setPlanQty(hgsc009A.getQuantity()); cg001A.setPlanQty(hgsc009A.getQuantity());
cg001A.setPlanNo(hgcg001.getPlanNo()); cg001A.setPlanNo(hgcg001.getPlanNo());
cg001A.setPlanLineNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_LINE_NO,
new String[]{hgcg001.getPlanNo()}));
cg001A.setUnit(finalPz005Map.get(hgsc009A.getInventCode()).getUnit()); cg001A.setUnit(finalPz005Map.get(hgsc009A.getInventCode()).getUnit());
cg001A.setInventType(finalPz005Map.get(hgsc009A.getInventCode()).getInventType()); cg001A.setInventType(finalPz005Map.get(hgsc009A.getInventCode()).getInventType());
DaoUtils.insert(HGCG001A.INSERT, cg001A); DaoUtils.insert(HGCG001A.INSERT, cg001A);
......
<?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="HGSC007B">
<sql id="column">
id as "id",
account_code as "accountCode", <!-- 帐套 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
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=已删除 -->
order_id as "orderId", <!-- 生产订单ID -->
order_detail_id as "orderDetailId", <!-- 生产订单明细ID -->
task_code as "taskCode", <!-- 任务编码 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name like concat('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name like concat('%', #groupName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
user_id = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name like concat('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<!-- 去重查询 -->
<select id="queryDistinct" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT DISTINCT
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
ORDER BY FACTORY_CODE DESC, GROUP_CODE DESC, USER_ID DESC
</select>
<select id="countDistinct" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, <!-- 帐套 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
delete_flag, <!-- 0=未删除,1=已删除 -->
order_id, <!-- 生产订单ID -->
order_detail_id, <!-- 生产订单明细ID -->
task_code, <!-- 任务编码 -->
factory_code, <!-- 工厂编号 -->
factory_name, <!-- 工厂名称 -->
group_code, <!-- 工作组编号 -->
group_name, <!-- 工作组名称 -->
user_id, <!-- 用户ID -->
user_name <!-- 用户姓名 -->
) VALUES (
#accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #orderId#, #orderDetailId#, #taskCode#, #factoryCode#,
#factoryName#, #groupCode#, #groupName#, #userId#, #userName#)
</insert>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, dep_code, dep_name, created_by, created_name,
created_time, delete_flag, order_id, order_detail_id, task_code,
factory_code, factory_name, group_code, group_name, user_id, user_name
) VALUES
<iterate open="(" conjunction="),(" close=")" property="rows">
#rows[].accountCode#, #rows[].depCode#, #rows[].depName#, #rows[].createdBy#,
#rows[].createdName#, #rows[].createdTime#, #rows[].deleteFlag#, #rows[].orderId#,
#rows[].orderDetailId#, #rows[].taskCode#, #rows[].factoryCode#,
#rows[].factoryName#, #rows[].groupCode#, #rows[].groupName#,
#rows[].userId#, #rows[].userName#
</iterate>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC007B WHERE id = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC007B
SET
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
order_id = #orderId#, <!-- 生产订单ID -->
order_detail_id = #orderDetailId#, <!-- 生产订单明细ID -->
task_code = #taskCode#, <!-- 任务编码 -->
factory_code = #factoryCode#, <!-- 工厂编号 -->
factory_name = #factoryName#, <!-- 工厂名称 -->
group_code = #groupCode#, <!-- 工作组编号 -->
group_name = #groupName#, <!-- 工作组名称 -->
user_id = #userId#, <!-- 用户ID -->
user_name = #userName# <!-- 用户姓名 -->
WHERE id = #id#
</update>
<!-- 根据订单清除 -->
<update id="deleteByOrder">
UPDATE FROM ${hggpSchema}.HGSC007B
SET DELETE_FLAG = 1
<include refid="SqlBase.updateRevise"/>
WHERE ORDER_DETAIL_ID = #orderDetailId#
</update>
</sqlMap>
...@@ -28,6 +28,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC005A; ...@@ -28,6 +28,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006; import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A; import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC008; import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009; import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A; import com.baosight.hggp.hg.sc.domain.HGSC009A;
...@@ -1580,6 +1581,29 @@ public class HGSCTools { ...@@ -1580,6 +1581,29 @@ public class HGSCTools {
} }
/** /**
* HGSC007B SQL 定义
*
* @author:songx
* @date:2024/9/14,14:34
*/
public static class HgSc007B {
/**
* 根据用户查询
*
* @param userId
* @return
*/
public static List<HGSC007B> listByUser(String userId) {
AssertUtils.isEmpty(userId, "用户ID不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGSC007B.FIELD_user_id, userId);
return DaoBase.getInstance().query(HGSC007B.QUERY, queryMap);
}
}
/**
* @author:songx * @author:songx
* @date:2024/9/10,9:27 * @date:2024/9/10,9:27
*/ */
......
package com.baosight.hggp.hg.sc.util; package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.xservices.xs.util.LoginUserDetails; import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -31,17 +38,84 @@ public class HgScUtils { ...@@ -31,17 +38,84 @@ public class HgScUtils {
* @param queryMap * @param queryMap
*/ */
public static void setOrgCondition(Map queryMap) { public static void setOrgCondition(Map queryMap) {
String userId = UserSessionUtils.getLoginName();
// 超级管理员看所有数据 // 超级管理员看所有数据
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) { if (LoginUserDetails.isUserAdmin(userId)) {
return; return;
} }
// 查询自己所在组的任务 added by songx at 20240820 // 查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName(); List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) { // 查询历史分配的组任务
queryMap.put("groupNames", allGroupNames); List<HGSC007B> dbSc007Bs = HGSCTools.HgSc007B.listByUser(userId);
if (CollectionUtils.isEmpty(allGroupNames) && CollectionUtils.isEmpty(dbSc007Bs)) {
return;
}
if (allGroupNames == null) {
allGroupNames = new ArrayList<>();
}
if (dbSc007Bs != null) {
List<String> historyGroupNames = dbSc007Bs.stream().map(HGSC007B::getGroupName)
.collect(Collectors.toList());
// 合并班组信息
allGroupNames.addAll(historyGroupNames);
}
queryMap.put("groupNames", allGroupNames.stream().distinct().collect(Collectors.toList()));
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0); queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
} }
} }
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:35
*/
public static class HgSc007B {
/**
* 新增组人员
*
* @param sc007
*/
public static void addGroupUser(HGSC007 sc007) {
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
}
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
/**
* 更新组人员
*
* @param sc007
*/
public static void modifyGroupUser(HGSC007 sc007) {
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, sc007);
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
}
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
} }
} }
...@@ -214,6 +214,19 @@ public class HGXSTools { ...@@ -214,6 +214,19 @@ public class HGXSTools {
/** /**
* 查询用户 * 查询用户
* *
* @param orgId
* @return
*/
public static List<User> queryByOrg(String orgId) {
AssertUtils.isEmpty(orgId, "组织ID不能为空");
Map paramMap = new HashMap();
paramMap.put("orgId", orgId);
return DaoBase.getInstance().query(HGSqlConstant.HgXsUser.QUERY_BY_ORG, paramMap);
}
/**
* 查询用户
*
* @param orgIds * @param orgIds
* @return * @return
*/ */
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007B.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/> <sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
......
...@@ -10,18 +10,18 @@ $(function () { ...@@ -10,18 +10,18 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [10, 20, 50, 70, 100],
}, },
columns: [ columns: [{
{
field: "operator", field: "operator",
template: function (item) { template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' + let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>'; + 'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>'; + 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showGroupUser(' + item.id + ')" >人员明细</a>';
return template; return template;
} }
} }],
],
loadComplete: function(grid) { loadComplete: function(grid) {
}, },
onSuccess: function (e) { onSuccess: function (e) {
...@@ -68,3 +68,16 @@ function showUploadFile(id) { ...@@ -68,3 +68,16 @@ function showUploadFile(id) {
}); });
} }
/**
* 显示班组人员明细
*
* @param orderCode
*/
function showGroupUser(id) {
JSColorbox.open({
href: "HGSC007B?inqu_status-0-orderId=" + id,
title: "<div style='text-align: center;'>班组人员明细</div>",
width: "85%",
height: "80%",
});
}
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" /> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="200" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/> <EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/> <EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: []
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 初始化
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
}
<!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="查询条件">
<EF:EFInput ename="orderId" cname="生产订单ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="orderDetailId" cname="生产订单明细ID" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="factoryName" cname="厂区名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="groupName" cname="班组名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="userName" cname="人员姓名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="数据集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="factoryName" cname="厂区名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupCode" cname="班组编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupName" cname="班组名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="人员ID" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="人员名称" enable="false" width="120" 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