材料出库同步其它仓库的代码及增加删除接口
This commit is contained in:
parent
b5826fbae9
commit
21cf13550b
|
@ -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;
|
||||
|
||||
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.scmpub.query.SCMBillQuery;
|
||||
import nc.itf.ic.m4d.IMaterialOutMaintain;
|
||||
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.pubitf.ic.m4d.api.IMaterialOutMaintainAPI;
|
||||
import nc.vo.bd.material.MaterialVO;
|
||||
import nc.vo.ic.general.define.ICBillFlag;
|
||||
import nc.vo.ic.general.define.ICBillHeadVO;
|
||||
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.pub.BusinessException;
|
||||
import nc.vo.pub.VOStatus;
|
||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||
import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule;
|
||||
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||
import nc.vo.scmpub.util.ArrayUtil;
|
||||
import nccloud.api.ic.m4d.IAPIMaterialOutMaintain;
|
||||
import nccloud.api.impl.ic.m4d.check.CheckMaterialOutSaveValidator;
|
||||
import nccloud.api.impl.ic.m4d.fill.MaterialOutSaveFillValue;
|
||||
import nccloud.api.impl.ic.m4d.fill.MaterialOutUpdateFillValue;
|
||||
import nccloud.api.impl.ic.pub.check.CheckProhibitUpdateFields;
|
||||
import nccloud.api.uapbd.wms.utils.IWmsSyncUtils;
|
||||
import nccloud.openapi.ic.util.ICAPILocationVOUtils;
|
||||
import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
|
||||
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
||||
import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Description: 库存材料出库单维护实现类
|
||||
*
|
||||
* @author: 曹军
|
||||
* @date: 2019-5-17 上午10:49:30
|
||||
* @version NCC1909
|
||||
* @Description: 库存材料出库单维护实现类
|
||||
* @author: 曹军
|
||||
* @date: 2019-5-17 上午10:49:30
|
||||
*/
|
||||
|
||||
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||
|
||||
// private static final BaseDAO DAO = new BaseDAO();
|
||||
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
|
||||
|
||||
// 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);
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +56,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
MaterialOutVO[] vos =
|
||||
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||
// 设置货位序列号VO
|
||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(),vos);
|
||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(), vos);
|
||||
// 1、传入数据基本非空校验
|
||||
BillVOsCheckRule checker =
|
||||
new BillVOsCheckRule(new CheckMaterialOutSaveValidator());
|
||||
|
@ -84,6 +80,60 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
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) {
|
||||
for (int i = 0; i < vos.length; i++) {
|
||||
MaterialOutVO vo = vos[i];
|
||||
|
@ -91,7 +141,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
if (bodys != null && bodys.length > 0) {
|
||||
for (int j = 0; j < bodys.length; 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 =
|
||||
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||
// 设置货位序列号VO
|
||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(),vos);
|
||||
ICAPILocationVOUtils.setLocationVO(ICBillType.MaterialOut.getCode(), vos);
|
||||
MaterialOutHeadVO newVO = vos[0].getHead();
|
||||
String cgeneralhid = newVO.getCgeneralhid();
|
||||
if(StringUtils.isEmpty(cgeneralhid)){
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
|
||||
if (StringUtils.isEmpty(cgeneralhid)) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
|
||||
}
|
||||
SCMBillQuery<MaterialOutVO> queryTool =
|
||||
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||
|
@ -119,29 +169,29 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
Map<String, ICLocationVO[]> deleteLoc =
|
||||
new HashMap<String, ICLocationVO[]>();
|
||||
// 加载原始单据和货位信息
|
||||
MaterialOutVO[] originBills = queryTool.queryVOByIDs(new String[] {
|
||||
MaterialOutVO[] originBills = queryTool.queryVOByIDs(new String[]{
|
||||
cgeneralhid
|
||||
});
|
||||
ICLocationUtil.loadLocationVOs(originBills);
|
||||
if(ArrayUtils.isEmpty(materialOutVOs)){
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0360")/*@res "没找到要修改的出库单信息,请检查数据的表头主键cgeneralhid。"*/);
|
||||
}else{
|
||||
if (ArrayUtils.isEmpty(materialOutVOs)) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息,请检查数据的表头主键cgeneralhid。"*/);
|
||||
} else {
|
||||
List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D");
|
||||
List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D");
|
||||
MaterialOutHeadVO origVO = materialOutVOs[0].getHead();
|
||||
if(origVO.getFbillflag() == null ||
|
||||
if (origVO.getFbillflag() == null ||
|
||||
0 != ((Integer) ICBillFlag.FREE.value())
|
||||
.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 "不是自由状态,不能修改"*/);
|
||||
.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 "不是自由状态,不能修改"*/);
|
||||
}
|
||||
origVO.setStatus(VOStatus.UPDATED);
|
||||
for(String attr : newVO.getAttributeNames()){
|
||||
if(newVO.getAttributeValue(attr) == null) {
|
||||
for (String attr : newVO.getAttributeNames()) {
|
||||
if (newVO.getAttributeValue(attr) == null) {
|
||||
continue;
|
||||
}
|
||||
if(headProFields.contains(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 "不允许修改。"*/ );
|
||||
if (headProFields.contains(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 "不允许修改。"*/);
|
||||
}
|
||||
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>();
|
||||
for(MaterialOutBodyVO origBvo : materialOutVOs[0].getBodys()){
|
||||
for (MaterialOutBodyVO origBvo : materialOutVOs[0].getBodys()) {
|
||||
origBvo.setStatus(VOStatus.UPDATED);
|
||||
pkbs.put(origBvo.getCgeneralbid(), origBvo);
|
||||
}
|
||||
for(MaterialOutBodyVO newBvo : vos[0].getBodys()){
|
||||
for (MaterialOutBodyVO newBvo : vos[0].getBodys()) {
|
||||
MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid());
|
||||
if(newBvo.getCgeneralbid() == null || roigBvo == null){
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0365")/*@res "没有匹配到原始出库单表体信息,请检查数据的表体主键cgeneralbid。"*/);
|
||||
if (newBvo.getCgeneralbid() == null || roigBvo == null) {
|
||||
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息,请检查数据的表体主键cgeneralbid。"*/);
|
||||
}
|
||||
Set<String> bfields = new HashSet<String>();
|
||||
for(String battr : newBvo.getAttributeNames()){
|
||||
if(newBvo.getAttributeValue(battr) == null) {
|
||||
for (String battr : newBvo.getAttributeNames()) {
|
||||
if (newBvo.getAttributeValue(battr) == null) {
|
||||
continue;
|
||||
}
|
||||
if(bodyProFields.contains(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 "不允许修改。"*/ );
|
||||
if (bodyProFields.contains(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 "不允许修改。"*/);
|
||||
}
|
||||
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
|
||||
bfields.add(battr);
|
||||
}
|
||||
//设置货位序列号孙表,把原来的孙表删除,修改的货位置为新增
|
||||
if(null != newBvo.getLocationVOs()) {
|
||||
if (null != newBvo.getLocationVOs()) {
|
||||
List<ICLocationVO> allloc = new ArrayList<ICLocationVO>();
|
||||
if(null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||
for(ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||
if (null != deleteLoc && null != deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||
for (ICLocationVO delloc : deleteLoc.get(roigBvo.getCgeneralbid())) {
|
||||
delloc.setStatus(VOStatus.DELETED);
|
||||
allloc.add(delloc);
|
||||
}
|
||||
}
|
||||
for(ICLocationVO loc : newBvo.getLocationVOs()) {
|
||||
for (ICLocationVO loc : newBvo.getLocationVOs()) {
|
||||
loc.setStatus(VOStatus.NEW);
|
||||
allloc.add(loc);
|
||||
}
|
||||
|
@ -195,7 +245,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
// 翻译货位
|
||||
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,
|
||||
ICBillType.MaterialOut.getCode());
|
||||
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
|
||||
public MaterialOutVO[] delete(MaterialOutVO[] vos) throws BusinessException {
|
||||
if(ArrayUtils.isEmpty(vos)){
|
||||
if (ArrayUtils.isEmpty(vos)) {
|
||||
return null;
|
||||
}
|
||||
for(MaterialOutVO aggvo : vos){
|
||||
for (MaterialOutVO aggvo : vos) {
|
||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||
if(parentVO.getFbillflag() == null ||
|
||||
if (parentVO.getFbillflag() == null ||
|
||||
0 != ((Integer) ICBillFlag.FREE.value())
|
||||
.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 "不是自由状态,不能删除"*/);
|
||||
.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 "不是自由状态,不能删除"*/);
|
||||
}
|
||||
}
|
||||
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null);
|
||||
|
@ -225,19 +282,19 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
|
||||
@Override
|
||||
public MaterialOutVO[] sign(MaterialOutVO[] vos) throws BusinessException {
|
||||
if(ArrayUtils.isEmpty(vos)){
|
||||
if (ArrayUtils.isEmpty(vos)) {
|
||||
return null;
|
||||
}
|
||||
for(MaterialOutVO aggvo : vos){
|
||||
for (MaterialOutVO aggvo : vos) {
|
||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||
if(parentVO.getFbillflag() == null ||
|
||||
if (parentVO.getFbillflag() == null ||
|
||||
0 != ((Integer) ICBillFlag.FREE.value())
|
||||
.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 "不是自由状态,不能签字"*/);
|
||||
.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 "不是自由状态,不能签字"*/);
|
||||
}
|
||||
if(aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0){
|
||||
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 "总数量为空,不能签字"*/);
|
||||
if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) {
|
||||
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 "总数量为空,不能签字"*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,22 +305,22 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
|
||||
@Override
|
||||
public MaterialOutVO[] unSign(MaterialOutVO[] vos) throws BusinessException {
|
||||
if(ArrayUtils.isEmpty(vos)){
|
||||
if (ArrayUtils.isEmpty(vos)) {
|
||||
return null;
|
||||
}
|
||||
for(MaterialOutVO aggvo : vos){
|
||||
for (MaterialOutVO aggvo : vos) {
|
||||
ICBillHeadVO parentVO = aggvo.getParentVO();
|
||||
if(parentVO.getFbillflag() == null ||
|
||||
if (parentVO.getFbillflag() == null ||
|
||||
0 != ((Integer) ICBillFlag.SIGN.value())
|
||||
.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 "不是签字状态,不能取消签字"*/);
|
||||
.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 "不是签字状态,不能取消签字"*/);
|
||||
}
|
||||
}
|
||||
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialOutVO[] saveByRef(List<Map<String, Object>> paramList) throws BusinessException{
|
||||
public MaterialOutVO[] saveByRef(List<Map<String, Object>> paramList) throws BusinessException {
|
||||
|
||||
// MapList转聚合VOList
|
||||
List<MaterialOutVO> aggVOList =
|
||||
|
@ -280,6 +337,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
|||
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[] 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue