|
|
@ -6,9 +6,11 @@ import com.qs.serve.common.model.enums.BudgetLogOptFlag; |
|
|
|
import com.qs.serve.common.model.consts.ResultFlag; |
|
|
|
import com.qs.serve.common.util.*; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsCostCenter; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsRegion; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsSubject; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|
|
|
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
|
|
|
import com.qs.serve.modules.bms.service.BmsRegionService; |
|
|
|
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|
|
|
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|
|
|
import com.qs.serve.modules.goods.entity.GoodsCategory; |
|
|
@ -85,6 +87,7 @@ public class PortalOfCostApplication { |
|
|
|
private BmsSupplierService supplierService; |
|
|
|
private BmsSubjectService subjectService; |
|
|
|
private BmsCostCenterService costCenterService; |
|
|
|
private BmsRegionService saleRegionService; |
|
|
|
|
|
|
|
private SysUserService userService; |
|
|
|
|
|
|
@ -555,8 +558,27 @@ public class PortalOfCostApplication { |
|
|
|
if(supplier==null){Assert.throwEx("客户不存在,请重新编辑");} |
|
|
|
BmsSubject subject = subjectService.getByCode(createBo.getSubjectCode()); |
|
|
|
if(subject==null){Assert.throwEx("科目不存在,请重新编辑");} |
|
|
|
BmsCostCenter costCenter = costCenterService.getByCode(createBo.getCenterCode()); |
|
|
|
if(costCenter==null){Assert.throwEx("成本中心不存在,请重新编辑");} |
|
|
|
String centerCode = createBo.getCenterCode(); |
|
|
|
String centerType = null; |
|
|
|
String centerName = null; |
|
|
|
String centerId = null; |
|
|
|
if(centerCode.contains("center_")){ |
|
|
|
centerType = "center"; |
|
|
|
centerCode = centerCode.replace("center_",""); |
|
|
|
BmsCostCenter costCenter = costCenterService.getByCode(centerCode); |
|
|
|
if(costCenter==null){Assert.throwEx("自定义成本中心不存在,请重新编辑");} |
|
|
|
centerName = costCenter.getName(); |
|
|
|
centerId = costCenter.getId()+""; |
|
|
|
} else if (centerCode.contains("saleRegion_")) { |
|
|
|
centerType = "saleRegion"; |
|
|
|
centerCode = centerCode.replace("saleRegion_",""); |
|
|
|
BmsRegion region = saleRegionService.getByCode(centerCode); |
|
|
|
if(region==null){Assert.throwEx("销售区域不存在,请重新编辑");} |
|
|
|
centerName = region.getName(); |
|
|
|
centerId = region.getId(); |
|
|
|
}else { |
|
|
|
Assert.throwEx("成本中心不存在,请重新编辑"); |
|
|
|
} |
|
|
|
//发票号
|
|
|
|
String billNumber = createBo.getBillNumber(); |
|
|
|
String disNumber = createBo.getErpCode(); |
|
|
@ -584,7 +606,6 @@ public class PortalOfCostApplication { |
|
|
|
List<GoodsSku> skuList = this.initSkuListOfProcess(invCodeList); |
|
|
|
//常用参数
|
|
|
|
final String GOODS_TYPE = "sku"; |
|
|
|
final String CENTER_TYPE = "center"; |
|
|
|
final BigDecimal OneHundred = new BigDecimal("100"); |
|
|
|
LocalDateTime nowTime = LocalDateTime.now(); |
|
|
|
LocalDate nowDate = LocalDate.now(); |
|
|
@ -657,10 +678,10 @@ public class PortalOfCostApplication { |
|
|
|
activityCenter.setSubjectId(subject.getId()); |
|
|
|
activityCenter.setCenterAmount(totalAmount); |
|
|
|
activityCenter.setCenterRate(OneHundred); |
|
|
|
activityCenter.setCenterType(CENTER_TYPE); |
|
|
|
activityCenter.setCenterId(costCenter.getId()+""); |
|
|
|
activityCenter.setCenterName(costCenter.getName()); |
|
|
|
activityCenter.setCenterCode(costCenter.getCode()); |
|
|
|
activityCenter.setCenterType(centerType); |
|
|
|
activityCenter.setCenterId(centerId); |
|
|
|
activityCenter.setCenterName(centerName); |
|
|
|
activityCenter.setCenterCode(centerCode); |
|
|
|
activityCenter.setUsedAmount(totalAmount); |
|
|
|
|
|
|
|
//活动-商品
|
|
|
@ -690,10 +711,10 @@ public class PortalOfCostApplication { |
|
|
|
centerGoods.setSupplierCode(supplier.getCode()); |
|
|
|
centerGoods.setSupplierName(supplier.getName()); |
|
|
|
//设置成本中心
|
|
|
|
centerGoods.setCenterType(CENTER_TYPE); |
|
|
|
centerGoods.setCenterId(costCenter.getId()+""); |
|
|
|
centerGoods.setCenterCode(costCenter.getCode()); |
|
|
|
centerGoods.setCenterName(costCenter.getName()); |
|
|
|
centerGoods.setCenterType(centerType); |
|
|
|
centerGoods.setCenterId(centerId); |
|
|
|
centerGoods.setCenterName(centerName); |
|
|
|
centerGoods.setCenterCode(centerCode); |
|
|
|
centerGoods.setCenterRate(OneHundred); |
|
|
|
centerGoods.setCenterAmount(totalAmount); |
|
|
|
//设置科目
|
|
|
|