【泛微盘点新增接口】
This commit is contained in:
		
							parent
							
								
									b77118320b
								
							
						
					
					
						commit
						479af662f4
					
				|  | @ -3342,6 +3342,324 @@ public class FWImpl { | ||||||
|         return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "采购费用申请流程", fw_wfid_zgyfd, billno, tqq9_fwrequestid); |         return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "采购费用申请流程", fw_wfid_zgyfd, billno, tqq9_fwrequestid); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 盘点表推送泛微 | ||||||
|  |      */ | ||||||
|  |     public static String pushFwImInvCountBill(DynamicObject bill) { | ||||||
|  |         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||||||
|  |         String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid");//泛微流程ID | ||||||
|  |         String billno = bill.getString("billno");//流程编号 | ||||||
|  |         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 org = bill.getDynamicObject("org");//库存组织 | ||||||
|  |         String orgNumber = org.getString("number"); | ||||||
|  |         String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);//业务归属 | ||||||
|  | 
 | ||||||
|  |         String kczz = ywgz;//库存组织 | ||||||
|  |         String djlx = null;//单据类型 | ||||||
|  |         DynamicObject billtype = bill.getDynamicObject("billtype");//单据类型 | ||||||
|  |         if (null != billtype) { | ||||||
|  |             djlx = billtype.getString("name"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String zcrq = null;//账存日期 | ||||||
|  |         Date invaccdate = bill.getDate("invaccdate"); | ||||||
|  |         if (null != invaccdate) { | ||||||
|  |             zcrq = sdf.format(invaccdate); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String kgbm = null;// 库管部门 | ||||||
|  |         DynamicObject dept = bill.getDynamicObject("dept"); | ||||||
|  |         if (null != dept) { | ||||||
|  |             String number = dept.getString("number"); | ||||||
|  |             kgbm = FWUtils.getFwOrgNumberByKdOrgNumber(number); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String kgy = null;//库管员 | ||||||
|  |         DynamicObject operator = bill.getDynamicObject("operator"); | ||||||
|  |         if (null != operator) { | ||||||
|  |             DynamicObject kgyUser = BusinessDataServiceHelper.loadSingle("bos_user", "tqq9_fwuserid,id,number", | ||||||
|  |                     new QFilter[]{new QFilter("number", QCP.equals, operator.getString("operatornumber"))}); | ||||||
|  |             kgy = kgyUser.getString("tqq9_fwuserid"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         int sjbftj = 0;//数据备份条件 0-即时库存 1-截止日期库存 | ||||||
|  |         //即时库存	invacc | ||||||
|  |         //截止日期库存 enddateinvacc | ||||||
|  |         String backupcondition = bill.getString("backupcondition"); | ||||||
|  |         if ("invacc".equals(backupcondition)) { | ||||||
|  |             sjbftj = 0; | ||||||
|  |         } else if ("enddateinvacc".equals(backupcondition)) { | ||||||
|  |             sjbftj = 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String pdr = null;//盘点人 | ||||||
|  |         DynamicObject checker = bill.getDynamicObject("checker"); | ||||||
|  |         if (null != checker) { | ||||||
|  |             DynamicObject kgyUser = BusinessDataServiceHelper.loadSingle("bos_user", "tqq9_fwuserid,id,number", | ||||||
|  |                     new QFilter[]{new QFilter("number", QCP.equals, checker.getString("operatornumber"))}); | ||||||
|  |             pdr = kgyUser.getString("tqq9_fwuserid"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String fpr = null;//复盘人 | ||||||
|  |         DynamicObject checker2nd = bill.getDynamicObject("checker2nd"); | ||||||
|  |         if (null != checker2nd) { | ||||||
|  |             DynamicObject kgyUser = BusinessDataServiceHelper.loadSingle("bos_user", "tqq9_fwuserid,id,number", | ||||||
|  |                     new QFilter[]{new QFilter("number", QCP.equals, checker2nd.getString("operatornumber"))}); | ||||||
|  |             fpr = kgyUser.getString("tqq9_fwuserid"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String bz = bill.getString("comment");//备注 | ||||||
|  | 
 | ||||||
|  |         int pdszmrzsz = 0;//盘点数值默认值设置 0-账存数量 | ||||||
|  | 
 | ||||||
|  |         String pdfabh = bill.getString("schemenumber");//盘点方案编号 | ||||||
|  |         String pdfamc = bill.getString("schemename");//盘点方案名称 | ||||||
|  |         String pdfs = null; | ||||||
|  |         String counttype = bill.getString("counttype");//盘点方式 	定期盘点 A | ||||||
|  |         if ("A".equals(counttype)) { | ||||||
|  |             pdfs = "定期盘点"; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         //0-是 1-否 | ||||||
|  |         int sfqyfp = 0;//是否启用复盘 | ||||||
|  |         boolean enablecheck = bill.getBoolean("enablecheck"); | ||||||
|  |         if (enablecheck) { | ||||||
|  |             sfqyfp = 0; | ||||||
|  |         } else { | ||||||
|  |             sfqyfp = 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         int sfbdzcy;//是否不调整差异 | ||||||
|  |         boolean nogenotherinout = bill.getBoolean("nogenotherinout"); | ||||||
|  |         if (nogenotherinout) { | ||||||
|  |             sfbdzcy = 0; | ||||||
|  |         } else { | ||||||
|  |             sfbdzcy = 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         //取数节点		主表	选择框-下拉框	0-截止日期初始 1-截止日期结存 | ||||||
|  |         //截止日期初始	start | ||||||
|  |         //截止日期结存	end | ||||||
|  |         int qsjd = 0; | ||||||
|  |         String accessnode = bill.getString("accessnode"); | ||||||
|  |         if ("start".equals(accessnode)) { | ||||||
|  |             qsjd = 0; | ||||||
|  |         } else if ("end".equals(accessnode)) { | ||||||
|  |             qsjd = 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         int sfpcbd = 0;//是否排除补单 | ||||||
|  |         boolean excludeenddate = bill.getBoolean("excludeenddate"); | ||||||
|  |         if (excludeenddate) { | ||||||
|  |             sfpcbd = 0; | ||||||
|  |         } else { | ||||||
|  |             sfpcbd = 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         JSONObject detail1 = new JSONObject(); | ||||||
|  |         JSONArray recordsArr1 = new JSONArray(); | ||||||
|  |         DynamicObjectCollection entries = bill.getDynamicObjectCollection("billentry"); | ||||||
|  |         for (DynamicObject entry : entries) { | ||||||
|  |             String wlbm = null;//物料编码 | ||||||
|  |             String wlmc = null;//物料名称 | ||||||
|  |             String ggxh = null;//规格型号 | ||||||
|  |             DynamicObject material = entry.getDynamicObject("material");//物料编码 | ||||||
|  |             if (null != material) { | ||||||
|  |                 wlbm = material.getString("masterid.number"); | ||||||
|  |                 wlmc = material.getString("masterid.number"); | ||||||
|  |                 ggxh = material.getString("masterid.modelnum"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             String ph = entry.getString("lotnumber");//批号 | ||||||
|  |             String scrq = null;//生产日期 | ||||||
|  |             Date producedate = entry.getDate("producedate"); | ||||||
|  |             if (null != producedate) { | ||||||
|  |                 scrq = sdf.format(producedate); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             String dqrq = null;//到期日期 | ||||||
|  |             Date expirydate = entry.getDate("expirydate"); | ||||||
|  |             if (null != expirydate) { | ||||||
|  |                 dqrq = sdf.format(expirydate); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             String jldw = null;//计量单位 | ||||||
|  |             DynamicObject unit = entry.getDynamicObject("unit"); | ||||||
|  |             if (null != unit) { | ||||||
|  |                 jldw = unit.getString("name"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             BigDecimal pdsl = entry.getBigDecimal("qty");//盘点数量 | ||||||
|  |             BigDecimal zcsl = entry.getBigDecimal("qtyacc");//账存数量 | ||||||
|  |             BigDecimal dzsl = entry.getBigDecimal("adjustqty");//调整数量 | ||||||
|  |             BigDecimal fpsl = entry.getBigDecimal("checkqty");//复盘数量 | ||||||
|  |             BigDecimal pysl = entry.getBigDecimal("gainqty");//盘盈数量 | ||||||
|  |             BigDecimal pksl = entry.getBigDecimal("lossqty");//盘亏数量 | ||||||
|  |             String ck = null; | ||||||
|  |             DynamicObject warehouse = entry.getDynamicObject("warehouse");//仓库 | ||||||
|  |             if (null != warehouse) { | ||||||
|  |                 ck = warehouse.getString("number"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             JSONObject e1 = new JSONObject(); | ||||||
|  |             e1.put("fieldName", "wlbm"); | ||||||
|  |             e1.put("fieldValue", wlbm); | ||||||
|  |             JSONObject e2 = new JSONObject(); | ||||||
|  |             e2.put("fieldName", "wlmc"); | ||||||
|  |             e2.put("fieldValue", wlmc); | ||||||
|  |             JSONObject e3 = new JSONObject(); | ||||||
|  |             e3.put("fieldName", "ggxh"); | ||||||
|  |             e3.put("fieldValue", ggxh); | ||||||
|  |             JSONObject e4 = new JSONObject(); | ||||||
|  |             e4.put("fieldName", "ph"); | ||||||
|  |             e4.put("fieldValue", ph); | ||||||
|  |             JSONObject e5 = new JSONObject(); | ||||||
|  |             e5.put("fieldName", "scrq"); | ||||||
|  |             e5.put("fieldValue", scrq); | ||||||
|  |             JSONObject e6 = new JSONObject(); | ||||||
|  |             e6.put("fieldName", "dqrq"); | ||||||
|  |             e6.put("fieldValue", dqrq); | ||||||
|  |             JSONObject e7 = new JSONObject(); | ||||||
|  |             e7.put("fieldName", "jldw"); | ||||||
|  |             e7.put("fieldValue", jldw); | ||||||
|  |             JSONObject e8 = new JSONObject(); | ||||||
|  |             e8.put("fieldName", "pdsl"); | ||||||
|  |             e8.put("fieldValue", pdsl == null || pdsl.compareTo(BigDecimal.ZERO) == 0 ? 0 : pdsl); | ||||||
|  |             JSONObject e9 = new JSONObject(); | ||||||
|  |             e9.put("fieldName", "zcsl"); | ||||||
|  |             e9.put("fieldValue", zcsl == null || zcsl.compareTo(BigDecimal.ZERO) == 0 ? 0 : zcsl); | ||||||
|  |             JSONObject e10 = new JSONObject(); | ||||||
|  |             e10.put("fieldName", "dzsl"); | ||||||
|  |             e10.put("fieldValue", dzsl == null || dzsl.compareTo(BigDecimal.ZERO) == 0 ? 0 : dzsl); | ||||||
|  |             JSONObject e11 = new JSONObject(); | ||||||
|  |             e11.put("fieldName", "fpsl"); | ||||||
|  |             e11.put("fieldValue", fpsl == null || fpsl.compareTo(BigDecimal.ZERO) == 0 ? 0 : fpsl); | ||||||
|  |             JSONObject e12 = new JSONObject(); | ||||||
|  |             e12.put("fieldName", "pysl"); | ||||||
|  |             e12.put("fieldValue", pysl == null || pysl.compareTo(BigDecimal.ZERO) == 0 ? 0 : pysl); | ||||||
|  |             JSONObject e13 = new JSONObject(); | ||||||
|  |             e13.put("fieldName", "pksl"); | ||||||
|  |             e13.put("fieldValue", pksl == null || pksl.compareTo(BigDecimal.ZERO) == 0 ? 0 : pksl); | ||||||
|  |             JSONObject e14 = new JSONObject(); | ||||||
|  |             e14.put("fieldName", "ck"); | ||||||
|  |             e14.put("fieldValue", ck); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             List<JSONObject> elist = Arrays.asList(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14); | ||||||
|  |             JSONArray recordsArr = new JSONArray(); | ||||||
|  |             recordsArr.addAll(elist); | ||||||
|  | 
 | ||||||
|  |             JSONObject recordObj = new JSONObject(); | ||||||
|  |             recordObj.put("recordOrder", 0); | ||||||
|  |             recordObj.put("workflowRequestTableFields", recordsArr); | ||||||
|  |             recordsArr1.add(recordObj); | ||||||
|  |         } | ||||||
|  |         detail1.put("tableDBName", "formtable_main_114_dt1"); | ||||||
|  |         detail1.put("workflowRequestTableRecords", recordsArr1); | ||||||
|  |         if (StringUtils.isNotBlank(tqq9_fwrequestid)) { | ||||||
|  |             detail1.put("deleteAll", "1"); | ||||||
|  |         } | ||||||
|  |         JSONArray detailRootArr = new JSONArray(); | ||||||
|  |         detailRootArr.add(detail1); | ||||||
|  | 
 | ||||||
|  |         //构建主表数据 | ||||||
|  |         JSONObject m1 = new JSONObject();// | ||||||
|  |         m1.put("fieldName", "KDBillType"); | ||||||
|  |         m1.put("fieldValue", "im_invcountbill"); | ||||||
|  |         JSONObject m2 = new JSONObject();// | ||||||
|  |         m2.put("fieldName", "lcbh"); | ||||||
|  |         m2.put("fieldValue", billno); | ||||||
|  |         JSONObject m3 = new JSONObject();// | ||||||
|  |         m3.put("fieldName", "sqr"); | ||||||
|  |         m3.put("fieldValue", sqr); | ||||||
|  |         JSONObject m4 = new JSONObject();// | ||||||
|  |         m4.put("fieldName", "bm"); | ||||||
|  |         m4.put("fieldValue", bm); | ||||||
|  |         JSONObject m5 = new JSONObject();// | ||||||
|  |         m5.put("fieldName", "sqrq"); | ||||||
|  |         m5.put("fieldValue", sqrq); | ||||||
|  |         JSONObject m6 = new JSONObject();// | ||||||
|  |         m6.put("fieldName", "ywgz"); | ||||||
|  |         m6.put("fieldValue", ywgz); | ||||||
|  |         JSONObject m7 = new JSONObject();// | ||||||
|  |         m7.put("fieldName", "kczz"); | ||||||
|  |         m7.put("fieldValue", kczz); | ||||||
|  |         JSONObject m8 = new JSONObject();// | ||||||
|  |         m8.put("fieldName", "djlx"); | ||||||
|  |         m8.put("fieldValue", djlx); | ||||||
|  |         JSONObject m9 = new JSONObject();// | ||||||
|  |         m9.put("fieldName", "zcrq"); | ||||||
|  |         m9.put("fieldValue", zcrq); | ||||||
|  |         JSONObject m10 = new JSONObject();// | ||||||
|  |         m10.put("fieldName", "kgbm"); | ||||||
|  |         m10.put("fieldValue", kgbm); | ||||||
|  |         JSONObject m11 = new JSONObject();// | ||||||
|  |         m11.put("fieldName", "kgy"); | ||||||
|  |         m11.put("fieldValue", kgy); | ||||||
|  |         JSONObject m12 = new JSONObject();// | ||||||
|  |         m12.put("fieldName", "sjbftj"); | ||||||
|  |         m12.put("fieldValue", sjbftj); | ||||||
|  |         JSONObject m13 = new JSONObject();// | ||||||
|  |         m13.put("fieldName", "pdr"); | ||||||
|  |         m13.put("fieldValue", pdr); | ||||||
|  |         JSONObject m14 = new JSONObject();// | ||||||
|  |         m14.put("fieldName", "fpr"); | ||||||
|  |         m14.put("fieldValue", fpr); | ||||||
|  |         JSONObject m15 = new JSONObject();// | ||||||
|  |         m15.put("fieldName", "bz"); | ||||||
|  |         m15.put("fieldValue", bz); | ||||||
|  |         JSONObject m16 = new JSONObject();// | ||||||
|  |         m16.put("fieldName", "pdszmrzsz"); | ||||||
|  |         m16.put("fieldValue", pdszmrzsz); | ||||||
|  |         JSONObject m17 = new JSONObject();// | ||||||
|  |         m17.put("fieldName", "pdfabh"); | ||||||
|  |         m17.put("fieldValue", pdfabh); | ||||||
|  |         JSONObject m18 = new JSONObject();// | ||||||
|  |         m18.put("fieldName", "pdfamc"); | ||||||
|  |         m18.put("fieldValue", pdfamc); | ||||||
|  |         JSONObject m19 = new JSONObject();// | ||||||
|  |         m19.put("fieldName", "pdfs"); | ||||||
|  |         m19.put("fieldValue", pdfs); | ||||||
|  |         JSONObject m20 = new JSONObject();// | ||||||
|  |         m20.put("fieldName", "sfqyfp"); | ||||||
|  |         m20.put("fieldValue", sfqyfp); | ||||||
|  |         JSONObject m21 = new JSONObject();// | ||||||
|  |         m21.put("fieldName", "sfbdzcy"); | ||||||
|  |         m21.put("fieldValue", sfbdzcy); | ||||||
|  |         JSONObject m22 = new JSONObject();// | ||||||
|  |         m22.put("fieldName", "qsjd"); | ||||||
|  |         m22.put("fieldValue", qsjd); | ||||||
|  |         JSONObject m23 = new JSONObject();// | ||||||
|  |         m23.put("fieldName", "sfpcbd"); | ||||||
|  |         m23.put("fieldValue", sfpcbd); | ||||||
|  | 
 | ||||||
|  |         List<JSONObject> mlist = new ArrayList<>(Arrays.asList(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16, | ||||||
|  |                 m17, m18, m19, m20, m21, m22, m23)); | ||||||
|  | 
 | ||||||
|  |         JSONArray mainArr = new JSONArray(); | ||||||
|  |         mainArr.addAll(mlist); | ||||||
|  | 
 | ||||||
|  |         String fw_wfid_pdb = ConfigUtils.getThirdConfigByNumber("FW_WFID_PDB"); | ||||||
|  |         FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); | ||||||
|  |         //如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口 | ||||||
|  |         return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "盘点结果确认审批流程", fw_wfid_pdb, billno, tqq9_fwrequestid); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * 短缺处理推送泛微 |      * 短缺处理推送泛微 | ||||||
|      */ |      */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue