Przeglądaj źródła

feat: 商品进销存

Joburgess 5 lat temu
rodzic
commit
e90b8716c3

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/StockType.java

@@ -25,6 +25,6 @@ public enum StockType implements BaseEnum<String, StockType> {
 
     @Override
     public String getCode() {
-        return null;
+        return code;
     }
 }

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -312,6 +312,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		if(CollectionUtils.isEmpty(noneBatchNoSellOrders)){
 			return;
 		}
+		List<SellOrder> updateSellOrders = new ArrayList<>();
 		for (SellOrder noneBatchNoSellOrder : noneBatchNoSellOrders) {
 			GoodsProcurement goodsProcurement = null;
 			if(StockType.INTERNAL.equals(noneBatchNoSellOrder.getStockType())||(StockType.ALL.equals(noneBatchNoSellOrder.getStockType())&&AccountType.INTERNAL.equals(noneBatchNoSellOrder.getAccountType()))){
@@ -332,9 +333,12 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 				goodsProcurementDao.update(goodsProcurement);
 				noneBatchNoSellOrder.setBatchNo(goodsProcurement.getBatchNo());
 				noneBatchNoSellOrder.setSellCost(goodsProcurement.getDiscountPrice());
+				updateSellOrders.add(noneBatchNoSellOrder);
 			}
 		}
-		sellOrderDao.batchUpdate(noneBatchNoSellOrders);
+		if(!CollectionUtils.isEmpty(updateSellOrders)){
+			sellOrderDao.batchUpdate(updateSellOrders);
+		}
 	}
 
 	@Override

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -34,7 +34,7 @@
         <result column="complement_goods_id_list_" property="complementGoodsIdList"/>
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="supply_channel_" property="supplyChannel" />
-
+        <result column="stock_type_" property="stockType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="client_show_" property="clientShow" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="stock_warning_" property="stockWarning" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
     </resultMap>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/GoodsProcurementMapper.xml

@@ -134,11 +134,11 @@
 	</select>
 
 	<select id="getWithStockSurplusProcurement" resultMap="GoodsProcurement">
-		SELECT * FROM goods_procurement WHERE goods_id_ = #{goodsId} AND stock_count_>stock_sold_num_
+		SELECT * FROM goods_procurement WHERE goods_id_ = #{goodsId} AND stock_count_>stock_sold_num_ ORDER BY create_time_ DESC LIMIT 1
 	</select>
 
 	<select id="getWithTaxStockSurplusProcurement" resultMap="GoodsProcurement">
-		SELECT * FROM goods_procurement WHERE goods_id_ = #{goodsId} AND tax_stock_count_>tax_stock_sold_num_
+		SELECT * FROM goods_procurement WHERE goods_id_ = #{goodsId} AND tax_stock_count_>tax_stock_sold_num_ ORDER BY create_time_ DESC LIMIT 1
 	</select>
 
 	<select id="getWithGoodsAndBatchNo" resultMap="GoodsProcurement">

+ 2 - 0
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -35,6 +35,8 @@
         <result column="create_ime_" property="createIme"/>
         <result column="update_time_" property="updateTime"/>
         <result column="receive_status_" property="receiveStatus"/>
+        <result column="stock_type_" property="stockType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
+        <result column="account_type_" property="accountType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->