物料导入税率转换
This commit is contained in:
parent
32bab7cf7e
commit
8f1f046f87
|
@ -171,6 +171,24 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin {
|
||||||
JSONObject data = importData.getData();
|
JSONObject data = importData.getData();
|
||||||
Map<String, Object> map = data.toJavaObject(Map.class);
|
Map<String, Object> map = data.toJavaObject(Map.class);
|
||||||
JSONObject material = (JSONObject) map.get("qeug_material");//物料编码
|
JSONObject material = (JSONObject) map.get("qeug_material");//物料编码
|
||||||
|
|
||||||
|
JSONObject taxRateObj = (JSONObject) map.get("qeug_taxrate"); // 物料编码
|
||||||
|
if (taxRateObj != null) {
|
||||||
|
String name = taxRateObj.getString("name"); // 税率名称
|
||||||
|
if (name != null && !name.trim().isEmpty()) {
|
||||||
|
if (!name.contains("%")){
|
||||||
|
// 1. 尝试解析为数字(可能是 0.01 这样的格式)
|
||||||
|
double rateValue = Double.parseDouble(name.trim());
|
||||||
|
// 2. 转换为百分比格式(0.01 → 1%)
|
||||||
|
int percentValue = (int) Math.round(rateValue * 100);
|
||||||
|
String percentStr = percentValue + "%";
|
||||||
|
// 3. 重新设置回 taxRateObj
|
||||||
|
taxRateObj.put("name", percentStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String number = null;
|
String number = null;
|
||||||
ImportMaterial importMaterial = new ImportMaterial();
|
ImportMaterial importMaterial = new ImportMaterial();
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,23 @@ public class OrderFormMaterialImportPlugin extends AbstractFormPlugin implements
|
||||||
JSONObject data = importData.getData();
|
JSONObject data = importData.getData();
|
||||||
Map<String, Object> map = data.toJavaObject(Map.class);
|
Map<String, Object> map = data.toJavaObject(Map.class);
|
||||||
JSONObject material = (JSONObject) map.get("material");//物料编码
|
JSONObject material = (JSONObject) map.get("material");//物料编码
|
||||||
|
|
||||||
|
JSONObject taxRateObj = (JSONObject) map.get("taxrate"); // 物料编码
|
||||||
|
if (taxRateObj != null) {
|
||||||
|
String name = taxRateObj.getString("name"); // 税率名称
|
||||||
|
if (name != null && !name.trim().isEmpty()) {
|
||||||
|
if (!name.contains("%")){
|
||||||
|
// 1. 尝试解析为数字(可能是 0.01 这样的格式)
|
||||||
|
double rateValue = Double.parseDouble(name.trim());
|
||||||
|
// 2. 转换为百分比格式(0.01 → 1%)
|
||||||
|
int percentValue = (int) Math.round(rateValue * 100);
|
||||||
|
String percentStr = percentValue + "%";
|
||||||
|
// 3. 重新设置回 taxRateObj
|
||||||
|
taxRateObj.put("name", percentStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String number=null;
|
String number=null;
|
||||||
ImportMaterial importMaterial = new ImportMaterial();
|
ImportMaterial importMaterial = new ImportMaterial();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue