Commit 023ce088 authored by 1650842865's avatar 1650842865

外发单打印格式调整

parent d4659581
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>外发加工单</title>
<#include "/print/commonStyleTemplate.ftl" />
<style type="text/css">
td {
font-size: 12px;
}
</style>
</head>
<body>
<!-- 页眉部分 -->
<div style="font-size: 20px;text-align: center; margin-top: 0px">广州市宝绅科技应用有限公司</div>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width="40%"/>
<col width="10%"/>
<col width="40%"/>
</colgroup>
<tr>
<td class="right">电 话:020-36201957/020-36343128</td>
<td> </td>
<td class="left">地 址:广州市白云区江高小塘南路68号</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='100%'/>
<#-- <col width="40%"/>-->
</colgroup>
<tr>
<td style="font-size: 20px;text-align: center;margin-top: 0.5cm">外发单</td>
<#-- <td class="right">-->
<#-- <img class="barcode" src="${barCode}" style="right: auto"></img>-->
<#-- </td>-->
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width='42%'/>
<col width="9%"/>
<col width="41%"/>
</colgroup>
<tr>
<td class="left">加工商</td>
<td class="left">${namel?default("")?html}</td>
<td class="left">加工商<br/>地址</td>
<td class="left">${address?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width='34%'/>
<col width="8%"/>
<col width="9%"/>
<col width="8%"/>
<col width="9%"/>
<col width="9%"/>
<col width="15%"/>
</colgroup>
<tr>
<td class="left">外发单号</td>
<td class="left">${ebeln?default("")?html}</td>
<td class="left">外发日期</td>
<td class="left"><@formatDate date=fillinDate/></td>
<td class="left">交货日期</td>
<td class="left"><@formatDate date=eindt/></td>
<td class="left">联系人电话</td>
<td class="left">${telf1?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width='68%'/>
<col width="9%"/>
<col width="15%"/>
</colgroup>
<tr>
<td class="left">交货地点</td>
<td class="left">${strSuppl?default("")?html}</td>
<td class="left">仓库</td>
<td class="left">${lgobe?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width="92%"/>
</colgroup>
<tr>
<td class="center">备注1</td>
<td class="left" style="height: 80px">${headText1?default("")?html}</td>
</tr>
</table>
<#if materialList?? && materialList?size gt 0>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='5%' />
<col width='10%' />
<col width='25%' />
<col width='5%' />
<col width='7%' />
<col width='7%' />
<col width='7%' />
<col width='5%' />
<col width='5%' />
<col width='9%' />
<col width='5%' />
<col width='10%' />
</colgroup>
<tr>
<td class="center" >项次</td>
<td class="center" >产品编码</td>
<td class="center" >产品名称</td>
<td class="center" >单位</td>
<td class="center" >数量</td>
<td class="center" >LOSS数</td>
<td class="center" >单价</td>
<td class="center" >运输费用</td>
<td class="center" >包装费用</td>
<td class="center" >总金额</td>
<td class="center" >外发工序</td>
<td class="center" >备注</td>
</tr>
<#list materialList as detail>
<tr>
<td class="center">${detail.no?default("")?html}</td>
<td class="center">${detail.matnr2?default("")?html}</td>
<td class="center">${detail.maktx?default("")?html}</td>
<td class="center">${detail.msehl?default("")?html}</td>
<td class="center">${detail.number?default("")?html}</td>
<td class="center">${detail.loss?default("")?html}</td>
<td class="center">${detail.netpr?default("")?html}</td>
<td class="center">${detail.kbetr2?default("")?html}</td>
<td class="center">${detail.kbetr3?default("")?html}</td>
<td class="center">${detail.amount?default("")?html}</td>
<td class="center">${detail.outProcess01?default("")?html}</td>
<td class="center">${detail.remark?default("")?html}</td>
</tr>
</#list>
</table>
<#else >
</#if>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width='92%'/>
</colgroup>
<tr>
<td class="center">生产制程</td>
<td class="left">${productionProcess?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='8%'/>
<col width="92%"/>
</colgroup>
<tr>
<td class="center">备注2</td>
<td class="left" style="height: 80px">${headText?default("")?html}</td>
</tr>
</table>
<#if productInfoVoList?? && productInfoVoList?size gt 0>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='50%' />
<col width='50%' />
</colgroup>
<tr>
<td class="left">产品正面图片:</td>
<td class="left">产品背面图片:</td>
</tr>
<#list productInfoVoList as detail>
<tr>
<td class="center">
<img src='${detail.frontImg?default("")?html}' width="230px"/>
</td>
<td class="center">
<img src='${detail.backImg?default("")?html}' width="230px"/>
</td>
</tr>
</#list>
</table>
<#else >
</#if>
<#--<table cellspacing="0px" cellpadding="0px" class="tableBorder">-->
<#-- <colgroup>-->
<#-- <col width='50%'/>-->
<#-- <col width="50%"/>-->
<#-- </colgroup>-->
<#-- <tr>-->
<#-- <td class="left">产品正面图片:-->
<#-- <br/>-->
<#-- <img src='${frontImg?default("")?html}' width="230px"/>-->
<#-- </td>-->
<#-- <td class="left">产品背面图片:-->
<#-- <br/>-->
<#-- <img src='${backImg?default("")?html}' width="230px"/>-->
<#-- </td>-->
<#-- </tr>-->
<#--</table>-->
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='100%' />
</colgroup>
<tr>
<td class="left">付款方式:${zwels?default("")?html}
<br/>
月结方式:${zterm?default("")?html}
<br/>
注意事项:整张订单结束后方可请款,送货和付款时请附上此单。收到订单请2小时内签回。周六,日不收货。周一至周五17:00下班。
</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tablePrint">
<colgroup>
<col width='33%'/>
<col width="33%"/>
<col width="33%"/>
</colgroup>
<tr>
<td class="left">加工商回签:</td>
<td class="left">核准:</td>
<td class="left">采购员:${personMemberName?default("")?html}</td>
</tr>
</table>
</body>
</html>
...@@ -450,54 +450,26 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -450,54 +450,26 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
//获取加工商信息 //获取加工商信息
String lifnr = sapPurchaseOrder.getLifnr(); String lifnr = sapPurchaseOrder.getLifnr();
map = this.getSupplierInfo(map,lifnr); map = this.getSupplierInfo(map,lifnr);
//获取销售订单信息
map = this.getSaleOrderInfo(map,sapPurchaseOrder.getId());
//获取产品信息 //获取产品信息
map = this.getProductInfo(map); //map = this.getProductInfo(map);
//成品外购 //map.put("page","/print/topsun/productProcessOuter.ftl");
map.put("page","/print/topsun/productProcessOuter.ftl");
List<SapPurchaseOrderItem> purchaseOrderItems = this.sapPurchaseOrderItemApplication.getPurchaseOrderItems(sapPurchaseOrder.getId());
map.put("eindt",purchaseOrderItems.get(0).getEindt());//交货时间
map.put("telf1",purchaseOrderItems.get(0).getTelf1());//联系电话
map.put("lgobe",purchaseOrderItems.get(0).getLgobe());//仓库
map.put("strSuppl",purchaseOrderItems.get(0).getStrSuppl());//交货地点
//订单类型是ZNB3时对应工序外发(临时工序外协) //订单类型是ZNB3时对应工序外发(临时工序外协)
if ("ZNB3".equals(sapPurchaseOrder.getBsart())){ if ("ZNB3".equals(sapPurchaseOrder.getBsart())){
map = this.getProcessOutInfo(map);
//工序外协 //工序外协
map.put("page","/print/topsun/processOuter.ftl"); map = this.getProcessOutInfo(map);
}
return map;
}
@Override
public void updateProcessOutStatus(List<String> ids) {
List<SapPurchaseOrder> orderList = sapPurchaseOrderRepository.findAll(ids);
for (SapPurchaseOrder sapPurchaseOrder : orderList) {
sapPurchaseOrder.setSendOut("1");
}
sapPurchaseOrderRepository.save(orderList);
}
@Override
public void abortPurchaseOrder(String id, String jobPageId) {
//先标记终止状态
SapPurchaseOrder purchaseOrder = sapPurchaseOrderRepository.findOne(id);
List<SapMutualEpLog> logList = sapMutualEpLogApplication.findByBusinessId(purchaseOrder.getId());
if (!CollectionUtils.isEmpty(logList)){
List<String> types = logList
.stream()
.map(SapMutualEpLog::getType)
.collect(Collectors.toList());
if (types.contains("E")){
purchaseOrder.setStatusId(BizBillStatus.ABORTED.getId());
//删除待办
actApplication.deleteRuntimeTaskExtension(jobPageId);
sapPurchaseOrderRepository.save(purchaseOrder);
}
else {
throw new RuntimeException("正常流程不能强制终止");
}
}else { }else {
throw new RuntimeException("正常流程不能强制终止"); //成品外购
//获取订单信息
map = this.getSaleOrderInfo(map,purchaseOrderItems);
} }
map.put("page","/print/topsun/processOuter2.ftl");
return map;
} }
public Map<String, Object> getSupplierInfo(Map<String, Object> map, String lifnr){ public Map<String, Object> getSupplierInfo(Map<String, Object> map, String lifnr){
...@@ -533,141 +505,171 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu ...@@ -533,141 +505,171 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
return map; return map;
} }
public Map<String, Object> getSaleOrderInfo(Map<String, Object> map,String orderId){ public Map<String, Object> getSaleOrderInfo(Map<String, Object> map,List<SapPurchaseOrderItem> purchaseOrderItems){
List<SapPurchaseOrderItem> purchaseOrderItems = this.sapPurchaseOrderItemApplication.getPurchaseOrderItems(orderId); //根据产品合并明细项
SapPurchaseOrderItem purchaseOrderItem = purchaseOrderItems.get(0); List<String> matnrList = new ArrayList<>(purchaseOrderItems
purchaseOrderItem.setMatnr2(purchaseOrderItem.getMatnr2().replaceFirst("^0*", ""));
BeanUtil.beanToMap(purchaseOrderItem,map,false,false);
// map.put("eindt",purchaseOrderItem.getEindt());//交货日期
// map.put("lgobe",purchaseOrderItem.getLgobe());//仓库
// map.put("telf1",purchaseOrderItem.getTelf1());//联系人电话
// map.put("matnr2",purchaseOrderItem.getMatnr2());//产品编码
// map.put("maktx",purchaseOrderItem.getMaktx());//产品名称
// map.put("strSuppl",purchaseOrderItem.getStrSuppl());//交货地点
// map.put("msehl",purchaseOrderItem.getMsehl());//单位
//销售单号多个的情况放明细列表中
Set<SapSaleOrderVo> saleOrderVos = purchaseOrderItems
.stream() .stream()
.map(sapPurchaseOrderItem -> { .map(SapPurchaseOrderItem::getMatnr2).collect(Collectors.toSet()));
SapSaleOrderVo sapSaleOrderVo = new SapSaleOrderVo(); ////获取产品信息
BeanUtil.copyProperties(sapPurchaseOrderItem, sapSaleOrderVo); List<EpProductInfoVo> productInfoVoList = this.getProductInfo(matnrList);
return sapSaleOrderVo; map.put("productInfoVoList",productInfoVoList);
}).collect(Collectors.toSet()); //生产制程
BigDecimal zero = BigDecimal.ZERO;//计算成品数量 map.put("productionProcess",productInfoVoList.get(0).getProductionProcess());
for (SapSaleOrderVo saleOrderVo : saleOrderVos) {
zero = zero.add(saleOrderVo.getKwmeng()); //获取订单明细信息
List<Map<String,Object>> detailList = new ArrayList<>();
for (int i = 1; i <= matnrList.size(); i++) {
String matnr = matnrList.get(i-1);
Map<String, Object> detailMap = new HashMap<>();
detailMap.put("no",i);
BigDecimal number = BigDecimal.ZERO;
BigDecimal amount = BigDecimal.ZERO;
for (int j = 0; j < purchaseOrderItems.size(); j++) {
SapPurchaseOrderItem purchaseOrderItem = purchaseOrderItems.get(j);
if (matnr.equals(purchaseOrderItem.getMatnr2())){
detailMap.put("matnr2",matnr.replaceFirst("^0*", ""));
detailMap.put("maktx",purchaseOrderItem.getTxz01());
detailMap.put("msehl",purchaseOrderItem.getMsehl());
number = number.add(purchaseOrderItem.getKwmeng());
//计算总额 = (含税单价+运输费)* 成品数量
BigDecimal netpr = purchaseOrderItem.getNetpr();//含税单价
BigDecimal kbetr2 = purchaseOrderItem.getKbetr2() == null ? BigDecimal.ZERO:purchaseOrderItem.getKbetr2();//运输费
BigDecimal kbetr3 = purchaseOrderItem.getKbetr3() == null ? BigDecimal.ZERO:purchaseOrderItem.getKbetr3();//包装费
amount = amount.add(netpr.add(kbetr2).add(kbetr3).multiply(purchaseOrderItem.getKwmeng()));
detailMap.put("netpr",netpr);
detailMap.put("kbetr2",kbetr2);
detailMap.put("kbetr3",kbetr3);
detailMap.put("priceAmount",netpr.add(kbetr2).add(kbetr3));//合计单价
detailMap.put("loss","1%");//LOSS数,默认1%
}
}
detailMap.put("number",number);
detailMap.put("amount",amount);
detailList.add(detailMap);
} }
map.put("number",zero); map.put("materialList",detailList);
map.put("backNumber",zero);
map.put("saleOrderVos",saleOrderVos);
//计算总额 = (含税单价+运输费)* 成品数量
BigDecimal netpr = purchaseOrderItem.getNetpr();//含税单价
BigDecimal kbetr2 = purchaseOrderItem.getKbetr2() == null ? BigDecimal.ZERO:purchaseOrderItem.getKbetr2();//运输费
BigDecimal kbetr3 = purchaseOrderItem.getKbetr3() == null ? BigDecimal.ZERO:purchaseOrderItem.getKbetr3();//包装费
BigDecimal amount = netpr.add(kbetr2).add(kbetr3).multiply(zero);
map.put("netpr",netpr);
map.put("kbetr2",kbetr2);
map.put("kbetr3",kbetr3);
map.put("priceAmount",netpr.add(kbetr2).add(kbetr3));//合计单价
map.put("amount",amount);
map.put("loss","1%");//LOSS数,默认1%
//实际送货数量 = 成品数量 + LOSS数 (向上取整)
BigDecimal multiply = zero.multiply(new BigDecimal("0.01"));
long loss = multiply.setScale( 0, RoundingMode.UP).longValue(); // 向上取整
BigDecimal realNumber = zero.add(BigDecimal.valueOf(loss));
map.put("realNumber",realNumber);
return map; return map;
} }
private Map<String, Object> getProductInfo(Map<String, Object> map) { private List<EpProductInfoVo> getProductInfo(List<String> matnrList) {
String matnr2 = (String) map.get("matnr2"); List<EpProductInfoVo> epProductInfoVos = new ArrayList<>();
//从EP系统查询产品信息 for (String matnr2 : matnrList) {
EpProductInfoVo epProductInfoVo = epApplication.queryEpProductInfo(matnr2); //从EP系统查询产品信息
epProductInfoVo.setPrintColor(epProductInfoVo.getFrontColor()+";"+epProductInfoVo.getOppositeColor()); EpProductInfoVo epProductInfoVo = epApplication.queryEpProductInfo(matnr2);
BeanUtil.beanToMap(epProductInfoVo,map,false,false); epProductInfoVos.add(epProductInfoVo);
try { //pProductInfoVo.setPrintColor(epProductInfoVo.getFrontColor()+";"+epProductInfoVo.getOppositeColor());
File file = new File("product-"+map.get("ebeln")+".png"); //BeanUtil.beanToMap(epProductInfoVo,map,false,false);
if(!file.exists()) {
String IMG_TYPE_PNG = "image/png";
map.put("barCode", CommonUtils.genBarCode128((String) map.get("ebeln"), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_BOTTOM));
} else {
map.put("barCode",file);
}
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("PDF生成失败!");
} }
return map;
// try {
// File file = new File("product-"+map.get("ebeln")+".png");
// if(!file.exists()) {
// String IMG_TYPE_PNG = "image/png";
// map.put("barCode", CommonUtils.genBarCode128((String) map.get("ebeln"), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_BOTTOM));
// } else {
// map.put("barCode",file);
// }
// }catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("PDF生成失败!");
// }
return epProductInfoVos;
} }
private Map<String, Object> getProcessOutInfo(Map<String, Object> map) { private Map<String, Object> getProcessOutInfo(Map<String, Object> map) {
String ebeln = (String) map.get("ebeln");//采购订单号 String ebeln = (String) map.get("ebeln");//采购订单号
//根据订单号查询外协单明细 //根据订单号查询外协单明细
ProcessOutsourceOrderItem outsourceOrderItem = processOutsourceOrderItemRepository.findByEbeln(ebeln); List<ProcessOutsourceOrderItem> outsourceOrderItemList = processOutsourceOrderItemRepository.findByEbeln(ebeln);
if (StringUtil.isBlank((String) map.get("matnr2")) ){ //根据产品合并明细项,获取产品图片信息
map.put("matnr2",outsourceOrderItem.getProductCode().replaceFirst("^0*", "")); List<String> matnrList = new ArrayList<>(outsourceOrderItemList
map.put("maktx",outsourceOrderItem.getProductName()); .stream()
//没有产品编码时,从外协单查询 .map(ProcessOutsourceOrderItem::getProductCode).collect(Collectors.toSet()));
map = this.getProductInfo(map); //获取产品信息
} List<EpProductInfoVo> productInfoVoList = this.getProductInfo(matnrList);
map.put("outProcess01",outsourceOrderItem.getTxz01()); map.put("productInfoVoList",productInfoVoList);
map.put("outProcess02",outsourceOrderItem.getTxz02()); //生产制程
//临时工序外发,计算印张数;实际送货数量,LOSS数 map.put("productionProcess",productInfoVoList.get(0).getProductionProcess());
BigDecimal number = outsourceOrderItem.getMenge();//成品数量 //产品和工序合并明细项,获取数量合计,loss合计,总金额合计
map.put("number",number); List<ProductKey> uniqueProductList = new ArrayList<>(outsourceOrderItemList.stream()
BigDecimal model = (BigDecimal)map.get("model") != null ? (BigDecimal)map.get("model") : BigDecimal.ZERO;//排版数量 .map(p -> new ProductKey(p.getProductCode(), p.getWempf()))
BigDecimal loss = outsourceOrderItem.getPrintLoss() != null ? outsourceOrderItem.getPrintLoss() : BigDecimal.ZERO;//印张LOSS数改为LOSS数 .collect(Collectors.toSet()));
//map.put("printLoss",printLoss); map.put("eindt",outsourceOrderItemList.get(0).getEeind());
BigDecimal printLoss = BigDecimal.ZERO; List<Map<String,Object>> detailList = new ArrayList<>();
if (model.compareTo(BigDecimal.ZERO) > 0 && loss.compareTo(BigDecimal.ZERO) > 0){ for (int i = 0; i < uniqueProductList.size(); i++) {
printLoss = loss.divide(model,2,RoundingMode.UP); Map<String, Object> detailMap = new HashMap<>();
long printLossL = printLoss.setScale(0, RoundingMode.UP).longValue(); detailMap.put("no",i+1);
printLoss = new BigDecimal(printLossL); ProductKey productKey = uniqueProductList.get(i);
} BigDecimal number = BigDecimal.ZERO;
map.put("printLoss",printLoss); BigDecimal loss = BigDecimal.ZERO;
//印张量 = 成品数量/排版数量 BigDecimal amount = BigDecimal.ZERO;
BigDecimal printNumber = BigDecimal.ZERO; for (int j = 0; j < outsourceOrderItemList.size(); j++) {
if (number.compareTo(BigDecimal.ZERO) > 0 && model.compareTo(BigDecimal.ZERO) > 0){ ProcessOutsourceOrderItem outsourceOrderItem = outsourceOrderItemList.get(j);
printNumber = number.divide(model,2,RoundingMode.UP); if (productKey.getProductCode().equals(outsourceOrderItem.getProductCode())){
long l = printNumber.setScale(0, RoundingMode.UP).longValue(); detailMap.put("matnr2",outsourceOrderItem.getProductCode().replaceFirst("^0*", ""));
printNumber = new BigDecimal(l); detailMap.put("maktx",outsourceOrderItem.getProductName());
} detailMap.put("msehl",outsourceOrderItem.getMeinsName());
map.put("printNumber",printNumber); detailMap.put("outProcess01",outsourceOrderItem.getWempf());
if (printNumber.compareTo(BigDecimal.ZERO) > 0){ //临时工序外发,计算印张数;实际送货数量,LOSS数
//有成品数量+排版数量的时候,应回厂数量=印张量 number = number.add(outsourceOrderItem.getMenge());//成品数量
map.put("backNumber",printNumber); loss = loss.add(outsourceOrderItem.getPrintLoss() != null ? outsourceOrderItem.getPrintLoss() : BigDecimal.ZERO);//印张LOSS数改为LOSS数
} //查询工序报价
ProcessQuotedPriceItemNumber quotedPriceItemNumber = processQuotedPriceItemApplication.findQuotedPriceByProductAndProcess(outsourceOrderItem.getProductCode(), outsourceOrderItem.getWempf(), outsourceOrderItem.getMenge(), outsourceOrderItem.getLifnr());
//LOSS数 = 印张LOSS * 排版数量 detailMap.put("netpr",quotedPriceItemNumber.getUnitPrice());//含税单价
//BigDecimal loss = printLoss.multiply(model); detailMap.put("kbetr2",quotedPriceItemNumber.getFreight());//运输费
map.put("loss",loss); detailMap.put("kbetr3",quotedPriceItemNumber.getPackMoney());//包装费
BigDecimal priceAmount = quotedPriceItemNumber.getUnitPrice();
if (quotedPriceItemNumber.getFreight() != null){
priceAmount = priceAmount.add(quotedPriceItemNumber.getFreight());
}
if (quotedPriceItemNumber.getPackMoney() != null){
priceAmount = priceAmount.add(quotedPriceItemNumber.getPackMoney());
}
detailMap.put("priceAmount",priceAmount);//合计单价
amount = amount.add(priceAmount.multiply(outsourceOrderItem.getMenge()));//合计金额
}
}
detailMap.put("number",number);
detailMap.put("loss",loss);
detailMap.put("amount",amount);//总价
detailList.add(detailMap);
//实际送货数量 = 成品数量 + LOSS数
BigDecimal realNumber = number.add(loss);
map.put("realNumber",realNumber);
//查询工序外协单组件
List<ProcessOutsourceMaterial> materialList = processOutsourceMaterialRepository.findByProcessOutsourceId(outsourceOrderItem.getProcessOutsourceId());
for (ProcessOutsourceMaterial material : materialList) {
material.setDeliveryMethodOut(DictUtil.getDictionaryDetailText("deliveryMethodOut",material.getDeliveryMethodOut()));
} }
map.put("materialList",materialList);
map.put("materialList",detailList);
//查询工序报价 return map;
ProcessQuotedPriceItemNumber quotedPriceItemNumber = processQuotedPriceItemApplication.findQuotedPriceByProductAndProcess(outsourceOrderItem.getProductCode(), outsourceOrderItem.getWempf(), outsourceOrderItem.getMenge(), outsourceOrderItem.getLifnr()); }
map.put("netpr",quotedPriceItemNumber.getUnitPrice());//含税单价
map.put("kbetr2",quotedPriceItemNumber.getFreight());//运输费 @Override
map.put("kbetr3",quotedPriceItemNumber.getPackMoney());//包装费 public void updateProcessOutStatus(List<String> ids) {
BigDecimal priceAmount = quotedPriceItemNumber.getUnitPrice(); List<SapPurchaseOrder> orderList = sapPurchaseOrderRepository.findAll(ids);
if (quotedPriceItemNumber.getFreight() != null){ for (SapPurchaseOrder sapPurchaseOrder : orderList) {
priceAmount = priceAmount.add(quotedPriceItemNumber.getFreight()); sapPurchaseOrder.setSendOut("1");
} }
if (quotedPriceItemNumber.getPackMoney() != null){ sapPurchaseOrderRepository.save(orderList);
priceAmount = priceAmount.add(quotedPriceItemNumber.getPackMoney()); }
@Override
public void abortPurchaseOrder(String id, String jobPageId) {
//先标记终止状态
SapPurchaseOrder purchaseOrder = sapPurchaseOrderRepository.findOne(id);
List<SapMutualEpLog> logList = sapMutualEpLogApplication.findByBusinessId(purchaseOrder.getId());
if (!CollectionUtils.isEmpty(logList)){
List<String> types = logList
.stream()
.map(SapMutualEpLog::getType)
.collect(Collectors.toList());
if (types.contains("E")){
purchaseOrder.setStatusId(BizBillStatus.ABORTED.getId());
//删除待办
actApplication.deleteRuntimeTaskExtension(jobPageId);
sapPurchaseOrderRepository.save(purchaseOrder);
}
else {
throw new RuntimeException("正常流程不能强制终止");
}
}else {
throw new RuntimeException("正常流程不能强制终止");
} }
map.put("priceAmount",priceAmount);//合计单价
map.put("amount",priceAmount.multiply(number));//总价
return map;
} }
} }
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 to comment