1.付款单保存api插件
2.post工具类修改 3.处理api接收付款处理中 收款方:收款行号、收款人户名缺失问题 4.采购申请修改 5.采购建议报表修改 6.商品批次证件管理及附件上传
This commit is contained in:
		
							parent
							
								
									ea9a8fa630
								
							
						
					
					
						commit
						c20e6f6901
					
				|  | @ -0,0 +1,32 @@ | |||
| package tqq9.lc123.cloud.app.api.plugin; | ||||
| 
 | ||||
| import kd.bos.form.plugin.AbstractFormPlugin; | ||||
| import kd.bos.openapi.api.plugin.ApiSavePlugin; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 动态表单插件 | ||||
|  */ | ||||
| public class PaySaveApiPlugin implements ApiSavePlugin { | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) { | ||||
|         for (Map<String, Object> reqDatum : reqData) { | ||||
|             BigDecimal actpayamt = (BigDecimal) reqDatum.get("actpayamt");//实付金额 | ||||
|             ArrayList<HashMap<String, Object>> entries = new ArrayList<HashMap<String, Object>>(); | ||||
|             HashMap<String, Object> map=new HashMap<>(); | ||||
|             map.put("e_payableamt", actpayamt); | ||||
|             entries.add(map); | ||||
|             reqDatum.put("entry",entries); | ||||
|         } | ||||
|         return ApiSavePlugin.super.preHandleRequestData(reqData); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -20,6 +20,7 @@ import javax.json.JsonObject; | |||
| import java.net.ConnectException; | ||||
| import java.util.Base64; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| public class HttpClient { | ||||
|     private static String URL; | ||||
|  | @ -39,7 +40,7 @@ public class HttpClient { | |||
|     private static RestTemplate restTemplate = new RestTemplate(); | ||||
|     private final static Log logger = LogFactory.getLog(HttpClient.class); | ||||
| 
 | ||||
|     public static ResponseEntity doPost(String url, Object body,String token_name ,String token_access) throws ConnectException { | ||||
|     public static ResponseEntity doPost(String url, Object body,String token_name ,String token_access,HashMap<String,String> queryMap) throws ConnectException { | ||||
|         HttpHeaders headers = new HttpHeaders(); | ||||
|         if (StringUtils.isNotBlank(token_access)) { | ||||
|             headers.set(token_name, token_access); | ||||
|  | @ -47,6 +48,12 @@ public class HttpClient { | |||
|         headers.set("Content-Type", "application/json;charset=UTF-8"); | ||||
|         headers.set("Accept", "application/json;charset=UTF-8"); | ||||
|         UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url); | ||||
| 
 | ||||
|         if(!queryMap.isEmpty()){ | ||||
|             for (Map.Entry<String, String> map : queryMap.entrySet()) { | ||||
|                 builder.queryParam(map.getKey(),map.getValue()); | ||||
|             } | ||||
|         } | ||||
|         HttpEntity<String> requestEntity = new HttpEntity(JSON.toJSONString(body), headers); | ||||
|         ResponseEntity<String> responseEntity = restTemplate.exchange(builder.build().toString(), HttpMethod.POST, requestEntity, String.class); | ||||
|         return responseEntity; | ||||
|  | @ -64,7 +71,7 @@ public class HttpClient { | |||
|         headers.set("Authorization", "Basic " + encodedAuth); | ||||
|         HashMap<String, String> body = new HashMap<>(); | ||||
|         body.put("sid","ERP"); | ||||
|         ResponseEntity responseEntity = doPost(URL, body, null, null); | ||||
|         ResponseEntity responseEntity = doPost(URL, body, null, null,null); | ||||
|         Object responseEntityBody = responseEntity.getBody(); | ||||
|         JSONObject jsonObject1 = JSON.parseObject(responseEntity.getBody().toString()); | ||||
|         String accessToken = jsonObject1.get("accessToken").toString(); | ||||
|  |  | |||
|  | @ -0,0 +1,60 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.ap; | ||||
| 
 | ||||
| import com.alibaba.nacos.common.utils.StringUtils; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.PreparePropertysEventArgs; | ||||
| import kd.bos.entity.plugin.args.BeforeOperationArgs; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| /** | ||||
|  * 处理api接收付款处理中 收款方:收款行号、收款人户名缺失问题 | ||||
|  */ | ||||
| public class PayBillFromApiSavePlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
| 
 | ||||
|     @Override | ||||
|     public void onPreparePropertys(PreparePropertysEventArgs e) { | ||||
|         super.onPreparePropertys(e); | ||||
|         e.getFieldKeys().add("tqq9_srcbillno"); | ||||
|         e.getFieldKeys().add("tqq9_srcsystem"); | ||||
|         e.getFieldKeys().add("recaccbankname"); | ||||
|         e.getFieldKeys().add("payeename"); | ||||
|         e.getFieldKeys().add("payeebank"); | ||||
|         e.getFieldKeys().add("recbanknumber"); | ||||
|         e.getFieldKeys().add("recprovince"); | ||||
|         e.getFieldKeys().add("reccity"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeExecuteOperationTransaction(BeforeOperationArgs e) { | ||||
|         super.beforeExecuteOperationTransaction(e); | ||||
|         DynamicObject[] bills = e.getDataEntities(); | ||||
|         for (DynamicObject bill : bills) { | ||||
|             String srcBillNo = bill.getString("tqq9_srcbillno"); | ||||
|             String srcSysName = bill.getString("tqq9_srcsystem"); | ||||
|             if (StringUtils.isBlank(srcSysName) || StringUtils.isBlank(srcBillNo)){ | ||||
|                 continue; | ||||
|             } | ||||
|             String recAccBankName = bill.getString("recaccbankname");//收款人户名(收款人实名) | ||||
|             String payeeName = bill.getString("payeename");//收款人名称 | ||||
|             if(StringUtils.isBlank(recAccBankName) && StringUtils.isNotBlank(payeeName)){ | ||||
|                 bill.set("recaccbankname", payeeName); | ||||
|             } | ||||
|             DynamicObject payeeBank = bill.getDynamicObject("payeebank");//收款银行 | ||||
|             String recBankNumber = bill.getString("recbanknumber");//收款行号 | ||||
|             if(payeeBank != null && StringUtils.isBlank(recBankNumber)){ | ||||
|                 bill.set("recbanknumber", payeeBank.getString("number")); | ||||
|             } | ||||
|             String provinceTxt = payeeBank.getString("provincetxt");//省份(银企) | ||||
|             String cityTxt = payeeBank.getString("citytxt");//城市(银企) | ||||
|             String recProvince = bill.getString("recprovince"); | ||||
|             String recCity = bill.getString("reccity"); | ||||
|             if (StringUtils.isBlank(recProvince) && StringUtils.isNotBlank(provinceTxt)){ | ||||
|                 bill.set("recprovince", provinceTxt); | ||||
|             } | ||||
|             if (StringUtils.isBlank(recCity) && StringUtils.isNotBlank(cityTxt)){ | ||||
|                 bill.set("reccity", cityTxt); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -87,7 +87,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { | |||
|         if (StringUtils.equals("tqq9_sup_bj", name)) { | ||||
|             DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_bj, model); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model); | ||||
|             String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1"); | ||||
|             model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1); | ||||
|             view.updateView(); | ||||
|  | @ -96,42 +96,42 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { | |||
|         if (StringUtils.equals("tqq9_rewares_bj", name)) { | ||||
|             DynamicObject tqq9_rewares_bj = (DynamicObject) model.getValue("tqq9_rewares_bj"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "warehouse", tqq9_rewares_bj, model); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "warehouse", tqq9_rewares_bj, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //采购数量 | ||||
|         if (StringUtils.equals("applyqty", name)) { | ||||
|             BigDecimal applyqty = (BigDecimal) model.getValue("applyqty"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.sumEntrByOrg(SH_ORGNUMBER, "applyqty", "tqq9_purqty_bj", model); | ||||
|             entryFieldRefresher.sumEntrByOrg(BJ_ORGNUMBER, "applyqty", "tqq9_purqty_bj", model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //应付金额 | ||||
|         if (StringUtils.equals("tqq9_yfje", name)) { | ||||
|             BigDecimal tqq9_yfje = (BigDecimal) model.getValue("tqq9_yfje"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.sumEntrByOrg(SH_ORGNUMBER, "tqq9_yfje", "tqq9_payamount_bj", model); | ||||
|             entryFieldRefresher.sumEntrByOrg(BJ_ORGNUMBER, "tqq9_yfje", "tqq9_payamount_bj", model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //优惠金额_单头 | ||||
|         if (StringUtils.equals("tqq9_discountamt_bj", name)) { | ||||
|             BigDecimal tqq9_discountamt_bj = (BigDecimal) model.getValue("tqq9_discountamt_bj"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_bj, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //货返_单头 | ||||
|         if (StringUtils.equals("tqq9_hshfsyje_bj", name)) { | ||||
|             BigDecimal tqq9_hshfsyje_bj = (BigDecimal) model.getValue("tqq9_hshfsyje_bj"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_bj, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //现返_单头 | ||||
|         if (StringUtils.equals("tqq9_hsxfsyje_bj", name)) { | ||||
|             BigDecimal tqq9_hsxfsyje_bj = (BigDecimal) model.getValue("tqq9_hsxfsyje_bj"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_bj, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //--------------广州------------------ | ||||
|  | @ -139,7 +139,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { | |||
|         if (StringUtils.equals("tqq9_sup_gz", name)) { | ||||
|             DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_gz, model); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model); | ||||
|             String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1"); | ||||
|             model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1); | ||||
|             view.updateView(); | ||||
|  | @ -148,46 +148,46 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { | |||
|         if (StringUtils.equals("tqq9_rewares_gz", name)) { | ||||
|             DynamicObject tqq9_rewares_gz = (DynamicObject) model.getValue("tqq9_rewares_gz"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "warehouse", tqq9_rewares_gz, model); | ||||
|             entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "warehouse", tqq9_rewares_gz, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //采购数量 | ||||
|         if (StringUtils.equals("applyqty", name)) { | ||||
|             BigDecimal applyqty = (BigDecimal) model.getValue("applyqty"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.sumEntrByOrg(SH_ORGNUMBER, "applyqty", "tqq9_purqty_gz", model); | ||||
|             entryFieldRefresher.sumEntrByOrg(GZ_ORGNUMBER, "applyqty", "tqq9_purqty_gz", model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //应付金额 | ||||
|         if (StringUtils.equals("tqq9_yfje", name)) { | ||||
|             BigDecimal tqq9_yfje = (BigDecimal) model.getValue("tqq9_yfje"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.sumEntrByOrg(SH_ORGNUMBER, "tqq9_yfje", "tqq9_payamount_gz", model); | ||||
|             entryFieldRefresher.sumEntrByOrg(GZ_ORGNUMBER, "tqq9_yfje", "tqq9_payamount_gz", model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //优惠金额_单头 | ||||
|         if (StringUtils.equals("tqq9_discountamt_gz", name)) { | ||||
|             BigDecimal tqq9_discountamt_gz = (BigDecimal) model.getValue("tqq9_discountamt_gz"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_gz, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //货返_单头 | ||||
|         if (StringUtils.equals("tqq9_hshfsyje_gz", name)) { | ||||
|             BigDecimal tqq9_hshfsyje_gz = (BigDecimal) model.getValue("tqq9_hshfsyje_gz"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_gz, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //现返_单头 | ||||
|         if (StringUtils.equals("tqq9_hsxfsyje_gz", name)) { | ||||
|             BigDecimal tqq9_hsxfsyje_gz = (BigDecimal) model.getValue("tqq9_hsxfsyje_gz"); | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model); | ||||
|             view.updateView(); | ||||
|         } | ||||
|         //分录优惠金额,现返,货返金额分摊 | ||||
|         if (StringUtils.equals("totalallamount", name)) { | ||||
|         if (StringUtils.equals("tqq9_amount", name)) { | ||||
|             EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); | ||||
|             BigDecimal tqq9_discountamt_sh = (BigDecimal) model.getValue("tqq9_discountamt_sh"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_sh, model); | ||||
|  | @ -196,17 +196,17 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { | |||
|             BigDecimal tqq9_hsxfsyje_sh = (BigDecimal) model.getValue("tqq9_hsxfsyje_sh"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_sh, model); | ||||
|             BigDecimal tqq9_discountamt_bj = (BigDecimal) model.getValue("tqq9_discountamt_bj"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_bj, model); | ||||
|             BigDecimal tqq9_hshfsyje_bj = (BigDecimal) model.getValue("tqq9_hshfsyje_bj"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_bj, model); | ||||
|             BigDecimal tqq9_hsxfsyje_bj = (BigDecimal) model.getValue("tqq9_hsxfsyje_bj"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_bj, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(BJ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_bj, model); | ||||
|             BigDecimal tqq9_discountamt_gz = (BigDecimal) model.getValue("tqq9_discountamt_gz"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_disamount", tqq9_discountamt_gz, model); | ||||
|             BigDecimal tqq9_hshfsyje_gz = (BigDecimal) model.getValue("tqq9_hshfsyje_gz"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_hfamount", tqq9_hshfsyje_gz, model); | ||||
|             BigDecimal tqq9_hsxfsyje_gz = (BigDecimal) model.getValue("tqq9_hsxfsyje_gz"); | ||||
|             entryFieldRefresher.updateAmountByOrg(SH_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model); | ||||
|             entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -148,7 +148,7 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi | |||
| 
 | ||||
|             //商城商品 | ||||
|             String goodspackagesql = "/*dialect*/select t1.fid tqq9_sku,t1.fk_tqq9_isauto tqq9_isauto,t1.fk_tqq9_mater tqq9_material,t1.fk_tqq9_skuno tqq9_sku_lc,t1.fcreateorgid tqq9_org,\n" + | ||||
|                     "t1.fk_tqq9_purchaser tqq9_purchaser,t1.fk_tqq9_onsale tqq9_onsale ,t1.fk_tqq9_totalupstock tqq9_totalupstock from tk_tqq9_goodspackage t1\n"; | ||||
|                     "t1.fk_tqq9_purchaser tqq9_purchaser,t1.fk_tqq9_onsale tqq9_onsale ,t1.fk_tqq9_totalupstock tqq9_totalupstock from tk_tqq9_goodspackage t1 where fstatus ='C' \n"; | ||||
|             //即时库存表 | ||||
|             String realbalancesql = "/*dialect*//*dialect*/select '1' tqq9_isauto,fmaterialid tqq9_material,forgid tqq9_org,sum(case when forgid=" + sh + " then fqty else 0 end) tqq9_shinventory, \n" + | ||||
|                     "sum(case when forgid=" + bj + " then fqty else 0 end) tqq9_bjinventory,sum(case when forgid=" + gz + " then fqty else 0 end) tqq9_gzinventory,\n" + | ||||
|  |  | |||
|  | @ -0,0 +1,57 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.sys; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.utils.StringUtils; | ||||
| import kd.bos.form.CloseCallBack; | ||||
| import kd.bos.form.FormShowParameter; | ||||
| import kd.bos.form.ShowType; | ||||
| import kd.bos.form.control.events.ItemClickEvent; | ||||
| import kd.bos.form.events.ClosedCallBackEvent; | ||||
| import kd.bos.list.plugin.AbstractListPlugin; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
| import java.util.HashMap; | ||||
| 
 | ||||
| /** | ||||
|  * 商品批次注册证管理界面插件 | ||||
|  */ | ||||
| public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugin { | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         this.addItemClickListeners("tbmain"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void itemClick(ItemClickEvent evt) { | ||||
|         super.itemClick(evt); | ||||
|         String itemKey = evt.getItemKey(); | ||||
|         if (StringUtils.equals(itemKey,"tqq9_lotchecktb")||StringUtils.equals(itemKey,"tqq9_customchecktb")) { | ||||
|             FormShowParameter param = new FormShowParameter(); | ||||
|             param.setFormId("tqq9_upattachment"); | ||||
|             param.setCloseCallBack(new CloseCallBack(this, "tqq9_upattachment")); | ||||
|             param.getOpenStyle().setShowType(ShowType.Modal); | ||||
|             this.getView().showForm(param); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { | ||||
|         super.closedCallBack(closedCallBackEvent); | ||||
|         String actionId = closedCallBackEvent.getActionId(); | ||||
|         Object returnData = closedCallBackEvent.getReturnData(); | ||||
|         if (returnData != null) { | ||||
|             if ("tqq9_upattachment".equals(actionId)) { | ||||
| 
 | ||||
|                 DynamicObject data = (DynamicObject) ((HashMap) returnData).get("data"); | ||||
| //                model.setValue("tqq9_paybillno", dynamicObject.getString("billno"));//付款单 | ||||
| //                model.setValue("joinpayamount", unsettleamount, seq);//关联付款金额 | ||||
| //                model.setValue("paidamount", unsettleamount, seq);//已付金额 | ||||
| //                model.setValue("tqq9_settleamount", unsettleamount, seq);//本次结算金额 | ||||
|                 getView().updateView(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,37 @@ | |||
| package tqq9.lc123.cloud.app.plugin.form.sys; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.form.control.Control; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.EventObject; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 附件上传界面插件 | ||||
|  */ | ||||
| public class upattAchmentBillPlugin extends AbstractBillPlugIn implements Plugin { | ||||
| 
 | ||||
|     @Override | ||||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         this.addClickListeners("btnok"); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public void click(EventObject evt) { | ||||
|         super.click(evt); | ||||
|         Control control = (Control) evt.getSource(); | ||||
|         if ("btnok".equals(control.getKey())) { | ||||
|             Map<String, Object> data = new HashMap<>(); | ||||
|             data.put("tqq9_attachmentpanelap", this.getModel().getValue("tqq9_attachmentpanelap")); | ||||
| //            data.put("query_project", this.getModel().getValue("rbkj_project")); | ||||
| //            data.put("isContinue", true); | ||||
|             this.getView().returnDataToParent(data); | ||||
|             this.getView().close(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,81 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.im; | ||||
| 
 | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.DynamicObjectCollection; | ||||
| import kd.bos.entity.plugin.AbstractOperationServicePlugIn; | ||||
| import kd.bos.entity.plugin.args.AfterOperationArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 采购入库反写批次注册证管理 | ||||
|  */ | ||||
| public class PurInIotManagePlugin extends AbstractOperationServicePlugIn implements Plugin { | ||||
|     private final static Log logger = LogFactory.getLog(PurInIotManagePlugin.class); | ||||
| 
 | ||||
|     @Override | ||||
|     public void afterExecuteOperationTransaction(AfterOperationArgs e) { | ||||
|         super.afterExecuteOperationTransaction(e); | ||||
|         //物料Map | ||||
|         DynamicObject[] materials = BusinessDataServiceHelper.load("bd_material", "id,number,name,tqq9_brand,baseunit,tqq9_brand", null); | ||||
|         HashMap<Long, DynamicObject> materialMap = new HashMap<Long, DynamicObject>(); | ||||
|         for (DynamicObject dynamicObject : materials) { | ||||
|             materialMap.put(dynamicObject.getLong("id"), dynamicObject); | ||||
|         } | ||||
|         for (DynamicObject dataEntity : e.getDataEntities()) { | ||||
|             String billno = dataEntity.getString("billno"); | ||||
|             QFilter qFilter = new QFilter("billno", QCP.equals, billno); | ||||
|             DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("im_purinbill",qFilter.toArray()); | ||||
|             DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry"); | ||||
|             DynamicObject[] tqq9_goodlotmanages=new DynamicObject[billentry.size()]; | ||||
|             boolean falg=false; | ||||
|             for (int i = 0; i < billentry.size(); i++) { | ||||
|                 DynamicObject entry = billentry.get(i); | ||||
|                 DynamicObject tqq9_goodlotmanage = BusinessDataServiceHelper.newDynamicObject("tqq9_goodlotmanage"); | ||||
|                 Date producedate = entry.getDate("producedate");//生产日期 | ||||
|                 Date expirydate = entry.getDate("expirydate");//到期日期 | ||||
|                 String lotnumber = entry.getString("lotnumber");//批号 | ||||
|                 DynamicObject tqq9_registration = entry.getDynamicObject("tqq9_registration");//商品注册证 | ||||
|                 DynamicObject materialpurch = entry.getDynamicObject("material");//物料采购信息 | ||||
|                 DynamicObject masterid = materialpurch.getDynamicObject("masterid");//物料id | ||||
|                 DynamicObject material = materialMap.get(masterid.getLong("id"));//物料 | ||||
|                 DynamicObject tqq9_brand = material.getDynamicObject("tqq9_brand");//商品品牌 | ||||
|                 String number = material.getString("number");//商品编码 | ||||
|                 String name = null; | ||||
|                 if(tqq9_registration!=null){ | ||||
|                     name=tqq9_registration.getString("name"); | ||||
|                 } | ||||
|                 tqq9_goodlotmanage.set("number",number);//商品编码 | ||||
|                 tqq9_goodlotmanage.set("tqq9_lot",lotnumber);//批号 | ||||
| 
 | ||||
|                 tqq9_goodlotmanage.set("name",name);//商品注册证名称 | ||||
|                 tqq9_goodlotmanage.set("tqq9_brand",tqq9_brand);//商品品牌 | ||||
|                 tqq9_goodlotmanage.set("tqq9_crreatdate",producedate);//生产日期 | ||||
|                 tqq9_goodlotmanage.set("tqq9_invaliddate",expirydate);//到期日期 | ||||
|                 tqq9_goodlotmanage.set("status","C");//数据状态 | ||||
|                 tqq9_goodlotmanage.set("enable","1");//使用状态 | ||||
|                 QFilter goodlotmanageF = new QFilter("number", QCP.equals,number); | ||||
|                 goodlotmanageF=goodlotmanageF.and(new QFilter("tqq9_lot", QCP.equals,lotnumber)); | ||||
|                 DynamicObject tqq9_goodlotmanage1 = BusinessDataServiceHelper.loadSingle("tqq9_goodlotmanage",goodlotmanageF.toArray()); | ||||
|                 if(tqq9_goodlotmanage1==null){ | ||||
|                     falg=true; | ||||
|                     tqq9_goodlotmanages[i]=tqq9_goodlotmanage; | ||||
|                 } | ||||
|             } | ||||
|             if(falg){ | ||||
|                 SaveServiceHelper.save(tqq9_goodlotmanages); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  | @ -77,14 +77,12 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI | |||
|                 if (!pushResult.isSuccess()) { | ||||
|                     for (SourceBillReport billReport : billReports) { | ||||
|                         String billNo = billReport.getBillNo(); | ||||
|                         isSuccess = false; | ||||
|                         String billMessage = billReport.getFailMessage(); | ||||
|                         errorMsg.append("采购订单:" + billNo + "下推失败 ").append(billMessage).append("\r\n"); | ||||
|                     } | ||||
|                 } else { | ||||
|                     for (SourceBillReport billReport : billReports) { | ||||
|                         String billNo = billReport.getBillNo(); | ||||
|                         isSuccess = true; | ||||
|                         errorMsg.append("采购订单:" + billNo + "下推成功 ").append("\r\n"); | ||||
|                     } | ||||
|                     Set<Object> targetBillIds = pushResult.getTargetBillIds(); | ||||
|  | @ -100,7 +98,6 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI | |||
|                     OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, RECEIPTNOTICE, load, option); | ||||
|                     List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo(); | ||||
|                     for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) { | ||||
|                         isSuccess = false; | ||||
|                         String message = iOperateInfo.getMessage(); | ||||
|                         String rebillno = reMap.get(iOperateInfo.getPkValue()); | ||||
|                         errorMsg.append("收货通知单:"+rebillno+"提交失败 ").append(message).append("\r\n"); | ||||
|  | @ -114,11 +111,6 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI | |||
|                     } | ||||
|                 } | ||||
|                 operationResult1.setMessage(errorMsg.toString()); | ||||
| //                if (isSuccess) { | ||||
| //                    operationResult1.setMessage("补货成功"); | ||||
| //                } else { | ||||
| //                    operationResult1.setMessage(errorMsg.toString()); | ||||
| //                } | ||||
|                 operationResult1.setShowMessage(false); | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -65,7 +65,7 @@ public class EntryFieldRefresher { | |||
|      * @param model      单据实体 | ||||
|      */ | ||||
|     public void updateAmountByOrg(String org, String entityname, BigDecimal amount, IDataModel model) { | ||||
|         if (amount.compareTo(BigDecimal.ZERO) > 0) { | ||||
|         if (amount.compareTo(BigDecimal.ZERO) >= 0) { | ||||
|             DynamicObjectCollection entries = model.getDataEntity(true).getDynamicObjectCollection("billentry"); | ||||
|             if (entries != null && entries.size() > 0) { | ||||
|                 BigDecimal remainRefundAmt = amount;//拆分后剩余的金额 | ||||
|  | @ -75,9 +75,9 @@ public class EntryFieldRefresher { | |||
|                     DynamicObject entry = entries.get(i); | ||||
|                     DynamicObject entryrecorg = entry.getDynamicObject("entryrecorg");//收货组织 | ||||
|                     if (StringUtils.equals(org, entryrecorg.getString("number"))) { | ||||
|                         BigDecimal amountandtax = entry.getBigDecimal("amountandtax");//价税合计 | ||||
|                         tqq9_totalamount = tqq9_totalamount.add(amountandtax); | ||||
|                         if (amountandtax.compareTo(BigDecimal.ZERO) > 0) { | ||||
|                         BigDecimal tqq9_amount = entry.getBigDecimal("tqq9_amount");//价税合计 | ||||
|                         tqq9_totalamount = tqq9_totalamount.add(tqq9_amount); | ||||
|                         if (tqq9_amount.compareTo(BigDecimal.ZERO) > 0) { | ||||
|                             seqs.add(i); | ||||
|                         } | ||||
|                     } | ||||
|  | @ -89,11 +89,11 @@ public class EntryFieldRefresher { | |||
|                         model.setValue(entityname, remainRefundAmt, seq);//明细金额 | ||||
|                     } else { | ||||
|                         //如果不是最后一行 | ||||
|                         BigDecimal amountandtax = (BigDecimal) model.getValue("amountandtax", seq);//价税合计 | ||||
|                         if (amountandtax.compareTo(BigDecimal.ZERO) == 0) { | ||||
|                         BigDecimal tqq9_amount = (BigDecimal) model.getValue("tqq9_amount", seq);//价税合计 | ||||
|                         if (tqq9_amount.compareTo(BigDecimal.ZERO) == 0) { | ||||
|                             model.setValue(entityname, BigDecimal.ZERO, seq);//明细金额 | ||||
|                         } else { | ||||
|                             BigDecimal tqq9_disamount = amount.multiply(amountandtax).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例 | ||||
|                             BigDecimal tqq9_disamount = amount.multiply(tqq9_amount).divide(tqq9_totalamount, 10, RoundingMode.HALF_UP);//分录行含税金额比例 | ||||
|                             model.setValue(entityname, tqq9_disamount, seq);//明细金额 | ||||
|                             remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount); | ||||
|                         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue