parent
093003b414
commit
e94c9f0305
|
|
@ -1,9 +1,12 @@
|
|||
package tqq9.lc123.cloud.app.plugin.form.im;
|
||||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
|
|
@ -13,6 +16,7 @@ import kd.bos.form.field.BasedataEdit;
|
|||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.orm.ORM;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
|
@ -65,6 +69,7 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 售后单号带出售后信息
|
||||
*/
|
||||
|
|
@ -103,21 +108,45 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
|||
DynamicObject masterid = newValue.getDynamicObject("masterid");//物料
|
||||
QFilter purinbillF = new QFilter("billentry.material.id", QCP.equals, newValue.getLong("id"));
|
||||
purinbillF = purinbillF.and("billstatus", QCP.equals, "C");
|
||||
//采购入库单
|
||||
DynamicObject[] purinbills = BusinessDataServiceHelper.load("im_purinbill", "id,billno,billentry.material,billentry.priceandtax", purinbillF.toArray(), "auditdate desc");
|
||||
//price
|
||||
DynamicObject[] purinbills = BusinessDataServiceHelper.load("im_purinbill", "id,billno,billentry.material,billentry.price", purinbillF.toArray(), "auditdate desc");
|
||||
if(purinbills != null && purinbills.length > 0){
|
||||
DynamicObject purinbill = purinbills[0];
|
||||
DynamicObjectCollection billentry = purinbill.getDynamicObjectCollection("billentry");
|
||||
for (DynamicObject dynamicObject : billentry) {
|
||||
String number = dynamicObject.getString("material.masterid.number");
|
||||
if (StringUtils.equals(number, masterid.getString("number"))) {
|
||||
BigDecimal priceandtax = dynamicObject.getBigDecimal("priceandtax");
|
||||
this.getModel().setValue("tqq9_price", priceandtax);
|
||||
BigDecimal price = dynamicObject.getBigDecimal("price");
|
||||
this.getModel().setValue("tqq9_price", price);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//批号带出批次可用量
|
||||
if (StringUtils.equals("tqq9_lot", name)) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
DynamicObject material = (DynamicObject)model.getValue("tqq9_materiel", rowIndex);//物料库存信息
|
||||
DynamicObject tqq9_lot = (DynamicObject)model.getValue("tqq9_lot", rowIndex);//批号
|
||||
if(material!=null){
|
||||
DynamicObject masterid = material.getDynamicObject("masterid");//物料
|
||||
if(masterid!=null){
|
||||
String id = masterid.getString("id");
|
||||
String tqq9_phno = tqq9_lot.getString("number");//批号
|
||||
String sql = "/*dialect*/ select sum(fbaseqty) useqty from t_im_inv_realbalance where fmaterialid ='"+id+"' and flotnum ='"+tqq9_phno+"'" ;
|
||||
DataSet pzDataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("scm"), sql);
|
||||
DataSet copy = pzDataSet.copy();
|
||||
DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
|
||||
if(dynamicObjects.size()>0){
|
||||
BigDecimal useqty = dynamicObjects.get(0).getBigDecimal("useqty");
|
||||
model.setValue("tqq9_pckyamount",useqty,rowIndex);
|
||||
this.getView().updateView();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -198,7 +227,7 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
|||
dynamicObject.set("tqq9_dczz", org);//调出组织
|
||||
dynamicObject.set("tqq9_drzz", org);//调入组织
|
||||
dynamicObject.set("tqq9_zczh", entry.getDynamicObject("tqq9_registration"));//注册证号
|
||||
dynamicObject.set("tqq9_licensenoxkzh", entry.getString("tqq9_ykzno"));//许可证号
|
||||
dynamicObject.set("tqq9_licenseno", entry.getString("tqq9_licenseno"));//许可证号
|
||||
dynamicObject.set("tqq9_producedate", entry.getDate("tqq9_createdate"));//生产日期
|
||||
dynamicObject.set("tqq9_expirydate", entry.getDate("tqq9_deadline"));//到期日期
|
||||
dynamicObject.set("tqq9_drck", entry.getDynamicObject("tqq9_thck"));//退货仓库
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.bill.BillShowParameter;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.form.CloseCallBack;
|
||||
import kd.bos.form.ShowType;
|
||||
|
|
@ -18,6 +24,7 @@ import kd.bos.form.operate.FormOperate;
|
|||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.ORM;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
|
@ -25,6 +32,7 @@ import kd.bos.servicehelper.operation.OperationServiceHelper;
|
|||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
|
@ -130,4 +138,34 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
if (StringUtils.equals("tqq9_ph", name)) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
IDataModel model = this.getModel();
|
||||
DynamicObject material = (DynamicObject)model.getValue("material", rowIndex);//物料采购信息
|
||||
DynamicObject tqq9_ph = (DynamicObject)model.getValue("tqq9_ph", rowIndex);//批号
|
||||
if(material!=null&&tqq9_ph!=null){
|
||||
DynamicObject masterid = material.getDynamicObject("masterid");//物料
|
||||
if(masterid!=null){
|
||||
String id = masterid.getString("id");
|
||||
String tqq9_phno = tqq9_ph.getString("number");//批号
|
||||
String sql = "/*dialect*/ select sum(fbaseqty) useqty from t_im_inv_realbalance where fmaterialid ='"+id+"' and flotnum ='"+tqq9_phno+"'" ;
|
||||
DataSet pzDataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("scm"), sql);
|
||||
DataSet copy = pzDataSet.copy();
|
||||
DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
|
||||
if(dynamicObjects.size()>0){
|
||||
BigDecimal useqty = dynamicObjects.get(0).getBigDecimal("useqty");
|
||||
model.setValue("tqq9_pckyamount",useqty,rowIndex);
|
||||
this.getView().updateView();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -434,13 +434,13 @@ public class PurOrderBillRebatePlugin extends AbstractOperationServicePlugIn imp
|
|||
BigDecimal notaxamount = tqq9_hshfsyje.multiply(oneHundred.divide(oneHundred.add(taxrate), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
|
||||
BigDecimal taxamount = tqq9_hshfsyje.subtract(notaxamount);//税额
|
||||
// HashMap<String, Object> bodyMap = new HashMap<>();
|
||||
JSONObject bodyMap = new JSONObject();
|
||||
bodyMap.put("id", hfid);
|
||||
bodyMap.put("money", tqq9_hshfsyje);
|
||||
bodyMap.put("taxAmount", taxamount);
|
||||
HashMap<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("id", hfid);
|
||||
queryMap.put("money", tqq9_hshfsyje);
|
||||
queryMap.put("taxAmount", taxamount);
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
String bodyString = HttpRequestUtils.postJson(Cancel_URL, bodyMap.toString(), tokenMap);
|
||||
String bodyString = HttpRequestUtils.doGet(Cancel_URL, queryMap, tokenMap);
|
||||
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
|
||||
Boolean data = map.getBoolean("data");
|
||||
if (data == null || !data) {
|
||||
|
|
@ -458,13 +458,13 @@ public class PurOrderBillRebatePlugin extends AbstractOperationServicePlugIn imp
|
|||
BigDecimal notaxamount = tqq9_hsxfsyje.multiply(oneHundred.divide(oneHundred.add(taxrate), 10, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
|
||||
BigDecimal taxamount = tqq9_hsxfsyje.subtract(notaxamount);//税额
|
||||
// HashMap<String, Object> bodyMap = new HashMap<>();
|
||||
JSONObject bodyMap = new JSONObject();
|
||||
bodyMap.put("id", xfid);
|
||||
bodyMap.put("money", tqq9_hsxfsyje);
|
||||
bodyMap.put("taxAmount", taxamount);
|
||||
HashMap<String, Object> queryMap = new HashMap<>();
|
||||
queryMap.put("id", xfid);
|
||||
queryMap.put("money", tqq9_hsxfsyje);
|
||||
queryMap.put("taxAmount", taxamount);
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
String bodyString = HttpRequestUtils.postJson(Cancel_URL, bodyMap.toString(), tokenMap);
|
||||
String bodyString = HttpRequestUtils.doGet(Cancel_URL, queryMap, tokenMap);
|
||||
JSONObject map = gson.fromJson(bodyString, JSONObject.class);
|
||||
Boolean data = map.getBoolean("data");
|
||||
if (data == null || !data) {
|
||||
|
|
|
|||
|
|
@ -244,14 +244,14 @@ public class HttpRequestUtils {
|
|||
httpPost.setConfig(config);
|
||||
|
||||
// 设置请求头
|
||||
httpPost.setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
httpPost.setHeader("Accept", "application/xml");
|
||||
// httpPost.setHeader("Content-Type", "application/xml");
|
||||
// httpPost.setHeader("Accept", "application/xml");
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
headers.forEach(httpPost::setHeader);
|
||||
}
|
||||
|
||||
// 设置请求体
|
||||
StringEntity entity = new StringEntity(xmlParams, ContentType.APPLICATION_XML);
|
||||
StringEntity entity = new StringEntity(xmlParams, ContentType.APPLICATION_SOAP_XML);
|
||||
httpPost.setEntity(entity);
|
||||
|
||||
// 执行请求并处理响应
|
||||
|
|
|
|||
Loading…
Reference in New Issue