|
|
@@ -36,8 +36,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
|
|
|
// @Autowired
|
|
|
// private SaledetailMapper saledetailMapper;
|
|
|
-// @Autowired
|
|
|
-// private MaxnumberService maxnumberService;
|
|
|
+ @Autowired
|
|
|
+ private MaxnumberService maxnumberService;
|
|
|
@Autowired
|
|
|
private SaleMapper saleMapper;
|
|
|
@Autowired
|
|
|
@@ -158,11 +158,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
|
private void singleDelete(Long id) {
|
|
|
if (null != id) {
|
|
|
+ ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
//从表删除
|
|
|
prodIODetailMapper.deleteByForeignKey(id);
|
|
|
//主表删除
|
|
|
prodInOutMapper.deleteByPrimaryKey(id);
|
|
|
- ProdInOut prodInOut = getMapper().selectByPrimaryKey(id);
|
|
|
//更新已转数
|
|
|
updateYqty(prodInOut);
|
|
|
}
|
|
|
@@ -215,9 +215,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
|
|
|
@Override
|
|
|
public Integer deleteItem(Long id) {
|
|
|
- Integer num = prodIODetailMapper.deleteByPrimaryKey(id);
|
|
|
ProdIODetail prodIODetail = prodIODetailMapper.selectByPrimaryKey(id);
|
|
|
ProdInOut prodInOut = getMapper().selectByPrimaryKey(prodIODetail.getPd_piid());
|
|
|
+ Integer num = prodIODetailMapper.deleteByPrimaryKey(id);
|
|
|
//更新已转数
|
|
|
updateYqty(prodInOut);
|
|
|
return num;
|
|
|
@@ -271,8 +271,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
List<ProdIODetail> sourcePids =prodIODetailMapper.selectByFK(id);
|
|
|
//检查从表
|
|
|
for (ProdIODetail prodIODetail : sourcePids) {
|
|
|
- pdOutqty = prodIODetail.getPd_outqty();
|
|
|
- pdYqty = prodIODetail.getPd_yqty();
|
|
|
+ pdOutqty = prodIODetail.getPd_outqty()==null?0.0:prodIODetail.getPd_outqty();
|
|
|
+ pdYqty = prodIODetail.getPd_yqty()==null?0.0:prodIODetail.getPd_yqty();
|
|
|
if (pdOutqty-pdYqty>0){
|
|
|
count++;
|
|
|
}
|
|
|
@@ -284,8 +284,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//插入销售退货单主表
|
|
|
ProdInOut targetPi = new ProdInOut();
|
|
|
//生成单号
|
|
|
- String piInoutno = "ProdInOut!SaleReturn"+Math.abs(Math.random()*10);
|
|
|
- //maxnumberService.getMaxnumber("ProdInOut!Sale",true).getData();
|
|
|
+ String piInoutno = maxnumberService.getMaxnumber("ProdInOut!Sale",true).getData();
|
|
|
targetPi.setPi_inoutno(piInoutno);
|
|
|
targetPi.setPi_class("销售退货单");
|
|
|
targetPi.setPi_date(new Date());
|
|
|
@@ -294,7 +293,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
targetPi.setPi_custid(sourcePi.getPi_custid());
|
|
|
targetPi.setPi_custcode(sourcePi.getPi_custcode());
|
|
|
targetPi.setPi_custname(sourcePi.getPi_custname());
|
|
|
-
|
|
|
+ targetPi.setPi_status("未审核");
|
|
|
+ targetPi.setPi_statuscode("UNAUDITED");
|
|
|
targetPi.setPi_sacode(sourcePi.getPi_sacode());
|
|
|
targetPi.setPi_said(sourcePi.getPi_said());
|
|
|
//设置公司id
|
|
|
@@ -306,7 +306,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
for (int i = 0;i<sourcePids.size();i++){
|
|
|
ProdIODetail sourcePid = sourcePids.get(i);
|
|
|
ProdIODetail targetPid = new ProdIODetail();
|
|
|
- if(sourcePid.getPd_inqty()-sourcePid.getPd_yqty()>0){
|
|
|
+ pdOutqty = sourcePid.getPd_outqty()==null?0.0:sourcePid.getPd_outqty();
|
|
|
+ pdYqty = sourcePid.getPd_yqty()==null?0.0:sourcePid.getPd_yqty();
|
|
|
+ if(pdOutqty-pdYqty>0){
|
|
|
targetPid.setPd_piid(pi_id);
|
|
|
targetPid.setPd_inoutno(piInoutno);
|
|
|
targetPid.setPd_piclass("销售退货单");
|
|
|
@@ -314,18 +316,23 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
targetPid.setPd_orderid(sourcePid.getPd_orderid());
|
|
|
targetPid.setPd_ordercode(sourcePid.getPd_ordercode());
|
|
|
targetPid.setPd_orderdetno(sourcePid.getPd_orderdetno());
|
|
|
+
|
|
|
targetPid.setPd_sendprice(sourcePid.getPd_sendprice());
|
|
|
+
|
|
|
targetPid.setPd_sdid(sourcePid.getPd_sdid());
|
|
|
+
|
|
|
targetPid.setPd_prodid(sourcePid.getPd_prodid());
|
|
|
targetPid.setPd_prodcode(sourcePid.getPd_prodcode());
|
|
|
+ targetPid.setPd_unit(sourcePid.getPd_unit());
|
|
|
targetPid.setPd_ioid(sourcePid.getId());
|
|
|
+ targetPid.setPd_status(0);
|
|
|
//公司id
|
|
|
targetPid.setCompanyId(sourcePid.getCompanyId());
|
|
|
//本次转单数
|
|
|
- targetPid.setPd_inqty(sourcePid.getPd_outqty()-sourcePid.getPd_yqty());
|
|
|
+ targetPid.setPd_inqty(pdOutqty-pdYqty);
|
|
|
prodIODetailMapper.insertSelective(targetPid);
|
|
|
//更新已转数
|
|
|
- sourcePid.setPd_yqty(sourcePid.getPd_outqty());
|
|
|
+ sourcePid.setPd_yqty(pdOutqty);
|
|
|
prodIODetailMapper.updateByPrimaryKeySelective(sourcePid);
|
|
|
}
|
|
|
}
|
|
|
@@ -340,9 +347,9 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
* @Date: 2018/10/19
|
|
|
*/
|
|
|
private String pushMaxnubmer(String code, Long id,String pi_class) {
|
|
|
-// if (null == code) {
|
|
|
-// throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
-// }
|
|
|
+ if (null == code) {
|
|
|
+ throw new BizException(BizExceptionCode.NULL_CODE);
|
|
|
+ }
|
|
|
Integer count = "0".equals(String.valueOf(id)) ? saleMapper.validateCodeWhenInsert(code) :
|
|
|
saleMapper.validateCodeWhenUpdate(code, id);
|
|
|
String caller = "";
|
|
|
@@ -351,12 +358,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}else {//销售退货单
|
|
|
caller = "ProdInOut!SaleReturn";
|
|
|
}
|
|
|
- if (null == code) {
|
|
|
- return caller+Math.random()*10;
|
|
|
- }else{
|
|
|
- return code;
|
|
|
- }
|
|
|
- //return maxnumberService.pushMaxnubmer(count, code, caller).getData();
|
|
|
+ return maxnumberService.pushMaxnubmer(count, code, caller).getData();
|
|
|
}
|
|
|
/**
|
|
|
* @Description: 更新已转数
|