Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
d6fcb6aabd
|
|
@ -0,0 +1,130 @@
|
||||||
|
package nc.pubimpl.ic.m4d.api;
|
||||||
|
|
||||||
|
import nc.pubimpl.ic.api.maintain.BillMaintainTool;
|
||||||
|
import nc.pubitf.ic.m4d.api.IMaterialOutMaintainAPI;
|
||||||
|
import nc.uap.oba.word.merger.Logger;
|
||||||
|
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||||
|
import nc.vo.scmpub.util.ArrayUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MaterialOutMaintainAPIImpl implements IMaterialOutMaintainAPI {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] insertBills(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(vos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
return tool.insert(vos);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] batchInsertBills_RequiresNew(MaterialOutVO[] vos) throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(vos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
return tool.insert(vos);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] insertBillsAutoPick(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(vos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
return tool.insertAutoPick(vos);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteBillsByID(String[] ids) throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
tool.deleteBillsByID(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteBillsBySourceID(String[] sourceIDs)
|
||||||
|
throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(sourceIDs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
String[] ids = tool.queryIDsBySourceHID(sourceIDs);
|
||||||
|
|
||||||
|
deleteBillsByID(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] signBills(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(vos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
return tool.sign(vos);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] cancelSignBills(String[] ids) throws BusinessException {
|
||||||
|
try {
|
||||||
|
if (ArrayUtil.isEmpty(ids)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BillMaintainTool<MaterialOutVO> tool = getBillMaintainTool();
|
||||||
|
return tool.cancelSign(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionUtils.marsh(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BillMaintainTool<MaterialOutVO> getBillMaintainTool() {
|
||||||
|
BillMaintainTool<MaterialOutVO> tool =
|
||||||
|
new BillMaintainTool<MaterialOutVO>(MaterialOutVO.class,
|
||||||
|
ICBillType.MaterialOut.getCode());
|
||||||
|
return tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
package nccloud.api.impl.ic.m4d;
|
package nccloud.api.impl.ic.m4d;
|
||||||
|
|
||||||
|
|
||||||
import nc.bs.dao.BaseDAO;
|
|
||||||
import nc.bs.framework.common.NCLocator;
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.scmpub.query.SCMBillQuery;
|
import nc.bs.scmpub.query.SCMBillQuery;
|
||||||
|
import nc.itf.ic.m4d.IMaterialOutMaintain;
|
||||||
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
|
import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
||||||
import nc.jdbc.framework.processor.MapListProcessor;
|
|
||||||
import nc.pubimpl.ic.api.maintain.BillMaintainTool;
|
import nc.pubimpl.ic.api.maintain.BillMaintainTool;
|
||||||
import nc.pubitf.ic.m4d.api.IMaterialOutMaintainAPI;
|
import nc.pubitf.ic.m4d.api.IMaterialOutMaintainAPI;
|
||||||
import nc.vo.bd.material.MaterialVO;
|
|
||||||
import nc.vo.ic.general.define.ICBillFlag;
|
import nc.vo.ic.general.define.ICBillFlag;
|
||||||
import nc.vo.ic.general.define.ICBillHeadVO;
|
import nc.vo.ic.general.define.ICBillHeadVO;
|
||||||
import nc.vo.ic.general.util.ICLocationUtil;
|
import nc.vo.ic.general.util.ICLocationUtil;
|
||||||
|
|
@ -20,36 +18,34 @@ import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pub.VOStatus;
|
import nc.vo.pub.VOStatus;
|
||||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
|
||||||
import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule;
|
import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule;
|
||||||
import nc.vo.scmpub.res.billtype.ICBillType;
|
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||||
|
import nc.vo.scmpub.util.ArrayUtil;
|
||||||
import nccloud.api.ic.m4d.IAPIMaterialOutMaintain;
|
import nccloud.api.ic.m4d.IAPIMaterialOutMaintain;
|
||||||
import nccloud.api.impl.ic.m4d.check.CheckMaterialOutSaveValidator;
|
import nccloud.api.impl.ic.m4d.check.CheckMaterialOutSaveValidator;
|
||||||
import nccloud.api.impl.ic.m4d.fill.MaterialOutSaveFillValue;
|
import nccloud.api.impl.ic.m4d.fill.MaterialOutSaveFillValue;
|
||||||
import nccloud.api.impl.ic.m4d.fill.MaterialOutUpdateFillValue;
|
import nccloud.api.impl.ic.m4d.fill.MaterialOutUpdateFillValue;
|
||||||
import nccloud.api.impl.ic.pub.check.CheckProhibitUpdateFields;
|
import nccloud.api.impl.ic.pub.check.CheckProhibitUpdateFields;
|
||||||
|
import nccloud.api.uapbd.wms.utils.IWmsSyncUtils;
|
||||||
import nccloud.openapi.ic.util.ICAPILocationVOUtils;
|
import nccloud.openapi.ic.util.ICAPILocationVOUtils;
|
||||||
import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
|
import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
|
||||||
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
||||||
import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @version NCC1909
|
||||||
* @Description: 库存材料出库单维护实现类
|
* @Description: 库存材料出库单维护实现类
|
||||||
*
|
|
||||||
* @author: 曹军
|
* @author: 曹军
|
||||||
* @date: 2019-5-17 上午10:49:30
|
* @date: 2019-5-17 上午10:49:30
|
||||||
* @version NCC1909
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
|
||||||
|
|
||||||
// private static final BaseDAO DAO = new BaseDAO();
|
|
||||||
|
|
||||||
|
// private static final BaseDAO DAO = new BaseDAO();
|
||||||
|
private static final Log log = Log.getInstance("wmslog");
|
||||||
// private static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
|
// private static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -60,7 +56,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
MaterialOutVO[] vos =
|
MaterialOutVO[] vos =
|
||||||
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||||
// 设置货位序列号VO
|
// 设置货位序列号VO
|
||||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(),vos);
|
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(), vos);
|
||||||
// 1、传入数据基本非空校验
|
// 1、传入数据基本非空校验
|
||||||
BillVOsCheckRule checker =
|
BillVOsCheckRule checker =
|
||||||
new BillVOsCheckRule(new CheckMaterialOutSaveValidator());
|
new BillVOsCheckRule(new CheckMaterialOutSaveValidator());
|
||||||
|
|
@ -84,6 +80,60 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
return materialOut.insertBills(vos);
|
return materialOut.insertBills(vos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialOutVO[] batchsave(List<Map<String, Object>> paramList) throws BusinessException {
|
||||||
|
// MapList转聚合VOList
|
||||||
|
List<MaterialOutVO> aggVOList =
|
||||||
|
TransferMapToVOTool.transferMapToAggVO(paramList, MaterialOutVO.class);
|
||||||
|
MaterialOutVO[] vos =
|
||||||
|
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||||
|
// 设置货位序列号VO
|
||||||
|
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(), vos);
|
||||||
|
// 1、传入数据基本非空校验
|
||||||
|
BillVOsCheckRule checker =
|
||||||
|
new BillVOsCheckRule(new CheckMaterialOutSaveValidator());
|
||||||
|
checker.check(vos);
|
||||||
|
// 2、编码翻译成pk
|
||||||
|
aggVOList = TransferCodeToPKTool.transferAggVO(aggVOList);
|
||||||
|
// 翻译货位
|
||||||
|
ICAPILocationVOUtils.translate(vos);
|
||||||
|
|
||||||
|
// boolean isSpecialCase = checkSpecialCondition(paramList);
|
||||||
|
// 如果判定成功,处理金思维的材料出库,将来源的相关数据补充上
|
||||||
|
// if (isSpecialCase) {
|
||||||
|
// processPickingPlanSpecialLogic(vos);
|
||||||
|
// }
|
||||||
|
//其他数据填充
|
||||||
|
new MaterialOutSaveFillValue().setDefaultValue(vos);
|
||||||
|
|
||||||
|
IMaterialOutMaintainAPI materialOut = NCLocator.getInstance().lookup(IMaterialOutMaintainAPI.class);
|
||||||
|
// 设置每行行号
|
||||||
|
setMaterialOutRowNum(vos);
|
||||||
|
List<MaterialOutVO> aggvoList = new ArrayList<>();
|
||||||
|
if (ArrayUtil.isEmpty(vos)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MaterialOutVO vo : vos) {
|
||||||
|
try {
|
||||||
|
MaterialOutVO[] materialOutVOS = NCLocator.getInstance().lookup(IMaterialOutMaintainAPI.class).batchInsertBills_RequiresNew(new MaterialOutVO[]{vo});
|
||||||
|
aggvoList.add(materialOutVOS[0]);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (e.getMessage() != null && e.getMessage().length() > 0) {
|
||||||
|
if (e.getMessage().length() > 300) {
|
||||||
|
vo.getHead().setVdef18("保存异常" + e.getMessage().substring(0, 300));
|
||||||
|
} else {
|
||||||
|
vo.getHead().setVdef18("保存异常" + e.getMessage().substring(0, e.getMessage().length()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.getHead().setVdef18("保存异常,异常信息为空,检查堆栈");
|
||||||
|
}
|
||||||
|
aggvoList.add(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aggvoList.toArray(new MaterialOutVO[aggvoList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
private void setMaterialOutRowNum(MaterialOutVO[] vos) {
|
private void setMaterialOutRowNum(MaterialOutVO[] vos) {
|
||||||
for (int i = 0; i < vos.length; i++) {
|
for (int i = 0; i < vos.length; i++) {
|
||||||
MaterialOutVO vo = vos[i];
|
MaterialOutVO vo = vos[i];
|
||||||
|
|
@ -91,7 +141,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
if (bodys != null && bodys.length > 0) {
|
if (bodys != null && bodys.length > 0) {
|
||||||
for (int j = 0; j < bodys.length; j++) {
|
for (int j = 0; j < bodys.length; j++) {
|
||||||
MaterialOutBodyVO body = bodys[j];
|
MaterialOutBodyVO body = bodys[j];
|
||||||
body.setCrowno(String.valueOf((j +1)*10));
|
body.setCrowno(String.valueOf((j + 1) * 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -107,11 +157,11 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
MaterialOutVO[] vos =
|
MaterialOutVO[] vos =
|
||||||
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||||
// 设置货位序列号VO
|
// 设置货位序列号VO
|
||||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(),vos);
|
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(), vos);
|
||||||
MaterialOutHeadVO newVO = vos[0].getHead();
|
MaterialOutHeadVO newVO = vos[0].getHead();
|
||||||
String cgeneralhid = newVO.getCgeneralhid();
|
String cgeneralhid = newVO.getCgeneralhid();
|
||||||
if(StringUtils.isEmpty(cgeneralhid)){
|
if (StringUtils.isEmpty(cgeneralhid)) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
|
||||||
}
|
}
|
||||||
SCMBillQuery<MaterialOutVO> queryTool =
|
SCMBillQuery<MaterialOutVO> queryTool =
|
||||||
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||||
|
|
@ -119,29 +169,29 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
Map<String, ICLocationVO[]> deleteLoc =
|
Map<String, ICLocationVO[]> deleteLoc =
|
||||||
new HashMap<String, ICLocationVO[]>();
|
new HashMap<String, ICLocationVO[]>();
|
||||||
// 加载原始单据和货位信息
|
// 加载原始单据和货位信息
|
||||||
MaterialOutVO[] originBills = queryTool.queryVOByIDs(new String[] {
|
MaterialOutVO[] originBills = queryTool.queryVOByIDs(new String[]{
|
||||||
cgeneralhid
|
cgeneralhid
|
||||||
});
|
});
|
||||||
ICLocationUtil.loadLocationVOs(originBills);
|
ICLocationUtil.loadLocationVOs(originBills);
|
||||||
if(ArrayUtils.isEmpty(materialOutVOs)){
|
if (ArrayUtils.isEmpty(materialOutVOs)) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0360")/*@res "没找到要修改的出库单信息,请检查数据的表头主键cgeneralhid。"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息,请检查数据的表头主键cgeneralhid。"*/);
|
||||||
}else{
|
} else {
|
||||||
List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D");
|
List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D");
|
||||||
List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D");
|
List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D");
|
||||||
MaterialOutHeadVO origVO = materialOutVOs[0].getHead();
|
MaterialOutHeadVO origVO = materialOutVOs[0].getHead();
|
||||||
if(origVO.getFbillflag() == null ||
|
if (origVO.getFbillflag() == null ||
|
||||||
0 != ((Integer) ICBillFlag.FREE.value())
|
0 != ((Integer) ICBillFlag.FREE.value())
|
||||||
.compareTo((Integer) origVO.getFbillflag())){
|
.compareTo((Integer) origVO.getFbillflag())) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0362")/*@res "不是自由状态,不能修改"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0362")/*@res "不是自由状态,不能修改"*/);
|
||||||
}
|
}
|
||||||
origVO.setStatus(VOStatus.UPDATED);
|
origVO.setStatus(VOStatus.UPDATED);
|
||||||
for(String attr : newVO.getAttributeNames()){
|
for (String attr : newVO.getAttributeNames()) {
|
||||||
if(newVO.getAttributeValue(attr) == null) {
|
if (newVO.getAttributeValue(attr) == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(headProFields.contains(attr)
|
if (headProFields.contains(attr)
|
||||||
&& !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))){
|
&& !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0363")/*@res "表头字段:"*/ + attr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0364")/*@res "不允许修改。"*/ );
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0363")/*@res "表头字段:"*/ + attr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
|
||||||
}
|
}
|
||||||
origVO.setAttributeValue(attr, newVO.getAttributeValue(attr));
|
origVO.setAttributeValue(attr, newVO.getAttributeValue(attr));
|
||||||
}
|
}
|
||||||
|
|
@ -154,39 +204,39 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(vos[0].getBodys() != null){
|
if (vos[0].getBodys() != null) {
|
||||||
Map<String, MaterialOutBodyVO> pkbs = new HashMap<String, MaterialOutBodyVO>();
|
Map<String, MaterialOutBodyVO> pkbs = new HashMap<String, MaterialOutBodyVO>();
|
||||||
for(MaterialOutBodyVO origBvo : materialOutVOs[0].getBodys()){
|
for (MaterialOutBodyVO origBvo : materialOutVOs[0].getBodys()) {
|
||||||
origBvo.setStatus(VOStatus.UPDATED);
|
origBvo.setStatus(VOStatus.UPDATED);
|
||||||
pkbs.put(origBvo.getCgeneralbid(), origBvo);
|
pkbs.put(origBvo.getCgeneralbid(), origBvo);
|
||||||
}
|
}
|
||||||
for(MaterialOutBodyVO newBvo : vos[0].getBodys()){
|
for (MaterialOutBodyVO newBvo : vos[0].getBodys()) {
|
||||||
MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid());
|
MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid());
|
||||||
if(newBvo.getCgeneralbid() == null || roigBvo == null){
|
if (newBvo.getCgeneralbid() == null || roigBvo == null) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0365")/*@res "没有匹配到原始出库单表体信息,请检查数据的表体主键cgeneralbid。"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息,请检查数据的表体主键cgeneralbid。"*/);
|
||||||
}
|
}
|
||||||
Set<String> bfields = new HashSet<String>();
|
Set<String> bfields = new HashSet<String>();
|
||||||
for(String battr : newBvo.getAttributeNames()){
|
for (String battr : newBvo.getAttributeNames()) {
|
||||||
if(newBvo.getAttributeValue(battr) == null) {
|
if (newBvo.getAttributeValue(battr) == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(bodyProFields.contains(battr)
|
if (bodyProFields.contains(battr)
|
||||||
&& !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))){
|
&& !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0366")/*@res "表体字段:"*/ + battr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0364")/*@res "不允许修改。"*/ );
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0366")/*@res "表体字段:"*/ + battr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
|
||||||
}
|
}
|
||||||
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
|
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
|
||||||
bfields.add(battr);
|
bfields.add(battr);
|
||||||
}
|
}
|
||||||
//设置货位序列号孙表,把原来的孙表删除,修改的货位置为新增
|
//设置货位序列号孙表,把原来的孙表删除,修改的货位置为新增
|
||||||
if(null != newBvo.getLocationVOs()) {
|
if (null != newBvo.getLocationVOs()) {
|
||||||
List<ICLocationVO> allloc = new ArrayList<ICLocationVO>();
|
List<ICLocationVO> allloc = new ArrayList<ICLocationVO>();
|
||||||
if(null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
|
if (null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||||
for(ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
|
for (ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||||
delloc.setStatus(VOStatus.DELETED);
|
delloc.setStatus(VOStatus.DELETED);
|
||||||
allloc.add(delloc);
|
allloc.add(delloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(ICLocationVO loc : newBvo.getLocationVOs()) {
|
for (ICLocationVO loc : newBvo.getLocationVOs()) {
|
||||||
loc.setStatus(VOStatus.NEW);
|
loc.setStatus(VOStatus.NEW);
|
||||||
allloc.add(loc);
|
allloc.add(loc);
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +245,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
// 翻译货位
|
// 翻译货位
|
||||||
ICAPILocationVOUtils.translate(materialOutVOs);
|
ICAPILocationVOUtils.translate(materialOutVOs);
|
||||||
//其他数据填充
|
//其他数据填充
|
||||||
new MaterialOutUpdateFillValue().setDefaultValue(materialOutVOs,bfields);
|
new MaterialOutUpdateFillValue().setDefaultValue(materialOutVOs, bfields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -203,21 +253,28 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
new BillMaintainTool<MaterialOutVO>(MaterialOutVO.class,
|
new BillMaintainTool<MaterialOutVO>(MaterialOutVO.class,
|
||||||
ICBillType.MaterialOut.getCode());
|
ICBillType.MaterialOut.getCode());
|
||||||
tool.doBeforeInsert(materialOutVOs);
|
tool.doBeforeInsert(materialOutVOs);
|
||||||
return NCLocator.getInstance()
|
|
||||||
.lookup(nc.itf.ic.m4d.IMaterialOutMaintain.class).update(materialOutVOs,originBills);
|
MaterialOutVO[] updateVOS = NCLocator.getInstance().lookup(IMaterialOutMaintain.class).update(materialOutVOs, originBills);
|
||||||
|
IWmsSyncUtils utils = NCLocator.getInstance().lookup(IWmsSyncUtils.class);
|
||||||
|
// 如果是WMS系统 则自动签字
|
||||||
|
if (utils != null && utils.isWMS()) {
|
||||||
|
log.info("当前是WMS系统用户,自动签字");
|
||||||
|
return this.sign(updateVOS);
|
||||||
|
}
|
||||||
|
return updateVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialOutVO[] delete(MaterialOutVO[] vos) throws BusinessException {
|
public MaterialOutVO[] delete(MaterialOutVO[] vos) throws BusinessException {
|
||||||
if(ArrayUtils.isEmpty(vos)){
|
if (ArrayUtils.isEmpty(vos)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for(MaterialOutVO aggvo : vos){
|
for (MaterialOutVO aggvo : vos) {
|
||||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||||
if(parentVO.getFbillflag() == null ||
|
if (parentVO.getFbillflag() == null ||
|
||||||
0 != ((Integer) ICBillFlag.FREE.value())
|
0 != ((Integer) ICBillFlag.FREE.value())
|
||||||
.compareTo((Integer) parentVO.getFbillflag())){
|
.compareTo((Integer) parentVO.getFbillflag())) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0367")/*@res "不是自由状态,不能删除"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0367")/*@res "不是自由状态,不能删除"*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null);
|
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null);
|
||||||
|
|
@ -225,19 +282,19 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialOutVO[] sign(MaterialOutVO[] vos) throws BusinessException {
|
public MaterialOutVO[] sign(MaterialOutVO[] vos) throws BusinessException {
|
||||||
if(ArrayUtils.isEmpty(vos)){
|
if (ArrayUtils.isEmpty(vos)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for(MaterialOutVO aggvo : vos){
|
for (MaterialOutVO aggvo : vos) {
|
||||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||||
if(parentVO.getFbillflag() == null ||
|
if (parentVO.getFbillflag() == null ||
|
||||||
0 != ((Integer) ICBillFlag.FREE.value())
|
0 != ((Integer) ICBillFlag.FREE.value())
|
||||||
.compareTo((Integer) parentVO.getFbillflag())){
|
.compareTo((Integer) parentVO.getFbillflag())) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0330")/*@res "不是自由状态,不能签字"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0330")/*@res "不是自由状态,不能签字"*/);
|
||||||
}
|
}
|
||||||
if(aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0){
|
if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) {
|
||||||
if(aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null){
|
if (aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0392")/*@res "总数量为空,不能签字"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0392")/*@res "总数量为空,不能签字"*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,22 +305,22 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialOutVO[] unSign(MaterialOutVO[] vos) throws BusinessException {
|
public MaterialOutVO[] unSign(MaterialOutVO[] vos) throws BusinessException {
|
||||||
if(ArrayUtils.isEmpty(vos)){
|
if (ArrayUtils.isEmpty(vos)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for(MaterialOutVO aggvo : vos){
|
for (MaterialOutVO aggvo : vos) {
|
||||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||||
if(parentVO.getFbillflag() == null ||
|
if (parentVO.getFbillflag() == null ||
|
||||||
0 != ((Integer) ICBillFlag.SIGN.value())
|
0 != ((Integer) ICBillFlag.SIGN.value())
|
||||||
.compareTo((Integer) parentVO.getFbillflag())){
|
.compareTo((Integer) parentVO.getFbillflag())) {
|
||||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0332")/*@res "不是签字状态,不能取消签字"*/);
|
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0332")/*@res "不是签字状态,不能取消签字"*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null);
|
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialOutVO[] saveByRef(List<Map<String, Object>> paramList) throws BusinessException{
|
public MaterialOutVO[] saveByRef(List<Map<String, Object>> paramList) throws BusinessException {
|
||||||
|
|
||||||
// MapList转聚合VOList
|
// MapList转聚合VOList
|
||||||
List<MaterialOutVO> aggVOList =
|
List<MaterialOutVO> aggVOList =
|
||||||
|
|
@ -280,6 +337,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
return materialOut.insertBills(vos);
|
return materialOut.insertBills(vos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查是否满足特殊条件:需要同步的组织
|
* 检查是否满足特殊条件:需要同步的组织
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
package nc.pubitf.ic.m4d.api;
|
||||||
|
|
||||||
|
import nc.itf.annotation.Component;
|
||||||
|
import nc.itf.annotation.OpenAPI;
|
||||||
|
import nc.itf.annotation.OpenLevel;
|
||||||
|
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description
|
||||||
|
* <ul>
|
||||||
|
* <li>新增保存材料出库单
|
||||||
|
* <li>新增保存材料出库单(自动拣货)
|
||||||
|
* <li>根据单据ID删除材料出库单
|
||||||
|
* <li>根据来源单据ID删除材料出库单
|
||||||
|
* <li>对材料出库单做签字操作
|
||||||
|
* <li>对材料出库单做取消签字操作
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @functionName 材料出库单持久化服务
|
||||||
|
*
|
||||||
|
* @since 6.5
|
||||||
|
* @version 2015-8-26 下午2:26:33
|
||||||
|
* @author jilu
|
||||||
|
*/
|
||||||
|
@OpenAPI(value = OpenLevel.SHARED)
|
||||||
|
@Component("库存出库单")
|
||||||
|
public interface IMaterialOutMaintainAPI {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>新增保存材料出库单</B>
|
||||||
|
* <li>会对传入的参数进行数据校验和数据补全</li>
|
||||||
|
* <li>不会自动拣货</li>
|
||||||
|
* <br></br>
|
||||||
|
* 校验内容有:
|
||||||
|
* <ol>
|
||||||
|
* <li>字段非空校验</li>
|
||||||
|
* <li>现存量校验,现存量不足时不可以出库</li>
|
||||||
|
* </ol>
|
||||||
|
* 补全内容有:
|
||||||
|
* <ol>
|
||||||
|
* <li>单据号自动生成</li>
|
||||||
|
* </ol>
|
||||||
|
*
|
||||||
|
* @param vos 材料出库单单据VO数组
|
||||||
|
* @return 保存后的材料出库单单据VO数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public MaterialOutVO[] insertBills(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仿照保存作修改,批量保存,返回信息作客开处理
|
||||||
|
* @param vos
|
||||||
|
* @return
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
public MaterialOutVO[] batchInsertBills_RequiresNew(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>新增保存材料出库单</B>
|
||||||
|
* <li>自动拣货</li>
|
||||||
|
* <li>其他同insertBills方法相同</li>
|
||||||
|
*
|
||||||
|
* @param vos 材料出库单单据VO数组
|
||||||
|
* @return 保存后的材料出库单单据VO数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public MaterialOutVO[] insertBillsAutoPick(MaterialOutVO[] vos)
|
||||||
|
throws BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>根据单据ID删除材料出库单</B>
|
||||||
|
*
|
||||||
|
* @param ids 材料出库单主键数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public void deleteBillsByID(String[] ids) throws BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>根据来源单据ID删除材料出库单</B>
|
||||||
|
*
|
||||||
|
* @param sourceIDs 来源单据的主键数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public void deleteBillsBySourceID(String[] sourceIDs)
|
||||||
|
throws BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>对材料出库单做签字操作</B>
|
||||||
|
*
|
||||||
|
* @param vos 材料出库单单据VO数组
|
||||||
|
* @return 签字后的材料出库单单据VO数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public MaterialOutVO[] signBills(MaterialOutVO[] vos) throws BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <B>对材料出库单做取消签字操作</B>
|
||||||
|
*
|
||||||
|
* @param vos 材料出库单单据VO数组
|
||||||
|
* @return 取消签字后的材料出库单单据VO数组
|
||||||
|
* @throws BusinessException 异常
|
||||||
|
*/
|
||||||
|
public MaterialOutVO[] cancelSignBills(String[] ids)
|
||||||
|
throws BusinessException;
|
||||||
|
}
|
||||||
|
|
@ -22,4 +22,6 @@ public interface IAPIMaterialOutMaintain {
|
||||||
MaterialOutVO[] unSign(MaterialOutVO[] var1) throws BusinessException;
|
MaterialOutVO[] unSign(MaterialOutVO[] var1) throws BusinessException;
|
||||||
|
|
||||||
MaterialOutVO[] saveByRef(List<Map<String, Object>> var1) throws BusinessException;
|
MaterialOutVO[] saveByRef(List<Map<String, Object>> var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] batchsave(List<Map<String, Object>> var1) throws BusinessException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,351 @@
|
||||||
|
package nccloud.openapi.ic.m4d;
|
||||||
|
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.logging.Log;
|
||||||
|
import nc.bs.scmpub.query.SCMBillQuery;
|
||||||
|
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
|
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
||||||
|
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
||||||
|
import nccloud.api.ic.m4d.IAPIMaterialOutMaintain;
|
||||||
|
import nccloud.api.ic.m4d.IAPIMaterialOutQuery;
|
||||||
|
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||||
|
import nccloud.openapi.scmpub.pub.NCCPubRestResource;
|
||||||
|
import org.json.JSONString;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version NCC1909
|
||||||
|
* @Description: 库存材料出库单资源类
|
||||||
|
* @author: 曹军
|
||||||
|
* @date: 2019-5-17 上午10:50:42
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Path("ic/materialout")
|
||||||
|
public class MaterialOutResource extends NCCPubRestResource {
|
||||||
|
|
||||||
|
private Integer pageNo = defaultPageIndex;
|
||||||
|
|
||||||
|
private Integer pageSize = defaultPageNum;
|
||||||
|
|
||||||
|
private static String HEADTABLE = "ic_material_h";
|
||||||
|
|
||||||
|
private static String BODYTABLE = "ic_material_b";
|
||||||
|
|
||||||
|
private static final Log log = Log.getInstance("wmslog");
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("commonquery")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString queryVOByCommon(Map<String, Object> paramMap) {
|
||||||
|
if (paramMap == null || !paramMap.containsKey(ICPubMetaNameConst.PK_ORG)
|
||||||
|
|| !paramMap.containsKey(ICPubMetaNameConst.DBILLDATE)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入参数错误,组织、单据日期条件必输", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 处理传过来的分页信息
|
||||||
|
if (paramMap.get(PAGE_NO) != null) {
|
||||||
|
Double pageno = (Double) paramMap.get(PAGE_NO);
|
||||||
|
this.pageNo = pageno.intValue();
|
||||||
|
}
|
||||||
|
if (paramMap.get(PAGE_SIZE) != null) {
|
||||||
|
Double pagesize = (Double) paramMap.get(PAGE_SIZE);
|
||||||
|
this.pageSize = pagesize.intValue();
|
||||||
|
}
|
||||||
|
IAPIMaterialOutQuery iQuery =
|
||||||
|
(IAPIMaterialOutQuery) NCLocator.getInstance().lookup(
|
||||||
|
IAPIMaterialOutQuery.class.getName());
|
||||||
|
MaterialOutVO[] materialOutVOs =
|
||||||
|
iQuery.queryPageVOByScheme(paramMap, this.pageNo,
|
||||||
|
this.pageSize);
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
|
||||||
|
.getStrByID("4008027_0", "04008027-0470")/* @res "材料出库单查询成功" */);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("schemequery")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString queryVOByScheme(Map<String, Object> paramMap) {
|
||||||
|
if (paramMap == null) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 处理传过来的分页信息
|
||||||
|
if (paramMap.get(PAGE_NO) != null) {
|
||||||
|
Double pageno = (Double) paramMap.get(PAGE_NO);
|
||||||
|
this.pageNo = pageno.intValue();
|
||||||
|
}
|
||||||
|
if (paramMap.get(PAGE_SIZE) != null) {
|
||||||
|
Double pagesize = (Double) paramMap.get(PAGE_SIZE);
|
||||||
|
this.pageSize = pagesize.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
IAPIMaterialOutQuery iQuery =
|
||||||
|
(IAPIMaterialOutQuery) NCLocator.getInstance().lookup(
|
||||||
|
IAPIMaterialOutQuery.class.getName());
|
||||||
|
MaterialOutVO[] materialOutVOs =
|
||||||
|
iQuery.queryPageVOByScheme(paramMap, defaultPageIndex,
|
||||||
|
defaultPageNum);
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
|
||||||
|
.getStrByID("4008027_0", "04008027-0470")/* @res "材料出库单查询成功" */);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("operation/save")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString save(Map<String, Object> param) {
|
||||||
|
List<Map<String, Object>> paramList = new ArrayList<Map<String, Object>>();
|
||||||
|
paramList.add(param);
|
||||||
|
JSONString result = save(paramList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("save")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString save(List<Map<String, Object>> paramList) {
|
||||||
|
try {
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(HEADTABLE) || !map.containsKey(BODYTABLE)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IAPIMaterialOutMaintain materialOut =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class);
|
||||||
|
MaterialOutVO[] materialOutVOs = materialOut.save(paramList);
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
|
||||||
|
.getStrByID("4008027_0", "04008027-0472")/* @res "材料出库单保存成功" */);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("batchsave")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString batchsave(List<Map<String, Object>> paramList) {
|
||||||
|
try {
|
||||||
|
for (Map<String, Object> map : paramList) {
|
||||||
|
if (!map.containsKey(HEADTABLE) || !map.containsKey(BODYTABLE)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IAPIMaterialOutMaintain materialOut =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class);
|
||||||
|
MaterialOutVO[] materialOutVOs = materialOut.batchsave(paramList);
|
||||||
|
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
|
||||||
|
.getStrByID("4008027_0", "04008027-0472")/* @res "材料出库单保存成功" */);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("update")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString update(Map<String, Object> paramMap) {
|
||||||
|
try {
|
||||||
|
if (paramMap == null || !paramMap.containsKey(HEADTABLE)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
List<Map<String, Object>> paramMapList = new ArrayList<>();
|
||||||
|
paramMapList.add(paramMap);
|
||||||
|
|
||||||
|
IAPIMaterialOutMaintain materialOut =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class);
|
||||||
|
// vbatchcode 批次号字段上游需要传递给WMS
|
||||||
|
MaterialOutVO[] updateVO = materialOut.update(paramMapList);
|
||||||
|
return ResultMessageUtil.toJSON(updateVO,
|
||||||
|
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0",
|
||||||
|
"04008027-0474")/* @res "材料出库单修改成功" */);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@POST
|
||||||
|
@Path("operation/delete")
|
||||||
|
@Consumes({"application/json"})
|
||||||
|
@Produces({"application/json"})
|
||||||
|
public JSONString delete(Map<String, Object> param) {
|
||||||
|
Object[] paramArray = ((ArrayList)param.get("cgeneralhid")).toArray();
|
||||||
|
String[] paramStrings = new String[paramArray.length];
|
||||||
|
|
||||||
|
for(int i = 0; i < paramArray.length; ++i) {
|
||||||
|
paramStrings[i] = paramArray[i].toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONString result = this.delete(paramStrings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("delete")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString delete(String[] hids) {
|
||||||
|
if (hids == null || hids.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
SCMBillQuery<MaterialOutVO> queryTool =
|
||||||
|
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||||
|
MaterialOutVO[] materialOutVOs = queryTool.queryVOByIDs(hids);
|
||||||
|
if (materialOutVOs.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("根据传入数据未匹配到相关数据", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
NCLocator.getInstance()
|
||||||
|
.lookup(IAPIMaterialOutMaintain.class).delete(materialOutVOs);
|
||||||
|
return ResultMessageUtil.toJSON(new String[0], nc.vo.ml.NCLangRes4VoTransl
|
||||||
|
.getNCLangRes().getStrByID("4008027_0", "04008027-0476")/*
|
||||||
|
* @res
|
||||||
|
* "材料出库单删除成功"
|
||||||
|
*/);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("operation/sign")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString sign(Map<String, Object> param) {
|
||||||
|
Object[] paramArray = ((ArrayList<String>) param.get("cgeneralhid")).toArray();
|
||||||
|
String[] paramStrings = new String[paramArray.length];
|
||||||
|
for (int i = 0; i < paramArray.length; i++) {
|
||||||
|
paramStrings[i] = paramArray[i].toString();
|
||||||
|
}
|
||||||
|
JSONString result = sign(paramStrings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("sign")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString sign(String[] hids) {
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
result.put("success", true);
|
||||||
|
if (hids == null || hids.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
SCMBillQuery<MaterialOutVO> queryTool =
|
||||||
|
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||||
|
MaterialOutVO[] materialOutVOs = queryTool.queryVOByIDs(hids);
|
||||||
|
if (materialOutVOs.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("根据传入数据未匹配到相关数据", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
IAPIMaterialOutMaintain generalIn =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class);
|
||||||
|
materialOutVOs = generalIn.sign(materialOutVOs);
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl
|
||||||
|
.getNCLangRes().getStrByID("4008027_0", "04008027-0478")/*
|
||||||
|
* @res
|
||||||
|
* "材料出库单签字成功"
|
||||||
|
*/);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("operation/unSign")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString unSign(Map<String, Object> param) {
|
||||||
|
Object[] paramArray = ((ArrayList<String>) param.get("cgeneralhid")).toArray();
|
||||||
|
String[] paramStrings = new String[paramArray.length];
|
||||||
|
for (int i = 0; i < paramArray.length; i++) {
|
||||||
|
paramStrings[i] = paramArray[i].toString();
|
||||||
|
}
|
||||||
|
JSONString result = unSign(paramStrings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("unsign")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString unSign(String[] hids) {
|
||||||
|
if (hids == null || hids.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
SCMBillQuery<MaterialOutVO> queryTool =
|
||||||
|
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||||
|
MaterialOutVO[] materialOutVOs = queryTool.queryVOByIDs(hids);
|
||||||
|
if (materialOutVOs.length == 0) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("根据传入数据未匹配到相关数据", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
} else {
|
||||||
|
IAPIMaterialOutMaintain generalIn =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class);
|
||||||
|
materialOutVOs = generalIn.unSign(materialOutVOs);
|
||||||
|
return ResultMessageUtil.toJSON(materialOutVOs, nc.vo.ml.NCLangRes4VoTransl
|
||||||
|
.getNCLangRes().getStrByID("4008027_0", "04008027-0480")/*
|
||||||
|
* @res
|
||||||
|
* "材料出库单取消签字成功"
|
||||||
|
*/);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("saveByRef")
|
||||||
|
@Consumes("application/json")
|
||||||
|
@Produces("application/json")
|
||||||
|
public JSONString saveByRef(Map<String, Object> paramMap) {
|
||||||
|
try {
|
||||||
|
if (!paramMap.containsKey(HEADTABLE) || !paramMap.containsKey(BODYTABLE)) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||||
|
}
|
||||||
|
// 参数翻译
|
||||||
|
List<Map<String, Object>> paramList =
|
||||||
|
new ArrayList<Map<String, Object>>();
|
||||||
|
paramList.add(paramMap);
|
||||||
|
MaterialOutVO[] resultVOs =
|
||||||
|
NCLocator.getInstance().lookup(IAPIMaterialOutMaintain.class)
|
||||||
|
.saveByRef(paramList);
|
||||||
|
return ResultMessageUtil.toJSON(resultVOs, "材料出库单保存成功");
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResultMessageUtil.exceptionToJSON(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getModule() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,190 @@
|
||||||
|
package nc.pubimpl.so.m30.ic.m4c;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.yonyou.cloud.ncc.NCCSagas;
|
||||||
|
|
||||||
|
import nc.bs.so.m30.plugin.ServicePlugInPoint;
|
||||||
|
import nc.bs.so.m30.rule.credit.RenovateARByBidsBeginRule;
|
||||||
|
import nc.bs.so.m30.rule.credit.RenovateARByBidsEndRule;
|
||||||
|
import nc.impl.pubapp.env.BSContext;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewQuery;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewUpdate;
|
||||||
|
import nc.impl.pubapp.pattern.pub.LockOperator;
|
||||||
|
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||||
|
import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery;
|
||||||
|
import nc.itf.so.m30.compensate.ISaleOrderSagasCompensate;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.Rewrite35WhenOutNumChange;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.Rewrite38WhenOutNumChange;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteExchangeOutRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteOPCOutNumRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteOutNumRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteOutStateRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewritePriceNumRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteSetNumRule;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteToleranceCheck;
|
||||||
|
import nc.pubimpl.so.m30.ic.m4c.rule.RewriteZ3ByRowStateRule;
|
||||||
|
import nc.pubimpl.so.rule.SyncClmNumRule;
|
||||||
|
import nc.pubitf.so.m30.ic.m4c.IRewrite30For4C;
|
||||||
|
import nc.pubitf.so.m30.ic.m4c.Rewrite4CPara;
|
||||||
|
import nc.vo.credit.engrossmaintain.pub.action.M30EngrossAction;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFBoolean;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nc.vo.pubapp.pattern.log.TimeLog;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderViewVO;
|
||||||
|
import nc.vo.so.pub.util.SOSagasConst;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库回写销售订单累计出库数量实现
|
||||||
|
* <p>
|
||||||
|
* <b>本类主要完成以下功能:</b>
|
||||||
|
*
|
||||||
|
* <ul>
|
||||||
|
* <li>功能条目1
|
||||||
|
* <li>功能条目2
|
||||||
|
* <li>...
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @version 6.0
|
||||||
|
* @author 刘志伟
|
||||||
|
* @time 2010-7-12 下午04:50:48
|
||||||
|
*/
|
||||||
|
public class Rewrite30For4CImpl implements IRewrite30For4C {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewrite30NumFor4C(Rewrite4CPara[] paras) throws BusinessException {
|
||||||
|
try {
|
||||||
|
//埋补偿
|
||||||
|
Map<String, Serializable> paraMap = new HashMap<String, Serializable>();
|
||||||
|
paraMap.put(SOSagasConst.OPERATER, SOSagasConst.REERITE30NUMFOR4CI);
|
||||||
|
paraMap.put(SOSagasConst.PARAS,paras);
|
||||||
|
NCCSagas.compensate(ISaleOrderSagasCompensate.class, paraMap);
|
||||||
|
this.rewrite(paras);
|
||||||
|
}
|
||||||
|
catch (RuntimeException ex) {
|
||||||
|
ExceptionUtils.marsh(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addRule(AroundProcesser<SaleOrderViewVO> processer,
|
||||||
|
SaleOrderViewVO[] views) throws BusinessException {
|
||||||
|
// -------- 执行前规则 ----------------
|
||||||
|
|
||||||
|
// 先检查出库容差范围
|
||||||
|
new RewriteToleranceCheck().process(views);
|
||||||
|
processer.addBeforeRule(new RewriteOutNumRule());
|
||||||
|
processer.addBeforeRule(new RewriteExchangeOutRule());
|
||||||
|
// 执行前最后设置累计出库数量
|
||||||
|
processer.addBeforeRule(new RewriteSetNumRule());
|
||||||
|
processer.addBeforeRule(new Rewrite35WhenOutNumChange());
|
||||||
|
// 设置销售价格限量促销执行量 jilu for 恒安限量促销
|
||||||
|
processer.addBeforeRule(new RewritePriceNumRule());
|
||||||
|
// end
|
||||||
|
// 更新信用调用前(必须放在前后rule最内层,防止和状态信用调用嵌套)
|
||||||
|
processer.addBeforeRule(new RenovateARByBidsBeginRule(
|
||||||
|
M30EngrossAction.M30OutReWrite));
|
||||||
|
|
||||||
|
// -------- 执行后规则 ----------------
|
||||||
|
|
||||||
|
// 更新信用调用后(必须放在前后rule最内层,防止和状态信用调用嵌套)
|
||||||
|
processer.addAfterRule(new RenovateARByBidsEndRule(
|
||||||
|
M30EngrossAction.M30OutReWrite));
|
||||||
|
//回写预订单累计出库数量
|
||||||
|
processer.addAfterRule(new Rewrite38WhenOutNumChange());
|
||||||
|
|
||||||
|
// 为了通知StateCalculateUtil.isAutoTransitInvoiceOpen是自动回写调用的,而非行手工打开
|
||||||
|
// 此处非常别扭,作为临时处理,以后版本对状态机的使用重新考虑
|
||||||
|
BSContext.getInstance().setSession(Rewrite30For4CImpl.class.getName(),
|
||||||
|
UFBoolean.TRUE);
|
||||||
|
// 回写电子销售:累计出库数量
|
||||||
|
if(SysInitGroupQuery.isOPCEnabled()){
|
||||||
|
processer.addAfterRule(new RewriteOPCOutNumRule());
|
||||||
|
}
|
||||||
|
processer.addAfterRule(new RewriteOutStateRule());
|
||||||
|
|
||||||
|
// 回写销售订单数量时,如果订单行关闭还要回写上游合同
|
||||||
|
processer.addAfterRule(new RewriteZ3ByRowStateRule());
|
||||||
|
|
||||||
|
// 同步CLM合同销售订单-累计出库数量
|
||||||
|
processer.addAfterRule(new SyncClmNumRule("ntotaloutnum"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] lockBills(Map<String, Rewrite4CPara> index) {
|
||||||
|
int size = index.size();
|
||||||
|
String[] bids = new String[size];
|
||||||
|
bids = index.keySet().toArray(bids);
|
||||||
|
LockOperator locker = new LockOperator();
|
||||||
|
String message =
|
||||||
|
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0",
|
||||||
|
"04006011-0180")/*@res "库存销售出库单回写销售订单累计出库数量,锁销售订单表体失败"*/;
|
||||||
|
locker.lock(bids, message);
|
||||||
|
return bids;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Rewrite4CPara> prepareParams(Rewrite4CPara[] paras) {
|
||||||
|
Map<String, Rewrite4CPara> index = new HashMap<String, Rewrite4CPara>();
|
||||||
|
for (Rewrite4CPara para : paras) {
|
||||||
|
index.put(para.getCsaleorderbid(), para);
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SaleOrderViewVO[] query(Map<String, Rewrite4CPara> index) {
|
||||||
|
String[] ids = this.lockBills(index);
|
||||||
|
ViewQuery<SaleOrderViewVO> bo =
|
||||||
|
new ViewQuery<SaleOrderViewVO>(SaleOrderViewVO.class);
|
||||||
|
bo.setSharedHead(true);
|
||||||
|
|
||||||
|
SaleOrderViewVO[] views = bo.query(ids);
|
||||||
|
if (views.length != index.size()) {
|
||||||
|
String message =
|
||||||
|
nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0",
|
||||||
|
"04006011-0171")/*@res "出现并发,请重新查询销售订单"*/;
|
||||||
|
ExceptionUtils.wrappBusinessException(message);
|
||||||
|
}
|
||||||
|
return views;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rewrite(Rewrite4CPara[] paras) throws BusinessException {
|
||||||
|
TimeLog.logStart();
|
||||||
|
Map<String, Rewrite4CPara> index = this.prepareParams(paras);
|
||||||
|
// 此处设置session变量,以避免程序到处传递
|
||||||
|
BSContext.getInstance().setSession(Rewrite4CPara.class.getName(), index);
|
||||||
|
TimeLog.info("并处理参数"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
SaleOrderViewVO[] views = this.query(index);
|
||||||
|
TimeLog.info("查询销售订单表体"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
AroundProcesser<SaleOrderViewVO> processer =
|
||||||
|
new AroundProcesser<SaleOrderViewVO>(
|
||||||
|
ServicePlugInPoint.rewrite30NumFor4C);
|
||||||
|
this.addRule(processer, views);
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
processer.before(views);
|
||||||
|
TimeLog.info("写数据库前执行业务规则"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
String[] names = new String[] {
|
||||||
|
SaleOrderBVO.NTOTALNOTOUTNUM, SaleOrderBVO.NTOTALOUTNUM
|
||||||
|
};
|
||||||
|
ViewUpdate<SaleOrderViewVO> bo = new ViewUpdate<SaleOrderViewVO>();
|
||||||
|
views = bo.update(views, SaleOrderBVO.class, names);
|
||||||
|
TimeLog.info("更新数据库"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
processer.after(views);
|
||||||
|
TimeLog.info("写数据库后执行业务规则"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
// 此处释放session变量,以免浪费内存
|
||||||
|
BSContext.getInstance().removeSession(Rewrite4CPara.class.getName());
|
||||||
|
BSContext.getInstance().removeSession(Rewrite30For4CImpl.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
package nc.pubimpl.so.m30.so.m32;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nc.bs.so.m30.plugin.ServicePlugInPoint;
|
||||||
|
import nc.bs.so.m30.rule.credit.RenovateARByBidsBeginRule;
|
||||||
|
import nc.bs.so.m30.rule.credit.RenovateARByBidsEndRule;
|
||||||
|
import nc.impl.pubapp.env.BSContext;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewQuery;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewUpdate;
|
||||||
|
import nc.impl.pubapp.pattern.pub.LockOperator;
|
||||||
|
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||||
|
import nc.pubimpl.so.m30.so.m32.rule.RewriteInvoiceStateRule;
|
||||||
|
import nc.pubimpl.so.m30.so.m32.rule.RewriteSetNumRule;
|
||||||
|
import nc.pubimpl.so.m30.so.m32.rule.RewriteToleranceCheck;
|
||||||
|
import nc.pubimpl.so.rule.SyncClmNumRule;
|
||||||
|
import nc.pubitf.so.m30.so.m32.IRewrite30For32;
|
||||||
|
import nc.pubitf.so.m30.so.m32.Rewrite32Para;
|
||||||
|
import nc.vo.credit.engrossmaintain.pub.action.M30EngrossAction;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nc.vo.pubapp.pattern.log.TimeLog;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderViewVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售发票回写销售订单服务接口实现类。
|
||||||
|
*
|
||||||
|
* @author 刘志伟
|
||||||
|
* @since 6.0
|
||||||
|
* @time 2010-01-28 下午13:49:07
|
||||||
|
*/
|
||||||
|
public class Rewrite30For32Impl implements IRewrite30For32 {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewrite30NumFor32(Rewrite32Para[] paras) throws BusinessException {
|
||||||
|
try {
|
||||||
|
this.rewrite(paras);
|
||||||
|
}
|
||||||
|
catch (RuntimeException ex) {
|
||||||
|
ExceptionUtils.marsh(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addRule(AroundProcesser<SaleOrderViewVO> processer,
|
||||||
|
SaleOrderViewVO[] views) throws BusinessException {
|
||||||
|
// -------- 执行前规则 ----------------
|
||||||
|
|
||||||
|
// 最先检查开票数量
|
||||||
|
new RewriteToleranceCheck().process(views);
|
||||||
|
// 执行前最后设置开票数量
|
||||||
|
processer.addBeforeRule(new RewriteSetNumRule());
|
||||||
|
|
||||||
|
// -------- 执行后规则 ----------------
|
||||||
|
|
||||||
|
// 执行后开票状态规则
|
||||||
|
processer.addAfterRule(new RewriteInvoiceStateRule());
|
||||||
|
|
||||||
|
// 同步CLM合同销售订单-累计开票数量
|
||||||
|
processer.addAfterRule(new SyncClmNumRule("ntotalinvoicenum"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] lockBills(Map<String, Rewrite32Para> index) {
|
||||||
|
int size = index.size();
|
||||||
|
String[] bids = new String[size];
|
||||||
|
bids = index.keySet().toArray(bids);
|
||||||
|
LockOperator locker = new LockOperator();
|
||||||
|
String message = nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0","04006011-0186")/*@res "销售发票回写销售订单累计开票数量,锁销售订单表体失败"*/;
|
||||||
|
locker.lock(bids, message);
|
||||||
|
return bids;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Rewrite32Para> prepareParams(Rewrite32Para[] paras) {
|
||||||
|
Map<String, Rewrite32Para> index = new HashMap<String, Rewrite32Para>();
|
||||||
|
for (Rewrite32Para para : paras) {
|
||||||
|
index.put(para.getCsaleorderbid(), para);
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SaleOrderViewVO[] query(Map<String, Rewrite32Para> index) {
|
||||||
|
String[] ids = this.lockBills(index);
|
||||||
|
ViewQuery<SaleOrderViewVO> bo =
|
||||||
|
new ViewQuery<SaleOrderViewVO>(SaleOrderViewVO.class);
|
||||||
|
bo.setSharedHead(true);
|
||||||
|
|
||||||
|
SaleOrderViewVO[] views = bo.query(ids);
|
||||||
|
if (views.length != index.size()) {
|
||||||
|
String message = nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0","04006011-0171")/*@res "出现并发,请重新查询销售订单"*/;
|
||||||
|
ExceptionUtils.wrappBusinessException(message);
|
||||||
|
}
|
||||||
|
return views;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rewrite(Rewrite32Para[] paras) throws BusinessException {
|
||||||
|
TimeLog.logStart();
|
||||||
|
Map<String, Rewrite32Para> index = this.prepareParams(paras);
|
||||||
|
// 此处设置session变量,以避免程序到处传递
|
||||||
|
BSContext.getInstance().setSession(Rewrite32Para.class.getName(), index);
|
||||||
|
TimeLog.info("并处理参数"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
SaleOrderViewVO[] views = this.query(index);
|
||||||
|
TimeLog.info("查询销售订单表体"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
AroundProcesser<SaleOrderViewVO> processer =
|
||||||
|
new AroundProcesser<SaleOrderViewVO>(
|
||||||
|
ServicePlugInPoint.rewrite30NumFor32);
|
||||||
|
this.addRule(processer, views);
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
processer.before(views);
|
||||||
|
TimeLog.info("写数据库前执行业务规则"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
String[] names = new String[] {
|
||||||
|
SaleOrderBVO.NTOTALINVOICENUM
|
||||||
|
};
|
||||||
|
ViewUpdate<SaleOrderViewVO> bo = new ViewUpdate<SaleOrderViewVO>();
|
||||||
|
views = bo.update(views, SaleOrderBVO.class, names);
|
||||||
|
TimeLog.info("更新数据库"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
processer.after(views);
|
||||||
|
TimeLog.info("写数据库后执行业务规则"); /*-=notranslate=-*/
|
||||||
|
|
||||||
|
// 此处释放session变量,以免浪费内存
|
||||||
|
BSContext.getInstance().removeSession(Rewrite32Para.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewirte30ForCredit(Rewrite32Para[] paras) throws BusinessException {
|
||||||
|
Map<String, Rewrite32Para> index = this.prepareParams(paras);
|
||||||
|
SaleOrderViewVO[] views = this.query(index);
|
||||||
|
AroundProcesser<SaleOrderViewVO> processer = new AroundProcesser<SaleOrderViewVO>(
|
||||||
|
ServicePlugInPoint.rewrite30NumFor32);
|
||||||
|
processer
|
||||||
|
.addBeforeRule(new RenovateARByBidsBeginRule(M30EngrossAction.M30InvoiceReWrite));
|
||||||
|
processer
|
||||||
|
.addAfterRule(new RenovateARByBidsEndRule(M30EngrossAction.M30InvoiceReWrite));
|
||||||
|
processer.before(views);
|
||||||
|
processer.after(views);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -209,7 +209,7 @@ public class Rewrite30For33Impl implements IRewrite30For33 {
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// 更新信用调用后
|
// 更新信用调用后
|
||||||
processer.addAfterRule(new RenovateARByBidsEndRule(engrossAction));
|
processer.addAfterRule(new RenovateARByBidsEndRule(engrossAction));
|
||||||
// 谿꼍CLM북谿饋簡땐데
|
// 谿꼍CLM북谿饋簡땐데-작셕횅훰壇澗쏜띨
|
||||||
processer.addAfterRule(new SyncClmNumRule("ntotalarmny"));
|
processer.addAfterRule(new SyncClmNumRule("ntotalarmny"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package nc.pubimpl.so.m30.so.withdraw;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import nc.bs.so.m30.plugin.ServicePlugInPoint;
|
||||||
|
import nc.bs.so.m30.rule.maintainprocess.NullRule;
|
||||||
|
import nc.bs.so.m30.rule.maintainprocess.RewriteReturnNumRule;
|
||||||
|
import nc.bs.so.m30.rule.rewrite.m30.CheckWithdrawNumRule;
|
||||||
|
import nc.impl.pubapp.env.BSContext;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewQuery;
|
||||||
|
import nc.impl.pubapp.pattern.data.view.ViewUpdate;
|
||||||
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||||
|
import nc.pubimpl.so.rule.SyncClmNumRule;
|
||||||
|
import nc.pubitf.so.m30.so.withdraw.IRewriteSaleOrderByWithdraw;
|
||||||
|
import nc.pubitf.so.m30.so.withdraw.Rewrite30Para;
|
||||||
|
import nc.vo.ml.NCLangRes4VoTransl;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
|
import nc.vo.pubapp.pattern.log.TimeLog;
|
||||||
|
import nc.vo.pubapp.pattern.pub.MathTool;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderBVO;
|
||||||
|
import nc.vo.so.m30.entity.SaleOrderViewVO;
|
||||||
|
|
||||||
|
public class RewriteSaleOrderByWitdrawImpl implements IRewriteSaleOrderByWithdraw {
|
||||||
|
public RewriteSaleOrderByWitdrawImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rewrite30NumForWithdraw(Rewrite30Para[] paras) throws BusinessException {
|
||||||
|
try {
|
||||||
|
this.rewrite(paras);
|
||||||
|
} catch (RuntimeException ex) {
|
||||||
|
ExceptionUtils.marsh(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAfterRule(AroundProcesser<SaleOrderViewVO> processer) {
|
||||||
|
processer.addAfterRule(new NullRule());
|
||||||
|
processer.addAfterRule(new RewriteReturnNumRule());
|
||||||
|
// 同步CLM合同销售订单-累计退货主数量
|
||||||
|
processer.addAfterRule(new SyncClmNumRule("ntotalreturnnum"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBeforeRule(AroundProcesser<SaleOrderViewVO> processer) {
|
||||||
|
IRule<SaleOrderViewVO> rule = new CheckWithdrawNumRule();
|
||||||
|
processer.addBeforeRule(rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Rewrite30Para> prepareParams(Rewrite30Para[] paras) {
|
||||||
|
Map<String, Rewrite30Para> index = new HashMap();
|
||||||
|
|
||||||
|
for(Rewrite30Para para : paras) {
|
||||||
|
index.put(para.getCsaleorderbid(), para);
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SaleOrderViewVO[] query(Map<String, Rewrite30Para> index) {
|
||||||
|
String[] ids = (String[])index.keySet().toArray(new String[0]);
|
||||||
|
ViewQuery<SaleOrderViewVO> bo = new ViewQuery(SaleOrderViewVO.class);
|
||||||
|
bo.setSharedHead(true);
|
||||||
|
SaleOrderViewVO[] views = (SaleOrderViewVO[])bo.query(ids);
|
||||||
|
if (views.length != index.size()) {
|
||||||
|
String message = NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0171");
|
||||||
|
ExceptionUtils.wrappBusinessException(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return views;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rewrite(Rewrite30Para[] paras) {
|
||||||
|
TimeLog.logStart();
|
||||||
|
Map<String, Rewrite30Para> index = this.prepareParams(paras);
|
||||||
|
TimeLog.logStart();
|
||||||
|
SaleOrderViewVO[] views = this.query(index);
|
||||||
|
TimeLog.info("查询销售订单表体");
|
||||||
|
BSContext.getInstance().setSession(Rewrite30Para.class.getName(), index);
|
||||||
|
AroundProcesser<SaleOrderViewVO> processer = new AroundProcesser(ServicePlugInPoint.rewrite30NumForWithdraw);
|
||||||
|
|
||||||
|
for(SaleOrderViewVO viewvo : views) {
|
||||||
|
this.setRewiteNum(viewvo, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeLog.logStart();
|
||||||
|
this.addBeforeRule(processer);
|
||||||
|
processer.before(views);
|
||||||
|
TimeLog.info("调用回写动作前插入点");
|
||||||
|
TimeLog.logStart();
|
||||||
|
String[] names = new String[]{"ntotalreturnnum"};
|
||||||
|
ViewUpdate<SaleOrderViewVO> bo = new ViewUpdate();
|
||||||
|
views = (SaleOrderViewVO[])bo.update(views, SaleOrderBVO.class, names);
|
||||||
|
TimeLog.info("更新数据库");
|
||||||
|
TimeLog.logStart();
|
||||||
|
this.addAfterRule(processer);
|
||||||
|
processer.after(views);
|
||||||
|
TimeLog.info("调用回写动作后插入点");
|
||||||
|
BSContext.getInstance().removeSession(Rewrite30Para.class.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRewiteNum(SaleOrderViewVO vo, Map<String, Rewrite30Para> index) {
|
||||||
|
SaleOrderBVO body = vo.getBody();
|
||||||
|
Rewrite30Para para = (Rewrite30Para)index.get(body.getCsaleorderbid());
|
||||||
|
UFDouble ntotalreturnnum = body.getNtotalreturnnum();
|
||||||
|
ntotalreturnnum = MathTool.sub(ntotalreturnnum, para.getNnum());
|
||||||
|
body.setNtotalreturnnum(ntotalreturnnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -64,7 +64,7 @@ public class Rewrite30ArrangeImpl implements IRewrite30For20, IRewrite30For21,
|
||||||
processer.addBeforeRule(new RewriteCheckArrangeNumRule());
|
processer.addBeforeRule(new RewriteCheckArrangeNumRule());
|
||||||
processer.addBeforeRule(new RewriteSetNumRule());
|
processer.addBeforeRule(new RewriteSetNumRule());
|
||||||
if (MMBillType.ProduceOrder.getCode().equals(srctype.getCode()) || MMBillType.LsProduceOrder.getCode().equals(srctype.getCode())) {
|
if (MMBillType.ProduceOrder.getCode().equals(srctype.getCode()) || MMBillType.LsProduceOrder.getCode().equals(srctype.getCode())) {
|
||||||
// 谿꼍CLM북谿饋簡땐데
|
// 同步CLM合同销售订单-累计安排生产订单主数量
|
||||||
processer.addAfterRule(new SyncClmNumRule("narrangemonum"));
|
processer.addAfterRule(new SyncClmNumRule("narrangemonum"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ public class SyncClmNumRule implements IRule<SaleOrderViewVO> {
|
||||||
if (StringUtils.isEmpty(vdef9) || StringUtils.isEmpty(vbdef11)) {
|
if (StringUtils.isEmpty(vdef9) || StringUtils.isEmpty(vbdef11)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 累计安排生产订单主数量
|
// 累计开票主数量
|
||||||
UFDouble narrangemonum = body.getNarrangemonum();
|
UFDouble ntotalinvoicenum = body.getNtotalinvoicenum();
|
||||||
if ("narrangemonum".equals(flag) && narrangemonum == null) {
|
if ("ntotalinvoicenum".equals(flag) && ntotalinvoicenum == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// ÀÛ¼ÆÈ·ÈÏÓ¦ÊÕ½ð¶î
|
// ÀÛ¼ÆÈ·ÈÏÓ¦ÊÕ½ð¶î
|
||||||
|
|
@ -48,17 +48,43 @@ public class SyncClmNumRule implements IRule<SaleOrderViewVO> {
|
||||||
if ("ntotalarmny".equals(flag) && ntotalarmny == null) {
|
if ("ntotalarmny".equals(flag) && ntotalarmny == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// 累计出库数量
|
||||||
|
UFDouble ntotaloutnum = body.getNtotaloutnum();
|
||||||
|
if ("ntotaloutnum".equals(flag) && ntotaloutnum == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 累计安排生产订单主数量
|
||||||
|
UFDouble narrangemonum = body.getNarrangemonum();
|
||||||
|
if ("narrangemonum".equals(flag) && narrangemonum == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 累计退货主数量
|
||||||
|
UFDouble ntotalreturnnum = body.getNtotalreturnnum();
|
||||||
|
if ("ntotalreturnnum".equals(flag) && ntotalreturnnum == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject oneJson = new JSONObject();
|
JSONObject oneJson = new JSONObject();
|
||||||
List<Map<String, Object>> bodyList = new ArrayList<>();
|
List<Map<String, Object>> bodyList = new ArrayList<>();
|
||||||
Map<String, Object> bodyMap = new HashMap<>();
|
Map<String, Object> bodyMap = new HashMap<>();
|
||||||
|
|
||||||
bodyMap.put("id", vbdef11);
|
bodyMap.put("id", vbdef11);
|
||||||
if (narrangemonum != null) {
|
|
||||||
bodyMap.put("narrangemonum", narrangemonum.toString());
|
if (ntotalinvoicenum != null) {
|
||||||
|
bodyMap.put("billQty", ntotalinvoicenum.toString());
|
||||||
}
|
}
|
||||||
if (ntotalarmny != null) {
|
if (ntotalarmny != null) {
|
||||||
bodyMap.put("totalAccrued", ntotalarmny.toString());
|
bodyMap.put("totalAccrued", ntotalarmny.toString());
|
||||||
}
|
}
|
||||||
|
if (ntotaloutnum != null) {
|
||||||
|
bodyMap.put("totalOutQty", ntotaloutnum.toString());
|
||||||
|
}
|
||||||
|
if (narrangemonum != null) {
|
||||||
|
bodyMap.put("narrangemonum", narrangemonum.toString());
|
||||||
|
}
|
||||||
|
if (ntotalreturnnum != null) {
|
||||||
|
bodyMap.put("ntotalreturnnum", ntotalreturnnum.toString());
|
||||||
|
}
|
||||||
|
|
||||||
bodyList.add(bodyMap);
|
bodyList.add(bodyMap);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ public class ErpSoToR6Plugin implements IBackgroundWorkPlugin {
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append("SELECT ");
|
sql.append("SELECT ");
|
||||||
sql.append(" a.vdef9, ");
|
sql.append(" a.vdef9, ");
|
||||||
|
sql.append(" a.nreceivedmny, ");
|
||||||
sql.append(" b.vbdef11, ");
|
sql.append(" b.vbdef11, ");
|
||||||
sql.append(" c.ntotalinvoicenum billqty, ");
|
sql.append(" c.ntotalinvoicenum billqty, ");
|
||||||
sql.append(" c.ntotalarmny totalaccrued, ");
|
sql.append(" c.ntotalarmny totalaccrued, ");
|
||||||
|
|
@ -183,6 +184,7 @@ public class ErpSoToR6Plugin implements IBackgroundWorkPlugin {
|
||||||
bodyList.add(bodyMap);
|
bodyList.add(bodyMap);
|
||||||
oneJson.put("contractOrdersList", bodyList);
|
oneJson.put("contractOrdersList", bodyList);
|
||||||
oneJson.put("id", hid);
|
oneJson.put("id", hid);
|
||||||
|
oneJson.put("actRecvAmt", soMap.get("nreceivedmny"));// 实际收款
|
||||||
array.add(oneJson);
|
array.add(oneJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import nc.vo.pub.BusinessException;
|
||||||
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
import nccloud.baseapp.core.log.NCCForUAPLogger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -111,7 +110,9 @@ public class MaterialToQmsListener implements IBusinessListener {
|
||||||
String statusCode = (3 == enablestate) ? "1" : "0";
|
String statusCode = (3 == enablestate) ? "1" : "0";
|
||||||
// 组装数据
|
// 组装数据
|
||||||
JSONObject singleObj = new JSONObject();
|
JSONObject singleObj = new JSONObject();
|
||||||
singleObj.put("batchid", "10001");// 批次编号,用于唯一标识当前传输的物料数据批次,便于追溯和批量处理
|
// 批次编号,用于唯一标识当前传输的物料数据批次,便于追溯和批量处理
|
||||||
|
long cts = System.currentTimeMillis();
|
||||||
|
singleObj.put("batchid", cts);
|
||||||
JSONObject contentObj = new JSONObject();
|
JSONObject contentObj = new JSONObject();
|
||||||
contentObj.put("meswlbh", vo.getCode()); // 启源物料编码
|
contentObj.put("meswlbh", vo.getCode()); // 启源物料编码
|
||||||
contentObj.put("bipwlbh", vo.getCode()); // BIP物料编码
|
contentObj.put("bipwlbh", vo.getCode()); // BIP物料编码
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue