编码改完GBK

This commit is contained in:
zhangxinah@yonyou.com 2025-03-27 16:03:51 +08:00
parent a783655c15
commit 9705b3b9fc
4 changed files with 52 additions and 52 deletions

View File

@ -28,7 +28,7 @@ import nc.vo.pubapp.pattern.pub.MathTool;
import nccloud.baseapp.core.log.NCCForUAPLogger;
/**
* 合并备料计划保存前校验申请数量是否超过计划数量-2005适配2312
* 合并备料计划保存前校验申请数量是否超过计划数量-2005适配2312
*
* @author mzr
* @date 2025/3/26
@ -57,16 +57,16 @@ public class N_4455_WRITE extends AbstractCompiler2 {
context.setICPFParameter(pfparam);
SapplyBillVO[] outVOs = (SapplyBillVO[])this.getVos();
// 保存前校验申请数量是否超过计划数量
// 保存前校验申请数量是否超过计划数量
for (SapplyBillVO billVO : outVOs) {
SapplyBillBodyVO[] bodyVOS = billVO.getBodys();
for (SapplyBillBodyVO bodyVO : bodyVOS) {
// 只判断来源单据是备料计划的出库申请
// 只判断来源单据是备料计划的出库申请
if (!"55A3".equals(bodyVO.getCsourcetype())) {
continue;
}
String csourcebillbid = bodyVO.getCsourcebillbid();
// 查询备料计划中的计划出库数量通过备料计划的表体主键
// 查询备料计划中的计划出库数量通过备料计划的表体主键
String getPlanNumSql = "SELECT nplanoutastnum "
+ "FROM mm_pickm_b "
+ "WHERE NVL(dr,0) = 0 AND cpickm_bid = '[csourcebillbid]'";
@ -77,12 +77,12 @@ public class N_4455_WRITE extends AbstractCompiler2 {
continue;
}
UFDouble plantNum = new UFDouble(String.valueOf(nplanoutastnum));
// 通过备料计划的表体主键查询已申请数量
// 通过备料计划的表体主键查询已申请数量
String getApplyNumSql = "SELECT NVL(SUM(nassistnum),0) nassistnum "
+ "FROM ic_sapply_b "
+ "WHERE NVL(dr,0) = 0 AND csourcebillbid = '[csourcebillbid]'";
getApplyNumSql = getApplyNumSql.replace("[csourcebillbid]", csourcebillbid);
// 修改的时候加上子表主键
// 修改的时候加上子表主键
if (null != outVOs[0] && null != outVOs[0].getHead() && null != outVOs[0].getHead().getCgeneralhid()) {
getApplyNumSql += " AND cgeneralbid != '" + bodyVO.getPrimaryKey() + "'";
}
@ -90,12 +90,12 @@ public class N_4455_WRITE extends AbstractCompiler2 {
new ColumnProcessor("nassistnum"));
UFDouble applyNum = new UFDouble(String.valueOf(nassistnum));
NCCForUAPLogger.debug(String.format(
"出库申请保存: 来源单据表体主键 = [%S], 计划出库数量 = [%S], 已申请数量 = [%S], 本次申请数量 = [%S],",
"出库申请保存: 来源单据表体主键 = [%S], 计划出库数量 = [%S], 已申请数量 = [%S], 本次申请数量 = [%S],",
csourcebillbid, plantNum, applyNum, bodyVO.getNassistnum()
));
UFDouble applyNum1 = applyNum.add(bodyVO.getNassistnum());
if (MathTool.compareTo(plantNum, applyNum1) < 0) {
nccloud.framework.core.exception.ExceptionUtils.wrapBusinessException("申请数量已超出计划数量,请检查!");
nccloud.framework.core.exception.ExceptionUtils.wrapBusinessException("申请数量已超出计划数量,请检查!");
}
}
}

View File

@ -35,7 +35,7 @@ import nc.vo.pub.lang.UFBoolean;
import nccloud.commons.lang.StringUtils;
/**
* 物料基本信息外部交互平台导入
* 物料基本信息外部交互平台导入
*
* @author jiangjuna
* @since NC6.0
@ -51,7 +51,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
String pk = null;
try {
MaterialVO materialVO = (MaterialVO) vo;
// by_zhangzhyz_20220113//项目专项需求 根据物料编码和组织进行查询不通过ID对照表
// by_zhangzhyz_20220113//项目专项需求 根据物料编码和组织进行查询不通过ID对照表
String whereSql = MaterialVO.CODE + " = '" + materialVO.getCode() + "'";
@SuppressWarnings("unchecked")
Collection<MaterialVO> cols = new BaseDAO().retrieveByClause(MaterialVO.class, whereSql);
@ -67,9 +67,9 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
this.getService().updateMaterial(this.getUpdateVO(materialVO, pk));
String sender = swapContext.getSender();
if("pdm".equalsIgnoreCase(sender)) {
// 物料更新后更新计划信息
// 物料更新后更新计划信息
updatePlanVOsAfterMaterialUpdate(materialVO);
// 物料更新后更新库存信息
// 物料更新后更新库存信息
updateStockVOsAfterMaterialUpdate(materialVO);
}
}
@ -81,7 +81,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
}
/**
* 物料更新后更新计划信息
* 物料更新后更新计划信息
*
* @param materialVO
* @throws BusinessException
@ -92,11 +92,11 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
String pk_org = materialVO.getPk_org();
String pk_material = materialVO.getPk_material();
IMaterialPlanQueryService queryService = NCLocator.getInstance().lookup(IMaterialPlanQueryService.class);
// 查询物料计划信息
// 查询物料计划信息
MaterialPlanVO[] pvos = queryService.queryMaterialPlanVOs(new String[] { pk_org }, pk_material);
IMaterialPlanService planService = NCLocator.getInstance().lookup(IMaterialPlanService.class);
for (MaterialPlanVO planVO : pvos) {
// PLM计划虚项映射到计划信息
// PLM计划虚项映射到计划信息
if (materialVO.getDef19() != null && UFBoolean.TRUE.toString().equals(materialVO.getDef19()))
planVO.setIsvirtual(UFBoolean.TRUE);
else
@ -107,7 +107,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
}
/**
* 物料更新后更新库存信息
* 物料更新后更新库存信息
*
* @param materialVO
* @throws BusinessException
@ -120,7 +120,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
IMaterialStockService stockService = NCLocator.getInstance().lookup(IMaterialStockService.class);
for (MaterialStockVO stockVO : svos) {
if (stockVO.getMartype() != null) {
// PLM物料类型映射到库存信息
// PLM物料类型映射到库存信息
switch (materialVO.getDef18()) {
case IMaterialEnumConst.MATERTYPE_DR:
stockVO.setMartype(IMaterialEnumConst.MATERTYPE_DR);
@ -141,7 +141,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
stockVO.setMartype(IMaterialEnumConst.MATERTYPE_ET);
break;
default:
// 物料类型默认为MR
// 物料类型默认为MR
stockVO.setMartype(IMaterialEnumConst.MATERTYPE_MR);
break;
}
@ -216,7 +216,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
new String[] { MaterialVO.CREATOR, MaterialVO.CREATIONTIME, MaterialVO.PK_SOURCE, MaterialVO.VERSION, MaterialVO.LATEST, MaterialVO.ENABLESTATE });
if (oldVO == null) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("bdpub", "0bdpub0057")
/* @res "该数据已被删除" */);
/* @res "该数据已被删除" */);
}
materialVO.setPrimaryKey(pk);
materialVO.setCreator(oldVO.getCreator());
@ -251,7 +251,7 @@ public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
if (vos != null && vos.length > 0) {
String message = nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("10140mag", "010140mag0200", null,
new String[] { Integer.toString(value.getTotalNum()), Integer.toString(value.getErrLogResult().getErrorMessagegNum()) })
/* @res "外部交换平台导入物料新版本数据时,分配操作部分成功,共处理了{0}条记录,其中有{1}条处理失败:" */+ "\n";
/* @res "外部交换平台导入物料新版本数据时,分配操作部分成功,共处理了{0}条记录,其中有{1}条处理失败:" */+ "\n";
for (int i = 0; i < vos.length; i++) {
message += vos[i].getErrormsg() + "\n";
}

View File

@ -37,7 +37,7 @@ import nccloud.ws.rest.resource.AbstractNCCRestResource;
import org.json.JSONString;
/**
* 物料接口适配2312
* 物料接口适配2312
*/
@Path("uapbd/material/material")
@ -64,7 +64,7 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
public JSONString queryMaterialIsExist(JSONString json) {
boolean bool = false;// false 不存在 true 存在
boolean bool = false;// false 不存在 true 存在
JSONObject jObject = JSONObject.parseObject(json.toJSONString());
if (jObject == null) {
@ -72,11 +72,11 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
}
if (StringUtils.isEmpty(jObject.getString("code"))) {
return ResultMessageUtil.exceptionToJSON("code 不能为空", APIErrCodeEnum.UNKNOWEXCCODE.getCode());
return ResultMessageUtil.exceptionToJSON("code 不能为空", APIErrCodeEnum.UNKNOWEXCCODE.getCode());
}
String code = jObject.getString("code");
String version = jObject.getString("version");
String pk_org = jObject.getString("pk_org");// 所属组织编码
String pk_org = jObject.getString("pk_org");// 所属组织编码
String sql = "select bd_material.code,bd_material.version,org_orgs.code From bd_material , org_orgs where bd_material.pk_org=org_orgs.pk_org and bd_material.code='"
+ code + "'";
@ -97,7 +97,7 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
return ResultMessageUtil.toJSONUnTranslate(bool);
} else {
bool = false;
return ResultMessageUtil.toJSONUnTranslate(bool, "没有符合条件的数据");
return ResultMessageUtil.toJSONUnTranslate(bool, "没有符合条件的数据");
}
} catch (DAOException e) {
// TODO Auto-generated catch block
@ -213,10 +213,10 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
Map<String, Object> param = new HashMap<String, Object>();
if (StringUtils.isBlank(pk_org) && StringUtils.isBlank(code) && StringUtils.isBlank(version)) {
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织、物料编码、版本号,不能同时为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织、物料编码、版本号,不能同时为空"));
}
if (assignorgs == null || (assignorgs != null && assignorgs.size() <= 0)) {
return ResultMessageUtil.exceptionToJSON(new Exception("分配组织不能为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("分配组织不能为空"));
}
if (StringUtils.isNotBlank(pk_org)) {
param.put("pk_org", pk_org);
@ -237,7 +237,7 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
MaterialVO[] vos = (MaterialVO[]) (new BaseDAO()).retrieveByClause(MaterialVO.class, condition)
.toArray(new MaterialVO[0]);
if (vos == null || (vos != null && vos.length <= 0)) {
return ResultMessageUtil.exceptionToJSON(new Exception("未查询到物料信息"));
return ResultMessageUtil.exceptionToJSON(new Exception("未查询到物料信息"));
}
IMaterialAssignService IMaterialAssignService = (IMaterialAssignService) NCLocator.getInstance()
.lookup(IMaterialAssignService.class);
@ -253,7 +253,7 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
(String[]) pk_orgs.toArray(new String[0]), null);
}
}
return ResultMessageUtil.toJSON(null, "分配成功!");
return ResultMessageUtil.toJSON(null, "分配成功!");
} catch (Exception e) {
return ResultMessageUtil.exceptionToJSON(e);
}
@ -292,11 +292,11 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
}
if (StringUtils.isBlank(pk_org) && StringUtils.isBlank(code)) {
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
}
if (saleorgs == null || saleorgs.size() == 0) {
return ResultMessageUtil.exceptionToJSON(new NullPointerException("saleorgs:" + saleorgs + ",不能为空"));
return ResultMessageUtil.exceptionToJSON(new NullPointerException("saleorgs:" + saleorgs + ",不能为空"));
}
try {
ApiResourceParamUtils ApiResourceParamUtils = new ApiResourceParamUtils();
@ -373,10 +373,10 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
param.put("version", version);
}
if (StringUtils.isBlank(pk_org) && StringUtils.isBlank(code)) {
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
}
if (prodorgs == null || prodorgs.size() == 0) {
return ResultMessageUtil.exceptionToJSON(new Exception("prodorgs:" + prodorgs + ",不能为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("prodorgs:" + prodorgs + ",不能为空"));
}
try {
ApiResourceParamUtils ApiResourceParamUtils = new ApiResourceParamUtils();
@ -453,11 +453,11 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
}
if (StringUtils.isBlank(pk_org) && StringUtils.isBlank(code)) {
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("所属组织和编码 pk_org、code不能同时为空"));
}
if (stockorgs == null || stockorgs.size() == 0) {
return ResultMessageUtil.exceptionToJSON(new Exception("stockorgs:" + stockorgs + ",不能为空"));
return ResultMessageUtil.exceptionToJSON(new Exception("stockorgs:" + stockorgs + ",不能为空"));
}
try {
ApiResourceParamUtils ApiResourceParamUtils = new ApiResourceParamUtils();
@ -533,7 +533,7 @@ public class MaterialManageMaterial extends AbstractNCCRestResource {
} catch (Exception e) {
return ResultMessageUtil.exceptionToJSON(e);
}
return ResultMessageUtil.exceptionToJSON(new Exception("未知异常"));
return ResultMessageUtil.exceptionToJSON(new Exception("未知异常"));
}
public String getModule() {

View File

@ -14,9 +14,9 @@ import nc.vo.bd.supplier.SupplierVO;
import nc.vo.pub.BusinessException;
/**
* 适配2005代码
* 适配2005代码
* zhangxinah
* 供应商变更名称后供应商银行户名同时变更
* 供应商变更名称后供应商银行户名同时变更
*/
public class updateAfterCheck implements IBusinessListener {
@ -28,41 +28,41 @@ public class updateAfterCheck implements IBusinessListener {
String eventType = event.getEventType();
Map<String, Object> map = this.getBills(event);
Object reObj = map.get("obj");
if (reObj instanceof Object[]) { // 检查 object 是否是 Object[] 类型
Object[] objectArray = (Object[]) reObj; // Object 强制转换为 Object[] 类型
if (reObj instanceof Object[]) { // 检查 object 是否是 Object[] 类型
Object[] objectArray = (Object[]) reObj; // Object 强制转换为 Object[] 类型
for (Object item : objectArray) {
SupplierVO itemVo = (SupplierVO) item;
String pk_supplierStr = itemVo.getPk_supplier();
String nameStr = itemVo.getName();
List<Map<String, Object>> pk_bankaccsubList = getSaleorderPK(pk_supplierStr);
StringBuilder vsrcbidStr = new StringBuilder();//客商银行账户子户PK
StringBuilder bankaccbasStr = new StringBuilder();//客商银行账户PK
StringBuilder vsrcbidStr = new StringBuilder();//客商银行账户子户PK
StringBuilder bankaccbasStr = new StringBuilder();//客商银行账户PK
for (int i = 0; i < pk_bankaccsubList.size(); i++) {
Map itemvo = pk_bankaccsubList.get(i);
if (i > 0) {
vsrcbidStr.append(","); // 在每个元素前加逗号避免首个元素前有逗号
vsrcbidStr.append(","); // 在每个元素前加逗号避免首个元素前有逗号
bankaccbasStr.append(",");
}
vsrcbidStr.append("'").append(itemvo.get("pk_bankaccsub")).append("'"); // 每个值加上单引号
bankaccbasStr.append("'").append(itemvo.get("pk_bankaccbas")).append("'"); // 每个值加上单引号
vsrcbidStr.append("'").append(itemvo.get("pk_bankaccsub")).append("'"); // 每个值加上单引号
bankaccbasStr.append("'").append(itemvo.get("pk_bankaccbas")).append("'"); // 每个值加上单引号
}
if (!vsrcbidStr.toString().equals("")) {
String updateSql =
"update bd_bankaccsub set accname='" + nameStr + "' where pk_bankaccsub in ("
+ vsrcbidStr + ")";//客商银行账户子户
+ vsrcbidStr + ")";//客商银行账户子户
updateSaleBSQty(updateSql.toString());
}
if (!bankaccbasStr.toString().equals("")) {
String updateSql2 =
"update bd_bankaccbas set accname='" + nameStr + "' where pk_bankaccbas in ("
+ bankaccbasStr + ")";//客商银行账户
+ bankaccbasStr + ")";//客商银行账户
updateSaleBSQty(updateSql2);
}
}
}
}
} catch (Exception e) {
throw new BusinessException("根据供应商更新供应商银行账号户名失败" + e);
throw new BusinessException("根据供应商更新供应商银行账号户名失败" + e);
}
}
@ -86,18 +86,18 @@ public class updateAfterCheck implements IBusinessListener {
Object object = null;
Object old = null;
Map<String, Object> retMap = new HashMap<>();
//类型判断和赋值
//类型判断和赋值
if (event instanceof BDCommonEvent) {
BDCommonEvent e = (BDCommonEvent) event;
object = e.getNewObjs();
old = e.getOldObjs();
} else {
throw new BusinessException("未找到单据类型");
throw new BusinessException("未找到单据类型");
}
// object old 转换为 SupplierVO[] 并添加到 retMap
// object old 转换为 SupplierVO[] 并添加到 retMap
retMap.put("new", object);
retMap.put("old", old);
// 根据 new old 来设置 "obj"
// 根据 new old 来设置 "obj"
retMap.put("obj", retMap.get("new") != null ? retMap.get("new") : retMap.get("old"));
return retMap;
}