Commit dc1c0266 by 胡懿

修复获评模块生成和清除二维码会把入库的也清除

parent a4aa24b7
......@@ -111,19 +111,24 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
GoodsInfo temGi = new GoodsInfo();
temGi.setId(infoId);
temQr.setGoodsInfo(temGi);
temQr.setState("0");
List<QrCode> qrCodeList = qrCodeMapper.findByGoodsInfoId(temQr);
if (null != qrCodeList && qrCodeList.size() > 0) { // 二维码已经生成过
goodsInfo.setQrCodeList(qrCodeList);
List<QrCode> qrCodeListAll = qrCodeMapper.findByGoodsInfoId(temQr);
if (null != qrCodeListAll && qrCodeListAll.size() > 0 && goodsInfo.getNum() == qrCodeListAll.size()) { // 二维码已经生成过
goodsInfo.setQrCodeList(qrCodeListAll);
return goodsInfo;
} else {
int haveSize = 0;
List<QrCode> qrCodeList = new ArrayList<>();
if (null != qrCodeListAll) {
haveSize = qrCodeListAll.size();
}
// 查询物资编码
Wzcode wzcode = wzcodeService.findByCode(goodsInfo.getType().getCode());
int wzNum = wzcode.getIntNum();
qrCodeList = new ArrayList<>();
int num = goodsInfo.getNum();
int num = goodsInfo.getNum() - haveSize;
String beginNumSeq = "";
for (int i = 0; i < num; i++) {
wzNum ++;
......@@ -154,7 +159,8 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
goodsInfo.setQrInterval(qrInterval); // 设置编码区间
// goodsInfo.preUpdate();
goodsInfoMapper.update(goodsInfo);
goodsInfo.setQrCodeList(qrCodeList);
qrCodeListAll.addAll(qrCodeList);
goodsInfo.setQrCodeList(qrCodeListAll);
// 更新物资编码表
wzcodeService.save(wzcode);
......@@ -173,6 +179,7 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
GoodsInfo temGi = new GoodsInfo();
temGi.setId(infoId);
temQr.setGoodsInfo(temGi);
temQr.setState("0");
List<QrCode> qrCodeList = qrCodeMapper.findByGoodsInfoId(temQr);
if (null != qrCodeList && qrCodeList.size() > 0) {
for (QrCode qrCode : qrCodeList) {
......@@ -193,7 +200,7 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
}
}
}
qrCodeMapper.deleteByGoodInfoId(infoId); // 删除二维码
qrCodeMapper.deleteByGoodInfoId(infoId, "0"); // 删除未入库的二维码
goodsInfo.setQrInterval("");
goodsInfo.preUpdate();
goodsInfoMapper.update(goodsInfo);
......
......@@ -22,7 +22,7 @@ public interface QrCodeMapper extends BaseMapper<QrCode> {
* @param infoId
* @return
*/
public int deleteByGoodInfoId(String infoId);
public int deleteByGoodInfoId(@Param("infoId")String infoId, @Param("state")String state);
/**
* 根据货品明细id查询二维码集合
......
......@@ -184,9 +184,9 @@
</select>
<!--根据货品明细删除-->
<update id="deleteByGoodInfoId">
<update id="deleteByGoodInfoId" parameterType="String">
DELETE FROM t_wh_qr
WHERE goods_info_id = #{infoId}
WHERE goods_info_id = #{infoId} and state = #{state}
</update>
<select id="findByGoodsInfoId" resultType="QrCode">
......@@ -199,6 +199,9 @@
<if test="goodsInfo.id != null and goodsInfo.id != ''">
AND a.goods_info_id = #{goodsInfo.id}
</if>
<if test="state != null and state != ''">
AND a.state = #{state}
</if>
</where>
</select>
......
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