Browse Source

Merge remote-tracking branch 'origin/master'

徐滕 1 tuần trước cách đây
mục cha
commit
7205401f7a

+ 1 - 1
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/collect/service/PsiCollectService.java

@@ -414,7 +414,7 @@ public class PsiCollectService {
                         List<PsiWareHouseDetailed> infoByProduceDateDesc = new ArrayList<>();
                         for (PsiCollectDetailedRecord psiCollectDetailedRecord : recordList) {
                             //如果领用详情的分类和物品名  跟  领用分配的相同
-                            if(detailInfo.getCollectTypeId().equals(psiCollectDetailedRecord.getCollectTypeId()) && detailInfo.getGoodsName().equals(psiCollectDetailedRecord.getGoodsName())){
+                            if(detailInfo.getCollectTypeId().equals(psiCollectDetailedRecord.getCollectTypeId())){
                                 String recordId = UUID.randomUUID().toString().replace("-", "");
                                 psiCollectDetailedRecord.setSurplusStock("0");//退回数量
                                 psiCollectDetailedRecord.setReturnedNum("0");//已退回数量

+ 4 - 0
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/domain/PsiDishOrder.java

@@ -46,6 +46,10 @@ public class PsiDishOrder extends BaseEntity {
 
     private Date settleTime;
 
+    private String tasteRemark;
+
+    private String specialRequirements;
+
     private String remarks;
 
     @TableField(exist = false)

+ 3 - 1
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/domain/PsiDishOrderDetail.java

@@ -37,7 +37,7 @@ public class PsiDishOrderDetail extends BaseEntity {
     private BigDecimal salePrice;
 
     /**
-     * 数量,菜时允许为负数
+     * 数量,退菜时允许为负数
      */
     private Integer quantity;
 
@@ -50,6 +50,8 @@ public class PsiDishOrderDetail extends BaseEntity {
      */
     private String isAddDish;
 
+    private String reason;
+
     private String remarks;
 
     @TableField(exist = false)

+ 5 - 2
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/mapper/xml/PsiDishOrderDetailMapper.xml

@@ -24,6 +24,7 @@
         <result property="amount" column="amount" jdbcType="DECIMAL"/>
         <result property="dishSort" column="dish_sort" jdbcType="INTEGER"/>
         <result property="isAddDish" column="is_add_dish" jdbcType="VARCHAR"/>
+        <result property="reason" column="reason" jdbcType="VARCHAR"/>
         <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
         <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
     </resultMap>
@@ -78,13 +79,14 @@
             a.amount,
             a.dish_sort,
             a.is_add_dish,
+            a.reason,
             a.remarks
         from psi_dish_order_detail a
         where a.del_flag = '0'
           and a.order_id = #{orderId}
           and a.is_add_dish = '1'
           and a.quantity > 0
-        order by case when ifnull(a.dish_sort, 0) > 0 then a.dish_sort else 999999 end asc, a.create_time asc
+        order by a.create_time desc
     </select>
 
     <select id="findReduceDishList" resultMap="BaseResultMap">
@@ -110,12 +112,13 @@
             a.amount,
             a.dish_sort,
             a.is_add_dish,
+            a.reason,
             a.remarks
         from psi_dish_order_detail a
         where a.del_flag = '0'
           and a.order_id = #{orderId}
           and a.quantity &lt; 0
-        order by case when ifnull(a.dish_sort, 0) > 0 then a.dish_sort else 999999 end asc, a.create_time asc
+        order by a.create_time desc
     </select>
 
     <update id="updateDishSort">

+ 4 - 0
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/mapper/xml/PsiDishOrderMapper.xml

@@ -20,6 +20,8 @@
         <result property="discountAmount" column="discount_amount" jdbcType="DECIMAL"/>
         <result property="payableAmount" column="payable_amount" jdbcType="DECIMAL"/>
         <result property="settleTime" column="settle_time" jdbcType="TIMESTAMP"/>
+        <result property="tasteRemark" column="taste_remark" jdbcType="VARCHAR"/>
+        <result property="specialRequirements" column="special_requirements" jdbcType="VARCHAR"/>
         <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
         <result property="createName" column="create_name" jdbcType="VARCHAR"/>
     </resultMap>
@@ -42,6 +44,8 @@
         a.discount_amount,
         a.payable_amount,
         a.settle_time,
+        a.taste_remark,
+        a.special_requirements,
         a.remarks
     </sql>
 

+ 9 - 4
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/dishManage/service/PsiDishOrderService.java

@@ -179,6 +179,8 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
             return null;
         }
         order.setDetailList(dishOrderDetailMapper.findSummaryByOrderId(order.getId()));
+        order.setAddDishList(dishOrderDetailMapper.findAddDishList(order.getId()));
+        order.setReduceDishList(dishOrderDetailMapper.findReduceDishList(order.getId()));
         return order;
     }
 
@@ -220,7 +222,7 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
         }
         boolean addDish = order != null;
         if (order == null) {
-            order = createOrder(room, userDto, now);
+            order = createOrder(room, info, userDto, now);
             dishOrderMapper.insert(order);
             PsiDishRoom updateRoom = new PsiDishRoom();
             updateRoom.setId(room.getId());
@@ -237,13 +239,14 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
             }
             int currentQuantity = currentQuantityMap.getOrDefault(item.getDishId(), 0);
             if (currentQuantity + item.getQuantity() < 0) {
-                return item.getDishName() + "菜数量不能大于已点数量";
+                return item.getDishName() + "退菜数量不能大于已点数量";
             }
             PsiDishMenuDish dish = dishMenuService.findCurrentByDishId(item.getDishId());
             if (dish == null || !"0".equals(dish.getStatus())) {
                 return "菜品不存在或已停用";
             }
             PsiDishOrderDetail detail = buildDetail(order, dish, item.getQuantity(), addDish ? "1" : "0", item.getDishSort(), userDto, now);
+            detail.setReason(item.getReason());
             dishOrderDetailMapper.insert(detail);
             changeAmount = changeAmount.add(detail.getAmount());
             currentQuantityMap.put(item.getDishId(), currentQuantity + item.getQuantity());
@@ -253,7 +256,7 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
         }
         info.setRoomName(order.getRoomName());
         refreshOrderAmount(order.getId(), info, userDto, now);
-        return "1".equals(info.getSettleFlag()) ? "下单并结账成功" : (changeAmount.compareTo(BigDecimal.ZERO) < 0 ? "菜成功" : "下单成功");
+        return "1".equals(info.getSettleFlag()) ? "下单并结账成功" : (changeAmount.compareTo(BigDecimal.ZERO) < 0 ? "退菜成功" : "下单成功");
     }
 
     public String cancelOrder(String id) {
@@ -294,7 +297,7 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
         return "取消成功";
     }
 
-    private PsiDishOrder createOrder(PsiDishRoom room, UserDTO userDto, Date now) {
+    private PsiDishOrder createOrder(PsiDishRoom room, PsiDishOrder info, UserDTO userDto, Date now) {
         PsiDishOrder order = new PsiDishOrder();
         order.setId(UUID.randomUUID().toString().replace("-", ""));
         order.setOrderNo("DC" + new SimpleDateFormat("yyyyMMddHHmmss").format(now));
@@ -306,6 +309,8 @@ public class PsiDishOrderService extends ServiceImpl<PsiDishOrderMapper, PsiDish
         order.setDiscountRate(new BigDecimal("100"));
         order.setDiscountAmount(BigDecimal.ZERO);
         order.setPayableAmount(BigDecimal.ZERO);
+        order.setTasteRemark(info.getTasteRemark());
+        order.setSpecialRequirements(info.getSpecialRequirements());
         order.setCreateById(userDto.getId());
         order.setCreateTime(now);
         order.setUpdateById(userDto.getId());

+ 6 - 0
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/materialType/service/PsiMaterialTypeService.java

@@ -39,6 +39,9 @@ public class PsiMaterialTypeService extends ServiceImpl<PsiMaterialTypeMapper, P
             List<PsiMaterialTypeInfo> materialTypeInfoList = this.list(new QueryWrapper<PsiMaterialTypeInfo>().lambda()
                     .like(StringUtils.isNotBlank(info.getName()), PsiMaterialTypeInfo::getName, info.getName())
             );
+            if (CollectionUtil.isEmpty(materialTypeInfoList)) {
+                return new ArrayList<>();
+            }
             List<String> collect = materialTypeInfoList.stream().map(PsiMaterialTypeInfo::getId).collect(Collectors.toList());
             //materialTypeInfoList的父级id全部获取
             List<String> cupIdList = materialTypeInfoList.stream().map(PsiMaterialTypeInfo::getParentId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());
@@ -127,6 +130,9 @@ public class PsiMaterialTypeService extends ServiceImpl<PsiMaterialTypeMapper, P
             List<PsiMaterialTypeInfo> materialTypeInfoList = this.list(new QueryWrapper<PsiMaterialTypeInfo>().lambda()
                     .like(StringUtils.isNotBlank(info.getName()), PsiMaterialTypeInfo::getName, info.getName())
             );
+            if (CollectionUtil.isEmpty(materialTypeInfoList)) {
+                return new ArrayList<>();
+            }
             List<String> collect = materialTypeInfoList.stream().map(PsiMaterialTypeInfo::getId).collect(Collectors.toList());
             //materialTypeInfoList的父级id全部获取
             List<String> cupIdList = materialTypeInfoList.stream().map(PsiMaterialTypeInfo::getParentId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList());

+ 4 - 8
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/psiWareHouse/mapper/xml/PsiWareHouseBasicMapper.xml

@@ -497,8 +497,7 @@
 			on a.ware_house_type = b.collect_type
 			LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
 			left join psi_management_type c on a.ware_house_type = c.id
-			where a.trade_name = #{goodsName}
-			  and a.ware_house_type = #{collectTypeId}
+			where a.ware_house_type = #{collectTypeId}
 			  and a.del_flag = 0
 			GROUP BY a.ware_house_type
 			ORDER BY a.update_time DESC
@@ -527,8 +526,7 @@
 
 				LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
 				left join psi_management_type c on a.ware_house_type = c.id
-		where a.trade_name = #{goodsName}
-		  and a.ware_house_type = #{collectTypeId}
+		where a.ware_house_type = #{collectTypeId}
 		  and a.produce_date = #{produceDate}
 		  and a.del_flag = 0
 		GROUP BY a.ware_house_type,a.produce_date
@@ -557,8 +555,7 @@
 			on a.ware_house_type = b.collect_type
 				LEFT JOIN psi_management_warehouse_basics bas on a.basic_id = bas.id
 				left join psi_management_type c on a.ware_house_type = c.id
-		where a.trade_name = #{goodsName}
-		  and a.ware_house_type = #{collectTypeId}
+		where a.ware_house_type = #{collectTypeId}
 		  and a.del_flag = 0
 		ORDER BY a.produce_date asc
 	</select>
@@ -595,14 +592,13 @@
 
 		WHERE a.ware_house_type = #{wareHouseType}
 		and a.del_flag = 0
-		and a.trade_name = #{tradeName}
 		and a.produce_date &lt;= #{produceDate}
 		GROUP BY a.ware_house_type
 		ORDER BY a.ware_house_type DESC
 	</select>
 	<select id="getCollectInfoByTime" resultType="java.lang.String">
 		SELECT
-		IFNULL((sum(trade_number) - collect_number),sum(trade_number)) as tradeNumber
+			GREATEST( IFNULL(SUM(trade_number) - collect_number, SUM(trade_number)), 0 ) AS tradeNumber
 		FROM
 		psi_management_warehouse_detailed a
 		left join psi_management_type c on a.ware_house_type = c.id

+ 0 - 4
jeeplus-modules/jeeplus-psi-management/src/main/java/com/jeeplus/psimanage/psiWareHouse/mapper/xml/PsiWareHouseSummaryMapper.xml

@@ -20,7 +20,6 @@
                 AND c.del_flag = 0
             WHERE
                 b.collect_type = #{wareHouseType}
-                AND b.goods_name = #{tradeName}
 
             AND b.del_flag = 0
             AND c.`status` = 5
@@ -29,7 +28,6 @@
 
         WHERE
             a.ware_house_type = #{wareHouseType}
-            AND a.trade_name = #{tradeName}
             AND a.del_flag = 0
     </select>
     <select id="getInfoByBasicId"
@@ -63,7 +61,6 @@
                                   ON b.basic_id = c.id AND c.del_flag = 0
                 WHERE
                     b.collect_type = #{wareHouseType}
-                  AND b.goods_name = #{tradeName}
                   AND b.del_flag = 0
                   AND c.`status` = 5
                 -- 按商品  生产日期分组
@@ -73,7 +70,6 @@
                               AND a.produce_date = c.produce_date  -- 关键:按生产日期匹配
         WHERE
             a.ware_house_type = #{wareHouseType}
-          AND a.trade_name = #{tradeName}
           AND a.del_flag = 0
 
         GROUP BY a.id  -- 按库存分组