|
@@ -1,6 +1,8 @@
|
|
|
package u8c.impl;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -15,18 +17,24 @@ import com.microsoft.sqlserver.jdbc.StringUtils;
|
|
|
import nc.bs.dao.BaseDAO;
|
|
|
import nc.bs.framework.adaptor.IHttpServletAdaptor;
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
+import nc.bs.pub.billcodemanage.BillcodeGenerater;
|
|
|
import nc.itf.uap.IUAPQueryBS;
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
+import nc.vo.jcom.lang.StringUtil;
|
|
|
import nc.vo.pub.BusinessException;
|
|
|
+import nc.vo.pub.CircularlyAccessibleValueObject;
|
|
|
import nc.vo.pub.lang.UFDate;
|
|
|
import nc.vo.pub.lang.UFDouble;
|
|
|
import nc.vo.trade.pub.IBillStatus;
|
|
|
import u8c.bs.servlet.service.BaseServlet;
|
|
|
import u8c.bs.servlet.service.GetBaseDAOUtil;
|
|
|
+import u8c.itf.po.IDemandPurchaseRequisition;
|
|
|
import u8c.log.NcLog;
|
|
|
import u8c.vo.DemandBVO;
|
|
|
import u8c.vo.DemandVO;
|
|
|
|
|
|
+import nc.bs.framework.common.NCLocator;
|
|
|
+
|
|
|
public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
private IUAPQueryBS iuap = NCLocator.getInstance().lookup(IUAPQueryBS.class);
|
|
|
BaseDAO dao = new BaseDAO();
|
|
@@ -72,6 +80,10 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
JSONObject bodyObject = JSONObject.parseObject(Object.toString());
|
|
|
String pk_corp = bodyObject.getString("pk_corp");//计划组织
|
|
|
String vbillcode = bodyObject.getString("vbillcode");//单据号
|
|
|
+ String prjcodehead=bodyObject.getString("prjcode");
|
|
|
+ if(StringUtil.isEmpty(vbillcode)) {//如果单据号为空则自动生成
|
|
|
+ vbillcode=new BillcodeGenerater().getBillCode("A2A3",pk_corp, null, null);
|
|
|
+ }
|
|
|
String pk_demandOld = getVbillcode(vbillcode);
|
|
|
if(!StringUtils.isEmpty(pk_demandOld)) {
|
|
|
errMessage.add(formatRSJsonData("失败","单据号"+ vbillcode +"已存在",""));
|
|
@@ -95,6 +107,9 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
}
|
|
|
String workmanid = GetBaseDAOUtil.getPsndocid(bodyObject.getString("workmanid"));//业务员
|
|
|
String plandeptid = GetBaseDAOUtil.getDeptdocid(bodyObject.getString("plandeptid"));//计划部门
|
|
|
+ String xmjbpk=GetBaseDAOUtil.getprojectid(prjcodehead);//项目基本档案主键
|
|
|
+ String xmglpk=SqlexecuteQuery("pk_jobmngfil","bd_jobmngfil","pk_jobbasfil",xmjbpk);//项目管理档案主键
|
|
|
+
|
|
|
String vnote = bodyObject.getString("vnote");//备注
|
|
|
DemandVO headvo = new DemandVO();
|
|
|
//表头赋值
|
|
@@ -108,6 +123,7 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
headvo.setVnote(vnote);//备注
|
|
|
headvo.setVdef30(bodyObject.getString("vdef30"));//业务类型
|
|
|
headvo.setBillstatus(IBillStatus.FREE);
|
|
|
+ headvo.setProjectid(xmglpk);
|
|
|
String pk_demand = dao.insertVO(headvo);
|
|
|
//表体赋值
|
|
|
if(bodyObject.getJSONArray("po")!=null) {
|
|
@@ -124,8 +140,16 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
String cmaterialname = GetBaseDAOUtil.getinvname(cmaterialcode);//存货名称
|
|
|
String spec = GetBaseDAOUtil.getinvspec(cmaterialcode);//规格
|
|
|
String model = GetBaseDAOUtil.getinvtype(cmaterialcode);//型号
|
|
|
- String width = GetBaseDAOUtil.getwidth(cmaterialcode);//宽度
|
|
|
- String height = GetBaseDAOUtil.getheight(cmaterialcode);//高度
|
|
|
+ String width = injsobj.getString("width");//宽度
|
|
|
+ String height = injsobj.getString("height");//高度
|
|
|
+// String castunitid = GetBaseDAOUtil.getMeasidByName(injsobj.getString("castunitid"));//辅助计量单位
|
|
|
+ String castunitid = injsobj.getString("castunitid");//辅助计量单位
|
|
|
+ String num = injsobj.getString("num");//数量
|
|
|
+ String nastnum = injsobj.getString("nastnum");//辅数量
|
|
|
+ String vdef13="";//换算率
|
|
|
+ if( (!StringUtils.isEmpty(num)) && (!StringUtils.isEmpty(nastnum)) ) {//判断数量与辅数量不为空计算换算率
|
|
|
+ vdef13=new UFDouble(num).div(new UFDouble(nastnum)).toString();
|
|
|
+ }
|
|
|
String unitid = GetBaseDAOUtil.getmeasname(cmaterialcode);//计量单位
|
|
|
String vdef1 = injsobj.getString("vdef1");//楼号楼层
|
|
|
String vdef2 = injsobj.getString("vdef2");//樘数(数量)
|
|
@@ -139,6 +163,7 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
String vdef10 = injsobj.getString("vdef10");//备注
|
|
|
String vdef11 = injsobj.getString("vdef11");//系列
|
|
|
String vdef12 = injsobj.getString("vdef12");//玻璃编号
|
|
|
+
|
|
|
DemandBVO bodyvo = new DemandBVO();
|
|
|
bodyvo.setPrjcode(prjcode);;
|
|
|
bodyvo.setPrjname(prjname);
|
|
@@ -151,8 +176,10 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
bodyvo.setModel(model);
|
|
|
bodyvo.setWidth(width);
|
|
|
bodyvo.setHeight(height);
|
|
|
+ bodyvo.setCastunitid(castunitid);
|
|
|
+ bodyvo.setNastnum(nastnum);
|
|
|
bodyvo.setUnitid(unitid);
|
|
|
- bodyvo.setNum(new UFDouble(injsobj.getString("num")));//数量
|
|
|
+ bodyvo.setNum(new UFDouble(num));//数量
|
|
|
bodyvo.setPk_demand(pk_demand);
|
|
|
bodyvo.setVdef1(vdef1);
|
|
|
bodyvo.setVdef2(vdef2);
|
|
@@ -166,7 +193,19 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
bodyvo.setVdef10(vdef10);
|
|
|
bodyvo.setVdef11(vdef11);
|
|
|
bodyvo.setVdef12(vdef12);
|
|
|
+ bodyvo.setVdef13(vdef13);
|
|
|
+ bodyvo.setColor(injsobj.getString("color"));
|
|
|
+ bodyvo.setSizing(injsobj.getString("sizing"));
|
|
|
+ bodyvo.setAlloy(injsobj.getString("alloy"));
|
|
|
+ // bodyvo.setStandard("国标");
|
|
|
dao.insertVO(bodyvo);
|
|
|
+ //生成请购单
|
|
|
+// IDemandPurchaseRequisition lookup = NCLocator.getInstance().lookup(IDemandPurchaseRequisition.class);
|
|
|
+ List<DemandBVO> demandBVOs = new ArrayList();
|
|
|
+ demandBVOs.add(bodyvo);
|
|
|
+// lookup.addPraybillVO(headvo,demandBVOs);
|
|
|
+ DemandPurchaseRequisitionImpl dao = new DemandPurchaseRequisitionImpl();
|
|
|
+ dao.addPraybillVO(headvo,demandBVOs);
|
|
|
}
|
|
|
}
|
|
|
result.add(formatRSJsonData("成功","",vbillcode));
|
|
@@ -243,7 +282,6 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
|
|
|
JSONArray oprepObjectBs = json.getJSONArray("result");
|
|
|
|
|
|
- String vbillcode = "vbillcode";//单据号
|
|
|
String pk_corp = "pk_corp";//组织
|
|
|
String billmaker = "billmaker";//制单人
|
|
|
String dbilldate = "dbilldate";//单据日期
|
|
@@ -252,7 +290,7 @@ public class DemandAddImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
|
|
|
for(int i = 0; i < oprepObjectBs.size(); i++) {
|
|
|
JSONObject oprepJsonObjectB = oprepObjectBs.getJSONObject(i);
|
|
|
- String[] HeadKey = {vbillcode,pk_corp,billmaker,dbilldate};
|
|
|
+ String[] HeadKey = {pk_corp,billmaker,dbilldate};
|
|
|
int num = i+1;
|
|
|
|
|
|
mags.append("第"+num+"块表头:{");
|