Commit 2c86de2d by zhanglt

盘盈入库调整,

新增台账明细逻辑删除方法
parent 8ad7d0d8
...@@ -7,6 +7,7 @@ import com.jeeplus.core.persistence.BaseMapper; ...@@ -7,6 +7,7 @@ import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper; import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo; import com.jeeplus.modules.warehouse.ledger.dto.CountLedgerInfo;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo; import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -19,4 +20,5 @@ import java.util.List; ...@@ -19,4 +20,5 @@ import java.util.List;
public interface LedgerInfoMapper extends BaseMapper<LedgerInfo> { public interface LedgerInfoMapper extends BaseMapper<LedgerInfo> {
public List<CountLedgerInfo> findCliList(LedgerInfo ledgerInfo); public List<CountLedgerInfo> findCliList(LedgerInfo ledgerInfo);
void deleteByLedgerInfo(@Param("id") String id);
} }
\ No newline at end of file
...@@ -208,6 +208,12 @@ ...@@ -208,6 +208,12 @@
</otherwise> </otherwise>
</choose> </choose>
</update> </update>
<!--逻辑删除-->
<update id="deleteByLedgerInfo">
UPDATE t_wh_ledger_info SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 --> <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
......
...@@ -134,7 +134,7 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM ...@@ -134,7 +134,7 @@ public class MaterialRequisitionService extends CrudService<MaterialRequisitionM
ledgerService.save(ledger); ledgerService.save(ledger);
} }
} }
ledgerInfoMapper.deleteByLogic(ledgerInfoId); ledgerInfoMapper.deleteByLedgerInfo(ledgerInfoId);
outboundInfo.setId(""); outboundInfo.setId("");
outboundInfo.setOutbound(outbound); outboundInfo.setOutbound(outbound);
outboundInfo.setLedgerInfo(one.getLedgerInfo()); outboundInfo.setLedgerInfo(one.getLedgerInfo());
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<sql id="profitWarehousingInfoColumns"> <sql id="profitWarehousingInfoColumns">
a.id AS "id", a.id AS "id",
a.profit_warehousing_id AS "profitWarehousing.id", a.profit_warehousing_id AS "profitWarehousing.id",
profitWarehousing.number AS "profitWarehousing.number",
a.name AS "name", a.name AS "name",
a.type AS "type.id", a.type AS "type.id",
a.marking AS "marking", a.marking AS "marking",
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
<sql id="profitWarehousingInfoJoins"> <sql id="profitWarehousingInfoJoins">
LEFT JOIN t_wh_material_type type ON type.id = a.type LEFT JOIN t_wh_material_type type ON type.id = a.type
LEFT JOIN t_wh_warehouse warehouse ON warehouse.id = a.warehouse_id LEFT JOIN t_wh_warehouse warehouse ON warehouse.id = a.warehouse_id
LEFT JOIN t_profit_warehousing profitWarehousing ON profitWarehousing.id = a.profit_warehousing_id
</sql> </sql>
......
...@@ -15,7 +15,9 @@ import com.jeeplus.modules.warehouse.code.util.StaticNumSeq; ...@@ -15,7 +15,9 @@ import com.jeeplus.modules.warehouse.code.util.StaticNumSeq;
import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo; import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo;
import com.jeeplus.modules.warehouse.ledger.entity.Ledger; import com.jeeplus.modules.warehouse.ledger.entity.Ledger;
import com.jeeplus.modules.warehouse.ledger.entity.LedgerInfo; 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.mapper.LedgerMapper;
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.util.BuildQcUtil; import com.jeeplus.modules.warehouse.qrcode.util.BuildQcUtil;
...@@ -46,6 +48,10 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -46,6 +48,10 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
private LedgerMapper ledgerMapper; private LedgerMapper ledgerMapper;
@Autowired @Autowired
private QrCodeMapper qrCodeMapper; private QrCodeMapper qrCodeMapper;
@Autowired
private LedgerInfoMapper ledgerInfoMapper;
@Autowired
private LedgerService ledgerService;
public ProfitWarehousing get(String id) { public ProfitWarehousing get(String id) {
ProfitWarehousing profitWarehousing = super.get(id); ProfitWarehousing profitWarehousing = super.get(id);
...@@ -93,11 +99,9 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -93,11 +99,9 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
profitWarehousingInfo.setQrCode(qrCode); profitWarehousingInfo.setQrCode(qrCode);
profitWarehousingInfoMapper.insert(profitWarehousingInfo); profitWarehousingInfoMapper.insert(profitWarehousingInfo);
return profitWarehousingInfo; return profitWarehousingInfo;
} }
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void save(ProfitWarehousing profitWarehousing) { public void save(ProfitWarehousing profitWarehousing) {
profitWarehousing.setNumber(createPYDH());
super.save(profitWarehousing); super.save(profitWarehousing);
for (ProfitWarehousingInfo profitWarehousingInfo : profitWarehousing.getProfitWarehousingInfoList()){ for (ProfitWarehousingInfo profitWarehousingInfo : profitWarehousing.getProfitWarehousingInfoList()){
profitWarehousingInfo.setProfitWarehousing(profitWarehousing); profitWarehousingInfo.setProfitWarehousing(profitWarehousing);
...@@ -125,38 +129,43 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe ...@@ -125,38 +129,43 @@ public class ProfitWarehousingService extends CrudService<ProfitWarehousingMappe
} }
//盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息 //盘盈入库 保存 盘盈入库信息 ,并添加对应的台账信息
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void inLedgerInfo(ProfitWarehousing profitWarehousing) { public void inLedgerInfo(ProfitWarehousingInfo profitWarehousingInfo) {
List<ProfitWarehousingInfo> profitWarehousingInfoList = profitWarehousing.getProfitWarehousingInfoList(); QrCode qrCode = profitWarehousingInfo.getQrCode();
//当前盘盈入库单的明细信息 qrCode.getId();
BigDecimal sum = BigDecimal.ONE; qrCode.getCode();
if(profitWarehousingInfoList != null ){ Ledger ledger = new Ledger(profitWarehousingInfo.getName(),profitWarehousingInfo.getType(),profitWarehousingInfo.getMarking());
if(profitWarehousingInfoList.size() > 0 ){ Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger);
for (ProfitWarehousingInfo one:profitWarehousingInfoList) { LedgerInfo ledgerInfo = new LedgerInfo();
BigDecimal amount = one.getAmount(); //名称
if(amount != null){ ledgerInfo.setName(ledger.getName());
//总价 是所有单价之和 //类型
sum = sum.add(amount); ledgerInfo.setType(ledger.getType());
} //型号
//获取同名称类型型号的台账主表信息 ledgerInfo.setModel(ledger.getModel());
Ledger ledger = new Ledger(one.getName(),one.getType(),one.getMarking()); //物资编码
Ledger oldLeger = ledgerMapper.findByTypeAndModel(ledger); ledgerInfo.setCode(qrCode.getCode());
LedgerInfo ledgerInfo = new LedgerInfo(); //二维码id
//单价 ledgerInfo.setQr(qrCode);
ledgerInfo.setAmount(one.getAmount()); //货架id
//名称 ledgerInfo.setShelves(profitWarehousingInfo.getShelves());
ledgerInfo.setName(one.getName()); //盘盈入库单编码
//盘盈入库单号 ledgerInfo.setBatchNum(profitWarehousingInfo.getProfitWarehousing().getNumber());
ledgerInfo.setBatchNum(profitWarehousing.getNumber()); //单价
//物资编码 ledgerInfo.setAmount(profitWarehousingInfo.getAmount());
ledgerInfo.setCode(""); //查询 台账中是否有 该类型的物资
if(oldLeger!=null){ if(oldLeger != null){
//台账主表 //有台账 直接在该物资下加入一条明细,并更新台账
ledgerInfo.setLedger(oldLeger); //台账主表id
}else { ledgerInfo.setLedger(oldLeger);
BigDecimal sum = oldLeger.getSum();
sum = sum.add(profitWarehousingInfo.getAmount());
oldLeger.setSum(sum);
List<LedgerInfo> ledgerInfoList = oldLeger.getLedgerInfoList();
ledgerInfoList.add(ledgerInfo);
oldLeger.setLedgerInfoList(ledgerInfoList);
}else {
}
}
}
} }
} }
} }
\ No newline at end of file
...@@ -5,11 +5,17 @@ package com.jeeplus.modules.warehouse.profitwarehousing.web; ...@@ -5,11 +5,17 @@ package com.jeeplus.modules.warehouse.profitwarehousing.web;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import com.jeeplus.modules.sys.utils.UserUtils;
import com.jeeplus.modules.warehouse.goods.entity.GoodsInfo;
import com.jeeplus.modules.warehouse.profitwarehousing.entity.ProfitWarehousingInfo;
import com.jeeplus.modules.warehouse.profitwarehousing.mapper.ProfitWarehousingInfoMapper;
import com.jeeplus.modules.warehouse.qrcode.entity.QrCode;
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;
...@@ -46,6 +52,8 @@ public class ProfitWarehousingController extends BaseController { ...@@ -46,6 +52,8 @@ public class ProfitWarehousingController extends BaseController {
@Autowired @Autowired
private ProfitWarehousingService profitWarehousingService; private ProfitWarehousingService profitWarehousingService;
@Autowired
private ProfitWarehousingInfoMapper profitWarehousingInfoMapper;
@ModelAttribute @ModelAttribute
public ProfitWarehousing get(@RequestParam(required=false) String id) { public ProfitWarehousing get(@RequestParam(required=false) String id) {
...@@ -86,6 +94,15 @@ public class ProfitWarehousingController extends BaseController { ...@@ -86,6 +94,15 @@ public class ProfitWarehousingController extends BaseController {
@RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:view","warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR) @RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:view","warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR)
@RequestMapping(value = "form/{mode}") @RequestMapping(value = "form/{mode}")
public String form(@PathVariable String mode, ProfitWarehousing profitWarehousing, Model model) { public String form(@PathVariable String mode, ProfitWarehousing profitWarehousing, Model model) {
if(mode !=null ||Objects.equals(mode, "add")){
if(profitWarehousing.getNumber()==null|| Objects.equals(profitWarehousing.getNumber(), "")){
profitWarehousing.setNumber(profitWarehousingService.createPYDH());
}
if(profitWarehousing.getOperator() == null){
profitWarehousing.setOperator(UserUtils.getUser());
}
}
model.addAttribute("profitWarehousing", profitWarehousing); model.addAttribute("profitWarehousing", profitWarehousing);
model.addAttribute("mode", mode); model.addAttribute("mode", mode);
return "modules/warehouse/profitwarehousing/profitWarehousingForm"; return "modules/warehouse/profitwarehousing/profitWarehousingForm";
...@@ -229,24 +246,53 @@ public class ProfitWarehousingController extends BaseController { ...@@ -229,24 +246,53 @@ public class ProfitWarehousingController extends BaseController {
return j; return j;
} }
/** /**
* 保存新增盘盈入库信息后,入台账 * 打印二维码
*/
@ResponseBody
@RequestMapping(value = "printQr")
public AjaxJson printQr(String profitWarehousingInfoId) throws Exception{
AjaxJson j = new AjaxJson();
//查询该明细,是否已经生成二维码记录
ProfitWarehousingInfo profitWarehousingInfo1 = profitWarehousingInfoMapper.get(profitWarehousingInfoId);
if(profitWarehousingInfo1.getQrCode() != null){
j.setSuccess(false);
j.setMsg("二维码已存在");
return j;
}
ProfitWarehousingInfo profitWarehousingInfo = profitWarehousingService.printQr(profitWarehousingInfoId);//保存
j.put("profitWarehousingInfo", profitWarehousingInfo);
j.setSuccess(true);
j.setMsg("生成二维码成功");
return j;
}
/**
* 盘盈入库明细,入台账
*/ */
@ResponseBody @ResponseBody
@RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR) @RequiresPermissions(value={"warehouse:profitwarehousing:profitWarehousing:add","warehouse:profitwarehousing:profitWarehousing:edit"},logical=Logical.OR)
@RequestMapping(value = "inLedgerInfo") @RequestMapping(value = "inLedgerInfo")
public AjaxJson inLedgerInfo(ProfitWarehousing profitWarehousing, Model model) throws Exception{ public AjaxJson inLedgerInfo(String profitWarehousingInfoId, Model model) throws Exception{
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
/** /**
* 后台hibernate-validation插件校验 * 后台hibernate-validation插件校验
*/ */
String errMsg = beanValidator(profitWarehousing); String errMsg = beanValidator(profitWarehousingInfoId);
if (StringUtils.isNotBlank(errMsg)){ if (StringUtils.isNotBlank(errMsg)){
j.setSuccess(false); j.setSuccess(false);
j.setMsg(errMsg); j.setMsg(errMsg);
return j; return j;
} }
ProfitWarehousingInfo profitWarehousingInfo = profitWarehousingInfoMapper.get(profitWarehousingInfoId);
if(profitWarehousingInfo.getQrCode() == null){
j.setSuccess(false);
j.setMsg("请先生成二维码");
}
if(profitWarehousingInfo.getQrCode() != null){
QrCode qrCode = profitWarehousingInfo.getQrCode();
}
//新增或编辑表单保存 //新增或编辑表单保存
profitWarehousingService.inLedgerInfo(profitWarehousing);//保存 profitWarehousingService.inLedgerInfo(profitWarehousingInfo);//保存
j.setSuccess(true); j.setSuccess(true);
j.setMsg("物资入帐成功"); j.setMsg("物资入帐成功");
return j; return j;
......
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