Commit 7c44c165 by ice

增加集团同步过来的接收单的成本计算

parent 1253dd21
......@@ -3,6 +3,7 @@ package orthopedics.controller.bookcity;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import orthopedics.controller.error.ErrorEnum;
import orthopedics.controller.v1.TransactionController;
......@@ -211,6 +212,14 @@ public class RcvReceiptController {
if(invLocator != null){
locator_code = invLocator.getLocatorCode();
}
//找到成本
Double cost = null;
if(StringUtils.isEmpty(rcvReceiptLine.getAttribute3())){
BigDecimal b = new BigDecimal(Double.valueOf(invItem.getPurchasePrice()) * 0.64);
cost = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}else{
cost = Double.valueOf(rcvReceiptLine.getAttribute3());
}
jsonObject.put("id",UuidUtil.get32UUIDString());
jsonObject.put("inv_code",inventory.getInvCode());
jsonObject.put("subinv_code",subinventory.getSubinvCode());
......@@ -221,7 +230,7 @@ public class RcvReceiptController {
jsonObject.put("tx_quantity",quantity);
jsonObject.put("source_header_id",id);
jsonObject.put("source_line_id",rcvReceiptLine.getId());
BigDecimal b = new BigDecimal(Double.valueOf(rcvReceiptLine.getAttribute3()) * quantity);
BigDecimal b = new BigDecimal(cost * quantity);
Double tx_amount = b.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
jsonObject.put("tx_amount",tx_amount);
jsonObject.put("tx_price",tx_amount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment