|
@@ -2,59 +2,43 @@ package u8c.impl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
+import nc.hr.utils.PubEnv;
|
|
|
import nc.itf.uap.IUAPQueryBS;
|
|
|
import nc.itf.uap.pf.IplatFormEntry;
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
-import nc.ui.pub.beans.MessageDialog;
|
|
|
-import nc.vo.hr.tools.pub.HRAggVO;
|
|
|
+import nc.jdbc.framework.processor.MapProcessor;
|
|
|
+import nc.ui.pub.ClientEnvironment;
|
|
|
import nc.vo.pr.pray.PraybillHeaderVO;
|
|
|
import nc.vo.pr.pray.PraybillItemVO;
|
|
|
import nc.vo.pr.pray.PraybillVO;
|
|
|
import nc.vo.pub.BusinessException;
|
|
|
-import nc.vo.pub.CircularlyAccessibleValueObject;
|
|
|
-import nc.vo.pub.lang.UFBoolean;
|
|
|
import nc.vo.pub.lang.UFDate;
|
|
|
+import nc.vo.pub.lang.UFDouble;
|
|
|
import u8c.bs.servlet.service.GetBaseDAOUtil;
|
|
|
import u8c.itf.po.IDemandPurchaseRequisition;
|
|
|
-import u8c.ui.mytest.panel.DemandTestUI;
|
|
|
import u8c.vo.DemandBVO;
|
|
|
import u8c.vo.DemandVO;
|
|
|
|
|
|
public class DemandPurchaseRequisitionImpl implements IDemandPurchaseRequisition {
|
|
|
|
|
|
- private IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
|
|
-
|
|
|
-
|
|
|
+ private static IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
|
|
|
|
|
* 根据材料采购单生成请购单
|
|
|
* @param s
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@Override
|
|
|
-
|
|
|
public void addPraybillVO(DemandVO demandVO, List<DemandBVO> demandBVOs) throws Exception {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
PraybillHeaderVO header = new PraybillHeaderVO();
|
|
|
header.setPk_corp(demandVO.getPk_corp());
|
|
|
- header.setDpraydate(demandVO.getDbilldate());
|
|
|
+ UFDate ufDate = new UFDate();
|
|
|
+ UFDate dbilldate = PubEnv.getLoginDate();
|
|
|
+ header.setDpraydate(dbilldate);
|
|
|
header.setIpraysource(5);
|
|
|
header.setIpraytype(2);
|
|
|
- header.isDirecttransit(new UFBoolean(true));
|
|
|
header.setIbillstatus(0);
|
|
|
header.setCpraypsn(demandVO.getWorkmanid());
|
|
|
header.setCdeptid(demandVO.getPlandeptid());
|
|
@@ -62,29 +46,166 @@ public class DemandPurchaseRequisitionImpl implements IDemandPurchaseRequisition
|
|
|
header.setDr(0);
|
|
|
header.setCaccountyear(String.valueOf(new UFDate().getYear()));
|
|
|
header.setCoperator(demandVO.getBillmaker());
|
|
|
+ header.setNversion(1);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,String> mapcodename=getprojectmap(demandVO.getProjectid());
|
|
|
+
|
|
|
+
|
|
|
+ header.setAttributeValue("vdef10", mapcodename.get("jobname"));
|
|
|
+
|
|
|
+ header.setAttributeValue("pk_defdoc10", demandVO.getProjectid());
|
|
|
+
|
|
|
+ header.setAttributeValue("vdef1", demandVO.getVdef1());
|
|
|
+
|
|
|
+ header.setAttributeValue("vdef7", demandVO.getVdef30());
|
|
|
+
|
|
|
+ header.setAttributeValue("pk_defdoc7",getpkdefdoc(demandVO.getVdef30()));
|
|
|
+
|
|
|
+ header.setVmemo("MRP运算清单");
|
|
|
+
|
|
|
+
|
|
|
PraybillItemVO[] items = new PraybillItemVO[demandBVOs.size()];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
for (int i = 0; i < demandBVOs.size(); i++) {
|
|
|
DemandBVO demandBVO = demandBVOs.get(i);
|
|
|
PraybillItemVO praybillItemVO = new PraybillItemVO();
|
|
|
praybillItemVO.setPk_corp(demandVO.getPk_corp());
|
|
|
-
|
|
|
praybillItemVO.setRowno((i+1)*10+"");
|
|
|
- praybillItemVO.setCmangid(getCmangid(demandBVO.getCmaterialcode()));
|
|
|
+
|
|
|
+ praybillItemVO.setCmangid(getCmangchid(getCmangid(demandBVO.getCmaterialcode())));
|
|
|
+ praybillItemVO.setCbaseid(getCmangid(demandBVO.getCmaterialcode()));
|
|
|
+
|
|
|
+ praybillItemVO.setPk_corp(PubEnv.getCorpCode());
|
|
|
+ praybillItemVO.setPk_purcorp (PubEnv.getCorpCode());
|
|
|
+
|
|
|
+
|
|
|
praybillItemVO.setNpraynum(demandBVO.getNum());
|
|
|
- praybillItemVO.setDdemanddate(new UFDate());
|
|
|
- String cprojectid = "";
|
|
|
- if(demandBVO.getPrjcode().startsWith("1001")) {
|
|
|
- cprojectid = demandBVO.getPrjcode();
|
|
|
- }
|
|
|
- else {
|
|
|
- cprojectid = GetBaseDAOUtil.getprojectid(demandBVO.getPrjcode());
|
|
|
- }
|
|
|
- praybillItemVO.setCprojectid(cprojectid);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ UFDouble hsl=new UFDouble(demandBVO.getVdef13());
|
|
|
+ praybillItemVO.setNexchangerate(hsl);
|
|
|
+
|
|
|
+ praybillItemVO.setCassistunit(getMeasidByNames(demandBVO.getCastunitid()));
|
|
|
+
|
|
|
+ praybillItemVO.setNassistnum(new UFDouble(demandBVO.getNastnum()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ praybillItemVO.setCprojectid(demandVO.getProjectid());
|
|
|
+
|
|
|
+ praybillItemVO.setVproducenum(demandBVO.getVbatchcode());
|
|
|
+
|
|
|
+ praybillItemVO.setDdemanddate(dbilldate);
|
|
|
+ praybillItemVO.setDsuggestdate(dbilldate);
|
|
|
+
|
|
|
+ praybillItemVO.setPk_reqcorp(PubEnv.getCorpCode());
|
|
|
+ praybillItemVO.setVfree1(demandBVO.getColor());
|
|
|
+ praybillItemVO.setVfree2(demandBVO.getAlloy());
|
|
|
+ praybillItemVO.setVfree3(demandBVO.getSizing());
|
|
|
+ praybillItemVO.setVfree4(demandBVO.getStandard());
|
|
|
+
|
|
|
+ praybillItemVO.setAttributeValue("vdef1",demandBVO.getVdef1() );
|
|
|
+ praybillItemVO.setAttributeValue("vdef2", demandBVO.getVdef2());
|
|
|
+ praybillItemVO.setAttributeValue("vdef3", demandBVO.getVdef3());
|
|
|
+ praybillItemVO.setAttributeValue("vdef4", demandBVO.getVdef4());
|
|
|
+ praybillItemVO.setAttributeValue("vdef5", demandBVO.getVdef5());
|
|
|
+ praybillItemVO.setAttributeValue("vdef6", demandBVO.getVdef6());
|
|
|
+ praybillItemVO.setAttributeValue("vdef7", demandBVO.getVdef7());
|
|
|
+ praybillItemVO.setAttributeValue("vdef8", demandBVO.getVdef8());
|
|
|
+ praybillItemVO.setAttributeValue("vdef9", demandBVO.getVdef9());
|
|
|
+ praybillItemVO.setAttributeValue("vdef10",demandBVO.getVdef10());
|
|
|
+ praybillItemVO.setAttributeValue("vdef11",demandBVO.getWidth());
|
|
|
+ praybillItemVO.setAttributeValue("vdef12",demandBVO.getHeight());
|
|
|
+ praybillItemVO.setAttributeValue("vdef13",demandBVO.getVdef11());
|
|
|
+ praybillItemVO.setAttributeValue("vdef14",demandBVO.getVdef12());
|
|
|
+
|
|
|
+
|
|
|
+ praybillItemVO.setAttributeValue("vdef17",demandBVO.getVdef21());
|
|
|
+ praybillItemVO.setAttributeValue("vdef18",demandBVO.getWeight());
|
|
|
+ praybillItemVO.setAttributeValue("vdef19",demandBVO.getRound());
|
|
|
+ praybillItemVO.setAttributeValue("vuserdef20",demandBVO.getVdef22());
|
|
|
+ praybillItemVO.setAttributeValue("pk_defdoc20",getzyqpk("专用区",demandBVO.getVdef22()==null?null:demandBVO.getVdef22().toString()));
|
|
|
+
|
|
|
+ praybillItemVO.setCsourcebillid(demandBVO.getPk_demand());
|
|
|
+ praybillItemVO.setCsourcebillrowid(demandBVO.getPk_demand_b());
|
|
|
+ praybillItemVO.setCupsourcebillid(demandBVO.getPk_demand());
|
|
|
+ praybillItemVO.setCupsourcebillrowid(demandBVO.getPk_demand_b());
|
|
|
+
|
|
|
+
|
|
|
items[i] = praybillItemVO;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
PraybillVO vo = new PraybillVO();
|
|
|
vo.setParentVO(header);
|
|
|
vo.setChildrenVO(items);
|
|
@@ -92,10 +213,6 @@ public class DemandPurchaseRequisitionImpl implements IDemandPurchaseRequisition
|
|
|
praybillVOs[0] = vo;
|
|
|
IplatFormEntry iIplatFormEntry = (IplatFormEntry)NCLocator.getInstance().lookup(IplatFormEntry.class.getName());
|
|
|
ArrayList retObj = (ArrayList) iIplatFormEntry.processAction("SAVEBASE", "20", vo.getHeadVO().getDpraydate().toString(), null, vo, null, null);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -113,5 +230,124 @@ public class DemandPurchaseRequisitionImpl implements IDemandPurchaseRequisition
|
|
|
}
|
|
|
return cmangid;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 根据物料code查询名称
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ public String getCmangName(String code) throws BusinessException {
|
|
|
+ String invname = null;
|
|
|
+ String sql = " select invname from bd_invbasdoc" + " where invcode ='" + code + "' and dr =0 ";
|
|
|
+ invname = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (invname == null) {
|
|
|
+ throw new BusinessException("根据物料code查询名称,U8C物料code不存在:" + code);
|
|
|
+ }
|
|
|
+ return invname;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 根据项目id查询项目名称
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+
|
|
|
+ public static String getprojectname(String prjcode) throws Exception {
|
|
|
+ String jobname = null;
|
|
|
+ String sql = "select jobname from bd_jobbasfil where pk_jobbasfil ='"+prjcode+"' and isnull(dr,0) = 0";
|
|
|
+ jobname = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (jobname == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ return jobname;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 根据项目id查询项目名称
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+
|
|
|
+ public static String getprojectcode(String prjcode) throws Exception {
|
|
|
+ String jobcode = null;
|
|
|
+ String sql = "select jobcode from bd_jobbasfil where pk_jobbasfil ='"+prjcode+"' and isnull(dr,0) = 0";
|
|
|
+ jobcode = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (jobcode == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ return jobcode;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 存货管理档案
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+public String getCmangchid(String pk_invbasdoc) throws BusinessException {
|
|
|
+ String cmangid = null;
|
|
|
+ String sql = " select pk_invmandoc from bd_invmandoc" + " where pk_invbasdoc ='" + pk_invbasdoc + "' and dr =0 ";
|
|
|
+ cmangid = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (cmangid == null) {
|
|
|
+ throw new BusinessException("U8C物料code不存在:" + pk_invbasdoc);
|
|
|
+ }
|
|
|
+ return cmangid;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+public String getMeasidByNames(String measname) throws Exception {
|
|
|
+ String sql = "select pk_measdoc from bd_measdoc where isnull(dr,0) = 0 and measname = '"+measname+"'";
|
|
|
+ return (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+public Map<String,String> getprojectmap(String pk_jobmngfil ) throws Exception {
|
|
|
+ String sql = "select jobcode,jobname from bd_jobbasfil where "
|
|
|
+ + "pk_jobbasfil = (select pk_jobbasfil from bd_jobmngfil where pk_jobmngfil ='"+pk_jobmngfil+"' and dr = 0) "
|
|
|
+ + "and dr=0";
|
|
|
+ Map<String,String> map = (Map<String, String>) iuap.executeQuery(sql, new MapProcessor());
|
|
|
+ if (map == null || map.size()==0) {
|
|
|
+ throw new Exception("项目管理档案"+pk_jobmngfil+"未查到,请检查");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+private String getpkdefdoc(String docname ) throws Exception {
|
|
|
+ String sql="select pk_defdoc from bd_defdoc where pk_defdoclist = "
|
|
|
+ + "(select pk_defdoclist from bd_defdef where defname = '业务类型' and dr=0 ) and dr=0 "
|
|
|
+ + "and docname='"+docname+"'";
|
|
|
+
|
|
|
+ Object pkdefdoc = iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if(pkdefdoc == null || "".equals(pkdefdoc)) {
|
|
|
+ throw new Exception("业务类型【"+docname+"】未查到,请检查");
|
|
|
+ }
|
|
|
+
|
|
|
+ return pkdefdoc.toString();
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+private String getzyqpk(String doclistname,String docname) throws BusinessException {
|
|
|
+
|
|
|
+ if(null==docname || "".equals(docname)) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String sql = "select pk_defdoclist from bd_defdoclist where doclistname = '"+doclistname+"'";
|
|
|
+ Object pk_defdoclist = iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if(pk_defdoclist == null) {
|
|
|
+ throw new BusinessException("以下档案在U8cloud系统中根据公司或者账簿信息找不到,请检查!详细信息:1、档案类型:自定义档案列表,档案名称:"+doclistname);
|
|
|
+ }
|
|
|
+ String sql1 = "select pk_defdoc from bd_defdoc where pk_defdoclist = '"+pk_defdoclist.toString()+"' and docname ='"+docname+"'";
|
|
|
+ String pk_defdoc = (String) iuap.executeQuery(sql1, new ColumnProcessor());
|
|
|
+
|
|
|
+ return pk_defdoc;
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
}
|