Commit 8198a183 by liuyang

2024-06-12

parent 6b3c468b
...@@ -3,6 +3,7 @@ package com.baosight.hpjx.common; ...@@ -3,6 +3,7 @@ package com.baosight.hpjx.common;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC102;
/** /**
* @author:songx * @author:songx
...@@ -11,7 +12,8 @@ import com.baosight.hpjx.hp.sc.domain.HPSC006; ...@@ -11,7 +12,8 @@ import com.baosight.hpjx.hp.sc.domain.HPSC006;
public enum DocRouteEnum { public enum DocRouteEnum {
HPSC002("route_001", "HPSC002", "importData", HPSC002.class), HPSC002("route_001", "HPSC002", "importData", HPSC002.class),
HPSC006("route_002", "HPSC006", "importData",HPSC006 .class); HPSC006("route_002", "HPSC006", "importData", HPSC006 .class),
HPSC102("route_003", "HPSC102", "importData", HPSC102.class),;
private String id; private String id;
private String serviceNme; private String serviceNme;
private String methodName; private String methodName;
......
...@@ -72,6 +72,8 @@ public class HPConstant { ...@@ -72,6 +72,8 @@ public class HPConstant {
public static final String PRO_PLAN_NO = "PRO_PLAN_NO"; public static final String PRO_PLAN_NO = "PRO_PLAN_NO";
//采购订单单号 //采购订单单号
public static final String PRO_ORDER_NO = "PRO_ORDER_NO"; public static final String PRO_ORDER_NO = "PRO_ORDER_NO";
public static final String HGSC008_WORK_CODE = "WORK_CODE";
} }
/** /**
......
...@@ -352,6 +352,8 @@ public class HPSqlConstant { ...@@ -352,6 +352,8 @@ public class HPSqlConstant {
public static final String LOCK = "HPSC005.lock"; public static final String LOCK = "HPSC005.lock";
// 查询 // 查询
public static final String UPDATE_ASSIGN_NUM = "HPSC005.updateAssignNum"; public static final String UPDATE_ASSIGN_NUM = "HPSC005.updateAssignNum";
// 修改完成重量
public static final String UPDATE_ASSIGN_WT = "HPSC005.updateAssignWt";
public static final String DELETE_BY_MAT = "HPSC005.deleteByMat"; public static final String DELETE_BY_MAT = "HPSC005.deleteByMat";
......
...@@ -170,8 +170,8 @@ public class HPSC005 extends DaoEPBase { ...@@ -170,8 +170,8 @@ public class HPSC005 extends DaoEPBase {
private String updatedBy = " "; /* 更新人*/ private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/ private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private String filePath1 = " "; /* 文件地址1*/ private String filePath1 = " "; /* 物料清单ID*/
private String filePath2 = " "; /* 文件地址2*/ private String filePath2 = " "; /* 剩余重量*/
private String filePath3 = " "; /* 文件地址3*/ private String filePath3 = " "; /* 文件地址3*/
private String filePath4 = " "; /* 文件地址4*/ private String filePath4 = " "; /* 文件地址4*/
private String filePath5 = " "; /* 文件地址5*/ private String filePath5 = " "; /* 文件地址5*/
......
...@@ -165,8 +165,10 @@ ...@@ -165,8 +165,10 @@
) )
VALUES (#id#, #companyCode#, #projType#, #projCode#, #projName#, #planInfoNo#,#inventRecordId#, VALUES (#id#, #companyCode#, #projType#, #projCode#, #projName#, #planInfoNo#,#inventRecordId#,
#spec#, #length#, #width#, #thick#, #prdtType#, #prdtCode#, #prdtName#, #planCompletionDate#, #status#, #spec#, #length#, #width#, #thick#, #prdtType#, #prdtCode#, #prdtName#, #planCompletionDate#, #status#,
#createdBy#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#,#matId#, #deliveryDate#,#factoryCode#)
#createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#,#matId#, #deliveryDate#,#factoryCode#) <selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) FROM ${hpjxSchema}.T_HPSC003
</selectKey>
</insert> </insert>
<delete id="delete"> <delete id="delete">
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
A.PRDT_CODE as "prdtCode", <!-- 部件编码 --> A.PRDT_CODE as "prdtCode", <!-- 部件编码 -->
A.PRDT_NAME as "prdtName", <!-- 部件名称 --> A.PRDT_NAME as "prdtName", <!-- 部件名称 -->
A.PRDT_SPEC as "prdtSpec", A.PRDT_SPEC as "prdtSpec",
A.PART_TYPE as "partType",
A.PART_CODE as "partCode", A.PART_CODE as "partCode",
A.PART_NAME as "partName", A.PART_NAME as "partName",
A.PART_SPEC as "partSpec", A.PART_SPEC as "partSpec",
......
package com.baosight.hpjx.hp.sc.tools; package com.baosight.hpjx.hp.sc.tools;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.utils.QrCodeUtils; import com.baosight.hpjx.core.utils.QrCodeUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC001; import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.hp.sc.domain.HPSC003; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC004; import com.baosight.iplat4j.core.ei.EiInfo;
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.hp.sc.domain.HPSC005C;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC007;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext; import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -75,6 +72,48 @@ public class HPSCTools { ...@@ -75,6 +72,48 @@ public class HPSCTools {
} }
/** /**
* 拆单重量校正
*
* @param prodOrderNo 生产订单号
* @param wt 分派重量
*/
public static void checkAssignedWt(String prodOrderNo, BigDecimal wt) {
// 生产订单
HPSC005 dbSc005 = HPSCTools.HpSc005.get(prodOrderNo);
BigDecimal jhWt = dbSc005.getTotalWt();
// 子单
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
List<HPSC005A> dbSc005as = DaoBase.getInstance().query(HPSC005A.QUERY, queryMap, 0, -999999);
BigDecimal totalWt = wt; // 总重量
if (CollectionUtils.isNotEmpty(dbSc005as)) {
for (HPSC005A dbSc005a : dbSc005as) {
totalWt = totalWt.add(dbSc005a.getTotalWt());
}
}
// 判断重量是否超过订单重量
AssertUtils.isGt(totalWt, jhWt, "拆单的分派重量不能大于计划重量!");
BigDecimal unassignedNum = jhWt.subtract(totalWt).divide(jhWt,4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
BigDecimal assignedNum = new BigDecimal(100).subtract(unassignedNum);
Map updateMap = new HashMap();
updateMap.put("id", dbSc005.getId());
updateMap.put("assignedNum", unassignedNum.compareTo(new BigDecimal(0)) == 0 ? new BigDecimal(100) : assignedNum);
updateMap.put("unassignedNum", unassignedNum.compareTo(new BigDecimal(0)) == 0 ? new BigDecimal(0) : unassignedNum);
// 0.未派工,1.部分派工,2.全部派工
if (jhWt.subtract(totalWt).compareTo(BigDecimal.ZERO)==0) {
updateMap.put("workDate",DateUtils.shortDate());
updateMap.put("status", 2);
} else if (totalWt.compareTo(BigDecimal.ZERO) == 1) {
updateMap.put("workDate",DateUtils.shortDate());
updateMap.put("status", 1);
} else {
updateMap.put("workDate","");
updateMap.put("status", 0);
}
DaoUtils.update(HPSqlConstant.HPSC005.UPDATE_ASSIGN_NUM, updateMap);
}
/**
* 拆单数量校正(部分派单) * 拆单数量校正(部分派单)
* *
* @param prodOrderNo 生产订单号 * @param prodOrderNo 生产订单号
...@@ -107,6 +146,39 @@ public class HPSCTools { ...@@ -107,6 +146,39 @@ public class HPSCTools {
} }
/** /**
* 拆单数量校正(部分派单)
*
* @param prodOrderNo 生产订单号
* @param wt 剩余重量
*/
public static void checkAssignedWt2(String prodOrderNo, BigDecimal wt) {
// 生产订单
HPSC005 dbSc005 = HPSCTools.HpSc005.get(prodOrderNo);
BigDecimal jhWt = dbSc005.getTotalWt();//生产订单总量
// 子单
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
List<HPSC005A> dbSc005as = DaoBase.getInstance().query(HPSC005A.QUERY, queryMap, 0, -999999);
BigDecimal totalWt = wt;
if (CollectionUtils.isNotEmpty(dbSc005as)) {
totalWt = totalWt.add(dbSc005as.stream().map(HPSC005A::getTotalWt).reduce(BigDecimal.ZERO, BigDecimal::add));
/*for (HPSC005A dbSc005a : dbSc005as) {
totalWt = totalWt.add(dbSc005a.getTotalWt());
}*/
}
// 判断重量是否超过订单重量
AssertUtils.isGt(totalWt, jhWt, "拆单的分派重量不能大于计划重量!");
Map updateMap = new HashMap();
updateMap.put("id", dbSc005.getId());
updateMap.put("assignedNum", 100);
updateMap.put("unassignedNum", 0);//分派剩余数量变为0
updateMap.put("workDate",DateUtils.shortDate());
// 部分派工变为全部派工
updateMap.put("status", 2);
DaoUtils.update(HPSqlConstant.HPSC005.UPDATE_ASSIGN_NUM, updateMap);
}
/**
* 新增入库及删除入库单做同步计划订单 * 新增入库及删除入库单做同步计划订单
* *
* @param prodOrderNo * @param prodOrderNo
...@@ -740,6 +812,46 @@ public class HPSCTools { ...@@ -740,6 +812,46 @@ public class HPSCTools {
return results.get(0); return results.get(0);
} }
/**
* 生成任务订单
*
* @param dbSc003
* @param dbSc004
*/
public static void addSc005(HPSC003 dbSc003, HPSC004 dbSc004) {
HPSC005 newSc005 = BeanUtils.copy(dbSc003, HPSC005.class);
newSc005.setProdOrderNo(dbSc004.getProdOrderNo());
if (StringUtils.isEmpty(newSc005.getProdOrderNo())){
newSc005.setProdOrderNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC005_PROD_NO));
}
newSc005.setPrdtLength(dbSc003.getLength());
newSc005.setPrdtWidth(dbSc003.getWidth());
newSc005.setPrdtThick(dbSc003.getThick());
newSc005.setPrdtSpec(dbSc003.getSpec());
newSc005.setInventRecordId(dbSc004.getInventRecordId());
newSc005.setPartType(dbSc004.getPrdtType());
newSc005.setPartCode(dbSc004.getPrdtCode());
newSc005.setPartName(dbSc004.getPrdtName());
newSc005.setPartLength(dbSc004.getLength());
newSc005.setPartWidth(dbSc004.getWidth());
newSc005.setPartThick(dbSc004.getThick());
newSc005.setPartSpec(dbSc004.getSpec());
newSc005.setRemark1(dbSc004.getRemark());
//newSc005.setWorkDate(DateUtils.shortDate());
newSc005.setPlanCompletionDate(dbSc004.getPlanCompletionDate());
newSc005.setNum(dbSc004.getNum());
newSc005.setUnassignedNum(dbSc004.getNum());
newSc005.setUnitWt(dbSc004.getUnitWt());
newSc005.setTotalWt(dbSc004.getTotalWt());
newSc005.setFilePath1(dbSc004.getFilePath1());
newSc005.setMatId(dbSc004.getMatId());
newSc005.setStatus(CommonConstant.YesNo.NO_0);
newSc005.setDeliveryDate(dbSc003.getDeliveryDate());
newSc005.setDepCode(dbSc004.getDepCode());
newSc005.setFactoryCode(dbSc003.getFactoryCode());
DaoUtils.insert(HPSC005.INSERT, newSc005);
}
} }
/** /**
...@@ -838,6 +950,19 @@ public class HPSCTools { ...@@ -838,6 +950,19 @@ public class HPSCTools {
return results.stream().collect(Collectors.toMap(HPSC005A::getProdTaskNo, item -> item)); return results.stream().collect(Collectors.toMap(HPSC005A::getProdTaskNo, item -> item));
} }
/**
* 查询信息
*
* @param prodOrderNo 生产订单号
* @return
*/
public static List<HPSC005A> getByProdOrderNo(String prodOrderNo) {
AssertUtils.isEmpty(prodOrderNo, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
return DaoBase.getInstance().query(HPSC005A.QUERY, queryMap);
}
} }
/** /**
...@@ -1037,4 +1162,19 @@ public class HPSCTools { ...@@ -1037,4 +1162,19 @@ public class HPSCTools {
return results; return results;
} }
} }
public static class Hpsc106 {
public static HPSC106 getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "报工单ID不能为空!");
HPSC106 results = (HPSC106)DaoBase.getInstance().get(HPSC106.QUERY, HPSC106.FIELD_ID, id);
return results;
}
public static List<HPSC106> getByProdTaskNo(String prodTaskNo){
AssertUtils.isTrue(StringUtils.isEmpty(prodTaskNo), "生产编号不能为空!");
List<HPSC106> results = DaoBase.getInstance().query(HPSC106.QUERY, new HashMap<String,Object>(){{put(HPSC106.FIELD_prod_task_no, prodTaskNo);}});
return CollectionUtils.isEmpty(results) ? null : results;
}
}
} }
...@@ -185,6 +185,22 @@ public class HPXSTools { ...@@ -185,6 +185,22 @@ public class HPXSTools {
} }
/** /**
* 查询用户组织机构
*
* @return
*/
public static List<String> getOrgId(String orgType) {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
paramMap.put("orgType", orgType);
List<Map> results = DaoBase.getInstance().query(HPSqlConstant.HpXsOrg.QUERY_ORG_ID, paramMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().map(item -> item.get("orgId").toString()).collect(Collectors.toList());
}
/**
* 查询 * 查询
* *
* @param orgId * @param orgId
......
...@@ -128,7 +128,7 @@ public class SecurityUserStandardImpl extends ServiceEPBase implements ISecurity ...@@ -128,7 +128,7 @@ public class SecurityUserStandardImpl extends ServiceEPBase implements ISecurity
} else if (!"-1".equals(userMap.get("isLocked")) && !"-1".equals(userMap.get("status"))) { } else if (!"-1".equals(userMap.get("isLocked")) && !"-1".equals(userMap.get("status"))) {
// 登录校验增加企业是否启用 modify by songx at 2024-01-16 // 登录校验增加企业是否启用 modify by songx at 2024-01-16
String dbCompanyCode = (String) userMap.get("companyCode"); String dbCompanyCode = (String) userMap.get("companyCode");
if (StringUtils.isBlank(dbCompanyCode) || HPPZTools.HpPz009.isValid(dbCompanyCode)) { if (StringUtils.isBlank(dbCompanyCode) || HPPZTools.HpPz009.isValid(dbCompanyCode) || dbCompanyCode.equals("admin")) {
String pwdExpireDateString = (String) userMap.get("pwdExpireDate"); String pwdExpireDateString = (String) userMap.get("pwdExpireDate");
String accountExpireDateString = (String) userMap.get("accountExpireDate"); String accountExpireDateString = (String) userMap.get("accountExpireDate");
String nowDateString = DateUtils.curDateStr8(); String nowDateString = DateUtils.curDateStr8();
......
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