Commit a0af70bd by zhanglt

新增领用单,自动生成领用单号

parent 5b21c8b2
......@@ -3,10 +3,14 @@
*/
package com.jeeplus.modules.warehouse.profitwarehousing.service;
import java.math.BigDecimal;
import java.util.List;
import com.jeeplus.modules.warehouse.code.util.CodeUtil;
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.LedgerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -30,7 +34,9 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
@Autowired
private ProfitWarehousingInfoMapper profitWarehousingInfoMapper;
@Autowired
private LedgerMapper ledgerMapper;
public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id);
profitWarehousing.setProfitWarehousingInfoList(profitWarehousingInfoMapper.findList(new ProfitWarehousingInfo(profitWarehousing)));
......@@ -77,5 +83,30 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
super.delete(profitWarehousing);
profitWarehousingInfoMapper.delete(new ProfitWarehousingInfo(profitWarehousing));
}
//盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息
@Transactional(readOnly = false)
public void inLedgerInfo(ProfitWarehousing profitWarehousing) {
List<ProfitWarehousingInfo> profitWarehousingInfoList = profitWarehousing.getProfitWarehousingInfoList();
//当前盘盈入库单的明细信息
BigDecimal sum = BigDecimal.ONE;
if(profitWarehousingInfoList != null ){
if(profitWarehousingInfoList.size() > 0 ){
for (ProfitWarehousingInfo one:profitWarehousingInfoList) {
BigDecimal amount = one.getAmount();
if(amount != null){
//总价 是所有单价之和
sum = sum.add(amount);
}
//获取同名称类型型号的台账主表信息
Ledger ledger = new Ledger(one.getName(),one.getType(),one.getMarking());
Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger);
if(oldLeger!=null){
LedgerInfo ledgerInfo = new LedgerInfo();
ledgerInfo.setLedger(oldLeger);
ledgerInfo.setAmount(one.getAmount());
}
}
}
}
}
}
\ 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