1.采购订单供应商带出现返货返总金额及可用金额(调用返利系统的余额查询接口)
2.采购申请单上海,北京,广州三地供应商带出现返货返总金额及可用金额(调用返利系统的余额查询接口) 3.采购建议报表下推采购申请单,携带最高采购限价并进行校验
This commit is contained in:
parent
a392dbd8cc
commit
813db84485
|
|
@ -1,20 +1,40 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.form.pm;
|
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.datamodel.IDataModel;
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.IFormView;
|
import kd.bos.form.IFormView;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||||
|
import tqq9.lc123.cloud.app.api.utils.HttpClient;
|
||||||
import tqq9.lc123.cloud.app.plugin.utils.EntryFieldRefresher;
|
import tqq9.lc123.cloud.app.plugin.utils.EntryFieldRefresher;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.net.ConnectException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单据界面插件
|
* 单据界面插件
|
||||||
*/
|
*/
|
||||||
public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
private static String URL;
|
||||||
|
static {
|
||||||
|
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
||||||
|
new QFilter[]{new QFilter("number", QCP.equals, "FLXT_Balance_Url")});
|
||||||
|
URL = url != null ? url.getString("name") : null;
|
||||||
|
}
|
||||||
|
private final static String ENTRYENTITY = "billentry";
|
||||||
|
|
||||||
private final static String SH_ORGNUMBER = "SHLC";
|
private final static String SH_ORGNUMBER = "SHLC";
|
||||||
|
|
||||||
private final static String BJ_ORGNUMBER = "BJLC";
|
private final static String BJ_ORGNUMBER = "BJLC";
|
||||||
|
|
@ -32,11 +52,41 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
//--------------上海------------------
|
//--------------上海------------------
|
||||||
//集采供应商
|
//集采供应商
|
||||||
if (StringUtils.equals("tqq9_sup_sh", name)) {
|
if (StringUtils.equals("tqq9_sup_sh", name)) {
|
||||||
DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_sh");
|
DynamicObject tqq9_sup_sh = (DynamicObject) model.getValue("tqq9_sup_sh");//供应商
|
||||||
|
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, SH_ORGNUMBER)});
|
||||||
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
||||||
entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_bj, model);
|
entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_sh, model);
|
||||||
String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1");
|
String tqq9_mulcombofield1 = tqq9_sup_sh.getString("tqq9_mulcombofield1");
|
||||||
model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1);
|
model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1);
|
||||||
|
HashMap<String,String> queryMap =new HashMap<>();
|
||||||
|
queryMap.put("supplierId",tqq9_sup_sh.getString("number"));
|
||||||
|
queryMap.put("companyId",org.getString("number"));
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
ResponseEntity responseEntity = HttpClient.sendRequest(URL, null, "Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3", queryMap, Constants.GET);
|
||||||
|
String jsonString = responseEntity.getBody().toString();
|
||||||
|
HashMap map = gson.fromJson(jsonString, HashMap.class);
|
||||||
|
ArrayList<Map<String, Object>> data = (ArrayList) map.get("data");
|
||||||
|
if(data!=null){
|
||||||
|
for (Map datum : data) {
|
||||||
|
Map<String, Object> dataMap = datum;
|
||||||
|
String type = dataMap.get("type").toString();//类型
|
||||||
|
BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额
|
||||||
|
BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额
|
||||||
|
if(StringUtils.equals(type,"1.0")){
|
||||||
|
//货返
|
||||||
|
model.setValue("tqq9_hshfzje_sh",totalMoney);//含税货返总金额
|
||||||
|
model.setValue("tqq9_hshfkyje_sh",totalMoneyAvailable);//含税货返可用金额
|
||||||
|
}else if(StringUtils.equals(type,"0.0")){
|
||||||
|
//现返
|
||||||
|
model.setValue("tqq9_hsxfzje_sh",totalMoney);//含税现返总金额
|
||||||
|
model.setValue("tqq9_hsxfkyje_sh",totalMoneyAvailable);//含税现返可用金额
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ConnectException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
view.updateView();
|
view.updateView();
|
||||||
}
|
}
|
||||||
//收货仓库
|
//收货仓库
|
||||||
|
|
@ -85,10 +135,40 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
//集采供应商
|
//集采供应商
|
||||||
if (StringUtils.equals("tqq9_sup_bj", name)) {
|
if (StringUtils.equals("tqq9_sup_bj", name)) {
|
||||||
DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj");
|
DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj");
|
||||||
|
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, BJ_ORGNUMBER)});
|
||||||
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
||||||
entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model);
|
entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model);
|
||||||
String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1");
|
String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1");
|
||||||
model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1);
|
model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1);
|
||||||
|
HashMap<String,String> queryMap =new HashMap<>();
|
||||||
|
queryMap.put("supplierId",tqq9_sup_bj.getString("number"));
|
||||||
|
queryMap.put("companyId",org.getString("number"));
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
ResponseEntity responseEntity = HttpClient.sendRequest(URL, null, "Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3", queryMap, Constants.GET);
|
||||||
|
String jsonString = responseEntity.getBody().toString();
|
||||||
|
HashMap map = gson.fromJson(jsonString, HashMap.class);
|
||||||
|
ArrayList<Map<String, Object>> data = (ArrayList) map.get("data");
|
||||||
|
if(data!=null){
|
||||||
|
for (Map datum : data) {
|
||||||
|
Map<String, Object> dataMap = datum;
|
||||||
|
String type = dataMap.get("type").toString();//类型
|
||||||
|
BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额
|
||||||
|
BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额
|
||||||
|
if(StringUtils.equals(type,"1.0")){
|
||||||
|
//货返
|
||||||
|
model.setValue("tqq9_hshfzje_bj",totalMoney);//含税货返总金额
|
||||||
|
model.setValue("tqq9_hshfkyje_bj",totalMoneyAvailable);//含税货返可用金额
|
||||||
|
}else if(StringUtils.equals(type,"0.0")){
|
||||||
|
//现返
|
||||||
|
model.setValue("tqq9_hsxfzje_bj",totalMoney);//含税现返总金额
|
||||||
|
model.setValue("tqq9_hsxfkyje_bj",totalMoneyAvailable);//含税现返可用金额
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ConnectException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
view.updateView();
|
view.updateView();
|
||||||
}
|
}
|
||||||
//收货仓库
|
//收货仓库
|
||||||
|
|
@ -137,10 +217,40 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
//集采供应商
|
//集采供应商
|
||||||
if (StringUtils.equals("tqq9_sup_gz", name)) {
|
if (StringUtils.equals("tqq9_sup_gz", name)) {
|
||||||
DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz");
|
DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz");
|
||||||
|
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, GZ_ORGNUMBER)});
|
||||||
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
||||||
entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model);
|
entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model);
|
||||||
String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1");
|
String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1");
|
||||||
model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1);
|
model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1);
|
||||||
|
HashMap<String,String> queryMap =new HashMap<>();
|
||||||
|
queryMap.put("supplierId",tqq9_sup_gz.getString("number"));
|
||||||
|
queryMap.put("companyId",org.getString("number"));
|
||||||
|
Gson gson = new Gson();
|
||||||
|
try {
|
||||||
|
ResponseEntity responseEntity = HttpClient.sendRequest(URL, null, "Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3", queryMap, Constants.GET);
|
||||||
|
String jsonString = responseEntity.getBody().toString();
|
||||||
|
HashMap map = gson.fromJson(jsonString, HashMap.class);
|
||||||
|
ArrayList<Map<String, Object>> data = (ArrayList) map.get("data");
|
||||||
|
if(data!=null){
|
||||||
|
for (Map datum : data) {
|
||||||
|
Map<String, Object> dataMap = datum;
|
||||||
|
String type = dataMap.get("type").toString();//类型
|
||||||
|
BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额
|
||||||
|
BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额
|
||||||
|
if(StringUtils.equals(type,"1.0")){
|
||||||
|
//货返
|
||||||
|
model.setValue("tqq9_hshfzje_gz",totalMoney);//含税货返总金额
|
||||||
|
model.setValue("tqq9_hshfkyje_gz",totalMoneyAvailable);//含税货返可用金额
|
||||||
|
}else if(StringUtils.equals(type,"0.0")){
|
||||||
|
//现返
|
||||||
|
model.setValue("tqq9_hsxfzje_gz",totalMoney);//含税现返总金额
|
||||||
|
model.setValue("tqq9_hsxfkyje_gz",totalMoneyAvailable);//含税现返可用金额
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ConnectException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
view.updateView();
|
view.updateView();
|
||||||
}
|
}
|
||||||
//收货仓库
|
//收货仓库
|
||||||
|
|
@ -207,6 +317,51 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
BigDecimal tqq9_hsxfsyje_gz = (BigDecimal) model.getValue("tqq9_hsxfsyje_gz");
|
BigDecimal tqq9_hsxfsyje_gz = (BigDecimal) model.getValue("tqq9_hsxfsyje_gz");
|
||||||
entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model);
|
entryFieldRefresher.updateAmountByOrg(GZ_ORGNUMBER, "tqq9_xfamount", tqq9_hsxfsyje_gz, model);
|
||||||
}
|
}
|
||||||
|
//物料带出最高限价
|
||||||
|
if (StringUtils.equals("material", name)) {
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection(ENTRYENTITY);
|
||||||
|
DynamicObject dynamicObject = dynamicObjectCollection.get(rowIndex);
|
||||||
|
DynamicObject material = dynamicObject.getDynamicObject("material");
|
||||||
|
DynamicObject masterid = material.getDynamicObject("masterid");
|
||||||
|
DynamicObject bd_material = BusinessDataServiceHelper.loadSingle(masterid.getLong("id"), "bd_material");
|
||||||
|
DynamicObject org = (DynamicObject)this.getModel().getValue("entryrecorg", rowIndex);
|
||||||
|
//上海
|
||||||
|
if (StringUtils.equals(SH_ORGNUMBER, org.getString("number"))) {
|
||||||
|
BigDecimal tqq9_maxprice_sh = bd_material.getBigDecimal("tqq9_maxprice_sh");
|
||||||
|
if (tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
getModel().setValue("priceandtax", tqq9_maxprice_sh, rowIndex);
|
||||||
|
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_sh, rowIndex);
|
||||||
|
}
|
||||||
|
//北京
|
||||||
|
} else if (StringUtils.equals(BJ_ORGNUMBER, org.getString("number"))) {
|
||||||
|
BigDecimal tqq9_maxprice_bj = bd_material.getBigDecimal("tqq9_maxprice_bj");
|
||||||
|
if (tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
getModel().setValue("priceandtax", tqq9_maxprice_bj, rowIndex);
|
||||||
|
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_bj, rowIndex);
|
||||||
|
}
|
||||||
|
//广州
|
||||||
|
} else if (StringUtils.equals(GZ_ORGNUMBER, org.getString("number"))) {
|
||||||
|
BigDecimal tqq9_maxprice_gz = bd_material.getBigDecimal("tqq9_maxprice_gz");
|
||||||
|
if (tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
getModel().setValue("priceandtax", tqq9_maxprice_gz, rowIndex);
|
||||||
|
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_gz, rowIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//校验含税单价和最高限价
|
||||||
|
if (StringUtils.equals("priceandtax", name)) {
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
|
int rowIndex = changeData.getRowIndex();
|
||||||
|
int seq = rowIndex;
|
||||||
|
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
|
||||||
|
BigDecimal tqq9_zgcgxj = (BigDecimal) getModel().getValue("tqq9_zgcgxj",seq);
|
||||||
|
if (newValue.compareTo(tqq9_zgcgxj) > 0 && tqq9_zgcgxj.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
getModel().setValue("priceandtax", 0,seq);
|
||||||
|
this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
||||||
purapplybill.set("tqq9_hsxfsysl_gz", taxrate);//含税现返使用税率
|
purapplybill.set("tqq9_hsxfsysl_gz", taxrate);//含税现返使用税率
|
||||||
}
|
}
|
||||||
DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org");//组织
|
DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org");//组织
|
||||||
DynamicObject tqq9_sku = dynamicObject.getDynamicObject("tqq9_sku");//商品
|
// DynamicObject tqq9_sku = dynamicObject.getDynamicObject("tqq9_sku");//商品
|
||||||
DynamicObject tqq9_material = dynamicObject.getDynamicObject("tqq9_material");//物料
|
DynamicObject tqq9_material = dynamicObject.getDynamicObject("tqq9_material");//物料
|
||||||
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo",
|
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo",
|
||||||
new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_material.getLong("id"))});//物料采购信息
|
new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_material.getLong("id"))});//物料采购信息
|
||||||
|
|
@ -424,6 +424,16 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
||||||
dynamicObject1.set("entrypurdept", tqq9_org);//采购部门
|
dynamicObject1.set("entrypurdept", tqq9_org);//采购部门
|
||||||
dynamicObject1.set("entryoperatorgroup", tqq9_org);//采购组
|
dynamicObject1.set("entryoperatorgroup", tqq9_org);//采购组
|
||||||
dynamicObject1.set("tqq9_expectsaletime", tqq9_saledates);//预计销售时间(月)
|
dynamicObject1.set("tqq9_expectsaletime", tqq9_saledates);//预计销售时间(月)
|
||||||
|
if(StringUtils.equals(tqq9_org.getString("number"),"SHLC")){
|
||||||
|
dynamicObject1.set("tqq9_zgcgxj", tqq9_material.getBigDecimal("tqq9_maxprice_sh"));//最高采购限价
|
||||||
|
dynamicObject1.set("priceandtax", tqq9_material.getBigDecimal("tqq9_maxprice_sh"));//含税单价
|
||||||
|
}else if(StringUtils.equals(tqq9_org.getString("number"),"BJLC")){
|
||||||
|
dynamicObject1.set("tqq9_zgcgxj", tqq9_material.getBigDecimal("tqq9_maxprice_bj"));//最高采购限价
|
||||||
|
dynamicObject1.set("priceandtax", tqq9_material.getBigDecimal("tqq9_maxprice_bj"));//含税单价
|
||||||
|
}else if(StringUtils.equals(tqq9_org.getString("number"),"GZLC")){
|
||||||
|
dynamicObject1.set("tqq9_zgcgxj", tqq9_material.getBigDecimal("tqq9_maxprice_gz"));//最高采购限价
|
||||||
|
dynamicObject1.set("priceandtax", tqq9_material.getBigDecimal("tqq9_maxprice_gz"));//含税单价
|
||||||
|
}
|
||||||
dynamicObjectCollection.set(i, dynamicObject1);
|
dynamicObjectCollection.set(i, dynamicObject1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.form.pm;
|
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.google.gson.Gson;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
|
@ -26,6 +25,7 @@ import java.net.ConnectException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购订单
|
* 采购订单
|
||||||
|
|
@ -322,41 +322,42 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
||||||
getModel().setValue("priceandtax", 0,seq);
|
getModel().setValue("priceandtax", 0,seq);
|
||||||
this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改");
|
this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// if (StringUtils.equals("supplier", name)) {
|
if (StringUtils.equals("supplier", name)) {
|
||||||
// IDataModel model = this.getModel();
|
IDataModel model = this.getModel();
|
||||||
// ChangeData changeData = e.getChangeSet()[0];
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
// DynamicObject newValue = (DynamicObject) changeData.getNewValue();//供应商
|
DynamicObject newValue = (DynamicObject) changeData.getNewValue();//供应商
|
||||||
// DynamicObject org = (DynamicObject)model.getValue("org");//组织
|
DynamicObject org = (DynamicObject)model.getValue("org");//组织
|
||||||
// HashMap<String,String> queryMap =new HashMap<>();
|
HashMap<String,String> queryMap =new HashMap<>();
|
||||||
// queryMap.put("supplierId",newValue.getString("number"));
|
queryMap.put("supplierId",newValue.getString("number"));
|
||||||
// queryMap.put("companyId",org.getString("number"));
|
queryMap.put("companyId",org.getString("number"));
|
||||||
// try {
|
Gson gson = new Gson();
|
||||||
// ResponseEntity responseEntity = HttpClient.sendRequest(URL, null, "Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3", queryMap, Constants.GET);
|
try {
|
||||||
// JSONObject responseEntityBody = (JSONObject)responseEntity.getBody();
|
ResponseEntity responseEntity = HttpClient.sendRequest(URL, null, "Authorization", "Bearer b96dad1eb4f84c41bae651162aeacdd3", queryMap, Constants.GET);
|
||||||
// JSONArray data = responseEntityBody.getJSONArray("data");
|
String jsonString = responseEntity.getBody().toString();
|
||||||
// for (Object datum : data) {
|
HashMap map = gson.fromJson(jsonString, HashMap.class);
|
||||||
// JSONObject datum1 = (JSONObject) datum;
|
ArrayList<Map<String, Object>> data = (ArrayList) map.get("data");
|
||||||
// String type = datum1.get("type").toString();//类型
|
if(data!=null){
|
||||||
// if(StringUtils.equals(type,"0")){
|
for (Map datum : data) {
|
||||||
// //货返
|
Map<String, Object> dataMap = datum;
|
||||||
// BigDecimal totalMoney = (BigDecimal) datum1.get("totalMoney");//剩余总金额
|
String type = dataMap.get("type").toString();//类型
|
||||||
// BigDecimal totalMoneyAvailable = (BigDecimal) datum1.get("totalMoneyAvailable");//可使用金额
|
BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额
|
||||||
// model.setValue("tqq9_hshfzje",totalMoney);//含税货返总金额
|
BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额
|
||||||
// model.setValue("tqq9_hshfkyje",totalMoneyAvailable);//含税货返可用金额
|
if(StringUtils.equals(type,"1.0")){
|
||||||
// }else if(StringUtils.equals(type,"1")){
|
//货返
|
||||||
// BigDecimal totalMoney = (BigDecimal) datum1.get("totalMoney");//剩余总金额
|
model.setValue("tqq9_hshfzje",totalMoney);//含税货返总金额
|
||||||
// BigDecimal totalMoneyAvailable = (BigDecimal) datum1.get("totalMoneyAvailable");//可使用金额
|
model.setValue("tqq9_hshfkyje",totalMoneyAvailable);//含税货返可用金额
|
||||||
// model.setValue("tqq9_hsxfzje",totalMoney);//含税现返总金额
|
}else if(StringUtils.equals(type,"0.0")){
|
||||||
// model.setValue("tqq9_hsxfzje",totalMoneyAvailable);//含税现返可用金额
|
//现返
|
||||||
// }
|
model.setValue("tqq9_hsxfzje",totalMoney);//含税现返总金额
|
||||||
// }
|
model.setValue("tqq9_hsxfzje",totalMoneyAvailable);//含税现返可用金额
|
||||||
// getView().updateView();
|
}
|
||||||
// } catch (ConnectException ex) {
|
}
|
||||||
// throw new RuntimeException(ex);
|
}
|
||||||
// }
|
getView().updateView();
|
||||||
// }
|
} catch (ConnectException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import org.apache.http.util.EntityUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
import javax.xml.bind.Marshaller;
|
import javax.xml.bind.Marshaller;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue