|
@@ -1212,4 +1212,51 @@ public class BmstruckDetailsOrderServiceImpl implements IBmstruckDetailsOrderSer
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int addTruckDetail(Map<String, Object> mapValue) throws Exception {
|
|
|
+ List<BigDecimal> orderIds = (List<BigDecimal>) mapValue.get("orderList");
|
|
|
+ BigDecimal detailsAmount = DataChange.dataToBigDecimal(mapValue.get("detailAmount"));
|
|
|
+ String detailRemark = mapValue.get("detailRemark").toString();
|
|
|
+ String userId = mapValue.get("userId").toString();
|
|
|
+ int result = 0;
|
|
|
+ for(int i=0;i<orderIds.size();i++){
|
|
|
+ BigDecimal orderId = DataChange.dataToBigDecimal(orderIds.get(i));
|
|
|
+ //校验
|
|
|
+ BigDecimal orderType = bmstruckDetailsOrderMapper.getOrderType(orderId);
|
|
|
+ if(orderType.intValue() != 1){
|
|
|
+ throw new Exception("订单类型错误,不允许生成汽运计费详单");
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> weightTaskResultIdList = bmstruckDetailsOrderMapper.getSteelWeightTaskResultId(orderId);
|
|
|
+ if(weightTaskResultIdList.size()<=0){
|
|
|
+ throw new Exception("没有计量实绩,无法冲红");
|
|
|
+ }
|
|
|
+ //新增详单
|
|
|
+ try {
|
|
|
+ // 得到最大id
|
|
|
+ BigDecimal detailsId = selectMaxId();
|
|
|
+ BmstruckDetailsOrder bmstruckDetailsOrder = new BmstruckDetailsOrder();
|
|
|
+ bmstruckDetailsOrder.setWetherToStatement(new BigDecimal(0));
|
|
|
+ String detailsNo = noUtil.setResultNo("QYXD", detailsId);
|
|
|
+ bmstruckDetailsOrder.setWeightTaskResultId(DataChange.dataToBigDecimal(weightTaskResultIdList.get(0).get("weightTaskResultId")));
|
|
|
+ bmstruckDetailsOrder.setDetailsId(detailsId);
|
|
|
+ bmstruckDetailsOrder.setOrderId(orderId);
|
|
|
+ bmstruckDetailsOrder.setDetailsNo(detailsNo);
|
|
|
+ bmstruckDetailsOrder.setDetailsAmount(detailsAmount);
|
|
|
+ bmstruckDetailsOrder.setDetailsTime(new Date());
|
|
|
+ bmstruckDetailsOrder.setRemark(detailRemark);//凭证备注
|
|
|
+ // 设置常规字段
|
|
|
+ bmstruckDetailsOrder.setInsertTime(new Date());
|
|
|
+ bmstruckDetailsOrder.setUpdateTime(new Date());
|
|
|
+ bmstruckDetailsOrder.setInsertUsername(userId);
|
|
|
+ bmstruckDetailsOrder.setUpdateUsername("admin");
|
|
|
+ bmstruckDetailsOrder.setInsertUpdateRemark("无");
|
|
|
+ result += bmstruckDetailsOrderMapper.insertSelective(bmstruckDetailsOrder);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|