【泛微物料新增接口】【泛微供应商新增修改接口】
This commit is contained in:
		
							parent
							
								
									12c0f52e5d
								
							
						
					
					
						commit
						f383fda1f6
					
				|  | @ -1,9 +1,23 @@ | ||||||
| package tqq9.lc123.cloud.app.plugin.operate.sys; | package tqq9.lc123.cloud.app.plugin.operate.sys; | ||||||
| 
 | 
 | ||||||
|  | import com.alibaba.fastjson.JSONArray; | ||||||
|  | import com.alibaba.fastjson.JSONObject; | ||||||
|  | import kd.bos.dataentity.entity.DynamicObject; | ||||||
| import kd.bos.entity.operate.result.OperationResult; | import kd.bos.entity.operate.result.OperationResult; | ||||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||||
|  | import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||||
|  | import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||||
|  | import org.apache.commons.lang3.StringUtils; | ||||||
|  | import tqq9.lc123.cloud.app.plugin.trd.FWImpl; | ||||||
|  | import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; | ||||||
|  | import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; | ||||||
|  | import tqq9.lc123.cloud.app.plugin.utils.FWUtils; | ||||||
| 
 | 
 | ||||||
|  | import java.math.BigDecimal; | ||||||
|  | import java.text.SimpleDateFormat; | ||||||
|  | import java.util.Arrays; | ||||||
|  | import java.util.Date; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  | @ -16,5 +30,23 @@ public class MaterialSubmitToFwOp extends AbstractOperationServicePlugIn { | ||||||
|         super.afterExecuteOperationTransaction(e); |         super.afterExecuteOperationTransaction(e); | ||||||
|         OperationResult operationResult = this.getOperationResult(); |         OperationResult operationResult = this.getOperationResult(); | ||||||
|         List<Object> successPkIds = operationResult.getSuccessPkIds(); |         List<Object> successPkIds = operationResult.getSuccessPkIds(); | ||||||
|  |         for (Object successPkId : successPkIds) { | ||||||
|  |             DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_material"); | ||||||
|  |             String resultStr = FWImpl.pushFwMaterial(bill); | ||||||
|  |             if(StringUtils.isNotBlank(resultStr)){ | ||||||
|  |                 JSONObject resultObj = JSONObject.parseObject(resultStr); | ||||||
|  |                 String code = resultObj.getString("code"); | ||||||
|  |                 if("SUCCESS".equals(code)){ | ||||||
|  |                     JSONObject data = resultObj.getJSONObject("data"); | ||||||
|  |                     if(data != null){ | ||||||
|  |                         String requestid = data.getString("requestid"); | ||||||
|  |                         bill.set("tqq9_fwrequestid", requestid); | ||||||
|  |                         SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -25,6 +25,7 @@ public class SupplierSubmitToFwOp extends AbstractOperationServicePlugIn { | ||||||
|         List<Object> successPkIds = operationResult.getSuccessPkIds(); |         List<Object> successPkIds = operationResult.getSuccessPkIds(); | ||||||
|         for (Object successPkId : successPkIds) { |         for (Object successPkId : successPkIds) { | ||||||
|             DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); |             DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); | ||||||
|  |             boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess"); | ||||||
|             String resultStr = FWImpl.pushFwSupplier(bill); |             String resultStr = FWImpl.pushFwSupplier(bill); | ||||||
|             if(StringUtils.isNotBlank(resultStr)){ |             if(StringUtils.isNotBlank(resultStr)){ | ||||||
|                 JSONObject resultObj = JSONObject.parseObject(resultStr); |                 JSONObject resultObj = JSONObject.parseObject(resultStr); | ||||||
|  | @ -33,7 +34,12 @@ public class SupplierSubmitToFwOp extends AbstractOperationServicePlugIn { | ||||||
|                     JSONObject data = resultObj.getJSONObject("data"); |                     JSONObject data = resultObj.getJSONObject("data"); | ||||||
|                     if(data != null){ |                     if(data != null){ | ||||||
|                         String requestid = data.getString("requestid"); |                         String requestid = data.getString("requestid"); | ||||||
|  |                         if(tqq9_issuccess){ | ||||||
|  |                             bill.set("tqq9_fwupdid", requestid); | ||||||
|  |                         }else{ | ||||||
|                             bill.set("tqq9_fwrequestid", requestid); |                             bill.set("tqq9_fwrequestid", requestid); | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|                         SaveServiceHelper.save(new DynamicObject[]{bill}); |                         SaveServiceHelper.save(new DynamicObject[]{bill}); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -3891,7 +3891,6 @@ public class FWImpl { | ||||||
|      */ |      */ | ||||||
|     public static String pushFwSupplier(DynamicObject bill){ |     public static String pushFwSupplier(DynamicObject bill){ | ||||||
|         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|         String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid"); |  | ||||||
|         String gysmc = bill.getString("name"); |         String gysmc = bill.getString("name"); | ||||||
|         String gysbh = bill.getString("number"); |         String gysbh = bill.getString("number"); | ||||||
|         DynamicObject creator = bill.getDynamicObject("creator"); |         DynamicObject creator = bill.getDynamicObject("creator"); | ||||||
|  | @ -4174,25 +4173,17 @@ public class FWImpl { | ||||||
|         JSONObject detail1 = new JSONObject(); |         JSONObject detail1 = new JSONObject(); | ||||||
|         JSONArray recordsArr1 = new JSONArray(); |         JSONArray recordsArr1 = new JSONArray(); | ||||||
|         DynamicObjectCollection entry_linkman = bill.getDynamicObjectCollection("entry_linkman"); |         DynamicObjectCollection entry_linkman = bill.getDynamicObjectCollection("entry_linkman"); | ||||||
| //        for (DynamicObject linkman : entry_linkman) { |         for (DynamicObject linkman : entry_linkman) { | ||||||
| //            String xxdz = linkman.getString("tqq9_textfield_xxdz"); |             String xxdz = linkman.getString("tqq9_textfield_xxdz"); | ||||||
| //            String lxr = linkman.getString("contactperson"); |             String lxr = linkman.getString("contactperson"); | ||||||
| //            String sj = linkman.getString("mobile"); |             String sj = linkman.getString("mobile"); | ||||||
| //            String dh = linkman.getString("phone"); |             String dh = linkman.getString("phone"); | ||||||
| //            String yx = linkman.getString("email"); |             String yx = linkman.getString("email"); | ||||||
| //            int sfmr = 1; |             int sfmr = 1; | ||||||
| //            boolean isdefault_linkman = linkman.getBoolean("isdefault_linkman"); |             boolean isdefault_linkman = linkman.getBoolean("isdefault_linkman"); | ||||||
| //            if(isdefault_linkman){ |             if(isdefault_linkman){ | ||||||
| //                sfmr = 0; |                 sfmr = 0; | ||||||
| //            } |             } | ||||||
|         if(true) |  | ||||||
|         { |  | ||||||
|             String xxdz = "上海某地"; |  | ||||||
|             String lxr = "李2"; |  | ||||||
|             String sj = "13234345454"; |  | ||||||
|             String dh = "02188887777"; |  | ||||||
|             String yx = "xxxxxx@qq.com"; |  | ||||||
|             int sfmr = 0; |  | ||||||
| 
 | 
 | ||||||
|             JSONObject e1 = new JSONObject(); |             JSONObject e1 = new JSONObject(); | ||||||
|             e1.put("fieldName", "xxdz"); |             e1.put("fieldName", "xxdz"); | ||||||
|  | @ -4223,11 +4214,6 @@ public class FWImpl { | ||||||
| 
 | 
 | ||||||
|             recordsArr1.add(recordObj); |             recordsArr1.add(recordObj); | ||||||
|         } |         } | ||||||
|         detail1.put("tableDBName", "formtable_main_103_dt1"); |  | ||||||
|         detail1.put("workflowRequestTableRecords", recordsArr1); |  | ||||||
|         if(StringUtils.isNotBlank(tqq9_fwrequestid)){ |  | ||||||
|             detail1.put("deleteAll", "1"); |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         //银行明细 |         //银行明细 | ||||||
|         JSONObject detail12 = new JSONObject(); |         JSONObject detail12 = new JSONObject(); | ||||||
|  | @ -4276,14 +4262,6 @@ public class FWImpl { | ||||||
|             recordObj.put("workflowRequestTableFields", recordsArr); |             recordObj.put("workflowRequestTableFields", recordsArr); | ||||||
|             recordsArr2.add(recordObj); |             recordsArr2.add(recordObj); | ||||||
|         } |         } | ||||||
|         detail12.put("tableDBName", "formtable_main_103_dt2"); |  | ||||||
|         detail12.put("workflowRequestTableRecords", recordsArr2); |  | ||||||
|         if(StringUtils.isNotBlank(tqq9_fwrequestid)){ |  | ||||||
|             detail12.put("deleteAll", "1"); |  | ||||||
|         } |  | ||||||
|         JSONArray detailRootArr = new JSONArray(); |  | ||||||
|         detailRootArr.add(detail1); |  | ||||||
|         detailRootArr.add(detail12); |  | ||||||
| 
 | 
 | ||||||
|         //构建主表数据 |         //构建主表数据 | ||||||
|         JSONObject m1 = new JSONObject(); |         JSONObject m1 = new JSONObject(); | ||||||
|  | @ -4584,9 +4562,478 @@ public class FWImpl { | ||||||
|         JSONArray mainArr = new JSONArray(); |         JSONArray mainArr = new JSONArray(); | ||||||
|         mainArr.addAll(mlist); |         mainArr.addAll(mlist); | ||||||
| 
 | 
 | ||||||
|         String fw_wfid_xzcgdd = ConfigUtils.getThirdConfigByNumber("FW_WFID_GYS"); |         //区分新建审核与修改审批 | ||||||
|  |         String requestName = "新增供应商流程"; | ||||||
|  |         String wfID = ConfigUtils.getThirdConfigByNumber("FW_WFID_GYS"); | ||||||
|  |         String tableName_1 = "formtable_main_103_dt1"; | ||||||
|  |         String tableName_2 = "formtable_main_103_dt2"; | ||||||
|  |         String requestid = bill.getString("tqq9_fwrequestid"); | ||||||
|  |         boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess"); | ||||||
|  |         if(tqq9_issuccess){ | ||||||
|  |             requestName = "变更供应商流程"; | ||||||
|  |             tableName_1 = "formtable_main_105_dt1"; | ||||||
|  |             tableName_2 = "formtable_main_105_dt2"; | ||||||
|  |             wfID = ConfigUtils.getThirdConfigByNumber("FW_WFID_GYSBG"); | ||||||
|  |             requestid = bill.getString("tqq9_fwupdid"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // 组装明细数据 | ||||||
|  |         detail1.put("tableDBName", tableName_1); | ||||||
|  |         detail1.put("workflowRequestTableRecords", recordsArr1); | ||||||
|  |         if(StringUtils.isNotBlank(requestid)){ | ||||||
|  |             detail1.put("deleteAll", "1"); | ||||||
|  |         } | ||||||
|  |         detail12.put("tableDBName", tableName_2); | ||||||
|  |         detail12.put("workflowRequestTableRecords", recordsArr2); | ||||||
|  |         if(StringUtils.isNotBlank(requestid)){ | ||||||
|  |             detail12.put("deleteAll", "1"); | ||||||
|  |         } | ||||||
|  |         JSONArray detailRootArr = new JSONArray(); | ||||||
|  |         detailRootArr.add(detail1); | ||||||
|  |         detailRootArr.add(detail12); | ||||||
|  | 
 | ||||||
|         //如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口 |         //如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口 | ||||||
|         FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); |         FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); | ||||||
|         return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "新增供应商流程", fw_wfid_xzcgdd, gysbh, tqq9_fwrequestid); |         return fwRestfulUtils.doBillAction(mainArr, detailRootArr, requestName, wfID, gysbh, requestid); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 物料提交推送泛微 | ||||||
|  |      * @param bill | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     public static String pushFwMaterial(DynamicObject bill){ | ||||||
|  |         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|  |         String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid"); | ||||||
|  |         DynamicObject creator = bill.getDynamicObject("creator"); | ||||||
|  |         creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), "bos_user", "tqq9_fwuserid,id,number"); | ||||||
|  |         String sqr = creator.getString("tqq9_fwuserid"); | ||||||
|  |         String bm = null; | ||||||
|  |         DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept"); | ||||||
|  |         if (tqq9_dept != null){ | ||||||
|  |             String number = tqq9_dept.getString("number"); | ||||||
|  |             bm = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||||
|  |         } | ||||||
|  |         Date createtime = bill.getDate("createtime"); | ||||||
|  |         String sqrq = sdf.format(createtime); | ||||||
|  |         DynamicObject createorg = bill.getDynamicObject("createorg"); | ||||||
|  |         String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(createorg.getString("number")); | ||||||
|  |         String wlmc = bill.getString("name"); | ||||||
|  |         String lcbh = bill.getString("number"); | ||||||
|  |         String ggxh = bill.getString("modelnum"); | ||||||
|  |         DynamicObject baseunit = bill.getDynamicObject("baseunit"); | ||||||
|  |         String jbdw = baseunit.getString("name"); | ||||||
|  |         String zhcg = ""; | ||||||
|  |         DynamicObjectCollection tqq9_shcg = bill.getDynamicObjectCollection("tqq9_shcg"); | ||||||
|  |         for (DynamicObject shcg : tqq9_shcg) { | ||||||
|  |             long id = shcg.getLong("fbasedataid.id"); | ||||||
|  |             shcg = BusinessDataServiceHelper.loadSingle(id, "bd_operator", "id,name,number,operatorid"); | ||||||
|  |             DynamicObject user = shcg.getDynamicObject("operatorid"); | ||||||
|  |             if(user != null){ | ||||||
|  |                 user = BusinessDataServiceHelper.loadSingle(user.getPkValue(), "bos_user", "tqq9_fwuserid,id,number"); | ||||||
|  |                 zhcg = zhcg + "," + user.getString("tqq9_fwuserid"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         DynamicObjectCollection tqq9_bjcg = bill.getDynamicObjectCollection("tqq9_bjcg"); | ||||||
|  |         for (DynamicObject bjcg : tqq9_bjcg) { | ||||||
|  |             long id = bjcg.getLong("fbasedataid.id"); | ||||||
|  |             bjcg = BusinessDataServiceHelper.loadSingle(id, "bd_operator", "id,name,number,operatorid"); | ||||||
|  |             DynamicObject user = bjcg.getDynamicObject("operatorid"); | ||||||
|  |             if(user != null){ | ||||||
|  |                 user = BusinessDataServiceHelper.loadSingle(user.getPkValue(), "bos_user", "tqq9_fwuserid,id,number"); | ||||||
|  |                 zhcg = zhcg + "," + user.getString("tqq9_fwuserid"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         DynamicObjectCollection tqq9_gzcg = bill.getDynamicObjectCollection("tqq9_gzcg"); | ||||||
|  |         for (DynamicObject gzcg : tqq9_gzcg) { | ||||||
|  |             long id = gzcg.getLong("fbasedataid.id"); | ||||||
|  |             gzcg = BusinessDataServiceHelper.loadSingle(id, "bd_operator", "id,name,number,operatorid"); | ||||||
|  |             DynamicObject user = gzcg.getDynamicObject("operatorid"); | ||||||
|  |             if(user != null){ | ||||||
|  |                 user = BusinessDataServiceHelper.loadSingle(user.getPkValue(), "bos_user", "tqq9_fwuserid,id,number"); | ||||||
|  |                 zhcg = zhcg + "," + user.getString("tqq9_fwuserid"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         if(StringUtils.isNotBlank(zhcg)){ | ||||||
|  |             zhcg = zhcg.substring(1); | ||||||
|  |         } | ||||||
|  |         String ywfzr = ""; | ||||||
|  |         DynamicObject tqq9_ywfzr21 = bill.getDynamicObject("tqq9_ywfzr21"); | ||||||
|  |         if(tqq9_ywfzr21 != null){ | ||||||
|  |             tqq9_ywfzr21 = BusinessDataServiceHelper.loadSingle(tqq9_ywfzr21.getPkValue(), "bos_user", "id,name,number,tqq9_fwuserid"); | ||||||
|  |             String tqq9_fwuserid = tqq9_ywfzr21.getString("tqq9_fwuserid"); | ||||||
|  |             if(StringUtils.isNotBlank(tqq9_fwuserid)){ | ||||||
|  |                 ywfzr += "," + tqq9_fwuserid; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         DynamicObject tqq9_ywfzr2 = bill.getDynamicObject("tqq9_ywfzr2"); | ||||||
|  |         if(tqq9_ywfzr2 != null){ | ||||||
|  |             tqq9_ywfzr2 = BusinessDataServiceHelper.loadSingle(tqq9_ywfzr2.getPkValue(), "bos_user", "id,name,number,tqq9_fwuserid"); | ||||||
|  |             String tqq9_fwuserid = tqq9_ywfzr2.getString("tqq9_fwuserid"); | ||||||
|  |             if(StringUtils.isNotBlank(tqq9_fwuserid)){ | ||||||
|  |                 ywfzr += "," + tqq9_fwuserid; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         DynamicObject tqq9_ywfzr3 = bill.getDynamicObject("tqq9_ywfzr3"); | ||||||
|  |         if(tqq9_ywfzr3 != null){ | ||||||
|  |             tqq9_ywfzr3 = BusinessDataServiceHelper.loadSingle(tqq9_ywfzr3.getPkValue(), "bos_user", "id,name,number,tqq9_fwuserid"); | ||||||
|  |             String tqq9_fwuserid = tqq9_ywfzr3.getString("tqq9_fwuserid"); | ||||||
|  |             if(StringUtils.isNotBlank(tqq9_fwuserid)){ | ||||||
|  |                 ywfzr += "," + tqq9_fwuserid; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         if(StringUtils.isNotBlank(ywfzr)){ | ||||||
|  |             ywfzr = ywfzr.substring(1); | ||||||
|  |         } | ||||||
|  |         String zcspmc = bill.getString("tqq9_zccpmc"); | ||||||
|  |         String bzgg = bill.getString("tqq9_bzgg"); | ||||||
|  |         String pp = null; | ||||||
|  |         DynamicObject tqq9_brand = bill.getDynamicObject("tqq9_brand"); | ||||||
|  |         if(tqq9_brand != null){ | ||||||
|  |             pp = tqq9_brand.getString("name"); | ||||||
|  |         } | ||||||
|  |         String ys = bill.getString("tqq9_ys1"); | ||||||
|  |         String ylfl = null; | ||||||
|  |         String tqq9_ylfl = bill.getString("tqq9_ylfl"); | ||||||
|  |         if("一类".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "0"; | ||||||
|  |         }else if("二类".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "1"; | ||||||
|  |         }else if("三类".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "2"; | ||||||
|  |         }else if("三类重点监管".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "3"; | ||||||
|  |         }else if("非医消毒".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "4"; | ||||||
|  |         }else if("非医非消毒".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "5"; | ||||||
|  |         }else if("牙膏".equals(tqq9_ylfl)){ | ||||||
|  |             ylfl = "6"; | ||||||
|  |         } | ||||||
|  |         String spdj = null; | ||||||
|  |         String tqq9_spdj = bill.getString("tqq9_spdj"); | ||||||
|  |         if("A".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "0"; | ||||||
|  |         }else if("B".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "1"; | ||||||
|  |         }else if("C".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "2"; | ||||||
|  |         }else if("D".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "3"; | ||||||
|  |         }else if("E".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "4"; | ||||||
|  |         }else if("NO".equals(tqq9_spdj)){ | ||||||
|  |             spdj = "5"; | ||||||
|  |         } | ||||||
|  |         String ccystj = null; | ||||||
|  |         String tqq9_ccystj = bill.getString("tqq9_ccystj"); | ||||||
|  |         if("0".equals(tqq9_ccystj)){ | ||||||
|  |             ccystj = "0"; | ||||||
|  |         }else if("3".equals(tqq9_ccystj)){ | ||||||
|  |             ccystj = "1"; | ||||||
|  |         }else if("1".equals(tqq9_ccystj)){ | ||||||
|  |             ccystj = "2"; | ||||||
|  |         } | ||||||
|  |         String xxs = null; | ||||||
|  |         DynamicObject taxrate = bill.getDynamicObject("taxrate"); | ||||||
|  |         if(taxrate != null){ | ||||||
|  |             taxrate = BusinessDataServiceHelper.loadSingle(taxrate.getPkValue(), "bd_taxrate", "id,name,number,taxrate"); | ||||||
|  |             BigDecimal value = taxrate.getBigDecimal("taxrate"); | ||||||
|  |             xxs = value.toString(); | ||||||
|  |         } | ||||||
|  |         String ylflml = null; | ||||||
|  |         DynamicObject tqq9_ylflml = bill.getDynamicObject("tqq9_ylflml"); | ||||||
|  |         if(tqq9_ylflml != null){ | ||||||
|  |             ylflml = tqq9_ylflml.getString("name"); | ||||||
|  |         } | ||||||
|  |         String sfqysnmgl = "1"; | ||||||
|  |         boolean tqq9_sfqysnmgl = bill.getBoolean("tqq9_sfqysnmgl"); | ||||||
|  |         if(tqq9_sfqysnmgl){ | ||||||
|  |             sfqysnmgl = "0"; | ||||||
|  |         } | ||||||
|  |         String spfl = null; | ||||||
|  |         DynamicObject tqq9_skutype = bill.getDynamicObject("tqq9_skutype"); | ||||||
|  |         if(tqq9_skutype != null){ | ||||||
|  |             spfl = tqq9_skutype.getString("name"); | ||||||
|  |         } | ||||||
|  |         String ylpfzlpczlp = null; | ||||||
|  |         String tqq9_combofield_spflii = bill.getString("tqq9_combofield_spflii"); | ||||||
|  |         if ("ylp".equals(tqq9_combofield_spflii)){ | ||||||
|  |             ylpfzlpczlp = "0"; | ||||||
|  |         }else if ("fzlp".equals(tqq9_combofield_spflii)){ | ||||||
|  |             ylpfzlpczlp = "1"; | ||||||
|  |         }else if ("czlp".equals(tqq9_combofield_spflii)){ | ||||||
|  |             ylpfzlpczlp = "2"; | ||||||
|  |         } | ||||||
|  |         String djtp = null; | ||||||
|  |         String tqq9_combofield_spfliii = bill.getString("tqq9_combofield_spfliii"); | ||||||
|  |         if ("dj".equals(tqq9_combofield_spfliii)){ | ||||||
|  |             djtp = "0"; | ||||||
|  |         }else if ("tp".equals(tqq9_combofield_spfliii)){ | ||||||
|  |             djtp = "1"; | ||||||
|  |         } | ||||||
|  |         String spytfl = null; | ||||||
|  |         String tqq9_spfliii = bill.getString("tqq9_spfliii"); | ||||||
|  |         if("lp".equals(tqq9_spfliii)){ | ||||||
|  |             spytfl = "0"; | ||||||
|  |         }else if ("zp".equals(tqq9_spfliii)){ | ||||||
|  |             spytfl = "1"; | ||||||
|  |         }else if ("hc".equals(tqq9_spfliii)){ | ||||||
|  |             spytfl = "2"; | ||||||
|  |         }else if ("sb".equals(tqq9_spfliii)){ | ||||||
|  |             spytfl = "3"; | ||||||
|  |         } | ||||||
|  |         String wllx = null; | ||||||
|  |         String materialtype = bill.getString("materialtype"); | ||||||
|  |         if("1".equals(materialtype)){ | ||||||
|  |             wllx = "物资"; | ||||||
|  |         }else if ("7".equals(materialtype)){ | ||||||
|  |             wllx = "费用"; | ||||||
|  |         }else if ("8".equals(materialtype)){ | ||||||
|  |             wllx = "资产"; | ||||||
|  |         }else if ("9".equals(materialtype)){ | ||||||
|  |             wllx = "服务"; | ||||||
|  |         }else if ("3".equals(materialtype)){ | ||||||
|  |             wllx = "套件"; | ||||||
|  |         }else if ("2".equals(materialtype)){ | ||||||
|  |             wllx = "虚拟件"; | ||||||
|  |         }else if ("4".equals(materialtype)){ | ||||||
|  |             wllx = "可配置件"; | ||||||
|  |         }else if ("5".equals(materialtype)){ | ||||||
|  |             wllx = "特征件"; | ||||||
|  |         } | ||||||
|  |         String ywzx = ""; | ||||||
|  |         DynamicObjectCollection serviceattribute = bill.getDynamicObjectCollection("serviceattribute"); | ||||||
|  |         for (DynamicObject attribute : serviceattribute) { | ||||||
|  |             long id = attribute.getLong("fbasedataid.id"); | ||||||
|  |             attribute = BusinessDataServiceHelper.loadSingle(id, "bd_serviceattribute", "id,name,number,operatorid"); | ||||||
|  |             String number = attribute.getString("number"); | ||||||
|  |             if("1001".equals(number)){ | ||||||
|  |                 ywzx = ywzx + "," + "0"; | ||||||
|  |             }else if ("2001".equals(number)){ | ||||||
|  |                 ywzx = ywzx + "," + "1"; | ||||||
|  |             }else if ("2002".equals(number)){ | ||||||
|  |                 ywzx = ywzx + "," + "2"; | ||||||
|  |             }else if ("2003".equals(number)){ | ||||||
|  |                 ywzx = ywzx + "," + "3"; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         if(StringUtils.isNotBlank(ywzx)){ | ||||||
|  |             ywzx = ywzx.substring(1); | ||||||
|  |         } | ||||||
|  |         String ym = bill.getString("tqq9_ym"); | ||||||
|  |         String ssbm = null; | ||||||
|  |         DynamicObject tqq9_ssbm = bill.getDynamicObject("tqq9_ssbm"); | ||||||
|  |         if(tqq9_ssbm != null){ | ||||||
|  |             ssbm = tqq9_ssbm.getString("name"); | ||||||
|  |         } | ||||||
|  |         String ybbm = bill.getString("tqq9_ybbm"); | ||||||
|  |         String lsm = bill.getString("tqq9_lsm"); | ||||||
|  |         String uidm = bill.getString("tqq9_udi"); | ||||||
|  |         String cd = null; | ||||||
|  |         DynamicObject tqq9_wlcd1 = bill.getDynamicObject("tqq9_wlcd1"); | ||||||
|  |         if(tqq9_wlcd1 != null){ | ||||||
|  |             cd = tqq9_wlcd1.getString("name"); | ||||||
|  |         } | ||||||
|  |         String cjbm = bill.getString("tqq9_cjbm"); | ||||||
|  |         String scxkzh = bill.getString("tqq9_scxkzh"); | ||||||
|  |         String scxkzgqr = null; | ||||||
|  |         Date tqq9_datefield = bill.getDate("tqq9_datefield"); | ||||||
|  |         if(tqq9_datefield != null){ | ||||||
|  |             scxkzgqr = sdf.format(tqq9_datefield); | ||||||
|  |         } | ||||||
|  |         String sccs = null; | ||||||
|  |         DynamicObject tqq9_sccs = bill.getDynamicObject("tqq9_sccs"); | ||||||
|  |         if(tqq9_sccs != null){ | ||||||
|  |             sccs = tqq9_sccs.getString("name"); | ||||||
|  |         } | ||||||
|  |         String sccslxfs = bill.getString("tqq9_sccslxfs"); | ||||||
|  |         String scqydz = bill.getString("tqq9_scqydz"); | ||||||
|  |         String scdz = bill.getString("tqq9_scdz1"); | ||||||
|  |         String zczh = bill.getString("tqq9_zczh"); | ||||||
|  |         String tjdw = null; | ||||||
|  |         DynamicObject volumnunit = bill.getDynamicObject("volumnunit"); | ||||||
|  |         if(volumnunit != null){ | ||||||
|  |             tjdw = volumnunit.getString("name"); | ||||||
|  |         } | ||||||
|  |         String tj = null; | ||||||
|  |         BigDecimal volume = bill.getBigDecimal("volume"); | ||||||
|  |         if(volume != null){ | ||||||
|  |             tj = volume.toString(); | ||||||
|  |         } | ||||||
|  |         String ccdw = null; | ||||||
|  |         DynamicObject lengthunit = bill.getDynamicObject("lengthunit"); | ||||||
|  |         if(lengthunit != null){ | ||||||
|  |             ccdw = lengthunit.getString("name"); | ||||||
|  |         } | ||||||
|  |         String kd = null; | ||||||
|  |         BigDecimal width = bill.getBigDecimal("width"); | ||||||
|  |         if(width != null){ | ||||||
|  |             kd = width.toString(); | ||||||
|  |         } | ||||||
|  |         String cd2 = null; | ||||||
|  |         BigDecimal length = bill.getBigDecimal("length"); | ||||||
|  |         if(length != null){ | ||||||
|  |             cd2 = length.toString(); | ||||||
|  |         } | ||||||
|  |         String gd = null; | ||||||
|  |         BigDecimal height = bill.getBigDecimal("height"); | ||||||
|  |         if(height != null){ | ||||||
|  |             gd = height.toString(); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         //单头赋值 | ||||||
|  |         JSONObject m1 = new JSONObject(); | ||||||
|  |         m1.put("fieldName", "KDBillType"); | ||||||
|  |         m1.put("fieldValue", "bd_material"); | ||||||
|  |         JSONObject m2 = new JSONObject(); | ||||||
|  |         m2.put("fieldName", "sqr"); | ||||||
|  |         m2.put("fieldValue", sqr); | ||||||
|  |         JSONObject m3 = new JSONObject(); | ||||||
|  |         m3.put("fieldName", "bm"); | ||||||
|  |         m3.put("fieldValue", bm); | ||||||
|  |         JSONObject m4 = new JSONObject(); | ||||||
|  |         m4.put("fieldName", "sqrq"); | ||||||
|  |         m4.put("fieldValue", sqrq); | ||||||
|  |         JSONObject m5 = new JSONObject(); | ||||||
|  |         m5.put("fieldName", "ywgz"); | ||||||
|  |         m5.put("fieldValue", ywgz); | ||||||
|  |         JSONObject m6 = new JSONObject(); | ||||||
|  |         m6.put("fieldName", "wlmc"); | ||||||
|  |         m6.put("fieldValue", wlmc); | ||||||
|  |         JSONObject m7 = new JSONObject(); | ||||||
|  |         m7.put("fieldName", "lcbh"); | ||||||
|  |         m7.put("fieldValue", lcbh); | ||||||
|  |         JSONObject m8 = new JSONObject(); | ||||||
|  |         m8.put("fieldName", "ggxh"); | ||||||
|  |         m8.put("fieldValue", ggxh); | ||||||
|  |         JSONObject m9 = new JSONObject(); | ||||||
|  |         m9.put("fieldName", "jbdw"); | ||||||
|  |         m9.put("fieldValue", jbdw); | ||||||
|  |         JSONObject m10 = new JSONObject(); | ||||||
|  |         m10.put("fieldName", "zhcg"); | ||||||
|  |         m10.put("fieldValue", zhcg); | ||||||
|  |         JSONObject m11 = new JSONObject(); | ||||||
|  |         m11.put("fieldName", "ywfzr"); | ||||||
|  |         m11.put("fieldValue", ywfzr); | ||||||
|  |         JSONObject m12 = new JSONObject(); | ||||||
|  |         m12.put("fieldName", "zcspmc"); | ||||||
|  |         m12.put("fieldValue", zcspmc); | ||||||
|  |         JSONObject m13 = new JSONObject(); | ||||||
|  |         m13.put("fieldName", "bzgg"); | ||||||
|  |         m13.put("fieldValue", bzgg); | ||||||
|  |         JSONObject m14 = new JSONObject(); | ||||||
|  |         m14.put("fieldName", "pp"); | ||||||
|  |         m14.put("fieldValue", pp); | ||||||
|  |         JSONObject m15 = new JSONObject(); | ||||||
|  |         m15.put("fieldName", "ys"); | ||||||
|  |         m15.put("fieldValue", ys); | ||||||
|  |         JSONObject m16 = new JSONObject(); | ||||||
|  |         m16.put("fieldName", "ylfl"); | ||||||
|  |         m16.put("fieldValue", ylfl); | ||||||
|  |         JSONObject m17 = new JSONObject(); | ||||||
|  |         m17.put("fieldName", "spdj"); | ||||||
|  |         m17.put("fieldValue", spdj); | ||||||
|  |         JSONObject m18 = new JSONObject(); | ||||||
|  |         m18.put("fieldName", "ccystj"); | ||||||
|  |         m18.put("fieldValue", ccystj); | ||||||
|  |         JSONObject m19 = new JSONObject(); | ||||||
|  |         m19.put("fieldName", "xxs"); | ||||||
|  |         m19.put("fieldValue", xxs); | ||||||
|  |         JSONObject m21 = new JSONObject(); | ||||||
|  |         m21.put("fieldName", "ylflml"); | ||||||
|  |         m21.put("fieldValue", ylflml); | ||||||
|  |         JSONObject m22 = new JSONObject(); | ||||||
|  |         m22.put("fieldName", "sfqysnmgl"); | ||||||
|  |         m22.put("fieldValue", sfqysnmgl); | ||||||
|  |         JSONObject m23 = new JSONObject(); | ||||||
|  |         m23.put("fieldName", "spfl"); | ||||||
|  |         m23.put("fieldValue", spfl); | ||||||
|  |         JSONObject m24 = new JSONObject(); | ||||||
|  |         m24.put("fieldName", "ylpfzlpczlp"); | ||||||
|  |         m24.put("fieldValue", ylpfzlpczlp); | ||||||
|  |         JSONObject m25 = new JSONObject(); | ||||||
|  |         m25.put("fieldName", "djtp"); | ||||||
|  |         m25.put("fieldValue", djtp); | ||||||
|  |         JSONObject m26 = new JSONObject(); | ||||||
|  |         m26.put("fieldName", "spytfl"); | ||||||
|  |         m26.put("fieldValue", spytfl); | ||||||
|  |         JSONObject m27 = new JSONObject(); | ||||||
|  |         m27.put("fieldName", "wllx"); | ||||||
|  |         m27.put("fieldValue", wllx); | ||||||
|  |         JSONObject m28 = new JSONObject(); | ||||||
|  |         m28.put("fieldName", "ywzx"); | ||||||
|  |         m28.put("fieldValue", ywzx); | ||||||
|  |         JSONObject m29 = new JSONObject(); | ||||||
|  |         m29.put("fieldName", "ym"); | ||||||
|  |         m29.put("fieldValue", ym); | ||||||
|  |         JSONObject m31 = new JSONObject(); | ||||||
|  |         m31.put("fieldName", "ssbm"); | ||||||
|  |         m31.put("fieldValue", ssbm); | ||||||
|  |         JSONObject m32 = new JSONObject(); | ||||||
|  |         m32.put("fieldName", "ybbm"); | ||||||
|  |         m32.put("fieldValue", ybbm); | ||||||
|  |         JSONObject m33 = new JSONObject(); | ||||||
|  |         m33.put("fieldName", "lsm"); | ||||||
|  |         m33.put("fieldValue", lsm); | ||||||
|  |         JSONObject m34 = new JSONObject(); | ||||||
|  |         m34.put("fieldName", "uidm"); | ||||||
|  |         m34.put("fieldValue", uidm); | ||||||
|  |         JSONObject m35 = new JSONObject(); | ||||||
|  |         m35.put("fieldName", "cd"); | ||||||
|  |         m35.put("fieldValue", cd); | ||||||
|  |         JSONObject m36 = new JSONObject(); | ||||||
|  |         m36.put("fieldName", "cjbm"); | ||||||
|  |         m36.put("fieldValue", cjbm); | ||||||
|  |         JSONObject m37 = new JSONObject(); | ||||||
|  |         m37.put("fieldName", "scxkzh"); | ||||||
|  |         m37.put("fieldValue", scxkzh); | ||||||
|  |         JSONObject m38 = new JSONObject(); | ||||||
|  |         m38.put("fieldName", "scxkzgqr"); | ||||||
|  |         m38.put("fieldValue", scxkzgqr); | ||||||
|  |         JSONObject m39 = new JSONObject(); | ||||||
|  |         m39.put("fieldName", "sccs"); | ||||||
|  |         m39.put("fieldValue", sccs); | ||||||
|  |         JSONObject m41 = new JSONObject(); | ||||||
|  |         m41.put("fieldName", "sccslxfs"); | ||||||
|  |         m41.put("fieldValue", sccslxfs); | ||||||
|  |         JSONObject m42 = new JSONObject(); | ||||||
|  |         m42.put("fieldName", "scqydz"); | ||||||
|  |         m42.put("fieldValue", scqydz); | ||||||
|  |         JSONObject m43 = new JSONObject(); | ||||||
|  |         m43.put("fieldName", "scdz"); | ||||||
|  |         m43.put("fieldValue", scdz); | ||||||
|  |         JSONObject m44 = new JSONObject(); | ||||||
|  |         m44.put("fieldName", "zczh"); | ||||||
|  |         m44.put("fieldValue", zczh); | ||||||
|  |         JSONObject m45 = new JSONObject(); | ||||||
|  |         m45.put("fieldName", "tjdw"); | ||||||
|  |         m45.put("fieldValue", tjdw); | ||||||
|  |         JSONObject m46 = new JSONObject(); | ||||||
|  |         m46.put("fieldName", "tj"); | ||||||
|  |         m46.put("fieldValue", tj); | ||||||
|  |         JSONObject m47 = new JSONObject(); | ||||||
|  |         m47.put("fieldName", "ccdw"); | ||||||
|  |         m47.put("fieldValue", ccdw); | ||||||
|  |         JSONObject m48 = new JSONObject(); | ||||||
|  |         m48.put("fieldName", "kd"); | ||||||
|  |         m48.put("fieldValue", kd); | ||||||
|  |         JSONObject m49 = new JSONObject(); | ||||||
|  |         m49.put("fieldName", "cd2"); | ||||||
|  |         m49.put("fieldValue", cd2); | ||||||
|  |         JSONObject m51 = new JSONObject(); | ||||||
|  |         m51.put("fieldName", "gd"); | ||||||
|  |         m51.put("fieldValue", gd); | ||||||
|  | 
 | ||||||
|  |         List<JSONObject> mlist = Arrays.asList(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15,m16,m17,m18,m19,m21, | ||||||
|  |                 m22,m23,m24,m25,m26,m27,m28,m29,m31,m32,m33,m34,m35,m36,m37,m38,m39,m41,m42,m43,m44,m45,m46,m47,m48,m49,m51); | ||||||
|  |         JSONArray mainArr = new JSONArray(); | ||||||
|  |         mainArr.addAll(mlist); | ||||||
|  |         String fw_wfid_xzcgdd = ConfigUtils.getThirdConfigByNumber("FW_WFID_XZWL"); | ||||||
|  |         FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); | ||||||
|  |         //如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口 | ||||||
|  |         return fwRestfulUtils.doBillAction(mainArr, null, "物料新增流程", fw_wfid_xzcgdd, lcbh, tqq9_fwrequestid); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue