材料出库同步其它仓库的代码及增加删除接口
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;
|
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
|
||||||
|
@ -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];
|
||||||
|
@ -203,8 +253,15 @@ 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
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue