Browse Source

AI图片入库真删除详情和stocklog;

撤销采购单,不删除商品,只回退库存数。
cangku
王富康 2 years ago
parent
commit
0a62da90aa
  1. 14
      hiver-admin/test-output/test-report.html
  2. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseDetailMapper.java
  3. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockLogMapper.java
  4. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java
  5. 3
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/PurchaseOcrVo.java
  6. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseDetailService.java
  7. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockLogService.java
  8. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseDetailServiceImpl.java
  9. 54
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java
  10. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockLogServiceImpl.java
  11. 6
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java
  12. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java
  13. 38
      hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseDetailMapper.xml
  14. 9
      hiver-modules/hiver-mall/src/main/resources/mapper/StockLogMapper.xml

14
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a> <a href="#"><span class="badge badge-primary">Hiver</span></a>
</li> </li>
<li class="m-r-10"> <li class="m-r-10">
<a href="#"><span class="badge badge-primary">���� 04, 2024 12:12:02</span></a> <a href="#"><span class="badge badge-primary">���� 04, 2024 16:50:15</span></a>
</li> </li>
</ul> </ul>
</div> </div>
@ -84,7 +84,7 @@
<div class="test-detail"> <div class="test-detail">
<span class="meta text-white badge badge-sm"></span> <span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p> <p class="name">passTest</p>
<p class="text-sm"><span>12:12:02 ����</span> / <span>0.016 secs</span></p> <p class="text-sm"><span>16:50:16 ����</span> / <span>0.016 secs</span></p>
</div> </div>
<div class="test-contents d-none"> <div class="test-contents d-none">
<div class="detail-head"> <div class="detail-head">
@ -92,8 +92,8 @@
<div class="info"> <div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div> <div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5> <h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>08.04.2024 12:12:02</span> <span class='badge badge-success'>08.04.2024 16:50:16</span>
<span class='badge badge-danger'>08.04.2024 12:12:02</span> <span class='badge badge-danger'>08.04.2024 16:50:16</span>
<span class='badge badge-default'>0.016 secs</span> <span class='badge badge-default'>0.016 secs</span>
</div> </div>
<div class="m-t-10 m-l-5"></div> <div class="m-t-10 m-l-5"></div>
@ -104,7 +104,7 @@
<tbody> <tbody>
<tr class="event-row"> <tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td> <td><span class="badge log pass-bg">Pass</span></td>
<td>12:12:02</td> <td>16:50:16</td>
<td> <td>
Test passed Test passed
</td> </td>
@ -128,13 +128,13 @@
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Started</p> <p class="m-b-0">Started</p>
<h3>���� 04, 2024 12:12:02</h3> <h3>���� 04, 2024 16:50:15</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<div class="card"><div class="card-body"> <div class="card"><div class="card-body">
<p class="m-b-0">Ended</p> <p class="m-b-0">Ended</p>
<h3>���� 04, 2024 12:12:02</h3> <h3>���� 04, 2024 16:50:16</h3>
</div></div> </div></div>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/PurchaseDetailMapper.java

@ -54,4 +54,6 @@ public interface PurchaseDetailMapper extends BaseMapper<PurchaseDetail> {
* @return List<PurchaseDetail> * @return List<PurchaseDetail>
*/ */
List<PurchaseDetail> getPurchaseDetailListByProductIds(@Param("productIdList") List<String> productIdList,@Param("id") String id); List<PurchaseDetail> getPurchaseDetailListByProductIds(@Param("productIdList") List<String> productIdList,@Param("id") String id);
void realDeleteByPurchaseId(@Param("purchaseId") String purchaseId);
} }

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/StockLogMapper.java

@ -45,4 +45,6 @@ public interface StockLogMapper extends BaseMapper<StockLog> {
List<StockLog> getPurchaseDetails(@Param("purchaseIdList") List<String> purchaseIdList); List<StockLog> getPurchaseDetails(@Param("purchaseIdList") List<String> purchaseIdList);
List<StockLog> getByProductIds(@Param("purchaseId") String purchaseId,@Param("productIdList") List<String> productIdList); List<StockLog> getByProductIds(@Param("purchaseId") String purchaseId,@Param("productIdList") List<String> productIdList);
void realDeleteByPurchaseId(@Param("purchaseId") String purchaseId);
} }

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PurchaseDetail.java

@ -98,6 +98,10 @@ public class PurchaseDetail extends HiverBaseEntity {
@ApiModelProperty(value = "识别图片id") @ApiModelProperty(value = "识别图片id")
private String ocrPicturePath; private String ocrPicturePath;
@ApiModelProperty(value = "排序")
private Integer sort;
@Transient @Transient
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "入库商品规格明细表") @ApiModelProperty(value = "入库商品规格明细表")

3
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/PurchaseOcrVo.java

@ -21,6 +21,9 @@ public class PurchaseOcrVo {
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer productCount; private Integer productCount;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private CopyOnWriteArrayList<PurchaseOcrDetailVo> attributeList; private CopyOnWriteArrayList<PurchaseOcrDetailVo> attributeList;
} }

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/PurchaseDetailService.java

@ -21,6 +21,8 @@ public interface PurchaseDetailService extends IService<PurchaseDetail> {
void deleteByPurchaseId(String purchaseId); void deleteByPurchaseId(String purchaseId);
void realDeleteByPurchaseId(String purchaseId);
List<PurchaseDetail> getPurchaseDetails(List<String> purchaseIdList); List<PurchaseDetail> getPurchaseDetails(List<String> purchaseIdList);
/** /**

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/StockLogService.java

@ -25,4 +25,6 @@ public interface StockLogService extends IService<StockLog> {
* @return List<StockLog> * @return List<StockLog>
*/ */
List<StockLog> getByProductIds(String purchaseId, String productIds); List<StockLog> getByProductIds(String purchaseId, String productIds);
void realDeleteByPurchaseId(String purchaseId);
} }

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseDetailServiceImpl.java

@ -82,6 +82,11 @@ public class PurchaseDetailServiceImpl extends ServiceImpl<PurchaseDetailMapper,
purchaseDetailMapper.deleteByPurchaseId(purchaseId); purchaseDetailMapper.deleteByPurchaseId(purchaseId);
} }
@Override
public void realDeleteByPurchaseId(String purchaseId) {
purchaseDetailMapper.realDeleteByPurchaseId(purchaseId);
}
@Override @Override
public List<PurchaseDetail> getPurchaseDetails(List<String> purchaseIdList) { public List<PurchaseDetail> getPurchaseDetails(List<String> purchaseIdList) {
return purchaseDetailMapper.getPurchaseDetails(purchaseIdList); return purchaseDetailMapper.getPurchaseDetails(purchaseIdList);

54
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/PurchaseServiceImpl.java

@ -436,7 +436,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
stockLogMap.put(mapKey, stockLogs); stockLogMap.put(mapKey, stockLogs);
} }
} }
final Map<String, List<PurchaseDetail>> purchaseDetailMap = new HashMap<>(); final LinkedHashMap<String, List<PurchaseDetail>> purchaseDetailMap = new LinkedHashMap<>();
for (PurchaseDetail purchaseDetail : purchaseDetails) { for (PurchaseDetail purchaseDetail : purchaseDetails) {
// 这里对purchaseDetail做个合并处理,优先根据商品id分组,如果商品id为空,那就就根据商品货号分组,如果商品货号为空,则根据商品名称分组, // 这里对purchaseDetail做个合并处理,优先根据商品id分组,如果商品id为空,那就就根据商品货号分组,如果商品货号为空,则根据商品名称分组,
// 重复的直接覆盖即可 // 重复的直接覆盖即可
@ -651,7 +651,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
for (PurchaseDetail purchaseDetail : byPurchaseIdList) { for (PurchaseDetail purchaseDetail : byPurchaseIdList) {
productIdList.add(purchaseDetail.getProductId()); productIdList.add(purchaseDetail.getProductId());
} }
// 查询该商品除当前入库单的其他的入库记录 // 查询该商品除当前入库单的其他的入库记录,用于计算平均采购价
final List<PurchaseDetail> purductPurchaseList = purchaseDetailService.getPurchaseDetailListByProductIds(productIdList, id); final List<PurchaseDetail> purductPurchaseList = purchaseDetailService.getPurchaseDetailListByProductIds(productIdList, id);
// 封装为商品id为key,List<PurchaseDetail>为value 的map // 封装为商品id为key,List<PurchaseDetail>为value 的map
final Map<String, List<PurchaseDetail>> purductPurchaseMap = new HashMap<>(); final Map<String, List<PurchaseDetail>> purductPurchaseMap = new HashMap<>();
@ -665,59 +665,15 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
purductPurchaseMap.put(productId, purchaseDetails); purductPurchaseMap.put(productId, purchaseDetails);
} }
} }
// 查询该商品的销售记录
final List<SaleDetail> purductSaleList = saleDetailService.getSaleDetailListByProductIds(productIdList);
// 封装为商品id为key,List<SaleDetail>为value 的map
final Map<String, List<SaleDetail>> purductSaleMap = new HashMap<>();
for (SaleDetail saleDetail : purductSaleList) {
final String productId = saleDetail.getProductId();
if (purductSaleMap.containsKey(productId)) {
purductSaleMap.get(productId).add(saleDetail);
} else {
final List<SaleDetail> saleDetails = new ArrayList<>();
saleDetails.add(saleDetail);
purductSaleMap.put(productId, saleDetails);
}
}
// final List<StockLog> stockLogList = stockLogService.getByPurchaseId(id);
final StringJoiner needDeleteProductId = new StringJoiner(","); // 根据入库记录减掉库存数
final StringJoiner needDeleteStockProductId = new StringJoiner(","); stockService.batchReduceStockByLog(stockLogList);
final StringJoiner needReduceStockProductId = new StringJoiner(",");
for (PurchaseDetail purchaseDetail : byPurchaseIdList) {
final String productId = purchaseDetail.getProductId();
if (!purductPurchaseMap.containsKey(productId) && !purductSaleMap.containsKey(productId)) {
// 可以删除商品的相关信息
needDeleteProductId.add(productId);
// 库存删除
needDeleteStockProductId.add(productId);
} else {
// 商品保留,库存扣减
needReduceStockProductId.add(productId);
}
}
// 执行删除商品
if (StringUtils.isNotEmpty(needDeleteProductId.toString())) {
productService.batchDeleteProduct(needDeleteProductId.toString());
}
// 执行删除库存
if (StringUtils.isNotEmpty(needReduceStockProductId.toString())) {
stockService.batchDeleteStockByProductIds(needDeleteStockProductId.toString());
}
// 执行扣减库存
if (StringUtils.isNotEmpty(needReduceStockProductId.toString())) {
// 获取当前入库单各商品的规格及数量信息
final List<StockLog> stockLogList = stockLogService.getByProductIds(id, needReduceStockProductId.toString());
// 根据入库记录减掉库存数
stockService.batchReduceStockByLog(stockLogList);
}
// 4. 根据采购单id删除库存记录 // 4. 根据采购单id删除库存记录
stockLogService.deleteByPurchaseId(id); stockLogService.deleteByPurchaseId(id);
// 5. 计算平均采购价 // 5. 计算平均采购价
// 获取该商品的历次入库记录,排除掉本次入库记录 入库的价格*入库数量/入库总数量 // 获取该商品的历次入库记录,排除掉本次入库记录 入库的价格*入库数量/入库总数量
final Map<String, BigDecimal> productPurchasePriceMap = new HashMap<>();
final List<Product> productList = new ArrayList<>(); final List<Product> productList = new ArrayList<>();
for (Map.Entry<String, List<PurchaseDetail>> stringListEntry : purductPurchaseMap.entrySet()) { for (Map.Entry<String, List<PurchaseDetail>> stringListEntry : purductPurchaseMap.entrySet()) {

5
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockLogServiceImpl.java

@ -57,4 +57,9 @@ public class StockLogServiceImpl extends ServiceImpl<StockLogMapper, StockLog> i
return stockLogMapper.getByProductIds(purchaseId, productIdList); return stockLogMapper.getByProductIds(purchaseId, productIdList);
} }
@Override
public void realDeleteByPurchaseId(String purchaseId) {
stockLogMapper.realDeleteByPurchaseId(purchaseId);
}
} }

6
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/StockServiceImpl.java

@ -736,9 +736,9 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
insertFlag = false; insertFlag = false;
} }
// 先根据入库单id 删除详情及库存履历表信息 // 先根据入库单id 删除详情及库存履历表信息(真删除)
purchaseDetailService.deleteByPurchaseId(purchaseId); purchaseDetailService.realDeleteByPurchaseId(purchaseId);
stockLogService.deleteByPurchaseId(purchaseId); stockLogService.realDeleteByPurchaseId(purchaseId);
// 获取前台入库商品信息 // 获取前台入库商品信息
final List<PurchaseDetail> purchaseDetails = purchaseVo.getPurchaseDetails(); final List<PurchaseDetail> purchaseDetails = purchaseVo.getPurchaseDetails();

2
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/utils/AliOcrUtil.java

@ -654,6 +654,7 @@ public class AliOcrUtil {
} }
purchaseOcrVo.setAttributeList(attributeList); purchaseOcrVo.setAttributeList(attributeList);
purchaseOcrVo.setSort(i);
purchaseOcrVos.add(purchaseOcrVo); purchaseOcrVos.add(purchaseOcrVo);
// 处理当前识别的货号及名称,现在需要特殊处理的 是货号:去掉“/”,或者是“/"在货号或者名称中间的,需要分隔为货号及名称 // 处理当前识别的货号及名称,现在需要特殊处理的 是货号:去掉“/”,或者是“/"在货号或者名称中间的,需要分隔为货号及名称
@ -809,6 +810,7 @@ public class AliOcrUtil {
} }
stockLogList.add(stockLog); stockLogList.add(stockLog);
purchaseDetail.setStockLogList1(stockLogList); purchaseDetail.setStockLogList1(stockLogList);
purchaseDetail.setSort(purchaseOcrVo.getSort());
// 如果货号为空,那么就拿商品名称作为key // 如果货号为空,那么就拿商品名称作为key
purchaseDetailMap.put(StringUtils.isEmpty(productSn) ? productName : productSn, purchaseDetail); purchaseDetailMap.put(StringUtils.isEmpty(productSn) ? productName : productSn, purchaseDetail);
} }

38
hiver-modules/hiver-mall/src/main/resources/mapper/PurchaseDetailMapper.xml

@ -30,6 +30,7 @@
<result column="print_barcode" jdbcType="VARCHAR" property="printBarcode" /> <result column="print_barcode" jdbcType="VARCHAR" property="printBarcode" />
<result column="product_count" jdbcType="INTEGER" property="productCount" /> <result column="product_count" jdbcType="INTEGER" property="productCount" />
<result column="ocr_picture_path" jdbcType="VARCHAR" property="ocrPicturePath" /> <result column="ocr_picture_path" jdbcType="VARCHAR" property="ocrPicturePath" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -93,7 +94,7 @@
id, create_by, create_time, del_flag, update_by, update_time, purchase_id, product_id, id, create_by, create_time, del_flag, update_by, update_time, purchase_id, product_id,
product_name, unit, shop_id, category_id, attribute_list, supplier_id,supplier_name, product_sn, product_name, unit, shop_id, category_id, attribute_list, supplier_id,supplier_name, product_sn,
barcode, price, purchase_price, wholesale_price, product_picture, product_video, barcode, price, purchase_price, wholesale_price, product_picture, product_video,
product_intro, sales_week, tail_warn, print_barcode, product_count,ocr_picture_path product_intro, sales_week, tail_warn, print_barcode, product_count,ocr_picture_path,sort
</sql> </sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.PurchaseDetailExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="cc.hiver.mall.entity.PurchaseDetailExample" resultMap="BaseResultMap">
select select
@ -134,7 +135,7 @@
barcode, price, purchase_price, barcode, price, purchase_price,
wholesale_price, product_picture, product_video, wholesale_price, product_picture, product_video,
product_intro, sales_week, tail_warn, product_intro, sales_week, tail_warn,
print_barcode, product_count,ocr_picture_path) print_barcode, product_count,ocr_picture_path,sort)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{purchaseId,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{purchaseId,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR},
@ -143,7 +144,7 @@
#{barcode,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, #{purchasePrice,jdbcType=DECIMAL}, #{barcode,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, #{purchasePrice,jdbcType=DECIMAL},
#{wholesalePrice,jdbcType=DECIMAL}, #{productPicture,jdbcType=VARCHAR}, #{productVideo,jdbcType=VARCHAR}, #{wholesalePrice,jdbcType=DECIMAL}, #{productPicture,jdbcType=VARCHAR}, #{productVideo,jdbcType=VARCHAR},
#{productIntro,jdbcType=VARCHAR}, #{salesWeek,jdbcType=TIMESTAMP}, #{tailWarn,jdbcType=INTEGER}, #{productIntro,jdbcType=VARCHAR}, #{salesWeek,jdbcType=TIMESTAMP}, #{tailWarn,jdbcType=INTEGER},
#{printBarcode,jdbcType=VARCHAR}, #{productCount,jdbcType=INTEGER},#{ocrPicturePath,jdbcType=VARCHAR}) #{printBarcode,jdbcType=VARCHAR}, #{productCount,jdbcType=INTEGER},#{ocrPicturePath,jdbcType=VARCHAR},#{sort,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.PurchaseDetail"> <insert id="insertSelective" parameterType="cc.hiver.mall.entity.PurchaseDetail">
insert into t_purchase_detail insert into t_purchase_detail
@ -232,6 +233,9 @@
<if test="ocrPicturePath != null"> <if test="ocrPicturePath != null">
ocr_picture_path, ocr_picture_path,
</if> </if>
<if test="sort != null">
sort,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -319,6 +323,9 @@
<if test="ocrPicturePath != null"> <if test="ocrPicturePath != null">
#{ocrPicturePath,jdbcType=VARCHAR}, #{ocrPicturePath,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="cc.hiver.mall.entity.PurchaseDetailExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="cc.hiver.mall.entity.PurchaseDetailExample" resultType="java.lang.Long">
@ -414,6 +421,9 @@
<if test="record.ocrPicturePath != null"> <if test="record.ocrPicturePath != null">
ocr_picture_path = #{record.ocrPicturePath,jdbcType=VARCHAR}, ocr_picture_path = #{record.ocrPicturePath,jdbcType=VARCHAR},
</if> </if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -448,7 +458,8 @@
tail_warn = #{record.tailWarn,jdbcType=INTEGER}, tail_warn = #{record.tailWarn,jdbcType=INTEGER},
print_barcode = #{record.printBarcode,jdbcType=VARCHAR}, print_barcode = #{record.printBarcode,jdbcType=VARCHAR},
product_count = #{record.productCount,jdbcType=INTEGER}, product_count = #{record.productCount,jdbcType=INTEGER},
ocr_picture_path = #{record.ocrPicturePath,jdbcType=VARCHAR} ocr_picture_path = #{record.ocrPicturePath,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -537,6 +548,9 @@
<if test="ocrPicturePath != null"> <if test="ocrPicturePath != null">
ocr_picture_path = #{ocrPicturePath,jdbcType=VARCHAR}, ocr_picture_path = #{ocrPicturePath,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -568,7 +582,8 @@
tail_warn = #{tailWarn,jdbcType=INTEGER}, tail_warn = #{tailWarn,jdbcType=INTEGER},
print_barcode = #{printBarcode,jdbcType=VARCHAR}, print_barcode = #{printBarcode,jdbcType=VARCHAR},
product_count = #{productCount,jdbcType=INTEGER}, product_count = #{productCount,jdbcType=INTEGER},
ocr_picture_path = #{ocrPicturePath,jdbcType=VARCHAR} ocr_picture_path = #{ocrPicturePath,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -578,7 +593,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from t_purchase_detail from t_purchase_detail
where purchase_id = #{id,jdbcType=VARCHAR} where purchase_id = #{id,jdbcType=VARCHAR}
order by create_time desc order by create_time desc ,sort asc
</select> </select>
<select id="getByPurchaseIdList" resultMap="BaseResultMap"> <select id="getByPurchaseIdList" resultMap="BaseResultMap">
@ -599,7 +614,7 @@
insert into t_purchase_detail (id, create_by, create_time, del_flag, update_by, update_time, purchase_id, product_id, insert into t_purchase_detail (id, create_by, create_time, del_flag, update_by, update_time, purchase_id, product_id,
product_name, unit, shop_id, category_id, attribute_list, supplier_id,supplier_name, product_sn, product_name, unit, shop_id, category_id, attribute_list, supplier_id,supplier_name, product_sn,
barcode, price, purchase_price, wholesale_price, product_picture, product_video, barcode, price, purchase_price, wholesale_price, product_picture, product_video,
product_intro, sales_week, tail_warn, print_barcode, product_count, ocr_picture_path) values product_intro, sales_week, tail_warn, print_barcode, product_count, ocr_picture_path,sort) values
<foreach item="purchaseDetail" collection="purchaseDetails" index="index" separator=","> <foreach item="purchaseDetail" collection="purchaseDetails" index="index" separator=",">
(#{purchaseDetail.id}, #{purchaseDetail.createBy}, #{purchaseDetail.createTime}, #{purchaseDetail.delFlag}, (#{purchaseDetail.id}, #{purchaseDetail.createBy}, #{purchaseDetail.createTime}, #{purchaseDetail.delFlag},
#{purchaseDetail.updateBy}, #{purchaseDetail.updateTime}, #{purchaseDetail.purchaseId}, #{purchaseDetail.productId}, #{purchaseDetail.updateBy}, #{purchaseDetail.updateTime}, #{purchaseDetail.purchaseId}, #{purchaseDetail.productId},
@ -607,7 +622,8 @@
#{purchaseDetail.attributeList}, #{purchaseDetail.supplierId}, #{purchaseDetail.supplierName}, #{purchaseDetail.productSn}, #{purchaseDetail.attributeList}, #{purchaseDetail.supplierId}, #{purchaseDetail.supplierName}, #{purchaseDetail.productSn},
#{purchaseDetail.barcode}, #{purchaseDetail.price}, #{purchaseDetail.purchasePrice}, #{purchaseDetail.wholesalePrice}, #{purchaseDetail.barcode}, #{purchaseDetail.price}, #{purchaseDetail.purchasePrice}, #{purchaseDetail.wholesalePrice},
#{purchaseDetail.productPicture}, #{purchaseDetail.productVideo}, #{purchaseDetail.productIntro}, #{purchaseDetail.productPicture}, #{purchaseDetail.productVideo}, #{purchaseDetail.productIntro},
#{purchaseDetail.salesWeek}, #{purchaseDetail.tailWarn}, #{purchaseDetail.printBarcode}, #{purchaseDetail.productCount},#{purchaseDetail.ocrPicturePath}) #{purchaseDetail.salesWeek}, #{purchaseDetail.tailWarn}, #{purchaseDetail.printBarcode}, #{purchaseDetail.productCount},
#{purchaseDetail.ocrPicturePath},#{purchaseDetail.sort})
</foreach> </foreach>
</insert> </insert>
@ -631,6 +647,12 @@
update t_purchase_detail set del_flag = '1' where purchase_id = #{purchaseId,jdbcType=VARCHAR} update t_purchase_detail set del_flag = '1' where purchase_id = #{purchaseId,jdbcType=VARCHAR}
</update> </update>
<!--根据入库单id真删除-->
<delete id="realDeleteByPurchaseId" parameterType="java.lang.String">
delete from t_purchase_detail
where purchase_id = #{purchaseId,jdbcType=VARCHAR}
</delete>
<select id="getPurchaseDetails" resultMap="BaseResultMap"> <select id="getPurchaseDetails" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>

9
hiver-modules/hiver-mall/src/main/resources/mapper/StockLogMapper.xml

@ -448,10 +448,15 @@
</insert> </insert>
<update id="deleteByPurchaseId" parameterType="java.lang.String"> <update id="deleteByPurchaseId" parameterType="java.lang.String">
update t_stock_log set del_flag ='1' update t_stock_log set del_flag = '1' where order_id = #{purchaseId,jdbcType=VARCHAR}
where order_id = #{purchaseId,jdbcType=VARCHAR}
</update> </update>
<!--根据入库单id真删除-->
<delete id="realDeleteByPurchaseId" parameterType="java.lang.String">
delete from t_stock_log
where order_id = #{purchaseId,jdbcType=VARCHAR}
</delete>
<update id="putInUpdatePurchasePrice"> <update id="putInUpdatePurchasePrice">
<foreach collection="purchaseDetails" item="item" separator=";" open="" close=""> <foreach collection="purchaseDetails" item="item" separator=";" open="" close="">
update t_stock_log set purchase_price = #{item.purchasePrice} WHERE product_id = #{item.productId} and purchase_price is null update t_stock_log set purchase_price = #{item.purchasePrice} WHERE product_id = #{item.productId} and purchase_price is null

Loading…
Cancel
Save