Commit dc1c0266 by 胡懿

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

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