Kaynağa Gözat

1.待出库列表接口状态条件修改
2.销售订单-订单确认接口增加修改上架数量逻辑
3.销售订单-撤销订单确认接口增加修改上架数量逻辑
4.生成出库工单接口逻辑修改
5.删除 出库工单接口逻辑修改

纪新园 1 ay önce
ebeveyn
işleme
5e708b72c1

+ 5 - 0
blade-common/src/main/java/org/springblade/common/enums/OrderTypeEnum.java

@@ -143,6 +143,11 @@ public enum OrderTypeEnum {
 	REVOKEOURTBOUND("撤销出库"),
 
 	/**
+	 * 销售订单状态已生成
+	 */
+	GENERATED("已生成"),
+
+	/**
 	 * 销售订单状态已发货
 	 */
 	SHIPED("已发货"),

+ 2 - 1
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/order/controller/OrderController.java

@@ -518,7 +518,8 @@ public class OrderController extends BladeController {
 			.like(ObjectUtils.isNotEmpty(order.getSrcOrdNo()), PjOrder::getSrcOrdNo, order.getSrcOrdNo())//来源单号
 			.like(ObjectUtils.isNotEmpty(order.getOrdNo()), PjOrder::getOrdNo, order.getOrdNo())//来源单号
 			.like(ObjectUtils.isNotEmpty(order.getGoodsNameJoin()), PjOrder::getGoodsNameJoin, order.getGoodsNameJoin())//商品名称
-			.eq(PjOrder::getStatus, "待发货");
+			.like(ObjectUtils.isNotEmpty(order.getGoodsTotalShipNum()), PjOrder::getGoodsNameJoin, order.getGoodsNameJoin())//商品名称
+			.apply("goods_total_ship_num != goods_total_num and find_in_set(status,'已生成,待发货')");
 		if (order.getBusinesDateList() != null && order.getBusinesDateList().size() > 1) {//业务日期
 			lambdaQueryWrapper.ge(PjOrder::getBusinesDate, order.getBusinesDateList().get(0));
 			lambdaQueryWrapper.le(PjOrder::getBusinesDate, order.getBusinesDateList().get(1));

+ 17 - 17
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/order/mapper/OrderItemsMapper.xml

@@ -305,18 +305,18 @@
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') <= #{saleDetailDto.dateEnd}
         </if>
         <if test='saleDetailDto.bsType !=null and saleDetailDto.bsType !="" and saleDetailDto.bsType == "XS"'>
-            and not FIND_IN_SET(po.`status`,'退款请核,已取消,已退款,售后中')
+            and not FIND_IN_SET(po.`status`,'申请退货,已取消,已退款,售后中')
         </if>
         <if test='saleDetailDto.isContain !=null and saleDetailDto.isContain !="" and saleDetailDto.isContain == "1"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货,待收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货,待收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='saleDetailDto.isContain !=null and saleDetailDto.isContain !="" and saleDetailDto.isContain == "0"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='saleDetailDto.isContain ==null or saleDetailDto.isContain ==""'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         ORDER BY
@@ -519,18 +519,18 @@
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') &lt;= #{dateEnd}
         </if>
         <if test='bsType !=null and bsType !="" and bsType == "XS"'>
-            and not FIND_IN_SET(po.`status`,'退款请核,已取消,已退款,售后中')
+            and not FIND_IN_SET(po.`status`,'申请退货,已取消,已退款,售后中')
         </if>
         <if test='isContain !=null and isContain !="" and isContain == "1"'>
-          and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货,待收货'))
+          and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货,待收货'))
               or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='isContain !=null and isContain !="" and isContain == "0"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='isContain ==null or isContain ==""'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         ORDER BY
@@ -562,7 +562,7 @@
         AND po.bs_type = 'XS'
         AND poi.tenant_id = #{tenantId}
         AND po.tenant_id = #{tenantId}
-        AND FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货')
+        AND FIND_IN_SET(po.`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货')
         <if test='type !=null and type != "" and type == "1"'>
             AND DATE(po.busines_date) = CURDATE()
         </if>
@@ -629,15 +629,15 @@
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') &lt;= #{saleDetailDto.dateEnd}
         </if>
         <if test='saleDetailDto.isContain !=null and saleDetailDto.isContain !="" and saleDetailDto.isContain == "1"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='saleDetailDto.isContain !=null and saleDetailDto.isContain !="" and saleDetailDto.isContain == "0"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='saleDetailDto.isContain ==null or saleDetailDto.isContain ==""'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         ORDER BY
@@ -700,18 +700,18 @@
             and DATE_FORMAT(po.delivery_busines_date,'%Y-%m-%d') &lt;= #{dateEnd}
         </if>
         <if test='bsType !=null and bsType !="" and bsType == "XS"'>
-            and not FIND_IN_SET(po.`status`,'退款请核,已取消,已退款,售后中')
+            and not FIND_IN_SET(po.`status`,'申请退货,已取消,已退款,售后中')
         </if>
         <if test='isContain !=null and isContain !="" and isContain == "1"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='isContain !=null and isContain !="" and isContain == "0"'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         <if test='isContain ==null or isContain ==""'>
-            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,退款请核,已取消,已退款,售后中,已收货'))
+            and ( (FIND_IN_SET(po.bs_type,'XS,CG,RZCG') and FIND_IN_SET(po.`status`,'已发货,申请退货,已取消,已退款,售后中,已收货'))
             or (FIND_IN_SET(po.bs_type,'TKXS,TKCG') and FIND_IN_SET(po.`status`,'已完成')) )
         </if>
         ORDER BY
@@ -857,7 +857,7 @@
           AND po.bs_type = 'XS'
           AND poi.tenant_id = #{tenantId}
           AND po.tenant_id = #{tenantId}
-          AND po.STATUS IN ( '待确认', '待发货', '已发货', '退款请核', '已取消', '已退款', '售后中', '已收货' )
+          AND po.STATUS IN ( '待确认', '待发货', '已发货', '申请退货', '已取消', '已退款', '售后中', '已收货' )
 
 
     </select>

+ 1 - 1
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/order/mapper/OrderMapper.xml

@@ -457,7 +457,7 @@
             is_deleted = '0'
           AND bs_type = 'XS'
           AND tenant_id = #{tenantId}
-        and FIND_IN_SET(`status`,'待确认,待发货,已发货,退款请核,已取消,已退款,售后中,已收货')
+        and FIND_IN_SET(`status`,'待确认,待发货,已发货,申请退货,已取消,已退款,售后中,已收货')
         <if test='type !=null and type != "" and type == "1"'>
             AND DATE(busines_date) = CURDATE()
         </if>

+ 61 - 0
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/order/service/impl/OrderServiceImpl.java

@@ -907,6 +907,39 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		order.setStatus("待发货");
 		order.setVersion(order.getVersion() + 1);
 		baseMapper.updateById(order);
+		LambdaQueryWrapper<PjOrderItems> itemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		itemsLambdaQueryWrapper.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
+			.eq(PjOrderItems::getIsDeleted, 0)
+			.eq(PjOrderItems::getPid, order.getId());
+		List<PjOrderItems> itemsList = orderItemsService.list(itemsLambdaQueryWrapper);
+		if (ObjectUtil.isNotEmpty(itemsList)) {
+			List<Long> goodsId = itemsList.stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
+			LambdaQueryWrapper<PjProductLaunch> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+				.eq(PjProductLaunch::getIsDeleted, 0)
+				.in(PjProductLaunch::getGoodsId, goodsId);
+			List<PjProductLaunch> launchList = productLaunchService.list(queryWrapper);
+			List<PjProductLaunch> productLaunchListNew = new ArrayList<>();
+			itemsList.forEach(e -> {
+				if (ObjectUtil.isNotEmpty(launchList)) {
+					PjProductLaunch pjProductLaunch = launchList.stream().filter(i -> i.getGoodsId().equals(e.getGoodsId())).findFirst().orElse(null);
+					if (pjProductLaunch != null) {
+						if (pjProductLaunch.getInventory().compareTo(e.getGoodsNum()) < 0) {
+							throw new RuntimeException("商品:" + e.getGoodsName() + "库存不足");
+						}
+						pjProductLaunch.setInventory(pjProductLaunch.getInventory().subtract(e.getGoodsNum()));
+						pjProductLaunch.setVersion(pjProductLaunch.getVersion());
+						productLaunchListNew.add(pjProductLaunch);
+					}
+				} else {
+					throw new RuntimeException("商品:" + e.getGoodsName() + "未上架");
+				}
+			});
+			R res = productLaunchService.updateBatchById(productLaunchListNew);
+			if (!res.isSuccess()) {
+				throw new RuntimeException(res.getMsg());
+			}
+		}
 		return R.data(order);
 	}
 
@@ -918,6 +951,34 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		order.setStatus("待确认");
 		order.setVersion(order.getVersion() + 1);
 		baseMapper.updateById(order);
+		LambdaQueryWrapper<PjOrderItems> itemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		itemsLambdaQueryWrapper.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
+			.eq(PjOrderItems::getIsDeleted, 0)
+			.eq(PjOrderItems::getPid, order.getId());
+		List<PjOrderItems> itemsList = orderItemsService.list(itemsLambdaQueryWrapper);
+		if (ObjectUtil.isNotEmpty(itemsList)) {
+			List<Long> goodsId = itemsList.stream().map(PjOrderItems::getGoodsId).distinct().collect(Collectors.toList());
+			LambdaQueryWrapper<PjProductLaunch> queryWrapper = new LambdaQueryWrapper<>();
+			queryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+				.eq(PjProductLaunch::getIsDeleted, 0)
+				.in(PjProductLaunch::getGoodsId, goodsId);
+			List<PjProductLaunch> launchList = productLaunchService.list(queryWrapper);
+			List<PjProductLaunch> productLaunchListNew = new ArrayList<>();
+			itemsList.forEach(e -> {
+				if (ObjectUtil.isNotEmpty(launchList)) {
+					PjProductLaunch pjProductLaunch = launchList.stream().filter(i -> i.getGoodsId().equals(e.getGoodsId())).findFirst().orElse(null);
+					if (pjProductLaunch != null) {
+						pjProductLaunch.setInventory(pjProductLaunch.getInventory().add(e.getGoodsNum()));
+						pjProductLaunch.setVersion(pjProductLaunch.getVersion());
+						productLaunchListNew.add(pjProductLaunch);
+					}
+				}
+			});
+			R res = productLaunchService.updateBatchById(productLaunchListNew);
+			if (!res.isSuccess()) {
+				throw new RuntimeException(res.getMsg());
+			}
+		}
 		return R.data(order);
 	}
 

+ 9 - 0
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/ship/controller/ShipController.java

@@ -396,4 +396,13 @@ public class ShipController extends BladeController {
 		return shipService.submitShip(ship);
 	}
 
+	/**
+	 * 删除 出库工单
+	 */
+	@GetMapping("/removeShip")
+	@RepeatSubmit
+	public R removeShip(@RequestParam("id")Long id) {
+		return shipService.removeShip(id);
+	}
+
 }

+ 2 - 0
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/ship/service/IShipService.java

@@ -150,4 +150,6 @@ public interface IShipService extends IService<PjShip> {
 	R submitReturns(ShipVO ship);
 
 	R submitShip(ShipItemsDTO ship);
+
+    R removeShip(Long id);
 }

+ 120 - 186
blade-service/gubersail-dealer-admin/src/main/java/com/gubersail/admin/ship/service/impl/ShipServiceImpl.java

@@ -15,7 +15,6 @@ import com.gubersail.admin.order.service.IOrderItemsService;
 import com.gubersail.admin.order.service.IOrderRecordService;
 import com.gubersail.admin.productLaunch.service.IProductLaunchService;
 import com.gubersail.admin.ship.mapper.ShipMapper;
-import com.gubersail.admin.ship.service.IShipItemsRecordService;
 import com.gubersail.admin.ship.service.IShipItemsService;
 import com.gubersail.admin.ship.service.IShipService;
 import com.gubersail.admin.stock.service.ITireStockDescService;
@@ -32,12 +31,10 @@ import com.gubersail.dealer.admin.api.history.entity.PjHistory;
 import com.gubersail.dealer.admin.api.order.entity.OrderRecord;
 import com.gubersail.dealer.admin.api.order.entity.PjOrder;
 import com.gubersail.dealer.admin.api.order.entity.PjOrderItems;
-import com.gubersail.dealer.admin.api.order.vo.OrderVO;
 import com.gubersail.dealer.admin.api.productLaunch.entity.PjProductLaunch;
 import com.gubersail.dealer.admin.api.ship.dto.ShipItemsDTO;
 import com.gubersail.dealer.admin.api.ship.entity.PjShip;
 import com.gubersail.dealer.admin.api.ship.entity.PjShipItems;
-import com.gubersail.dealer.admin.api.ship.entity.ShipItemsRecord;
 import com.gubersail.dealer.admin.api.ship.vo.ShipVO;
 import com.gubersail.dealer.admin.api.stock.entity.TireStockDesc;
 import com.gubersail.dealer.admin.api.storage.entity.PjStorageDesc;
@@ -60,8 +57,6 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.math.RoundingMode;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -95,13 +90,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	private final IUserClient userClient;
 	private final StorageDescMapper storageDescMapper;
 
-	private final IShipItemsRecordService shipItemsRecordService;
-
 	/**
 	 * 获取收发货订单详情
-	 *
-	 * @param ship
-	 * @return
 	 */
 	@Override
 	public ShipVO getMessageById(PjShip ship) {
@@ -139,9 +129,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 	/**
 	 * 保存订单信息
-	 *
-	 * @param shipVO
-	 * @return
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
@@ -242,13 +229,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 	/**
 	 * 出库完成
-	 *
-	 * @param shipVO
-	 * @return
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public R outboundCompleted(ShipVO shipVO) {
+	public R<PjShip> outboundCompleted(ShipVO shipVO) {
 		PjShip ship = new PjShip();
 		BeanUtil.copyProperties(shipVO, ship);
 		if (ObjectUtils.isNull(ship.getStorageId())) {
@@ -380,11 +364,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				}
 				PjOrderItems orderItems = pjOrderItems.stream().filter(e -> e.getId().equals(item.getSrcItemId())).findFirst().orElse(null);
 				if (orderItems != null) {
-					if (orderItems.getGoodsNum().compareTo(orderItems.getSendNum().add(item.getSendNum())) < 0) {
-						throw new RuntimeException(orderItems.getGoodsName() + "剩余应发货数量" + orderItems.getGoodsNum().subtract(orderItems.getSendNum()));
-					} else {
-						orderItems.setSendNum(orderItems.getSendNum().add(item.getSendNum()));
-					}
 					orderItems.setCostprie(orderItems.getCostprie().add(item.getCostprie()));
 					orderItems.setCostpriePrice(orderItems.getCostprie().divide(orderItems.getSendNum(), 2, RoundingMode.HALF_UP));
 					orderItems.setProfit(orderItems.getSubTotalMoney().subtract(orderItems.getCostprie()));
@@ -394,7 +373,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					orderItems.setRebatePrice(orderItems.getRebateCostprie().divide(orderItems.getSendNum(), 2, RoundingMode.HALF_UP));
 					orderItems.setRebateProfit(orderItems.getSubTotalMoney().subtract(orderItems.getRebateCostprie()));
 
-					orderItems.setGoodsTotalShipAmount(orderItems.getSendNum().multiply(orderItems.getPrice()));
 					pjOrderItemsList.add(orderItems);
 				} else {
 					throw new RuntimeException("数据异常请联系管理员");
@@ -419,35 +397,26 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		orderItemsService.updateBatchById(pjOrderItemsList);
 		PjOrder order = orderMapper.selectById(ship.getOrdId());
 		if (ObjectUtil.isNotEmpty(order)) {
-			List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
-				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
-				.eq(PjOrderItems::getIsDeleted, 0)
-				.eq(PjOrderItems::getPid, order.getId()));
-			if (!orderItemsList.isEmpty()) {
-				if ("已收货".equals(order.getStatus()) || "退款请核".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
+			if (!pjOrderItemsList.isEmpty()) {
+				if ("已收货".equals(order.getStatus()) || "申请退货".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
 					throw new RuntimeException("单据已收货或申请售后中,操作失败");
 				}
 				//数量和
-				BigDecimal goodsNum = orderItemsList.stream().map(PjOrderItems::getGoodsNum).filter(Objects::nonNull)
+				BigDecimal goodsNum = pjOrderItemsList.stream().map(PjOrderItems::getGoodsNum).filter(Objects::nonNull)
 					.reduce(BigDecimal.ZERO, BigDecimal::add);
 				//发货数量和
-				BigDecimal sendNum = orderItemsList.stream().map(PjOrderItems::getSendNum).filter(Objects::nonNull)
+				BigDecimal sendNum = pjOrderItemsList.stream().map(PjOrderItems::getSendNum).filter(Objects::nonNull)
 					.reduce(BigDecimal.ZERO, BigDecimal::add);
-				BigDecimal goodsTotalShipAmount = orderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount)
+				BigDecimal goodsTotalShipAmount = pjOrderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount)
 					.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 				order.setGoodsTotalShipAmount(goodsTotalShipAmount);
 				order.setGoodsTotalShipNum(sendNum);
-				order.setGrossProfit(orderItemsList.stream().map(PjOrderItems::getGrossProfit).reduce(BigDecimal.ZERO, BigDecimal::add));
-				order.setCost(orderItemsList.stream().map(PjOrderItems::getCostprie).reduce(BigDecimal.ZERO, BigDecimal::add));
-				order.setShipType(ship.getShipType());
-				order.setLogisticsCorpId(ship.getLogisticsCorpId());
-				order.setLogisticsCorpName(ship.getLogisticsCorpName());
-				order.setExpressNo(ship.getExpressNo());
+				order.setGrossProfit(pjOrderItemsList.stream().map(PjOrderItems::getGrossProfit).reduce(BigDecimal.ZERO, BigDecimal::add));
+				order.setCost(pjOrderItemsList.stream().map(PjOrderItems::getCostprie).reduce(BigDecimal.ZERO, BigDecimal::add));
 				order.setVersion(order.getVersion() + 1);
 				if (goodsNum.compareTo(sendNum) == 0) {//数量等于发货数量修改销售订单状态
 					order.setDeliveryBusinesDate(new Date());
 					order.setStatus(OrderTypeEnum.SHIPED.getType());
-					order.setXcxStatus(OrderTypeEnum.GOODSRECEIVED.getType());
 					orderMapper.updateById(order);
 				} else {
 					order.setStorageId(ship.getStorageId());
@@ -471,15 +440,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		ship.setUpdateUser(AuthUtil.getUserId());
 		ship.setUpdateTime(new Date());
 		ship.setVersion(Objects.isNull(ship.getVersion()) ? 1 : ship.getVersion() + 1);
-/*		PjShip shipVersion = baseMapper.selectById(ship.getId());
-		if (shipVersion != null && !shipVersion.getVersion().equals(ship.getVersion())) {
-			throw new RuntimeException("数据已被修改,请返回列表重新操作!");
-		}*/
 		baseMapper.updateById(ship);
 		PjOrder order = orderMapper.selectById(ship.getOrdId());
 		// 保存订单明细
 		List<PjShipItems> itemsList = new ArrayList<>();
-		List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
 		List<TireStockDesc> pjStockDescArrayList = new ArrayList<>();
 		if (CollectionUtils.isNotEmpty(shipVO.getShipItemsList())) {
 			List<Long> goodIds = shipVO.getShipItemsList().stream().map(PjShipItems::getGoodsId).distinct().collect(Collectors.toList());
@@ -488,31 +452,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				.eq(PjGoodsDesc::getIsDeleted, 0)
 				.in(PjGoodsDesc::getId, goodIds));
 			//修改库存账
-			String poNo = shipVO.getShipItemsList().stream().map(PjShipItems::getPoNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
 			LambdaQueryWrapper<TireStockDesc> stockLambdaQueryWrapper = new LambdaQueryWrapper<>();
 			stockLambdaQueryWrapper
 				.eq(TireStockDesc::getTenantId, AuthUtil.getTenantId())
 				.eq(TireStockDesc::getIsDeleted, 0)
 				.eq(TireStockDesc::getStorageId, ship.getStorageId())
-				.eq(TireStockDesc::getSalesCompanyId, ship.getSalesCompanyId())
 				.in(TireStockDesc::getGoodsId, goodIds);
-//			if (ObjectUtils.isNotNull(status) && "1".equals(status)) {
-			if (ObjectUtils.isNotNull(ship.getWhetherFinancing()) && "1".equals(ship.getWhetherFinancing())) {
-				stockLambdaQueryWrapper.apply("find_in_set(po_no,'" + poNo + "')");
-			}
 			List<TireStockDesc> pjStockDescList = iStockDescService.list(stockLambdaQueryWrapper);
-			LambdaQueryWrapper<TireStockDesc> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
-			lambdaQueryWrapper1.eq(TireStockDesc::getTenantId, AuthUtil.getTenantId())
-				.eq(TireStockDesc::getIsDeleted, 0)
-				.eq(TireStockDesc::getSalesCompanyId, ship.getSalesCompanyId())
-				.eq(TireStockDesc::getStorageId, order.getStorageId())
-				.in(TireStockDesc::getGoodsId, goodIds);
-			List<TireStockDesc> pjStockDescList1 = iStockDescService.list(lambdaQueryWrapper1);
-			List<Long> srcItemIds = shipVO.getShipItemsList().stream().map(PjShipItems::getSrcItemId).distinct().collect(Collectors.toList());
-			List<PjOrderItems> pjOrderItems = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
-				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
-				.eq(PjOrderItems::getIsDeleted, 0)
-				.in(PjOrderItems::getId, srcItemIds));
 			List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
 				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
 				.eq(PjOrderItems::getIsDeleted, 0)
@@ -530,30 +476,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				if (ObjectUtil.isEmpty(goodsDesc)) {
 					throw new RuntimeException("商品数据异常");
 				}
-				//管理批次号
-				TireStockDesc stockOne1 = null;
-				if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && "1".equals(goodsDesc.getWhether())) {
-					stockOne1 = pjStockDescList1.stream()
-						.filter(e -> e.getGoodsId().equals(item.getGoodsId())
-							&& e.getDot().equals(item.getDot())).findFirst().orElse(null);
-				} else {
-					stockOne1 = pjStockDescList1.stream()
-						.filter(e -> e.getGoodsId().equals(item.getGoodsId())
-							&& ObjectUtils.isNull(e.getDot())).findFirst().orElse(null);
-				}
-				PjOrderItems orderItems = pjOrderItems.stream().filter(e -> e.getId().equals(item.getSrcItemId())).findFirst().orElse(null);
-				if (orderItems != null) {
-					if (stockOne1 == null) {
-						orderItems.setCostprie(new BigDecimal("0.00"));
-						orderItems.setGrossProfit(new BigDecimal("0.00"));
-						orderItems.setRebateCostprie(new BigDecimal("0.00"));
-						orderItems.setRebateProfit(new BigDecimal("0.00"));
-					}
-					orderItems.setSendNum(orderItems.getSendNum().subtract(item.getSendNum()));
-					pjOrderItemsList.add(orderItems);
-				} else {
-					throw new RuntimeException("数据异常请联系管理员");
-				}
 				List<PjOrderItems> pjOrderItemsList1 = orderItemsList.stream().filter(e -> e.getGoodsId().equals(item.getGoodsId())).collect(Collectors.toList());
 				if (!pjOrderItemsList1.isEmpty()) {
 					msg1.append(item.getGoodsName()).append(",");
@@ -571,8 +493,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				}
 				if (stockOne != null) {
 					stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().add(item.getSendNum()));
-					stockOne.setBalanceQuantityFinancing(stockOne.getBalanceQuantityFinancing().add(item.getSendNumFinancing()));
-					stockOne.setBalanceQuantityHave(stockOne.getBalanceQuantityHave().add(item.getSendNumHave()));
 					stockOne.setStoreInventory(stockOne.getBalanceQuantity());
 					BigDecimal inventoryAmount = item.getSendNum().multiply(stockOne.getInventoryCostPrice());
 					BigDecimal rebateInventoryAmount = item.getSendNum().multiply(stockOne.getRebatePrice());
@@ -593,22 +513,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				throw new RuntimeException(res.getMsg());
 			}
 			shipItemsService.updateBatchById(itemsList);
-			orderItemsService.updateBatchById(pjOrderItemsList);
 			ship.setNumberRows(shipVO.getShipItemsList().size());
-
-			//修改任务发货数量
-			PjShip rwShip = baseMapper.selectById(ship.getTaskId());
-			if (ObjectUtils.isNotNull(rwShip)) {
-				rwShip.setSendTotalNum(rwShip.getSendTotalNum().subtract(number));
-				if (rwShip.getSendTotalNum().compareTo(rwShip.getGoodsTotalNum()) == 0) {
-					rwShip.setStatusName("已完成");
-				} else {
-					rwShip.setStatusName("未完成");
-				}
-				rwShip.setUpdateUser(AuthUtil.getUserId());
-				rwShip.setUpdateTime(new Date());
-				baseMapper.updateById(rwShip);
-			}
 		} else {
 			throw new RuntimeException("出库明细不能为空");
 		}
@@ -620,25 +525,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			if (order1 != null && "待入库,已完成".contains(order1.getStatus())) {
 				throw new RuntimeException("已生成销售退货单据,撤销失败");
 			}
-			if ("已收货".equals(order.getStatus()) || "退款请核".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
+			if ("已收货".equals(order.getStatus()) || "申请退货".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
 				throw new RuntimeException("单据已收货或申请售后中,操作失败");
 			}
-			List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
-				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
-				.eq(PjOrderItems::getIsDeleted, 0)
-				.eq(PjOrderItems::getPid, order.getId()));
-			if (!orderItemsList.isEmpty()) {
-				//发货数量和
-				BigDecimal sendNum = orderItemsList.stream().map(PjOrderItems::getSendNum).filter(Objects::nonNull)
-					.reduce(BigDecimal.ZERO, BigDecimal::add);
-				BigDecimal goodsTotalShipAmount = orderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount)
-					.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-				order.setGoodsTotalShipAmount(goodsTotalShipAmount);
-				order.setGoodsTotalShipNum(sendNum);
-			}
 			order.setDeliveryBusinesDate(null);
-			order.setStatus(OrderTypeEnum.XSDFH.getType());
-			order.setXcxStatus(OrderTypeEnum.XSDFH.getType());
+			order.setStatus(OrderTypeEnum.GENERATED.getType());
 			order.setVersion(order.getVersion() + 1);
 			orderMapper.updateById(order);
 		} else {
@@ -653,13 +544,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 	/**
 	 * 入库完成
-	 *
-	 * @param shipVO
-	 * @return
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public R warehousingComplete(ShipVO shipVO) {
+	public R<PjShip> warehousingComplete(ShipVO shipVO) {
 		PjShip ship = new PjShip();
 		BeanUtil.copyProperties(shipVO, ship);
 		if (ship.getId() == null) {
@@ -748,10 +636,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				TireStockDesc stockDesc = new TireStockDesc();
 				stockDesc.setGoodsTypeId(goodsDesc.getGoodsTypeId());
 				if (ObjectUtils.isNotNull(goodsDesc.getGoodsTypeId())) {
-					PjGoodsType goodsType = pjGoodsTypeList.stream().filter(e -> (e.getId() + "").equals(goodsDesc.getGoodsTypeId())).findFirst().orElse(null);
-					if (goodsType != null) {
-						stockDesc.setGoodsTypeName(goodsType.getCname());
-					}
+					pjGoodsTypeList.stream().filter(e -> (e.getId() + "").equals(goodsDesc.getGoodsTypeId())).findFirst()
+						.ifPresent(goodsType -> stockDesc.setGoodsTypeName(goodsType.getCname()));
 				}
 				stockDesc.setGoodsId(goodsDesc.getId());
 				stockDesc.setCode(item.getGoodsNo());
@@ -955,9 +841,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 	/**
 	 * 退货入库完成
-	 *
-	 * @param shipVO
-	 * @return
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
@@ -1090,10 +973,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R revokeWarehousing(ShipVO shipVO) {
-/*		PjShip shipVersion = baseMapper.selectById(ship.getId());
-		if (shipVersion != null && !shipVersion.getVersion().equals(ship.getVersion())) {
-			throw new RuntimeException("数据已被修改,请返回列表重新操作!");
-		}*/
 		PjShip ship = new PjShip();
 		BeanUtil.copyProperties(shipVO, ship);
 		// 保存订单明细
@@ -1658,7 +1537,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			shipItemsService.saveOrUpdateBatch(shipVO.getShipItemsList());
 			ship.setNumberRows(shipVO.getShipItemsList().size());//行数
 			//明细总数量
-			ship.setGoodsTotalNum(shipVO.getShipItemsList().stream().filter(e -> e.getGoodsNum() != null).map(PjShipItems::getGoodsNum).reduce(BigDecimal.ZERO, BigDecimal::add));
+			ship.setGoodsTotalNum(shipVO.getShipItemsList().stream().map(PjShipItems::getGoodsNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 		}
 		baseMapper.updateById(ship);
 		return R.data(ship);
@@ -2107,13 +1986,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			if (rwShip == null) {
 				throw new RuntimeException("数据异常 请联系管理员");
 			}
-			StringBuilder goodsNames = new StringBuilder();
-
 			//根据销售id获得销售明细数据
 			List<PjOrderItems> list = pjOrderItemsList.stream().filter(e -> e.getPid().equals(item.getOrdId())).collect(Collectors.toList());
 			if (ObjectUtil.isNotEmpty(list)) {
 				for (PjOrderItems e : list) {
-					goodsNames.append(e.getGoodsName()).append(",");
 					//根据销售明细创建出库工单明细
 					PjShipItems shipItems = new PjShipItems();
 					BeanUtil.copyProperties(e, shipItems);
@@ -2139,11 +2015,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 			//生成出库工单历史记录
 			saveHistory(item.getId(), OrderTypeEnum.TREATWAREHOUSING.getType());
+			//给角色为派工的人发送消息
+			/*
 			LocalDateTime now = LocalDateTime.now();
 			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 			String formatted = now.format(formatter);
-			//给角色为派工的人发送消息
-			/*if (ObjectUtils.isNotNull(rwShip.getStockClerkId())) {
+			if (ObjectUtils.isNotNull(rwShip.getStockClerkId())) {
 				Message sendMessage = new Message();
 				sendMessage.setParameter(item.getId() + "");
 				sendMessage.setUserName(AuthUtil.getUserName());
@@ -2327,7 +2204,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					throw new RuntimeException("数据异常请联系管理员");
 				}
 				//管理批次号
-				TireStockDesc stockOne = null;
+				TireStockDesc stockOne;
 				if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && "1".equals(goodsDesc.getWhether())) {
 					stockOne = pjStockDescList.stream()
 						.filter(e -> e.getGoodsId().equals(item.getGoodsId())
@@ -2437,7 +2314,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		BigDecimal goodsNum = pjOrderItemsList.stream().map(PjOrderItems::getReturnsNumber).reduce(BigDecimal.ZERO, BigDecimal::add);
 		//发货数量和
 		BigDecimal sendNum = pjOrderItemsList.stream().map(PjOrderItems::getSendNum).reduce(BigDecimal.ZERO, BigDecimal::add);
-		BigDecimal amount = pjOrderItemsList.stream().map(PjOrderItems::getSubTotalMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
 		PjOrder order = orderMapper.selectById(ship.getOrdId());
 		if (ObjectUtil.isNotEmpty(order)) {
 			order.setVersion(order.getVersion() + 1);
@@ -2466,7 +2342,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		}
 		//生成出库工单历史记录
 		saveHistory(ship.getId(), OrderTypeEnum.OURTBOUND.getType());
-		String status = sysClient.getParamService("whether.financing");
 		//融资流程
 		PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
 		if (storageDesc == null) {
@@ -2539,7 +2414,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					throw new RuntimeException("商品数据异常");
 				}
 				//管理批次号
-				TireStockDesc stockOne = null;
+				TireStockDesc stockOne;
 				if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && "1".equals(goodsDesc.getWhether())) {
 					stockOne = pjStockDescList.stream()
 						.filter(e -> e.getGoodsId().equals(item.getGoodsId())
@@ -2652,7 +2527,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 		//生成出库工单历史记录
 		saveHistory(ship.getId(), OrderTypeEnum.TOBESHIPPEDOUT.getType());
-		String status = sysClient.getParamService("whether.financing");
 		//融资流程
 		PjStorageDesc storageDesc = storageDescMapper.selectById(ship.getStorageId());
 		if (storageDesc == null) {
@@ -2756,11 +2630,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 			//生成入库工单历史记录
 			saveHistory(item.getId(), OrderTypeEnum.TOBESHIPPEDOUT.getType());
+			//给角色为派工的人发送消息
+			/*
 			LocalDateTime now = LocalDateTime.now();
 			DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 			String formatted = now.format(formatter);
-			//给角色为派工的人发送消息
-			/*if (ObjectUtils.isNotNull(rwShip.getStockClerkId())) {
+			if (ObjectUtils.isNotNull(rwShip.getStockClerkId())) {
 				Message sendMessage = new Message();
 				sendMessage.setParameter(item.getId() + "");
 				sendMessage.setUserName(AuthUtil.getUserName());
@@ -2945,10 +2820,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				stockDesc.setSalesCompanyName(ship.getSalesCompanyName());
 				stockDesc.setGoodsTypeId(goodsDesc.getGoodsTypeId());
 				if (ObjectUtils.isNotNull(goodsDesc.getGoodsTypeId())) {
-					PjGoodsType goodsType = pjGoodsTypeList.stream().filter(e -> (e.getId() + "").equals(goodsDesc.getGoodsTypeId())).findFirst().orElse(null);
-					if (goodsType != null) {
-						stockDesc.setGoodsTypeName(goodsType.getCname());
-					}
+					pjGoodsTypeList.stream().filter(e -> (e.getId() + "").equals(goodsDesc.getGoodsTypeId())).findFirst()
+						.ifPresent(goodsType -> stockDesc.setGoodsTypeName(goodsType.getCname()));
 				}
 				stockDesc.setGoodsId(goodsDesc.getId());
 				stockDesc.setCode(item.getGoodsNo());
@@ -3396,7 +3269,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			} else {
 				rwShip.setStatusName("未完成");
 			}
-			rwShip.setVersion(Objects.isNull(rwShip) ? 1 : rwShip.getVersion() + 1);
+			rwShip.setVersion(rwShip.getVersion() + 1);
 			rwShip.setUpdateUser(AuthUtil.getUserId());
 			rwShip.setUpdateTime(new Date());
 			baseMapper.updateById(rwShip);
@@ -3793,7 +3666,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	public R submitShip(ShipItemsDTO shipDTO) {
 		PjShip ship = new PjShip();
 		ship.setOrdNo(shipDTO.getOrdNo());
-		ship.setOrdId(shipDTO.getId());
+		ship.setOrdId(shipDTO.getOrdId());
 		ship.setSrcOrdNo(shipDTO.getSrcOrdNo());
 		ship.setBsType(shipDTO.getBsType());
 		ship.setBizTypeName(shipDTO.getBizTypeName());
@@ -3807,11 +3680,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 			return R.fail(500, "生成系统编号失败");
 		}
-		if (ship.getBizTypeName().equals(OrderTypeEnum.SHGD.getType())) {
-			ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
-		} else {
-			ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
-		}
+		ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
 		ship.setBillno(billNo);
 		ship.setCreateTime(new Date());
 		ship.setCreateUser(AuthUtil.getUserId());
@@ -3820,12 +3689,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 		baseMapper.insert(ship);
 		// 保存订单明细
 		if (CollectionUtils.isNotEmpty(shipDTO.getShipItemsList())) {
-			List<PjProductLaunch> pjProductLaunchList = new ArrayList<>();
-			List<Long> goodIds = shipDTO.getShipItemsList().stream().map(PjShipItems::getGoodsId).distinct().collect(Collectors.toList());
-			List<PjGoodsDesc> pjGoodsDescList = goodsDescMapper.selectList(new LambdaQueryWrapper<PjGoodsDesc>()
-				.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
-				.eq(PjGoodsDesc::getIsDeleted, 0)
-				.in(PjGoodsDesc::getId, goodIds));
 			List<PjShipItems> shipItemsList = new ArrayList<>();
 			shipDTO.getShipItemsList().forEach(item -> {
 				item.setCostprie(item.getSendNum().multiply(item.getCostpriePrice()));
@@ -3840,35 +3703,106 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			ship.setNumberRows(shipDTO.getShipItemsList().size());
 			ship.setGoodsTotalNum(shipDTO.getShipItemsList().stream().map(PjShipItems::getGoodsNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 			ship.setSendTotalNum(shipDTO.getShipItemsList().stream().map(PjShipItems::getSendNum).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-			//查询所有上架商品
-			LambdaQueryWrapper<PjProductLaunch> productLaunchQueryWrapper = new LambdaQueryWrapper<>();
-			productLaunchQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
-				.eq(PjProductLaunch::getIsDeleted, 0)
-				.isNull(PjProductLaunch::getSourceId)
-				.in(PjProductLaunch::getGoodsId, goodIds);
-			List<PjProductLaunch> productLaunch = productLaunchService.list(productLaunchQueryWrapper);
+			// 保存订单明细
+			List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
+			List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
+				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
+				.eq(PjOrderItems::getIsDeleted, 0)
+				.eq(PjOrderItems::getPid, shipDTO.getOrdId()));
+			BigDecimal number = new BigDecimal("0.00");
 			for (PjShipItems item : shipDTO.getShipItemsList()) {
-				//获得商品
-				PjGoodsDesc goodsDesc = pjGoodsDescList.stream().filter(e -> e.getId().equals(item.getGoodsId())).findFirst().orElse(null);
-				if (ObjectUtil.isEmpty(goodsDesc)) {
-					throw new RuntimeException("商品数据异常");
-				}
-				PjProductLaunch pjProductLaunches = productLaunch.stream()
-					.filter(i -> i.getGoodsId().equals(goodsDesc.getId())).findFirst().orElse(null);
-				//修改上架数量
-				if (pjProductLaunches == null) {
-					throw new RuntimeException("未查到商品:" + item.getGoodsName() + "上架数据");
+				number = number.add(item.getSendNum());
+				PjOrderItems orderItems = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcItemId())).findFirst().orElse(null);
+				if (orderItems != null) {
+					if (orderItems.getGoodsNum().compareTo(orderItems.getSendNum().add(item.getSendNum())) < 0) {
+						throw new RuntimeException(orderItems.getGoodsName() + "剩余应发货数量" + orderItems.getGoodsNum().subtract(orderItems.getSendNum()));
+					} else {
+						orderItems.setSendNum(orderItems.getSendNum().add(item.getSendNum()));
+					}
+					orderItems.setGoodsTotalShipAmount(orderItems.getSendNum().multiply(orderItems.getPrice()));
+					pjOrderItemsList.add(orderItems);
+				} else {
+					throw new RuntimeException("数据异常请联系管理员");
 				}
-				pjProductLaunches.setInventory(pjProductLaunches.getInventory().subtract(item.getSendNum()));
-				pjProductLaunchList.add(pjProductLaunches);
 			}
-			R res = productLaunchService.updateBatchById(pjProductLaunchList);
-			if (!res.isSuccess()) {
-				throw new RuntimeException(res.getMsg());
+			orderItemsService.updateBatchById(pjOrderItemsList);
+			PjOrder order = orderMapper.selectById(ship.getOrdId());
+			if (ObjectUtil.isNotEmpty(order)) {
+				if (!orderItemsList.isEmpty()) {
+					if ("已收货".equals(order.getStatus()) || "申请退货".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
+						throw new RuntimeException("单据已收货或申请售后中,操作失败");
+					}
+					//发货数量和
+					BigDecimal sendNum = orderItemsList.stream().map(PjOrderItems::getSendNum).filter(Objects::nonNull)
+						.reduce(BigDecimal.ZERO, BigDecimal::add);
+					BigDecimal goodsTotalShipAmount = orderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount)
+						.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+					order.setGoodsTotalShipAmount(goodsTotalShipAmount);
+					order.setGoodsTotalShipNum(sendNum);
+					order.setVersion(order.getVersion() + 1);
+					order.setStatus(OrderTypeEnum.GENERATED.getType());
+					order.setStorageId(ship.getStorageId());
+					order.setStorageName(ship.getStorageName());
+					orderMapper.updateById(order);
+				}
 			}
 		}
 		baseMapper.updateById(ship);
 		return R.data(ship);
 	}
 
+	@Override
+	public R removeShip(Long id) {
+		if (id == null) {
+			throw new RuntimeException("缺少必要参数");
+		}
+		PjShip ship = this.getById(id);
+		if (ship == null) {
+			throw new RuntimeException("未查到出库单据");
+		}
+		List<PjShipItems> shipItemsList = shipItemsService.list(new LambdaQueryWrapper<PjShipItems>()
+			.eq(PjShipItems::getIsDeleted, 0)
+			.eq(PjShipItems::getPid, id));
+		if (!shipItemsList.isEmpty()) {
+			// 保存订单明细
+			List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
+			List<PjOrderItems> orderItemsList = orderItemsService.list(new LambdaQueryWrapper<PjOrderItems>()
+				.eq(PjOrderItems::getTenantId, AuthUtil.getTenantId())
+				.eq(PjOrderItems::getIsDeleted, 0)
+				.eq(PjOrderItems::getPid, ship.getOrdId()));
+			BigDecimal number = new BigDecimal("0.00");
+			for (PjShipItems item : shipItemsList) {
+				number = number.add(item.getSendNum());
+				PjOrderItems orderItems = orderItemsList.stream().filter(e -> e.getId().equals(item.getSrcItemId())).findFirst().orElse(null);
+				if (orderItems != null) {
+					orderItems.setSendNum(orderItems.getSendNum().subtract(item.getSendNum()));
+					orderItems.setGoodsTotalShipAmount(orderItems.getSendNum().multiply(orderItems.getPrice()));
+					pjOrderItemsList.add(orderItems);
+				} else {
+					throw new RuntimeException("数据异常请联系管理员");
+				}
+			}
+			orderItemsService.updateBatchById(pjOrderItemsList);
+			PjOrder order = orderMapper.selectById(ship.getOrdId());
+			if (ObjectUtil.isNotEmpty(order)) {
+				if (!pjOrderItemsList.isEmpty()) {
+					if ("已收货".equals(order.getStatus()) || "申请退货".equals(order.getStatus()) || "已取消".equals(order.getStatus())) {
+						throw new RuntimeException("单据已收货或申请售后中,操作失败");
+					}
+					//发货数量和
+					BigDecimal sendNum = pjOrderItemsList.stream().map(PjOrderItems::getSendNum).filter(Objects::nonNull)
+						.reduce(BigDecimal.ZERO, BigDecimal::add);
+					BigDecimal goodsTotalShipAmount = pjOrderItemsList.stream().map(PjOrderItems::getGoodsTotalShipAmount)
+						.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+					order.setGoodsTotalShipAmount(goodsTotalShipAmount);
+					order.setGoodsTotalShipNum(sendNum);
+					order.setVersion(order.getVersion() + 1);
+					order.setStatus("待发货");
+					orderMapper.updateById(order);
+				}
+			}
+		}
+		return R.data("操作成功");
+	}
+
 }

+ 4 - 6
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/claim/service/impl/ShopAppClaimServiceImpl.java

@@ -17,20 +17,16 @@
 package com.gubersail.shop.app.claim.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gubersail.shop.app.api.claim.entity.ShopAppClaim;
 import com.gubersail.shop.app.api.claim.entity.ShopAppClaimAttachment;
-import com.gubersail.shop.app.api.claim.entity.ShopAppClaimAudit;
 import com.gubersail.shop.app.api.claim.vo.ShopAppClaimVO;
 import com.gubersail.shop.app.claim.mapper.ShopAppClaimMapper;
 import com.gubersail.shop.app.claim.service.IShopAppClaimAttachmentService;
 import com.gubersail.shop.app.claim.service.IShopAppClaimAuditService;
 import com.gubersail.shop.app.claim.service.IShopAppClaimService;
-import com.gubersail.shop.app.insurance.mapper.ShopAppTireInsuranceRegisterMapper;
 import com.gubersail.shop.app.wrapper.ShopAppClaimWrapper;
-import com.gubersail.shop.app.zcrm.customer.service.IShopAppCustomerSelService;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -40,11 +36,10 @@ import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * 理赔申请主表 服务实现类
@@ -99,6 +94,9 @@ public class ShopAppClaimServiceImpl extends ServiceImpl<ShopAppClaimMapper, Sho
 		ShopAppClaim claim = this.getById(bladeClaim.getId());
 		//数据实体类转换
 		ShopAppClaimVO bladeClaimVO = ShopAppClaimWrapper.build().entityVO(claim);
+		if (new BigDecimal("0.00").compareTo(bladeClaimVO.getClaimAmount()) == 0) {
+			bladeClaimVO.setClaimAmount(null);
+		}
 		R<User> createUserR = userClient.userInfoById(claim.getCreateUser());
 		if (createUserR.isSuccess() && ObjectUtils.isNotNull(createUserR.getData())) {
 			bladeClaimVO.setCreateUserName(createUserR.getData().getRealName());

+ 0 - 2
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/insurance/controller/ShopAppTireInsuranceRegisterController.java

@@ -233,8 +233,6 @@ public class ShopAppTireInsuranceRegisterController extends BladeController {
 	 * 删除 轮胎保注册附件
 	 */
 	@PostMapping("/removeFiles")
-	@ApiOperationSupport(order = 8)
-	@ApiOperation(value = "删除", notes = "传入ids")
 	@RepeatSubmit
 	public R removeFiles(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
 		return R.status(tireInsuranceFilesService.removeByIds(Func.toLongList(ids)));