优化订单中明细的excel导入
This commit is contained in:
@@ -1127,62 +1127,64 @@ public class DepotItemService {
|
|||||||
for (Map<String, String> detailMap: detailList) {
|
for (Map<String, String> detailMap: detailList) {
|
||||||
JSONObject item = new JSONObject();
|
JSONObject item = new JSONObject();
|
||||||
String barCode = detailMap.get("barCode");
|
String barCode = detailMap.get("barCode");
|
||||||
MaterialVo4Unit m = materialMap.get(barCode);
|
if(StringUtil.isNotEmpty(barCode)) {
|
||||||
if(m!=null) {
|
MaterialVo4Unit m = materialMap.get(barCode);
|
||||||
item.put("barCode", barCode);
|
if(m!=null) {
|
||||||
item.put("name", m.getName());
|
item.put("barCode", barCode);
|
||||||
item.put("standard", m.getStandard());
|
item.put("name", m.getName());
|
||||||
if(StringUtil.isNotEmpty(m.getModel())) {
|
item.put("standard", m.getStandard());
|
||||||
item.put("model", m.getModel());
|
if(StringUtil.isNotEmpty(m.getModel())) {
|
||||||
}
|
item.put("model", m.getModel());
|
||||||
if(StringUtil.isNotEmpty(m.getColor())) {
|
|
||||||
item.put("color", m.getColor());
|
|
||||||
}
|
|
||||||
if(StringUtil.isNotEmpty(m.getSku())) {
|
|
||||||
item.put("sku", m.getSku());
|
|
||||||
}
|
|
||||||
BigDecimal stock = depotItemMapperEx.getCurrentStockByParam(null, m.getId());
|
|
||||||
item.put("stock", stock);
|
|
||||||
item.put("unit", m.getCommodityUnit());
|
|
||||||
BigDecimal operNumber = BigDecimal.ZERO;
|
|
||||||
BigDecimal unitPrice = BigDecimal.ZERO;
|
|
||||||
BigDecimal taxRate = BigDecimal.ZERO;
|
|
||||||
if(StringUtil.isNotEmpty(detailMap.get("num"))) {
|
|
||||||
operNumber = new BigDecimal(detailMap.get("num"));
|
|
||||||
}
|
|
||||||
if(StringUtil.isNotEmpty(detailMap.get("unitPrice"))) {
|
|
||||||
unitPrice = new BigDecimal(detailMap.get("unitPrice"));
|
|
||||||
} else {
|
|
||||||
if("CGDD".equals(prefixNo)) {
|
|
||||||
unitPrice = m.getPurchaseDecimal();
|
|
||||||
} else if("XSDD".equals(prefixNo)) {
|
|
||||||
unitPrice = m.getWholesaleDecimal();
|
|
||||||
}
|
}
|
||||||
|
if(StringUtil.isNotEmpty(m.getColor())) {
|
||||||
|
item.put("color", m.getColor());
|
||||||
|
}
|
||||||
|
if(StringUtil.isNotEmpty(m.getSku())) {
|
||||||
|
item.put("sku", m.getSku());
|
||||||
|
}
|
||||||
|
BigDecimal stock = depotItemMapperEx.getCurrentStockByParam(null, m.getId());
|
||||||
|
item.put("stock", stock);
|
||||||
|
item.put("unit", m.getCommodityUnit());
|
||||||
|
BigDecimal operNumber = BigDecimal.ZERO;
|
||||||
|
BigDecimal unitPrice = BigDecimal.ZERO;
|
||||||
|
BigDecimal taxRate = BigDecimal.ZERO;
|
||||||
|
if(StringUtil.isNotEmpty(detailMap.get("num"))) {
|
||||||
|
operNumber = new BigDecimal(detailMap.get("num"));
|
||||||
|
}
|
||||||
|
if(StringUtil.isNotEmpty(detailMap.get("unitPrice"))) {
|
||||||
|
unitPrice = new BigDecimal(detailMap.get("unitPrice"));
|
||||||
|
} else {
|
||||||
|
if("CGDD".equals(prefixNo)) {
|
||||||
|
unitPrice = m.getPurchaseDecimal();
|
||||||
|
} else if("XSDD".equals(prefixNo)) {
|
||||||
|
unitPrice = m.getWholesaleDecimal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(StringUtil.isNotEmpty(detailMap.get("taxRate"))) {
|
||||||
|
taxRate = new BigDecimal(detailMap.get("taxRate"));
|
||||||
|
}
|
||||||
|
String remark = detailMap.get("remark");
|
||||||
|
item.put("operNumber", operNumber);
|
||||||
|
item.put("unitPrice", unitPrice);
|
||||||
|
BigDecimal allPrice = BigDecimal.ZERO;
|
||||||
|
if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
|
||||||
|
allPrice = unitPrice.multiply(operNumber);
|
||||||
|
}
|
||||||
|
BigDecimal taxMoney = BigDecimal.ZERO;
|
||||||
|
if(taxRate.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
|
taxMoney = taxRate.multiply(allPrice).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
}
|
||||||
|
BigDecimal taxLastMoney = allPrice.add(taxMoney);
|
||||||
|
item.put("allPrice", allPrice);
|
||||||
|
item.put("taxRate", taxRate);
|
||||||
|
item.put("taxMoney", taxMoney);
|
||||||
|
item.put("taxLastMoney", taxLastMoney);
|
||||||
|
item.put("remark", remark);
|
||||||
|
arr.add(item);
|
||||||
|
} else {
|
||||||
|
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,
|
||||||
|
String.format(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG, barCode));
|
||||||
}
|
}
|
||||||
if(StringUtil.isNotEmpty(detailMap.get("taxRate"))) {
|
|
||||||
taxRate = new BigDecimal(detailMap.get("taxRate"));
|
|
||||||
}
|
|
||||||
String remark = detailMap.get("remark");
|
|
||||||
item.put("operNumber", operNumber);
|
|
||||||
item.put("unitPrice", unitPrice);
|
|
||||||
BigDecimal allPrice = BigDecimal.ZERO;
|
|
||||||
if(unitPrice!=null && unitPrice.compareTo(BigDecimal.ZERO)!=0) {
|
|
||||||
allPrice = unitPrice.multiply(operNumber);
|
|
||||||
}
|
|
||||||
BigDecimal taxMoney = BigDecimal.ZERO;
|
|
||||||
if(taxRate.compareTo(BigDecimal.ZERO) != 0) {
|
|
||||||
taxMoney = taxRate.multiply(allPrice).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
}
|
|
||||||
BigDecimal taxLastMoney = allPrice.add(taxMoney);
|
|
||||||
item.put("allPrice", allPrice);
|
|
||||||
item.put("taxRate", taxRate);
|
|
||||||
item.put("taxMoney", taxMoney);
|
|
||||||
item.put("taxLastMoney", taxLastMoney);
|
|
||||||
item.put("remark", remark);
|
|
||||||
arr.add(item);
|
|
||||||
} else {
|
|
||||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,
|
|
||||||
String.format(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG, barCode));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.put("rows", arr);
|
map.put("rows", arr);
|
||||||
|
|||||||
@@ -966,7 +966,7 @@
|
|||||||
|
|
||||||
<select id="getBillItemByParam" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
<select id="getBillItemByParam" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||||
select m.id, m.name, m.standard, m.model, me.id meId,me.commodity_unit commodityUnit,
|
select m.id, m.name, m.standard, m.model, me.id meId,me.commodity_unit commodityUnit,
|
||||||
me.purchase_decimal purchaseDecimal, me.wholesale_decimal wholesaleDecimal, me.bar_code mBarCode
|
me.purchase_decimal purchaseDecimal, me.wholesale_decimal wholesaleDecimal, me.bar_code mBarCode, me.sku
|
||||||
from jsh_material m
|
from jsh_material m
|
||||||
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||||
where 1=1
|
where 1=1
|
||||||
|
|||||||
Reference in New Issue
Block a user