|
@@ -88,6 +88,10 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
private GeTuiUtils geTuiUtils;
|
|
private GeTuiUtils geTuiUtils;
|
|
@Autowired
|
|
@Autowired
|
|
private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IWeightedDetailsService weightedDetailsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICostManagementInfoService costManagementInfoService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 待完成页面列表
|
|
* 待完成页面列表
|
|
@@ -98,11 +102,15 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
@Override
|
|
@Override
|
|
public Page<WarehouseInOutInfo> selectWarehouseInOutInfo(WarehouseInOutInfo warehouseInOutInfo) {
|
|
public Page<WarehouseInOutInfo> selectWarehouseInOutInfo(WarehouseInOutInfo warehouseInOutInfo) {
|
|
//查询页面信息
|
|
//查询页面信息
|
|
- Page<WarehouseInOutInfo> warehouseInOutInfoPage = this.selectPage(warehouseInOutInfo.getQueryPage(), new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("base_id", warehouseInOutInfo.getBaseId())
|
|
|
|
|
|
+ Wrapper<WarehouseInOutInfo> warehouseInOutInfoWrapper = new EntityWrapper<WarehouseInOutInfo>();
|
|
|
|
+ if (warehouseInOutInfo.getInOutFlag() != null) {
|
|
|
|
+ warehouseInOutInfoWrapper.eq("in_out_flag", warehouseInOutInfo.getInOutFlag());
|
|
|
|
+ }
|
|
|
|
+ warehouseInOutInfoWrapper.eq("base_id", warehouseInOutInfo.getBaseId())
|
|
.eq("position_id", warehouseInOutInfo.getPositionId())
|
|
.eq("position_id", warehouseInOutInfo.getPositionId())
|
|
.eq("status_flag", StatusEnum.TEMPORARILY_STORED.getFlag())
|
|
.eq("status_flag", StatusEnum.TEMPORARILY_STORED.getFlag())
|
|
- .orderBy("update_date", false));
|
|
|
|
|
|
+ .orderBy("update_date", false);
|
|
|
|
+ Page<WarehouseInOutInfo> warehouseInOutInfoPage = this.selectPage(warehouseInOutInfo.getQueryPage(), warehouseInOutInfoWrapper);
|
|
List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoPage.getRecords();
|
|
List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoPage.getRecords();
|
|
if (warehouseInOutInfoList != null) {
|
|
if (warehouseInOutInfoList != null) {
|
|
for (WarehouseInOutInfo warehouseInOutInfo1 : warehouseInOutInfoList) {
|
|
for (WarehouseInOutInfo warehouseInOutInfo1 : warehouseInOutInfoList) {
|
|
@@ -224,6 +232,8 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
//判断出入库
|
|
//判断出入库
|
|
//常用库入库
|
|
//常用库入库
|
|
if ("2".equals(warehouseInOutInfo.getInOutFlag()) && "1".equals(warehouseBaseInfo.getWarehouseType())) {
|
|
if ("2".equals(warehouseInOutInfo.getInOutFlag()) && "1".equals(warehouseBaseInfo.getWarehouseType())) {
|
|
|
|
+
|
|
|
|
+ float original = 0f;
|
|
//判断是否有库
|
|
//判断是否有库
|
|
if (warehouseBaseInfo != null) {
|
|
if (warehouseBaseInfo != null) {
|
|
// 查询库位
|
|
// 查询库位
|
|
@@ -236,6 +246,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
// 判断是否有货
|
|
// 判断是否有货
|
|
if (warehousePositionStorageInfo != null) {
|
|
if (warehousePositionStorageInfo != null) {
|
|
|
|
+ original = warehousePositionStorageInfo.getStorage();
|
|
// 更新库存量
|
|
// 更新库存量
|
|
warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
|
|
warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
|
|
warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
@@ -252,8 +263,91 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
+ .eq(TranCarInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
|
+ if (tranCarInfo != null) {
|
|
|
|
+ //将到货数据同步到派车表
|
|
|
|
+ tranCarInfo.setUnloadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setUnloadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
|
|
|
|
+ tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
|
|
|
|
+ if ("1".equals(tranCarInfo.getSubmit())) {
|
|
|
|
+ throw new YException(YExceptionEnum.CARNO_SUBMITTED_ERROR);
|
|
|
|
+ } else {
|
|
|
|
+ tranCarInfo.setSubmit("1");
|
|
|
|
+ }
|
|
|
|
+ tranCarInfoService.updateById(tranCarInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 生成加权成本数据
|
|
|
|
+ WeightedDetails weightedDetails = new WeightedDetails();
|
|
|
|
+ weightedDetails.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ weightedDetails.setId(IdGenerator.generateUUID());
|
|
|
|
+ weightedDetails.setWarehouseId(warehouseInOutInfo.getBaseId());
|
|
|
|
+ weightedDetails.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ weightedDetails.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
|
+ weightedDetails.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ weightedDetails.setGrainType(warehouseInOutInfo.getType());
|
|
|
|
+ weightedDetails.setInTypeKey(warehouseInOutInfo.getTaskTypeKey());
|
|
|
|
+ weightedDetails.setInType(warehouseInOutInfo.getTaskType());
|
|
|
|
+ weightedDetails.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ weightedDetails.setPureWeight(warehouseInOutInfo.getPureWeight());
|
|
|
|
+ weightedDetails.setUnitPrice(warehouseInOutInfo.getUnitPrice());
|
|
|
|
+ weightedDetails.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ weightedDetails.setFreight(warehouseInOutInfo.getFreight());
|
|
|
|
+ weightedDetails.setOriginalStock(original);
|
|
|
|
+ // 查询入库全加权成本
|
|
|
|
+ List<WeightedDetails> weightedDetailsList = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ if (CollectionUtils.isEmpty(weightedDetailsList)) {
|
|
|
|
+ weightedDetails.setCostBefore(0f);
|
|
|
|
+ } else {
|
|
|
|
+ weightedDetails.setCostBefore(weightedDetailsList.get(0).getCostBefore());
|
|
|
|
+ }
|
|
|
|
+ // 计算新加权成本
|
|
|
|
+ Float newCost = 0f;
|
|
|
|
+ if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getPureWeight() + original);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ weightedDetails.setCostAfter(newCost);
|
|
|
|
+
|
|
|
|
+ weightedDetailsService.insert(weightedDetails);
|
|
|
|
+ // 修改成本信息表
|
|
|
|
+ CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", weightedDetails.getWarehouseId())
|
|
|
|
+ .eq("goods_name_key", weightedDetails.getGoodsNameKey()));
|
|
|
|
+ List<WeightedDetails> weightedDetailsLists = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ Float net = 0f;
|
|
|
|
+ for(int i=0;i<weightedDetailsLists.size();i++){
|
|
|
|
+ net = net +weightedDetailsLists.get(i).getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ if(costManagementInfo ==null){
|
|
|
|
+ CostManagementInfo costManagementInfo1= new CostManagementInfo();
|
|
|
|
+ costManagementInfo1.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ costManagementInfo1.setId(IdGenerator.generateUUID());
|
|
|
|
+ costManagementInfo1.setWarehouseId(weightedDetails.getWarehouseId());
|
|
|
|
+ costManagementInfo1.setWarehouseName(weightedDetails.getWarehouseName());
|
|
|
|
+ costManagementInfo1.setGoodsNameKey(weightedDetails.getGoodsNameKey());
|
|
|
|
+ costManagementInfo1.setGoodsName(weightedDetails.getGoodsName());
|
|
|
|
+ costManagementInfo1.setWarehouseType(warehouseBaseInfo.getWarehouseType());
|
|
|
|
+
|
|
|
|
+ costManagementInfo1.setStorage(net);
|
|
|
|
+ costManagementInfo1.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfoService.insert(costManagementInfo1);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ costManagementInfo.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfo.setStorage(net);
|
|
|
|
+ costManagementInfoService.updateById(costManagementInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//常用库出库
|
|
//常用库出库
|
|
else if ("1".equals(warehouseInOutInfo.getInOutFlag()) && "1".equals(warehouseBaseInfo.getWarehouseType())) {
|
|
else if ("1".equals(warehouseInOutInfo.getInOutFlag()) && "1".equals(warehouseBaseInfo.getWarehouseType())) {
|
|
@@ -347,12 +441,439 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
warehouseInOutDetail.setInfoId(warehouseInOutInfo.getId());
|
|
warehouseInOutDetail.setInfoId(warehouseInOutInfo.getId());
|
|
warehouseInOutDetail.setId(IdGenerator.generateUUID());
|
|
warehouseInOutDetail.setId(IdGenerator.generateUUID());
|
|
warehouseInOutDetailService.insert(warehouseInOutDetail);
|
|
warehouseInOutDetailService.insert(warehouseInOutDetail);
|
|
|
|
+ //App端入库关联派车表
|
|
|
|
+ if ("0".equals(warehouseInOutInfo.getPcFlag()) && "入库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
+ .eq(TranCarInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0));
|
|
|
|
+ // 采购订单
|
|
|
|
+ PurchaseOrder purchaseOrder = purchaseOrderService.selectOne(new EntityWrapper<PurchaseOrder>().eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ // 合同表
|
|
|
|
+ ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>().eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ //更新库存量
|
|
|
|
+ if (warehouseBaseInfo != null) {
|
|
|
|
+ float original = 0f;
|
|
|
|
+ // 查询库位
|
|
|
|
+ WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
|
|
|
|
+ if (warehousePositionInfo != null) {
|
|
|
|
+ // 查询货物库存量
|
|
|
|
+ WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
+ .eq("position_id", warehouseInOutInfo.getPositionId())
|
|
|
|
+ .eq("goods_name", warehouseInOutInfo.getGoodsName())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ // 判断是否有货
|
|
|
|
+ if (warehousePositionStorageInfo != null) {
|
|
|
|
+ original = warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight();
|
|
|
|
+ // 更新库存量
|
|
|
|
+ warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
|
|
|
|
+ warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
|
|
+ }
|
|
|
|
+ // 没有货
|
|
|
|
+ else {
|
|
|
|
+ original=0f;
|
|
|
|
+ WarehousePositionStorageInfo warehousePositionStorageInfo1 = new WarehousePositionStorageInfo();
|
|
|
|
+ warehousePositionStorageInfo1.setId(IdGenerator.generateUUID());
|
|
|
|
+ warehousePositionStorageInfo1.setPositionId(warehouseInOutInfo.getPositionId());
|
|
|
|
+ warehousePositionStorageInfo1.setBinNumber(warehouseInOutInfo.getBinNumber());
|
|
|
|
+ warehousePositionStorageInfo1.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ warehousePositionStorageInfo1.setStorage(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 生成加权成本数据
|
|
|
|
+ WeightedDetails weightedDetails = new WeightedDetails();
|
|
|
|
+ weightedDetails.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ weightedDetails.setId(IdGenerator.generateUUID());
|
|
|
|
+ weightedDetails.setWarehouseId(warehouseInOutInfo.getBaseId());
|
|
|
|
+ weightedDetails.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ weightedDetails.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
|
+ weightedDetails.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ weightedDetails.setGrainType(warehouseInOutInfo.getType());
|
|
|
|
+ weightedDetails.setInTypeKey(warehouseInOutInfo.getTaskTypeKey());
|
|
|
|
+ weightedDetails.setInType(warehouseInOutInfo.getTaskType());
|
|
|
|
+ weightedDetails.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ weightedDetails.setPureWeight(warehouseInOutInfo.getPureWeight());
|
|
|
|
+ weightedDetails.setUnitPrice(warehouseInOutInfo.getUnitPrice());
|
|
|
|
+ weightedDetails.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ weightedDetails.setFreight(warehouseInOutInfo.getFreight());
|
|
|
|
+ weightedDetails.setOriginalStock(original);
|
|
|
|
+ // 查询入库全加权成本
|
|
|
|
+ List<WeightedDetails> weightedDetailsList = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ if (CollectionUtils.isEmpty(weightedDetailsList)) {
|
|
|
|
+ weightedDetails.setCostBefore(0f);
|
|
|
|
+ } else {
|
|
|
|
+ weightedDetails.setCostBefore(weightedDetailsList.get(0).getCostBefore());
|
|
|
|
+ }
|
|
|
|
+ // 计算新加权成本
|
|
|
|
+ Float newCost = 0f;
|
|
|
|
+ if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getPureWeight() + original);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ weightedDetails.setCostAfter(newCost);
|
|
|
|
+
|
|
|
|
+ weightedDetailsService.insert(weightedDetails);
|
|
|
|
+ // 修改成本信息表
|
|
|
|
+ CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", weightedDetails.getWarehouseId())
|
|
|
|
+ .eq("goods_name_key", weightedDetails.getGoodsNameKey()));
|
|
|
|
+ List<WeightedDetails> weightedDetailsLists = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ Float net = 0f;
|
|
|
|
+ for(int i=0;i<weightedDetailsLists.size();i++){
|
|
|
|
+ net = net +weightedDetailsLists.get(i).getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ if(costManagementInfo ==null){
|
|
|
|
+ CostManagementInfo costManagementInfo1= new CostManagementInfo();
|
|
|
|
+ costManagementInfo1.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ costManagementInfo1.setId(IdGenerator.generateUUID());
|
|
|
|
+ costManagementInfo1.setWarehouseId(weightedDetails.getWarehouseId());
|
|
|
|
+ costManagementInfo1.setWarehouseName(weightedDetails.getWarehouseName());
|
|
|
|
+ costManagementInfo1.setGoodsNameKey(weightedDetails.getGoodsNameKey());
|
|
|
|
+ costManagementInfo1.setGoodsName(weightedDetails.getGoodsName());
|
|
|
|
+ costManagementInfo1.setWarehouseType(warehouseBaseInfo.getWarehouseType());
|
|
|
|
+
|
|
|
|
+ costManagementInfo1.setStorage(net);
|
|
|
|
+ costManagementInfo1.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfoService.insert(costManagementInfo1);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ costManagementInfo.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfo.setStorage(net);
|
|
|
|
+ costManagementInfoService.updateById(costManagementInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ StockPurchaseReceiptReport stockPurchaseReceiptReport = new StockPurchaseReceiptReport();
|
|
|
|
+ PurchaseReceiptReport purchaseReceiptReport = new PurchaseReceiptReport();
|
|
|
|
+ // 期货采购入库统计
|
|
|
|
+ if ("2".equals(contractManagementInfo.getGoodsType())) {
|
|
|
|
+ purchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
|
|
+ purchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
|
+ purchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ purchaseReceiptReport.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ purchaseReceiptReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
|
+ purchaseReceiptReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
|
|
|
|
+ purchaseReceiptReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ purchaseReceiptReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
|
+ purchaseReceiptReport.setWarehousingDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ purchaseReceiptReport.setProtein(warehouseInOutDetail.getProtein());
|
|
|
|
+ purchaseReceiptReport.setWaterContent(warehouseInOutDetail.getWaterContent());
|
|
|
|
+ purchaseReceiptReport.setDeductionAmount(Float.valueOf(warehouseInOutInfo.getDeductionAmount()));
|
|
|
|
+ purchaseReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ purchaseReceiptReport.setDeductionItems(warehouseInOutInfo.getDeductionItems());
|
|
|
|
+ purchaseReceiptReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ purchaseReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
|
+ purchaseReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
|
+ if (purchaseOrder != null) {
|
|
|
|
+ purchaseReceiptReport.setUnitPrice(purchaseOrder.getUnitPrice());
|
|
|
|
+ purchaseReceiptReport.setUnloadingCharge(purchaseOrder.getUnloadingCharge());
|
|
|
|
+ purchaseReceiptReport.setInvoiceFee(purchaseOrder.getInvoiceFee());
|
|
|
|
+ //期货
|
|
|
|
+ if (purchaseOrder.getBasis() != null) {
|
|
|
|
+ purchaseReceiptReport.setBasisPrice(purchaseOrder.getBasis());
|
|
|
|
+ BigDecimal unitPrice = new BigDecimal(Float.toString(purchaseReceiptReport.getUnitPrice()));
|
|
|
|
+ BigDecimal basis = new BigDecimal(Float.toString(purchaseReceiptReport.getBasisPrice()));
|
|
|
|
+ BigDecimal unloadingCharge = new BigDecimal(Float.toString(purchaseReceiptReport.getUnloadingCharge()));
|
|
|
|
+ BigDecimal invoiceFee = new BigDecimal(Float.toString(purchaseReceiptReport.getInvoiceFee()));
|
|
|
|
+ BigDecimal deductionAmount = new BigDecimal(Float.toString(purchaseReceiptReport.getDeductionAmount()));
|
|
|
|
+ purchaseReceiptReport.setSettlementPrice(unitPrice.add(basis).add(unloadingCharge).add(invoiceFee).add(deductionAmount).floatValue());
|
|
|
|
+ }
|
|
|
|
+ purchaseReceiptReport.setCustomerName(purchaseOrder.getSeller());
|
|
|
|
+ purchaseReceiptReport.setInvoiceType(purchaseOrder.getType());
|
|
|
|
+ purchaseReceiptReport.setInvoiceTypeKey(purchaseOrder.getType());
|
|
|
|
+ purchaseReceiptReport.setAmountIngPayable(CalculationUtil.mulToFloat(purchaseReceiptReport.getSettlementPrice(), purchaseReceiptReport.getNetWeight()));
|
|
|
|
+ purchaseReceiptReport.setAmountEdPayable(0f);
|
|
|
|
+ purchaseReceiptReport.setAmountNotPayable(purchaseReceiptReport.getAmountIngPayable());
|
|
|
|
+ if (tranCarInfo != null) {
|
|
|
|
+ //将到货数据同步到派车表
|
|
|
|
+ tranCarInfo.setUnloadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setUnloadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ tranCarInfo.setDeductionItems(warehouseInOutInfo.getDeductionItems());
|
|
|
|
+ tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
|
|
|
|
+ tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
|
|
|
|
+ if (purchaseOrder != null) {
|
|
|
|
+ tranCarInfo.setSettlementPrice(purchaseReceiptReport.getSettlementPrice());
|
|
|
|
+ }
|
|
|
|
+ tranCarInfoService.updateById(tranCarInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 客户确认
|
|
|
|
+ TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatusFlag("1");
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatus("是");
|
|
|
|
+ tesk(warehouseInOutInfo, "2");
|
|
|
|
+ geTuiUtils.pushByCid("卸货提醒", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "申请卸货,请及时确认", purchaseOrder.getCommonId());
|
|
|
|
+ } else {
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatusFlag("3");
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatus("否");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //现货采购入库统计
|
|
|
|
+ else {
|
|
|
|
+ stockPurchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
|
|
+ stockPurchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
|
+ stockPurchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ stockPurchaseReceiptReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ stockPurchaseReceiptReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ stockPurchaseReceiptReport.setGrossWeight(warehouseInOutInfo.getGrossWeight());
|
|
|
|
+ stockPurchaseReceiptReport.setTare(warehouseInOutInfo.getTare());
|
|
|
|
+ stockPurchaseReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockPurchaseReceiptReport.setWarehousingDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ stockPurchaseReceiptReport.setDeductionWeight(warehouseInOutInfo.getDeductionWeight());
|
|
|
|
+ stockPurchaseReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockPurchaseReceiptReport.setAmountIngPayable
|
|
|
|
+ (warehouseInOutInfo.getNetWeight() *
|
|
|
|
+ (Float.valueOf(String.valueOf(contractManagementInfo.getUnitContractPrice())) - Float.valueOf(warehouseInOutInfo.getDeductionAmount())));
|
|
|
|
+ stockPurchaseReceiptReport.setAmountEdPayable(0.0f);
|
|
|
|
+ stockPurchaseReceiptReport.setAmountNotPayable(stockPurchaseReceiptReport.getAmountIngPayable());
|
|
|
|
+ stockPurchaseReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
|
+ stockPurchaseReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
|
+ if (tranCarInfo != null) {
|
|
|
|
+ //将到货数据同步到派车表
|
|
|
|
+ tranCarInfo.setUnloadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setUnloadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
|
|
|
|
+ tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
|
|
|
|
+ if ("1".equals(tranCarInfo.getSubmit())) {
|
|
|
|
+ throw new YException(YExceptionEnum.CARNO_SUBMITTED_ERROR);
|
|
|
|
+ } else {
|
|
|
|
+ tranCarInfo.setSubmit("1");
|
|
|
|
+ }
|
|
|
|
+ tranCarInfoService.updateById(tranCarInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ purchaseReceiptReportService.insert(purchaseReceiptReport);
|
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(purchaseReceiptReport.getWorkflowId());
|
|
|
|
+ // 不是退回的单子
|
|
|
|
+ if (isStartWorkflow) {
|
|
|
|
+ Workflow workflow = workflowService
|
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(purchaseReceiptReport.getCompId(), "PROCUREMENT-RECEIPT-REPORT");
|
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
|
+ if (workflow == null) {
|
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ // 开启审核流
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ // 设置状态 已提交审核
|
|
|
|
+ purchaseReceiptReport.setWorkflowId(workflow.getId());
|
|
|
|
+ purchaseReceiptReportService.updateById(purchaseReceiptReport);
|
|
|
|
+ workflowService.startInstance(workflow.getId(), purchaseReceiptReport.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退回的单子 再启用
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ purchaseReceiptReportService.updateById(purchaseReceiptReport);
|
|
|
|
+ workflowService.activateInstance(purchaseReceiptReport.getWorkflowId(), purchaseReceiptReport.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //App端出库
|
|
|
|
+ else if ("0".equals(warehouseInOutInfo.getPcFlag()) && "出库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ //状态改为已发车
|
|
|
|
+ warehouseInOutInfo.setTranFlag("1");
|
|
|
|
+ // 销售订单
|
|
|
|
+ SaleOrder saleOrder = saleOrderService.selectOne(new EntityWrapper<SaleOrder>().eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ //判断是否第一次提交
|
|
|
|
+ if (StringUtils.isEmpty(warehouseInOutDetail.getId())) {
|
|
|
|
+ // 插入详情
|
|
|
|
+ warehouseInOutDetail.setInfoId(warehouseInOutInfo.getId());
|
|
|
|
+ warehouseInOutDetail.setId(IdGenerator.generateUUID());
|
|
|
|
+ warehouseInOutDetailService.insert(warehouseInOutDetail);
|
|
|
|
+ }
|
|
|
|
+ //更新库存量
|
|
|
|
+ //判断是否有货
|
|
|
|
+ if (warehouseBaseInfo != null) {
|
|
|
|
+ // 查询库位
|
|
|
|
+ WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
|
|
|
|
+ if (warehousePositionInfo != null) {
|
|
|
|
+ // 查询货物库存量
|
|
|
|
+ WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
|
|
|
|
+ .eq("position_id", warehouseInOutInfo.getPositionId())
|
|
|
|
+ .eq("goods_name", warehouseInOutInfo.getGoodsName())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ // 判断是否有货
|
|
|
|
+ if (warehousePositionStorageInfo != null) {
|
|
|
|
+ if (warehouseInOutInfo.getNetWeight() <= warehousePositionStorageInfo.getStorage()) {
|
|
|
|
+ // 更新库存量
|
|
|
|
+ warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() - warehouseInOutInfo.getNetWeight());
|
|
|
|
+ warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
|
|
+ }
|
|
|
|
+ //出库量大于库存量
|
|
|
|
+ else {
|
|
|
|
+ throw new YException(YExceptionEnum.INVENTORY_NO_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 没有储存量
|
|
|
|
+ else {
|
|
|
|
+ throw new YException(YExceptionEnum.POSITIONSTORAGE_NO_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //库位不存在
|
|
|
|
+ else {
|
|
|
|
+ throw new YException(YExceptionEnum.POSITION_NO_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //仓库不存在
|
|
|
|
+ else {
|
|
|
|
+ throw new YException(YExceptionEnum.WAREHOUSE_NO_ERROR);
|
|
|
|
+ }
|
|
|
|
+ //查询期货现货合同
|
|
|
|
+ ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo()));
|
|
|
|
+ if ("2".equals(contractManagementInfo.getGoodsType())) {
|
|
|
|
+ //客户生成收货信息
|
|
|
|
+ TranCarInfo tranCarInfo = new TranCarInfo();
|
|
|
|
+ tranCarInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ tranCarInfo.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ tranCarInfo.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
|
+ tranCarInfo.setLoadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setLoadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setConfirmFlag(StatusEnum.NOT_CONFIRM.getFlag());
|
|
|
|
+ // 期货销售出库统计
|
|
|
|
+ SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
|
|
|
|
+ salesDeliveryReport.setId(IdGenerator.generateUUID());
|
|
|
|
+ salesDeliveryReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
|
+ salesDeliveryReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ salesDeliveryReport.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ salesDeliveryReport.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
|
+ salesDeliveryReport.setPositionNumber(warehouseInOutInfo.getBinNumber());
|
|
|
|
+ salesDeliveryReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ salesDeliveryReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
|
+ salesDeliveryReport.setRetrievalDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ salesDeliveryReport.setProtein(warehouseInOutDetail.getProtein());
|
|
|
|
+ salesDeliveryReport.setWaterContent(warehouseInOutDetail.getWaterContent());
|
|
|
|
+ salesDeliveryReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ salesDeliveryReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ salesDeliveryReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
|
|
+ salesDeliveryReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
|
|
+ if (saleOrder != null) {
|
|
|
|
+ salesDeliveryReport.setUnitPrice(saleOrder.getUnitPrice());
|
|
|
|
+ salesDeliveryReport.setInvoiceFee(saleOrder.getInvoiceFee());
|
|
|
|
+ //期货
|
|
|
|
+ if (saleOrder.getBasis() != null) {
|
|
|
|
+ salesDeliveryReport.setBasisPrice(saleOrder.getBasis());
|
|
|
|
+ BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
|
+ BigDecimal basis = new BigDecimal(Float.toString(salesDeliveryReport.getBasisPrice()));
|
|
|
|
+ BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
|
+ salesDeliveryReport.setSettlementPrice(unitPrice.add(basis).add(invoiceFee).floatValue());
|
|
|
|
+ tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice() + saleOrder.getBasis() + saleOrder.getInvoiceFee());
|
|
|
|
+ }
|
|
|
|
+ salesDeliveryReport.setCustomerName(saleOrder.getBuyer());
|
|
|
|
+ salesDeliveryReport.setCollectionIngPayable(CalculationUtil.mulToFloat(salesDeliveryReport.getSettlementPrice(), salesDeliveryReport.getNetWeight()));
|
|
|
|
+ salesDeliveryReport.setCollectionEdPayable(0f);
|
|
|
|
+ salesDeliveryReport.setCollectionNotPayable(salesDeliveryReport.getCollectionIngPayable());
|
|
|
|
+ tranCarInfoService.insert(tranCarInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 客户确认
|
|
|
|
+ TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatusFlag("1");
|
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatus("是");
|
|
|
|
+ geTuiUtils.pushByCid("发货通知", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "已发出", saleOrder.getCommonId());
|
|
|
|
+ tesk(warehouseInOutInfo, "1");
|
|
|
|
+ } else {
|
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatusFlag("3");
|
|
|
|
+ salesDeliveryReport.setCustomerConfirmationStatus("否");
|
|
|
|
+ }
|
|
|
|
+ salesDeliveryReportService.insert(salesDeliveryReport);
|
|
|
|
+
|
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(salesDeliveryReport.getWorkflowId());
|
|
|
|
+ // 不是退回的单子
|
|
|
|
+ if (isStartWorkflow) {
|
|
|
|
+ Workflow workflow = workflowService
|
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(saleOrder.getCompId(), "SALE-RECEIPT-REPORT");
|
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
|
+ if (workflow == null) {
|
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ // 开启审核流
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ // 设置状态 已提交审核
|
|
|
|
+ salesDeliveryReport.setWorkflowId(workflow.getId());
|
|
|
|
+ salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
|
|
+ workflowService.startInstance(workflow.getId(), salesDeliveryReport.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退回的单子 再启用
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
|
|
+ workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //现货销售统计
|
|
|
|
+ StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
|
|
|
|
+ stockSaleReceiptReport.setId(IdGenerator.generateUUID());
|
|
|
|
+ stockSaleReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
|
|
+ stockSaleReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ stockSaleReceiptReport.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ stockSaleReceiptReport.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ stockSaleReceiptReport.setGrossWeight(warehouseInOutInfo.getGrossWeight());
|
|
|
|
+ stockSaleReceiptReport.setTare(warehouseInOutInfo.getTare());
|
|
|
|
+ stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ if ("出库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getUnitPrice() * stockSaleReceiptReport.getSettlementWeight());
|
|
|
|
+ } else if ("退库并出库".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ stockSaleReceiptReport.setReturnDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(-warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(0.0f);
|
|
|
|
+ stockSaleReceiptReport.setReturnFlag("1");
|
|
|
|
+ }
|
|
|
|
+ stockSaleReceiptReportService.insert(stockSaleReceiptReport);
|
|
|
|
+ boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(stockSaleReceiptReport.getWorkflowId());
|
|
|
|
+ // 不是退回的单子
|
|
|
|
+ if (isStartWorkflow) {
|
|
|
|
+ Workflow workflow = workflowService
|
|
|
|
+ .findLatestWorkflowByBusinessCodeByApp(saleOrder.getCompId(), "SALE-RECEIPT-REPORT");
|
|
|
|
+ // 没配置审核流程,直接结束并处理信息
|
|
|
|
+ if (workflow == null) {
|
|
|
|
+ throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ // 开启审核流
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ // 设置状态 已提交审核
|
|
|
|
+ stockSaleReceiptReport.setWorkflowId(workflow.getId());
|
|
|
|
+ stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
|
|
|
|
+ workflowService.startInstance(workflow.getId(), stockSaleReceiptReport.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 退回的单子 再启用
|
|
|
|
+ else {
|
|
|
|
+
|
|
|
|
+ stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
|
|
|
|
+ workflowService.activateInstance(stockSaleReceiptReport.getWorkflowId(), stockSaleReceiptReport.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 编辑修改记录
|
|
// 编辑修改记录
|
|
else {
|
|
else {
|
|
//App端入库关联派车表
|
|
//App端入库关联派车表
|
|
if ("0".equals(warehouseInOutInfo.getPcFlag()) && "入库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
if ("0".equals(warehouseInOutInfo.getPcFlag()) && "入库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
-// warehouseInOutInfo.setInOutDate(warehouseInOutInfo.getUpdateDate());
|
|
|
|
TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
.eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
.eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
.eq("car_no", warehouseInOutInfo.getCarNo())
|
|
.eq("car_no", warehouseInOutInfo.getCarNo())
|
|
@@ -373,6 +894,8 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
}
|
|
}
|
|
//更新库存量
|
|
//更新库存量
|
|
if (warehouseBaseInfo != null) {
|
|
if (warehouseBaseInfo != null) {
|
|
|
|
+
|
|
|
|
+ Float original = 0f;
|
|
// 查询库位
|
|
// 查询库位
|
|
WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
|
|
WarehousePositionInfo warehousePositionInfo = warehousePositionInfoService.selectById(warehouseInOutInfo.getPositionId());
|
|
if (warehousePositionInfo != null) {
|
|
if (warehousePositionInfo != null) {
|
|
@@ -383,12 +906,14 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
// 判断是否有货
|
|
// 判断是否有货
|
|
if (warehousePositionStorageInfo != null) {
|
|
if (warehousePositionStorageInfo != null) {
|
|
|
|
+ original = warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight();
|
|
// 更新库存量
|
|
// 更新库存量
|
|
warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
|
|
warehousePositionStorageInfo.setStorage(warehousePositionStorageInfo.getStorage() + warehouseInOutInfo.getNetWeight());
|
|
warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
warehousePositionStorageInfoService.updateById(warehousePositionStorageInfo);
|
|
}
|
|
}
|
|
// 没有货
|
|
// 没有货
|
|
else {
|
|
else {
|
|
|
|
+ original= 0f;
|
|
WarehousePositionStorageInfo warehousePositionStorageInfo1 = new WarehousePositionStorageInfo();
|
|
WarehousePositionStorageInfo warehousePositionStorageInfo1 = new WarehousePositionStorageInfo();
|
|
warehousePositionStorageInfo1.setId(IdGenerator.generateUUID());
|
|
warehousePositionStorageInfo1.setId(IdGenerator.generateUUID());
|
|
warehousePositionStorageInfo1.setPositionId(warehouseInOutInfo.getPositionId());
|
|
warehousePositionStorageInfo1.setPositionId(warehouseInOutInfo.getPositionId());
|
|
@@ -398,11 +923,77 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
warehousePositionStorageInfoService.insert(warehousePositionStorageInfo1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 生成加权成本数据
|
|
|
|
+ WeightedDetails weightedDetails = new WeightedDetails();
|
|
|
|
+ weightedDetails.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ weightedDetails.setId(IdGenerator.generateUUID());
|
|
|
|
+ weightedDetails.setWarehouseId(warehouseInOutInfo.getBaseId());
|
|
|
|
+ weightedDetails.setWarehouseName(warehouseInOutInfo.getWarehouseName());
|
|
|
|
+ weightedDetails.setGoodsNameKey(warehouseInOutInfo.getGoodsNameKey());
|
|
|
|
+ weightedDetails.setGoodsName(warehouseInOutInfo.getGoodsName());
|
|
|
|
+ weightedDetails.setGrainType(warehouseInOutInfo.getType());
|
|
|
|
+ weightedDetails.setInTypeKey(warehouseInOutInfo.getTaskTypeKey());
|
|
|
|
+ weightedDetails.setInType(warehouseInOutInfo.getTaskType());
|
|
|
|
+ weightedDetails.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ weightedDetails.setPureWeight(warehouseInOutInfo.getPureWeight());
|
|
|
|
+ weightedDetails.setUnitPrice(warehouseInOutInfo.getUnitPrice());
|
|
|
|
+ weightedDetails.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ weightedDetails.setFreight(warehouseInOutInfo.getFreight());
|
|
|
|
+ weightedDetails.setOriginalStock(original);
|
|
|
|
+ // 查询入库全加权成本
|
|
|
|
+ List<WeightedDetails> weightedDetailsList = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ if (CollectionUtils.isEmpty(weightedDetailsList)) {
|
|
|
|
+ weightedDetails.setCostBefore(0f);
|
|
|
|
+ } else {
|
|
|
|
+ weightedDetails.setCostBefore(weightedDetailsList.get(0).getCostBefore());
|
|
|
|
+ }
|
|
|
|
+ // 计算新加权成本
|
|
|
|
+ Float newCost = 0f;
|
|
|
|
+ if ("干粮".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getNetWeight() + original);
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ newCost = ((warehouseInOutInfo.getCost() + warehouseInOutInfo.getFreight()) * warehouseInOutInfo.getNetWeight() + original * weightedDetails.getCostBefore()) / (warehouseInOutInfo.getPureWeight() + original);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ weightedDetails.setCostAfter(newCost);
|
|
|
|
+
|
|
|
|
+ weightedDetailsService.insert(weightedDetails);
|
|
|
|
+ // 修改成本信息表
|
|
|
|
+ CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", weightedDetails.getWarehouseId())
|
|
|
|
+ .eq("goods_name_key", weightedDetails.getGoodsNameKey()));
|
|
|
|
+ List<WeightedDetails> weightedDetailsLists = weightedDetailsService.selectList(new EntityWrapper<WeightedDetails>().eq("warehouse_id", warehouseInOutInfo.getWarehouseName())
|
|
|
|
+ .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()).orderBy("update_date", false));
|
|
|
|
+ Float net = 0f;
|
|
|
|
+ for(int i=0;i<weightedDetailsLists.size();i++){
|
|
|
|
+ net = net +weightedDetailsLists.get(i).getNetWeight();
|
|
|
|
+ }
|
|
|
|
+ if(costManagementInfo ==null){
|
|
|
|
+ CostManagementInfo costManagementInfo1= new CostManagementInfo();
|
|
|
|
+ costManagementInfo1.setCompId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
|
|
|
|
+ costManagementInfo1.setId(IdGenerator.generateUUID());
|
|
|
|
+ costManagementInfo1.setWarehouseId(weightedDetails.getWarehouseId());
|
|
|
|
+ costManagementInfo1.setWarehouseName(weightedDetails.getWarehouseName());
|
|
|
|
+ costManagementInfo1.setGoodsNameKey(weightedDetails.getGoodsNameKey());
|
|
|
|
+ costManagementInfo1.setGoodsName(weightedDetails.getGoodsName());
|
|
|
|
+ costManagementInfo1.setWarehouseType(warehouseBaseInfo.getWarehouseType());
|
|
|
|
+
|
|
|
|
+ costManagementInfo1.setStorage(net);
|
|
|
|
+ costManagementInfo1.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfoService.insert(costManagementInfo1);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ costManagementInfo.setCost(weightedDetails.getCostAfter());
|
|
|
|
+ costManagementInfo.setStorage(net);
|
|
|
|
+ costManagementInfoService.updateById(costManagementInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
StockPurchaseReceiptReport stockPurchaseReceiptReport = new StockPurchaseReceiptReport();
|
|
StockPurchaseReceiptReport stockPurchaseReceiptReport = new StockPurchaseReceiptReport();
|
|
PurchaseReceiptReport purchaseReceiptReport = new PurchaseReceiptReport();
|
|
PurchaseReceiptReport purchaseReceiptReport = new PurchaseReceiptReport();
|
|
// 期货采购入库统计
|
|
// 期货采购入库统计
|
|
- if("2".equals(contractManagementInfo.getGoodsType())) {
|
|
|
|
|
|
+ if ("2".equals(contractManagementInfo.getGoodsType())) {
|
|
purchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
purchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
purchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
purchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
purchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
purchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
@@ -434,15 +1025,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
BigDecimal deductionAmount = new BigDecimal(Float.toString(purchaseReceiptReport.getDeductionAmount()));
|
|
BigDecimal deductionAmount = new BigDecimal(Float.toString(purchaseReceiptReport.getDeductionAmount()));
|
|
purchaseReceiptReport.setSettlementPrice(unitPrice.add(basis).add(unloadingCharge).add(invoiceFee).add(deductionAmount).floatValue());
|
|
purchaseReceiptReport.setSettlementPrice(unitPrice.add(basis).add(unloadingCharge).add(invoiceFee).add(deductionAmount).floatValue());
|
|
}
|
|
}
|
|
-// //现货
|
|
|
|
-// else {
|
|
|
|
-// BigDecimal unitPrice = new BigDecimal(Float.toString(purchaseReceiptReport.getUnitPrice()));
|
|
|
|
-// BigDecimal unloadingCharge = new BigDecimal(Float.toString(purchaseReceiptReport.getUnloadingCharge()));
|
|
|
|
-// BigDecimal invoiceFee = new BigDecimal(Float.toString(purchaseReceiptReport.getInvoiceFee()));
|
|
|
|
-// BigDecimal deductionAmount = new BigDecimal(Float.toString(purchaseReceiptReport.getDeductionAmount()));
|
|
|
|
-// purchaseReceiptReport.setSettlementPrice(unitPrice.add(unloadingCharge).add(invoiceFee).add(deductionAmount).floatValue());
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
purchaseReceiptReport.setCustomerName(purchaseOrder.getSeller());
|
|
purchaseReceiptReport.setCustomerName(purchaseOrder.getSeller());
|
|
purchaseReceiptReport.setInvoiceType(purchaseOrder.getType());
|
|
purchaseReceiptReport.setInvoiceType(purchaseOrder.getType());
|
|
purchaseReceiptReport.setInvoiceTypeKey(purchaseOrder.getType());
|
|
purchaseReceiptReport.setInvoiceTypeKey(purchaseOrder.getType());
|
|
@@ -463,9 +1045,23 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
tranCarInfoService.updateById(tranCarInfo);
|
|
tranCarInfoService.updateById(tranCarInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 客户确认
|
|
|
|
+ TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
+ .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
|
+ if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatusFlag("1");
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatus("是");
|
|
|
|
+ tesk(warehouseInOutInfo, "2");
|
|
|
|
+ geTuiUtils.pushByCid("卸货提醒", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "申请卸货,请及时确认", purchaseOrder.getCommonId());
|
|
|
|
+ } else {
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatusFlag("3");
|
|
|
|
+ purchaseReceiptReport.setCustomerConfirmationStatus("否");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//现货采购入库统计
|
|
//现货采购入库统计
|
|
- else{
|
|
|
|
|
|
+ else {
|
|
stockPurchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
stockPurchaseReceiptReport.setId(IdGenerator.generateUUID());
|
|
stockPurchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
stockPurchaseReceiptReport.setCompId(warehouseBaseInfo.getCompId());
|
|
stockPurchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
stockPurchaseReceiptReport.setContractNo(warehouseInOutInfo.getContractNo());
|
|
@@ -484,25 +1080,22 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
stockPurchaseReceiptReport.setAmountNotPayable(stockPurchaseReceiptReport.getAmountIngPayable());
|
|
stockPurchaseReceiptReport.setAmountNotPayable(stockPurchaseReceiptReport.getAmountIngPayable());
|
|
stockPurchaseReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
stockPurchaseReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
|
|
stockPurchaseReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
stockPurchaseReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
|
|
- }
|
|
|
|
-
|
|
|
|
- // 客户确认
|
|
|
|
- TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
|
|
|
|
- .eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
|
|
- .eq("car_no", warehouseInOutInfo.getCarNo())
|
|
|
|
- .eq("delete_flag", "0"));
|
|
|
|
- if (tranCarInfo1 != null && "3".equals(tranCarInfo1.getConfirmFlag())) {
|
|
|
|
- purchaseReceiptReport.setCustomerConfirmationStatusFlag("1");
|
|
|
|
- purchaseReceiptReport.setCustomerConfirmationStatus("是");
|
|
|
|
- tesk(warehouseInOutInfo, "2");
|
|
|
|
- geTuiUtils.pushByCid("卸货提醒", "您的合同车辆:" + warehouseInOutInfo.getCarNo() + "申请卸货,请及时确认", purchaseOrder.getCommonId());
|
|
|
|
- } else {
|
|
|
|
- purchaseReceiptReport.setCustomerConfirmationStatusFlag("3");
|
|
|
|
- purchaseReceiptReport.setCustomerConfirmationStatus("否");
|
|
|
|
|
|
+ if (tranCarInfo != null) {
|
|
|
|
+ //将到货数据同步到派车表
|
|
|
|
+ tranCarInfo.setUnloadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setUnloadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setDeductionAmount(warehouseInOutInfo.getDeductionAmount());
|
|
|
|
+ tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
|
|
|
|
+ tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
|
|
|
|
+ if ("1".equals(tranCarInfo.getSubmit())) {
|
|
|
|
+ throw new YException(YExceptionEnum.CARNO_SUBMITTED_ERROR);
|
|
|
|
+ } else {
|
|
|
|
+ tranCarInfo.setSubmit("1");
|
|
|
|
+ }
|
|
|
|
+ tranCarInfoService.updateById(tranCarInfo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
purchaseReceiptReportService.insert(purchaseReceiptReport);
|
|
purchaseReceiptReportService.insert(purchaseReceiptReport);
|
|
-
|
|
|
|
-
|
|
|
|
boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(purchaseReceiptReport.getWorkflowId());
|
|
boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(purchaseReceiptReport.getWorkflowId());
|
|
// 不是退回的单子
|
|
// 不是退回的单子
|
|
if (isStartWorkflow) {
|
|
if (isStartWorkflow) {
|
|
@@ -532,16 +1125,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
else if ("0".equals(warehouseInOutInfo.getPcFlag()) && "出库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
else if ("0".equals(warehouseInOutInfo.getPcFlag()) && "出库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
//状态改为已发车
|
|
//状态改为已发车
|
|
warehouseInOutInfo.setTranFlag("1");
|
|
warehouseInOutInfo.setTranFlag("1");
|
|
-// warehouseInOutInfo.setInOutDate(warehouseInOutInfo.getUpdateDate());
|
|
|
|
- //客户生成收货信息
|
|
|
|
- TranCarInfo tranCarInfo = new TranCarInfo();
|
|
|
|
- tranCarInfo.setId(IdGenerator.generateUUID());
|
|
|
|
- tranCarInfo.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
- tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
- tranCarInfo.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
|
- tranCarInfo.setLoadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
- tranCarInfo.setLoadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
- tranCarInfo.setConfirmFlag(StatusEnum.NOT_CONFIRM.getFlag());
|
|
|
|
// 销售订单
|
|
// 销售订单
|
|
SaleOrder saleOrder = saleOrderService.selectOne(new EntityWrapper<SaleOrder>().eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
SaleOrder saleOrder = saleOrderService.selectOne(new EntityWrapper<SaleOrder>().eq("contract_no", warehouseInOutInfo.getContractNo())
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
@@ -593,8 +1176,17 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
|
|
|
|
//查询期货现货合同
|
|
//查询期货现货合同
|
|
ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
- .eq("contract_no",warehouseInOutInfo.getContractNo()));
|
|
|
|
- if("2".equals(contractManagementInfo.getGoodsType())){
|
|
|
|
|
|
+ .eq("contract_no", warehouseInOutInfo.getContractNo()));
|
|
|
|
+ if ("2".equals(contractManagementInfo.getGoodsType())) {
|
|
|
|
+ //客户生成收货信息
|
|
|
|
+ TranCarInfo tranCarInfo = new TranCarInfo();
|
|
|
|
+ tranCarInfo.setId(IdGenerator.generateUUID());
|
|
|
|
+ tranCarInfo.setCarNo(warehouseInOutInfo.getCarNo());
|
|
|
|
+ tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
|
|
|
|
+ tranCarInfo.setTranCarNo(warehouseInOutInfo.getTranCarNo());
|
|
|
|
+ tranCarInfo.setLoadNetWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ tranCarInfo.setLoadPoundImg(warehouseInOutInfo.getAddressUrl());
|
|
|
|
+ tranCarInfo.setConfirmFlag(StatusEnum.NOT_CONFIRM.getFlag());
|
|
// 期货销售出库统计
|
|
// 期货销售出库统计
|
|
SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
|
|
SalesDeliveryReport salesDeliveryReport = new SalesDeliveryReport();
|
|
salesDeliveryReport.setId(IdGenerator.generateUUID());
|
|
salesDeliveryReport.setId(IdGenerator.generateUUID());
|
|
@@ -616,7 +1208,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
salesDeliveryReport.setUnitPrice(saleOrder.getUnitPrice());
|
|
salesDeliveryReport.setUnitPrice(saleOrder.getUnitPrice());
|
|
salesDeliveryReport.setInvoiceFee(saleOrder.getInvoiceFee());
|
|
salesDeliveryReport.setInvoiceFee(saleOrder.getInvoiceFee());
|
|
//期货
|
|
//期货
|
|
- if (saleOrder.getBasis()!=null){
|
|
|
|
|
|
+ if (saleOrder.getBasis() != null) {
|
|
salesDeliveryReport.setBasisPrice(saleOrder.getBasis());
|
|
salesDeliveryReport.setBasisPrice(saleOrder.getBasis());
|
|
BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
BigDecimal basis = new BigDecimal(Float.toString(salesDeliveryReport.getBasisPrice()));
|
|
BigDecimal basis = new BigDecimal(Float.toString(salesDeliveryReport.getBasisPrice()));
|
|
@@ -624,13 +1216,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
salesDeliveryReport.setSettlementPrice(unitPrice.add(basis).add(invoiceFee).floatValue());
|
|
salesDeliveryReport.setSettlementPrice(unitPrice.add(basis).add(invoiceFee).floatValue());
|
|
tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice() + saleOrder.getBasis() + saleOrder.getInvoiceFee());
|
|
tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice() + saleOrder.getBasis() + saleOrder.getInvoiceFee());
|
|
}
|
|
}
|
|
- //现货
|
|
|
|
-// else{
|
|
|
|
-// BigDecimal unitPrice = new BigDecimal(Float.toString(salesDeliveryReport.getUnitPrice()));
|
|
|
|
-// BigDecimal invoiceFee = new BigDecimal(Float.toString(salesDeliveryReport.getInvoiceFee()));
|
|
|
|
-// salesDeliveryReport.setSettlementPrice(unitPrice.add(invoiceFee).floatValue());
|
|
|
|
-// tranCarInfo.setSettlementPrice(saleOrder.getUnitPrice()+ saleOrder.getInvoiceFee());
|
|
|
|
-// }
|
|
|
|
salesDeliveryReport.setCustomerName(saleOrder.getBuyer());
|
|
salesDeliveryReport.setCustomerName(saleOrder.getBuyer());
|
|
salesDeliveryReport.setCollectionIngPayable(CalculationUtil.mulToFloat(salesDeliveryReport.getSettlementPrice(), salesDeliveryReport.getNetWeight()));
|
|
salesDeliveryReport.setCollectionIngPayable(CalculationUtil.mulToFloat(salesDeliveryReport.getSettlementPrice(), salesDeliveryReport.getNetWeight()));
|
|
salesDeliveryReport.setCollectionEdPayable(0f);
|
|
salesDeliveryReport.setCollectionEdPayable(0f);
|
|
@@ -678,7 +1263,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
salesDeliveryReportService.updateById(salesDeliveryReport);
|
|
workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
|
|
workflowService.activateInstance(salesDeliveryReport.getWorkflowId(), salesDeliveryReport.getId());
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
//现货销售统计
|
|
//现货销售统计
|
|
StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
|
|
StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
|
|
stockSaleReceiptReport.setId(IdGenerator.generateUUID());
|
|
stockSaleReceiptReport.setId(IdGenerator.generateUUID());
|
|
@@ -689,15 +1274,21 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
stockSaleReceiptReport.setGrossWeight(warehouseInOutInfo.getGrossWeight());
|
|
stockSaleReceiptReport.setGrossWeight(warehouseInOutInfo.getGrossWeight());
|
|
stockSaleReceiptReport.setTare(warehouseInOutInfo.getTare());
|
|
stockSaleReceiptReport.setTare(warehouseInOutInfo.getTare());
|
|
stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
|
|
- if("1".equals(warehouseInOutInfo.getTaskTypeKey())){
|
|
|
|
|
|
+ if ("出库任务".equals(warehouseInOutInfo.getTaskType())) {
|
|
stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
|
|
stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
|
|
stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getUnitPrice() * stockSaleReceiptReport.getSettlementWeight());
|
|
stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getUnitPrice() * stockSaleReceiptReport.getSettlementWeight());
|
|
- }else if ("4".equals(warehouseInOutInfo.getTaskTypeKey())){
|
|
|
|
- stockSaleReceiptReport.setReturnDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
- stockSaleReceiptReport.setSettlementWeight(-warehouseInOutInfo.getNetWeight());
|
|
|
|
- stockSaleReceiptReport.setAmountIngReceivable(0.0f);
|
|
|
|
- stockSaleReceiptReport.setReturnFlag("1");
|
|
|
|
|
|
+ } else if ("退库并出库".equals(warehouseInOutInfo.getTaskType())) {
|
|
|
|
+ if ("1".equals(warehouseInOutInfo.getTaskTypeKey())) {
|
|
|
|
+ stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getUnitPrice() * stockSaleReceiptReport.getSettlementWeight());
|
|
|
|
+ } else if ("4".equals(warehouseInOutInfo.getTaskTypeKey())) {
|
|
|
|
+ stockSaleReceiptReport.setReturnDate(warehouseInOutInfo.getInOutDate());
|
|
|
|
+ stockSaleReceiptReport.setSettlementWeight(-warehouseInOutInfo.getNetWeight());
|
|
|
|
+ stockSaleReceiptReport.setAmountIngReceivable(0.0f);
|
|
|
|
+ stockSaleReceiptReport.setReturnFlag("1");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
stockSaleReceiptReportService.insert(stockSaleReceiptReport);
|
|
stockSaleReceiptReportService.insert(stockSaleReceiptReport);
|
|
boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(stockSaleReceiptReport.getWorkflowId());
|
|
boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(stockSaleReceiptReport.getWorkflowId());
|
|
@@ -917,7 +1508,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
|
|
WarehouseInOutInfo warehouseInOutInfo = this.selectById(id);
|
|
WarehouseInOutInfo warehouseInOutInfo = this.selectById(id);
|
|
//详情信息
|
|
//详情信息
|
|
WarehouseInOutDetail warehouseInOutDetail = warehouseInOutDetailService.selectOne(new EntityWrapper<WarehouseInOutDetail>().eq(WarehouseInOutDetail.QueryFiles.INFO_ID, id));
|
|
WarehouseInOutDetail warehouseInOutDetail = warehouseInOutDetailService.selectOne(new EntityWrapper<WarehouseInOutDetail>().eq(WarehouseInOutDetail.QueryFiles.INFO_ID, id));
|
|
- if (warehouseInOutDetail!=null){
|
|
|
|
|
|
+ if (warehouseInOutDetail != null) {
|
|
warehouseInOutInfo.setWarehouseInOutDetail(warehouseInOutDetail);
|
|
warehouseInOutInfo.setWarehouseInOutDetail(warehouseInOutDetail);
|
|
}
|
|
}
|
|
return warehouseInOutInfo;
|
|
return warehouseInOutInfo;
|