|
@@ -0,0 +1,69 @@
|
|
|
+package u8c.bs.mmpac.bp;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import nc.bs.framework.common.NCLocator;
|
|
|
+import nc.itf.uap.IUAPQueryBS;
|
|
|
+import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
+import nc.jdbc.framework.processor.MapProcessor;
|
|
|
+import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.CircularlyAccessibleValueObject;
|
|
|
+import u8c.pubitf.rule.IRule;
|
|
|
+import u8c.vo.ExAggOrderMainVO;
|
|
|
+import u8c.vo.OrderInVO;
|
|
|
+import u8c.vo.OrderMainVO;
|
|
|
+
|
|
|
+public class SpecialDataRule implements IRule<ExAggOrderMainVO>{
|
|
|
+ private IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
|
|
+ @Override
|
|
|
+ public void process(ExAggOrderMainVO[] vos) throws BusinessException {
|
|
|
+ for(int i = 0; i < vos.length; i++) {
|
|
|
+ OrderMainVO headvo = (OrderMainVO) vos[i].getParentVO();
|
|
|
+ Map<String,String> map = getJobbasfil(headvo.getProjectid());
|
|
|
+ CircularlyAccessibleValueObject[] bodyvos = vos[i].getChildrenVO();
|
|
|
+ for (int j = 0; j < bodyvos.length; j++) {
|
|
|
+ OrderInVO orderInVO = (OrderInVO) bodyvos[j];
|
|
|
+ //项目编码
|
|
|
+ orderInVO.setPrjcode(map.get("jobcode"));
|
|
|
+ //项目名称
|
|
|
+ orderInVO.setPrjname(map.get("jobname"));
|
|
|
+ //项目分类编码
|
|
|
+ orderInVO.setPrjtypecode(map.get("jobtypecode"));
|
|
|
+ //项目分类名称
|
|
|
+ orderInVO.setPrjtypename(map.get("jobtypename"));
|
|
|
+ //批次
|
|
|
+ orderInVO.setVbatchcode(map.get("jobcode"));
|
|
|
+ //存货名称
|
|
|
+ orderInVO.setCmaterialname(getInvbasdoc(orderInVO.getCmaterialcode()));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //查询项目
|
|
|
+ public Map<String,String> getJobbasfil(String pk_jobmngfil)throws BusinessException {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append("SELECT");
|
|
|
+ sql.append(" bd_jobbasfil.jobcode as jobcode,bd_jobbasfil.jobname as jobname,bd_jobtype.jobtypecode as jobtypecode,bd_jobtype.jobtypename as jobtypename");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" bd_jobbasfil bd_jobbasfil");
|
|
|
+ sql.append(" left join bd_jobmngfil bd_jobmngfil on bd_jobbasfil.pk_jobbasfil = bd_jobmngfil.pk_jobbasfil");
|
|
|
+ sql.append(" left join bd_jobtype bd_jobtype on bd_jobbasfil.pk_jobtype = bd_jobtype.pk_jobtype");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" bd_jobmngfil.pk_jobmngfil = '"+pk_jobmngfil+"'");
|
|
|
+ return (Map<String, String>) iuap.executeQuery(sql.toString(), new MapProcessor());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //查询物料
|
|
|
+ public String getInvbasdoc(String code)throws BusinessException {
|
|
|
+ String sql = "select invname from bd_invbasdoc where invcode = '"+code+"' and dr = 0";
|
|
|
+ String invname = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (invname == null) {
|
|
|
+ throw new BusinessException("以下档案在U8cloud系统中根据公司或者账簿信息找不到,请检查!详细信息:1、档案类型:存货档案,档案编码:"+code);
|
|
|
+ }
|
|
|
+ return invname;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|