|
|
@@ -2,10 +2,13 @@ package com.usoftchina.saas.sale.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
+import com.usoftchina.saas.commons.api.MessageLogService;
|
|
|
import com.usoftchina.saas.commons.dto.BatchDealBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.DocBaseDTO;
|
|
|
import com.usoftchina.saas.commons.dto.ListReqDTO;
|
|
|
import com.usoftchina.saas.commons.exception.BizExceptionCode;
|
|
|
+import com.usoftchina.saas.commons.po.BillCodeSeq;
|
|
|
import com.usoftchina.saas.commons.po.Status;
|
|
|
import com.usoftchina.saas.context.BaseContextHolder;
|
|
|
import com.usoftchina.saas.exception.BizException;
|
|
|
@@ -43,10 +46,10 @@ public class SaleServiceImpl implements SaleService{
|
|
|
private SaleMapper saleMapper;
|
|
|
@Autowired
|
|
|
private SaledetailMapper saledetailMapper;
|
|
|
- /* @Autowired
|
|
|
+ @Autowired
|
|
|
private MessageLogService messageLogService;
|
|
|
@Autowired
|
|
|
- private MaxnumberService maxnumberService;*/
|
|
|
+ private MaxnumberService maxnumberService;
|
|
|
@Autowired
|
|
|
private ProdInOutMapper prodInOutMapper;
|
|
|
@Autowired
|
|
|
@@ -113,7 +116,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
sale.setCreateTime(new Date());
|
|
|
|
|
|
//编号校验
|
|
|
- //sa_code = pushMaxnubmer(sa_code, sa_id);
|
|
|
+ sa_code = pushMaxnubmer(sa_code, sa_id);
|
|
|
//单号赋值
|
|
|
sale.setSa_code(sa_code);
|
|
|
//判断更新与保存动作
|
|
|
@@ -136,7 +139,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
//更新销售金额
|
|
|
getTotal(sa_id);
|
|
|
//日志记录
|
|
|
- //messageLogService.save(baseDTO);
|
|
|
+ messageLogService.save(baseDTO);
|
|
|
return baseDTO;
|
|
|
}
|
|
|
//更新操作
|
|
|
@@ -164,7 +167,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
//更新销售金额
|
|
|
getTotal(sa_id);
|
|
|
//日志
|
|
|
- //messageLogService.save(baseDTO);
|
|
|
+ messageLogService.update(baseDTO);
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
@@ -179,7 +182,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
Integer num = saledetailMapper.deleteByPrimaryKey(id);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.deleteDetail(docBaseDTO);
|
|
|
+ messageLogService.deleteDetail(docBaseDTO);
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
@@ -206,7 +209,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
}
|
|
|
String code = saleMapper.validateUnAudit(id);
|
|
|
if (null != code) {
|
|
|
- throw new BizException(500, "单据:" + code + " 未审核,无法反审核");
|
|
|
+ throw new BizException(BizExceptionCode.SALE_NULL_BILL);
|
|
|
}
|
|
|
singleUnAudit(id);
|
|
|
}
|
|
|
@@ -252,7 +255,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.audit(docBaseDTO);
|
|
|
+ messageLogService.audit(docBaseDTO);
|
|
|
}
|
|
|
|
|
|
private void singleDelete(Long id) {
|
|
|
@@ -263,7 +266,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
saleMapper.deleteByPrimaryKey(id);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.delete(docBaseDTO);
|
|
|
+ messageLogService.delete(docBaseDTO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -290,14 +293,15 @@ public class SaleServiceImpl implements SaleService{
|
|
|
* @Author: guq
|
|
|
* @Date: 2018/10/19
|
|
|
*/
|
|
|
- /* private String pushMaxnubmer(String code, Long id) {
|
|
|
+ private String pushMaxnubmer(String code, Long id) {
|
|
|
if (null == code) {
|
|
|
throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
}
|
|
|
- Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code) :
|
|
|
- saleMapper.validateCodeWhenUpdate(code, id);
|
|
|
- return maxnumberService.pushMaxnubmer(count, code, "Purchase").getData();
|
|
|
- }*/
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code, companyId) :
|
|
|
+ saleMapper.validateCodeWhenUpdate(code, id, companyId);
|
|
|
+ return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.SALE.getCaller()).getData();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @Description
|
|
|
@@ -343,7 +347,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
saleMapper.updateByPrimaryKeySelective(sale);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.close(docBaseDTO);
|
|
|
+ messageLogService.close(docBaseDTO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -379,7 +383,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
saleMapper.updateByPrimaryKeySelective(sale);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.open(docBaseDTO);
|
|
|
+ messageLogService.open(docBaseDTO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -419,10 +423,8 @@ public class SaleServiceImpl implements SaleService{
|
|
|
//插入验收单主表
|
|
|
ProdInOut prodInOut = new ProdInOut();
|
|
|
//生成单号
|
|
|
- //String pi_inoutno = maxnumberService.getMaxnumber("Sale", true).getData();
|
|
|
- // Object data =
|
|
|
- String pi_inoutno = "xxxxx" + (int)(Math.random()*100)+1;;
|
|
|
-
|
|
|
+ String pi_inoutno = maxnumberService.getMaxnumber(BillCodeSeq.SALEOUT.getCaller(),
|
|
|
+ true).getData();
|
|
|
prodInOut.setPi_inoutno(pi_inoutno);
|
|
|
prodInOut.setPi_class("出货单");
|
|
|
prodInOut.setPi_date(new Date());
|
|
|
@@ -483,7 +485,7 @@ public class SaleServiceImpl implements SaleService{
|
|
|
saleMapper.updateByPrimaryKeySelective(sale);
|
|
|
DocBaseDTO docBaseDTO = getBaseDTOById(id);
|
|
|
//日志
|
|
|
- //messageLogService.unAudit(docBaseDTO);
|
|
|
+ messageLogService.unAudit(docBaseDTO);
|
|
|
}
|
|
|
|
|
|
//更新最新销售总额
|