|
@@ -47,76 +47,77 @@ import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
public class ModifyMaintianImpl extends BaseServlet implements IHttpServletAdaptor{
|
|
|
-
|
|
|
+
|
|
|
private String vbillcode = "";
|
|
|
|
|
|
@SuppressWarnings("restriction")
|
|
|
@Override
|
|
|
public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
|
+ InvocationInfoProxy.getInstance().setUserDataSource("sypnctest");
|
|
|
try {
|
|
|
String createStr = buildJson(req, resp, this.getClass().getName());
|
|
|
JSONObject json = JSONObject.fromObject(createStr);
|
|
|
- NcLog.info("閿€鍞�悎鍚屽彉鏇碕SON:"+json);
|
|
|
+ NcLog.info("销售合同变更JSON:"+json);
|
|
|
vbillcode = json.getString("vbillcode");
|
|
|
collect(json);
|
|
|
resp.getWriter().write(formatRSJsonData("0",vbillcode,"").toString());
|
|
|
} catch (Exception e) {
|
|
|
-
|
|
|
+
|
|
|
resp.getWriter().write(formatRSJsonData("1",vbillcode,e.getMessage()==null?e.toString():e.getMessage()).toString());
|
|
|
StringWriter stringWriter = new StringWriter();
|
|
|
e.printStackTrace(new PrintWriter(stringWriter));
|
|
|
-
|
|
|
+
|
|
|
String msg=stringWriter.getBuffer().toString();
|
|
|
- NcLog.info("閿€鍞�悎鍚屽彉鏇�:"+msg);
|
|
|
+ NcLog.info("销售合同变更:"+msg);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void collect(JSONObject json) throws Exception {
|
|
|
|
|
|
-
|
|
|
+
|
|
|
int version;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
CtSaleTermVO ctSaleTermVO = new CtSaleTermVO();
|
|
|
List<CtSaleTermVO> ctSaleTermListVO = new ArrayList<CtSaleTermVO>();
|
|
|
-
|
|
|
+
|
|
|
CtSaleExpVO ctSaleExpVO = new CtSaleExpVO();
|
|
|
List<CtSaleExpVO> ctSaleExpListVO = new ArrayList<CtSaleExpVO>();
|
|
|
-
|
|
|
+
|
|
|
CtSaleMemoraVO ctSaleMemoraVO = new CtSaleMemoraVO();
|
|
|
List<CtSaleMemoraVO> ctSaleMemoraListVO = new ArrayList<CtSaleMemoraVO>();
|
|
|
-
|
|
|
+
|
|
|
GroupVO groupVo = GetBaseDAOUtil.getGroup(json.getString("groupCode"));
|
|
|
NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
|
|
|
|
|
|
-
|
|
|
+
|
|
|
InvocationInfoProxy.getInstance().setGroupId(groupVo.getPk_group());
|
|
|
-
|
|
|
+
|
|
|
SalesOrgVO salesOrgVO = GetBaseDAOUtil.getSalesOrg(json.getString("pk_org"));
|
|
|
String sm_userpk = GetBaseDAOUtil.getUser(json.getString("billmaker")).getCuserid();
|
|
|
-
|
|
|
+
|
|
|
InvocationInfoProxy.getInstance().setUserId(sm_userpk);
|
|
|
|
|
|
IMDPersistenceQueryService service=NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
|
|
|
AggCtSaleVO aggCtSaleVO = (AggCtSaleVO) service.queryBillOfNCObjectByPKWithDR(AggCtSaleVO.class,GetBaseDAOUtil.GetVOID("ct_sale",json.getString("vbillcode")),true).getContainmentObject();
|
|
|
-
|
|
|
+
|
|
|
CtSaleVO ctSaleVO = aggCtSaleVO.getParentVO();
|
|
|
-
|
|
|
+
|
|
|
ctSaleVO.setValdate(new UFDate(json.getString("valdate")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleVO.setInvallidate(new UFDate(json.getString("invallidate")));
|
|
|
if(!"".equals(json.getString("depid"))) {
|
|
|
DeptVO deptVO = GetBaseDAOUtil.getDept(json.getString("depid"),salesOrgVO.getPk_salesorg());
|
|
|
-
|
|
|
+
|
|
|
ctSaleVO.setDepid(deptVO.getPk_dept());
|
|
|
-
|
|
|
+
|
|
|
ctSaleVO.setDepid_v(deptVO.getPk_vid());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
ctSaleVO.setPersonnelid("".equals(json.getString("personnelid")) ? null : GetBaseDAOUtil.getPsndoc(json.getString("personnelid"),salesOrgVO.getPk_salesorg()).getPk_psndoc());
|
|
|
-
|
|
|
+
|
|
|
aggCtSaleVO.getParent().setStatus(VOStatus.UPDATED);
|
|
|
|
|
|
if (aggCtSaleVO.getChildren(CtSaleChangeVO.class)==null) {
|
|
@@ -125,25 +126,25 @@ public class ModifyMaintianImpl extends BaseServlet implements IHttpServletAdapt
|
|
|
version = aggCtSaleVO.getChildren(CtSaleChangeVO.class).length;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
CtSaleChangeVO ctSaleChangeVO = new CtSaleChangeVO();
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setPk_ct_sale(aggCtSaleVO.getParent().getAttributeValue("pk_ct_sale").toString());
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setPk_group(groupVo.getPk_group());
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setPk_org(salesOrgVO.getPk_org());
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setPk_org_v(salesOrgVO.getPk_vid());
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setVchangecode(new UFDouble(version+1));
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setVchgdate(new UFDate(json.getString("vchgdate")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setVchgpsn(sm_userpk);
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setVchgreason(json.getString("vchgreason"));
|
|
|
-
|
|
|
+
|
|
|
ctSaleChangeVO.setStatus(VOStatus.NEW);
|
|
|
|
|
|
|
|
@@ -159,74 +160,74 @@ public class ModifyMaintianImpl extends BaseServlet implements IHttpServletAdapt
|
|
|
|
|
|
for (int i = 0; i < datas.size(); i++) {
|
|
|
JSONObject JSONBody = (JSONObject) datas.get(i);
|
|
|
-
|
|
|
+
|
|
|
CtSaleBVO ctSaleBVO = new CtSaleBVO();
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_ct_sale(aggCtSaleVO.getParent().getAttributeValue("pk_ct_sale").toString());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_financeorg(GetBaseDAOUtil.GetFinanceorg("SYP"));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_financeorg_v(GetBaseDAOUtil.GetFinanceorg_v("SYP"));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_group(groupVo.getPk_group());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_org(salesOrgVO.getPk_org());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_org_v(salesOrgVO.getPk_vid());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCrowno(JSONBody.getString("crowno"));
|
|
|
MaterialVO materialVO = GetBaseDAOUtil.getMaterial(JSONBody.getString("pk_material"));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_material(materialVO.getPk_material());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setPk_srcmaterial(materialVO.getPk_source());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCastunitid("".equals(JSONBody.getString("castunitid")) ? null : GetBaseDAOUtil.getMeasdo(JSONBody.getString("castunitid")).getPk_measdoc());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCunitid("".equals(JSONBody.getString("cunitid")) ? null : GetBaseDAOUtil.getMeasdo(JSONBody.getString("cunitid")).getPk_measdoc());
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setVchangerate("1");
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNastnum(new UFDouble(JSONBody.getString("nnum")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNnum(new UFDouble(JSONBody.getString("nnum")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNtaxrate(new UFDouble(JSONBody.getString("ntaxrate")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNgtaxprice(new UFDouble(JSONBody.getString("norigtaxprice")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNorigtaxprice(new UFDouble(JSONBody.getString("norigtaxprice")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNorigprice((new UFDouble(JSONBody.getString("norigtaxprice"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNqtorigprice((new UFDouble(JSONBody.getString("norigtaxprice"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNqtorigtaxprice((new UFDouble(JSONBody.getString("norigtaxprice"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNqttaxprice((new UFDouble(JSONBody.getString("norigtaxprice"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNmny((new UFDouble(JSONBody.getString("norigmny"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNorigmny((new UFDouble(JSONBody.getString("norigmny"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNtax((new UFDouble(JSONBody.getString("ntax"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setFtaxtypeflag(1);
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCtaxcodeid(GetBaseDAOUtil.GetTaxcode(JSONBody.getString("ctaxcode")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCrececountryid(GetBaseDAOUtil.GetCountry(JSONBody.getString("crececountryid")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCsendcountryid(GetBaseDAOUtil.GetCountry(JSONBody.getString("csendcountryid")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setCtaxcountryid(GetBaseDAOUtil.GetCountry(JSONBody.getString("ctaxcountryid")));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setFbuysellflag(3);
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setNorigtaxmny((new UFDouble(JSONBody.getString("norigmny"))));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setVmemo(JSONBody.getString("vmemo"));
|
|
|
-
|
|
|
+
|
|
|
ctSaleBVO.setStatus(VOStatus.NEW);
|
|
|
|
|
|
newAssetList.add(ctSaleBVO);
|
|
@@ -238,26 +239,26 @@ public class ModifyMaintianImpl extends BaseServlet implements IHttpServletAdapt
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
CtSaleChangeVO[] CtSaleChangearrVO = new CtSaleChangeVO[version+1];
|
|
|
for (int i = 0; i < version; i++) {
|
|
|
CtSaleChangearrVO[i] = (CtSaleChangeVO) aggCtSaleVO.getChildren(CtSaleChangeVO.class)[i];
|
|
@@ -272,7 +273,7 @@ public class ModifyMaintianImpl extends BaseServlet implements IHttpServletAdapt
|
|
|
public void processAction(AggCtSaleVO aggCtSaleVO) throws Exception{
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
NCLocator.getInstance().lookup(IplatFormEntry.class).processAction("SAVEBASE",aggCtSaleVO.getParentVO().getVtrantypecode(),null,aggCtSaleVO,null,null);
|
|
|
}
|