Commit 0e5f32d5 by zhanglt

盘盈入库相关接口,物资领用出库、盘亏出库、直接出库、更新二维码状态

parent 6e17c7f4
...@@ -19,6 +19,8 @@ import com.jeeplus.modules.warehouse.materialrequisition.entity.MaterialRequisit ...@@ -19,6 +19,8 @@ import com.jeeplus.modules.warehouse.materialrequisition.entity.MaterialRequisit
import com.jeeplus.modules.warehouse.outbound.entity.Outbound; import com.jeeplus.modules.warehouse.outbound.entity.Outbound;
import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo; import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo;
import com.jeeplus.modules.warehouse.outbound.service.OutboundService; import com.jeeplus.modules.warehouse.outbound.service.OutboundService;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.service.QrCodeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -48,6 +50,8 @@ public class MaterialLossService extends CrudService<MaterialLossMapper, Materia ...@@ -48,6 +50,8 @@ public class MaterialLossService extends CrudService<MaterialLossMapper, Materia
private LedgerService ledgerService; private LedgerService ledgerService;
@Autowired @Autowired
private LedgerInfoMapper ledgerInfoMapper; private LedgerInfoMapper ledgerInfoMapper;
@Autowired
private QrCodeService qrCodeService;
public MaterialLoss get(String id) { public MaterialLoss get(String id) {
MaterialLoss materialLoss = super.get(id); MaterialLoss materialLoss = super.get(id);
...@@ -123,8 +127,13 @@ public class MaterialLossService extends CrudService<MaterialLossMapper, Materia ...@@ -123,8 +127,13 @@ public class MaterialLossService extends CrudService<MaterialLossMapper, Materia
OutboundInfo outboundInfo = new OutboundInfo(); OutboundInfo outboundInfo = new OutboundInfo();
String ledgerInfoId = one.getLedgerInfo().getId(); String ledgerInfoId = one.getLedgerInfo().getId();
LedgerInfo ledgerInfo = ledgerInfoMapper.get(ledgerInfoId); LedgerInfo ledgerInfo = ledgerInfoMapper.get(ledgerInfoId);
if(ledgerInfo != null ){ if(ledgerInfo != null && Objects.equals(ledgerInfo.getDelFlag(), "0") ){
Ledger ledger = ledgerService.get(ledgerInfo.getLedger().getId()); Ledger ledger = ledgerService.get(ledgerInfo.getLedger().getId());
if(ledgerInfo.getQr() != null){
QrCode qrCode = qrCodeService.get(ledgerInfo.getQr().getId());
qrCode.setState("3");
qrCodeService.save(qrCode);
}
if(ledger != null){ if(ledger != null){
ledger.setNum(ledger.getNum() - 1); ledger.setNum(ledger.getNum() - 1);
try { try {
......
...@@ -17,6 +17,8 @@ import com.jeeplus.modules.warehouse.ledger.service.LedgerService; ...@@ -17,6 +17,8 @@ import com.jeeplus.modules.warehouse.ledger.service.LedgerService;
import com.jeeplus.modules.warehouse.outbound.entity.Outbound; import com.jeeplus.modules.warehouse.outbound.entity.Outbound;
import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo; import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo;
import com.jeeplus.modules.warehouse.outbound.service.OutboundService; import com.jeeplus.modules.warehouse.outbound.service.OutboundService;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.service.QrCodeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -46,6 +48,8 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM ...@@ -46,6 +48,8 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM
private LedgerService ledgerService; private LedgerService ledgerService;
@Autowired @Autowired
private LedgerInfoMapper ledgerInfoMapper; private LedgerInfoMapper ledgerInfoMapper;
@Autowired
private QrCodeService qrCodeService;
public MaterialRequisition get(String id) { public MaterialRequisition get(String id) {
...@@ -123,6 +127,11 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM ...@@ -123,6 +127,11 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM
String ledgerInfoId = one.getLedgerInfo().getId(); String ledgerInfoId = one.getLedgerInfo().getId();
LedgerInfo ledgerInfo = ledgerInfoMapper.get(ledgerInfoId); LedgerInfo ledgerInfo = ledgerInfoMapper.get(ledgerInfoId);
ledgerInfoMapper.deleteByLedgerInfo(ledgerInfoId); ledgerInfoMapper.deleteByLedgerInfo(ledgerInfoId);
if(ledgerInfo.getQr() != null){
QrCode qrCode = qrCodeService.get(ledgerInfo.getQr().getId());
qrCode.setState("3");
qrCodeService.save(qrCode);
}
if(ledgerInfo != null ){ if(ledgerInfo != null ){
Ledger ledger = ledgerService.get(ledgerInfo.getLedger().getId()); Ledger ledger = ledgerService.get(ledgerInfo.getLedger().getId());
if(ledger != null){ if(ledger != null){
......
...@@ -8,6 +8,14 @@ import java.util.Objects; ...@@ -8,6 +8,14 @@ import java.util.Objects;
import com.jeeplus.modules.warehouse.code.util.CodeUtil; import com.jeeplus.modules.warehouse.code.util.CodeUtil;
import com.jeeplus.modules.warehouse.code.util.StaticNumSeq; import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.ledger.entity.Ledger;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
import com.jeeplus.modules.warehouse.ledger.mapper.LedgerInfoMapper;
import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper;
import com.jeeplus.modules.warehouse.ledger.service.LedgerService;
import com.jeeplus.modules.warehouse.materialrequisition.entity.MaterialRequisitionInfo;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.service.QrCodeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -31,6 +39,13 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> { ...@@ -31,6 +39,13 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> {
@Autowired @Autowired
private OutboundInfoMapper outboundInfoMapper; private OutboundInfoMapper outboundInfoMapper;
@Autowired
private LedgerInfoMapper ledgerInfoMapper;
@Autowired
private LedgerService ledgerService;
@Autowired
private QrCodeService qrCodeService;
public Outbound get(String id) { public Outbound get(String id) {
Outbound outbound = super.get(id); Outbound outbound = super.get(id);
...@@ -71,6 +86,36 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> { ...@@ -71,6 +86,36 @@ public class OutboundService extends CrudService<OutboundMapper, Outbound> {
outboundInfoMapper.delete(outboundInfo); outboundInfoMapper.delete(outboundInfo);
} }
} }
this.delivery(outbound);
}
@Transactional(readOnly = false)
public void delivery(Outbound outbound) {
List<OutboundInfo> outboundInfoList = outbound.getOutboundInfoList();
if(outboundInfoList != null ){
for (OutboundInfo one:outboundInfoList) {
String ledgerInfoId = one.getLedgerInfo().getId();
LedgerInfo ledgerInfo = ledgerInfoMapper.get(ledgerInfoId);
if(ledgerInfo != null && Objects.equals(ledgerInfo.getDelFlag(), "0")){
if(ledgerInfo.getQr() != null){
QrCode qrCode = qrCodeService.get(ledgerInfo.getQr().getId());
qrCode.setState("3");
qrCodeService.save(qrCode);
}
Ledger ledger = ledgerService.get(ledgerInfo.getLedger().getId());
ledgerInfoMapper.deleteByLedgerInfo(ledgerInfoId);
if(ledger != null){
ledger.setNum(ledger.getNum() - 1);
try {
ledger.setSum(ledger.getSum().subtract(ledgerInfo.getAmount()));
}catch (Exception e){
System.out.println(e.getMessage());
}
ledgerService.lowerLedger(ledger);
}
}
}
}
} }
@Transactional(readOnly = false) @Transactional(readOnly = false)
public String createCKDH() { public String createCKDH() {
......
...@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.sys.utils.UserUtils; import com.jeeplus.modules.sys.utils.UserUtils;
import com.jeeplus.modules.warehouse.outbound.entity.OutboundInfo;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -120,6 +121,7 @@ public class OutboundController extends BaseController { ...@@ -120,6 +121,7 @@ public class OutboundController extends BaseController {
} }
//新增或编辑表单保存 //新增或编辑表单保存
outboundService.save(outbound);//保存 outboundService.save(outbound);//保存
List<OutboundInfo> outboundInfoList = outbound.getOutboundInfoList();
j.setSuccess(true); j.setSuccess(true);
j.setMsg("保存出库信息成功"); j.setMsg("保存出库信息成功");
return j; return j;
......
...@@ -20,6 +20,7 @@ import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper; ...@@ -20,6 +20,7 @@ import com.jeeplus.modules.warehouse.ledger.mapper.LedgerMapper;
import com.jeeplus.modules.warehouse.ledger.service.LedgerService; import com.jeeplus.modules.warehouse.ledger.service.LedgerService;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode; import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
import com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper; import com.jeeplus.modules.warehouse.qrcode.mapper.QrCodeMapper;
import com.jeeplus.modules.warehouse.qrcode.service.QrCodeService;
import com.jeeplus.modules.warehouse.qrcode.util.BuildQcUtil; import com.jeeplus.modules.warehouse.qrcode.util.BuildQcUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -52,6 +53,8 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -52,6 +53,8 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
private LedgerInfoMapper ledgerInfoMapper; private LedgerInfoMapper ledgerInfoMapper;
@Autowired @Autowired
private LedgerService ledgerService; private LedgerService ledgerService;
@Autowired
private QrCodeService qrCodeService;
public ProfitWarehousing get(String id) { public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id); ProfitWarehousing profitWarehousing = super.get(id);
...@@ -130,9 +133,7 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -130,9 +133,7 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
//盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息 //盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void inLedgerInfo(ProfitWarehousingInfo profitWarehousingInfo) { public void inLedgerInfo(ProfitWarehousingInfo profitWarehousingInfo) {
QrCode qrCode = profitWarehousingInfo.getQrCode(); QrCode qrCode = qrCodeService.get(profitWarehousingInfo.getQrCode().getId());
qrCode.getId();
qrCode.getCode();
Ledger ledger = new Ledger(profitWarehousingInfo.getName(),profitWarehousingInfo.getType(),profitWarehousingInfo.getMarking()); Ledger ledger = new Ledger(profitWarehousingInfo.getName(),profitWarehousingInfo.getType(),profitWarehousingInfo.getMarking());
Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger); Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger);
LedgerInfo ledgerInfo = new LedgerInfo(); LedgerInfo ledgerInfo = new LedgerInfo();
...@@ -160,12 +161,34 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -160,12 +161,34 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
BigDecimal sum = oldLeger.getSum(); BigDecimal sum = oldLeger.getSum();
sum = sum.add(profitWarehousingInfo.getAmount()); sum = sum.add(profitWarehousingInfo.getAmount());
oldLeger.setSum(sum); oldLeger.setSum(sum);
List<LedgerInfo> ledgerInfoList = oldLeger.getLedgerInfoList(); oldLeger.setNum(oldLeger.getNum()+1);
ledgerInfoList.add(ledgerInfo); List<String> shelvesList = ledgerMapper.findShelvesListByLedgerId(oldLeger.getId());
oldLeger.setLedgerInfoList(ledgerInfoList); if(!shelvesList.contains(ledgerInfo.getShelves().getId())){
shelvesList.add(ledgerInfo.getShelves().getId());
}
String shelvesIds = String.join(",", shelvesList);
oldLeger.setShelvesIds(shelvesIds);
oldLeger.preUpdate();
ledgerMapper.update(oldLeger);
ledgerInfo.preInsert();
ledgerInfoMapper.insert(ledgerInfo);
}else { }else {
ledger.setShelvesIds(ledgerInfo.getShelves().getId());
ledger.setNum(1);
ledger.setSum(ledgerInfo.getAmount());
ledger.preInsert();
ledgerMapper.insert(ledger);
ledgerInfo.setLedger(ledger);
ledgerInfo.preInsert();
ledgerInfoMapper.insert(ledgerInfo);
} }
//设置二维码状态为 入库并入帐
qrCode.setState("2");
qrCodeService.save(qrCode);
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment