现存量新增接口增加字段

This commit is contained in:
lihao 2025-12-02 13:58:51 +08:00
parent 7bb1fa3ace
commit 22004d24aa
1 changed files with 33 additions and 9 deletions

View File

@ -1,6 +1,8 @@
package nc.api.mmpac.resource;
import com.alibaba.fastjson.JSONObject;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Log;
import nc.bs.trade.business.HYPubBO;
@ -12,6 +14,7 @@ import nc.itf.mmpac.apply.task.ITaskAQueryService;
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
import nc.itf.uap.IUAPQueryBS;
import nc.itf.uap.pf.IPfExchangeService;
import nc.jdbc.framework.processor.ColumnListProcessor;
import nc.util.mmf.framework.base.MMArrayUtil;
import nc.util.mmf.framework.base.MMCollectionUtil;
import nc.util.mmf.framework.base.MMValueCheck;
@ -50,6 +53,7 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
}
return dmo;
}
public ApplytaskRestResource() {
}
@Override
@ -68,28 +72,30 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
throw new BusinessException("数据不能为空");
}
HYPubBO hybo = new HYPubBO();
List<String> ids = new ArrayList<String>();
List<String> bids= new ArrayList<>();
List<AggTaskAVO> aggTaskAVOS = new ArrayList<>();
try {
for (Map<String, Object> param : paramList) {
Object orderId= param.get("billcode") +"";
List<String> ids = new ArrayList<String>();
List<String> bids= new ArrayList<>();
// Object orderId= hybo.findColValue("mm_pmo","cpmohid"," vbillcode ='" + param.get("billcode") + "' ");
// String mrlCode= (String) param.get("mrlcode");
// String mrlid=(String) hybo.findColValue("bd_material","pk_material"," code = '" + mrlCode + "' ");
// if(mrlid == null){
// throw new BusinessException("产品编码不能为空");
// }
if (orderId != null && !orderId.equals("")) {
PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryPMOAggVOByBid(new String[]{(String) orderId});
if (pmoaggvos == null || pmoaggvos.length == 0) {
throw new BusinessException("单据"+ orderId+"未找到数据!");
}else{
for (PMOAggVO pmoaggvo : pmoaggvos) {
for (PMOItemVO pmoItemVO: pmoaggvo.getChildrenVO()){
// if(pmoItemVO.getCmaterialvid().equals(mrlid)){
if(!ids.contains(pmoaggvo.getParentVO().getCpmohid())){
ids.add(pmoaggvo.getParentVO().getCpmohid()) ;
}
bids.add(pmoItemVO.getCmoid());
AggTaskAVO[] aggvos =pushActivity((String[]) ids.toArray(new String[ids.size()]), (String[]) bids.toArray(new String[ids.size()]));
@ -103,9 +109,17 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
aggTaskAVO.getParentVO();
TaskABVO[] taskABVOS= (TaskABVO[])aggTaskAVO.getChildrenVO();
for (TaskABVO taskABVO : taskABVOS) {
// if(taskABVO.getVbdef1()!=null){
// throw new BusinessException("单据"+ param.get("billcode")+"mes已经传输作业量");
// }
if(CheckVbdef1((double) param.get("vbdef1"))){
throw new BusinessException("mesid["+ (new UFDouble((double) param.get("vbdef1"))).intValue()+"]已经传输作业量!");
}
taskABVO.setAttributeValue("vbdef1",(new UFDouble((double) param.get("vbdef1"))).intValue());
taskABVO.setCactivityid((String) cactivityid);
taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) );
String month = (String) param.get("month");
String month = param.get("month").toString();
taskABVO.setDtaskdate(UFDate.getDate(get25thOfMonth(month)) );
// taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) );
@ -121,9 +135,6 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
}
}
ITaskAMaintainService iTaskAQueryService = NCLocator.getInstance().lookup(ITaskAMaintainService.class);
AggTaskAVO[] sourceVOs = iTaskAQueryService.insert(aggTaskAVOS.toArray(new AggTaskAVO[aggTaskAVOS.size()]));
JSONObject errojson = new JSONObject();
@ -143,6 +154,19 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
return ResultMessageUtil.toJSON(errojson);
}
}
private Boolean CheckVbdef1(double vbdef1) throws DAOException {
BaseDAO baseDAO = new BaseDAO();
String sql = "select pk_ta_b from mm_ta_b where dr = 0 and vbdef1 = '" +new UFDouble(vbdef1).intValue()+"'";
List<String> mids = (List<String>) baseDAO.executeQuery(sql, new ColumnListProcessor());
if(mids.isEmpty()){
return false;
}else{
return true;
}
}
public AggTaskAVO[] pushActivity(String[] ids, String[] bids) throws BusinessException {
PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryByPks(ids);
if (MMArrayUtil.isEmpty(pmoaggvos)) {