Jelajahi Sumber

20230515 17:12

wangzhuo 2 tahun lalu
induk
melakukan
6b2fcc99e4
18 mengubah file dengan 781 tambahan dan 34 penghapusan
  1. 34 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/HistoryDTO.java
  2. 132 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjHistory.java
  3. 39 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjShip.java
  4. 29 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjStockDesc.java
  5. 11 1
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/enums/OrderTypeEnum.java
  6. 36 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/HistoryVO.java
  7. 2 2
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/receiving/ReCeVingController.java
  8. 2 2
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  9. 126 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/controller/HistoryController.java
  10. 43 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/mapper/HistoryMapper.java
  11. 28 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/mapper/HistoryMapper.xml
  12. 41 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/service/IHistoryService.java
  13. 41 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/service/impl/HistoryServiceImpl.java
  14. 1 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  15. 7 3
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java
  16. 57 12
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/controller/ShipController.java
  17. 145 13
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java
  18. 7 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

+ 34 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/dto/HistoryDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.salesPart.entity.PjHistory;
+
+/**
+ * 轮胎配件历史记录表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HistoryDTO extends PjHistory {
+	private static final long serialVersionUID = 1L;
+
+}

+ 132 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjHistory.java

@@ -0,0 +1,132 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 轮胎配件历史记录表实体类
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+@Data
+@TableName("pjpf_history")
+@ApiModel(value = "History对象", description = "轮胎配件历史记录表")
+public class PjHistory implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 主键
+	*/
+		@ApiModelProperty(value = "主键")
+		private Long id;
+
+	/**
+	 * 租户id
+	 */
+	@ApiModelProperty(value = "租户id")
+	private String tenantId;
+
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 修改时间
+	*/
+		@ApiModelProperty(value = "修改时间")
+		private Date updateTime;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		private Integer isDeleted;
+	/**
+	* 备注
+	*/
+		@ApiModelProperty(value = "备注")
+		private String remarks;
+	/**
+	* 订单状态
+	*/
+		@ApiModelProperty(value = "订单状态")
+		private String status;
+	/**
+	* 来源id
+	*/
+		@ApiModelProperty(value = "来源id")
+		private Long pid;
+	/**
+	* 操作人id
+	*/
+		@ApiModelProperty(value = "操作人id")
+		private Long operatorId;
+	/**
+	* 操作人名称
+	*/
+		@ApiModelProperty(value = "操作人名称")
+		private String operatorName;
+	/**
+	* 操作状态
+	*/
+		@ApiModelProperty(value = "操作状态")
+		private String operateStatus;
+	/**
+	* 操作时间
+	*/
+		@ApiModelProperty(value = "操作时间")
+		private Date operateTime;
+
+	/**
+	 * 所属公司id
+	 */
+	@ApiModelProperty(value = "所属公司id")
+	private Long salesCompanyId;
+
+	/**
+	 * 所属公司名称
+	 */
+	@ApiModelProperty(value = "所属公司名称")
+	private String salesCompanyName;
+
+}

+ 39 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjShip.java

@@ -29,6 +29,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springblade.salesPart.vo.ShipVO;
 
 /**
  * 配件收发货表实体类
@@ -106,6 +107,13 @@ public class PjShip implements Serializable {
 	*/
 		@ApiModelProperty(value = "创建人")
 		private Long createUser;
+
+	/**
+	 * 创建人名称
+	 */
+	@TableField(exist = false)
+	private String createUserName;
+
 	/**
 	* 创建部门
 	*/
@@ -121,6 +129,13 @@ public class PjShip implements Serializable {
 	*/
 		@ApiModelProperty(value = "修改人")
 		private Long updateUser;
+
+	/**
+	 * 修改人名称
+	 */
+	@TableField(exist = false)
+	private String updateUserName;
+
 	/**
 	* 修改时间
 	*/
@@ -195,4 +210,28 @@ public class PjShip implements Serializable {
 	 */
 	@TableField(exist = false)
 	private List<PjShipItems> shipItemsList;
+
+	/**
+	 * 订单信息
+	 */
+	@TableField(exist = false)
+	private List<ShipVO> shipVOList;
+
+	/**
+	 * 历史记录list
+	 */
+	@TableField(exist = false)
+	private List<PjHistory> historyList;
+
+	/**
+	 * 库管员id
+	 */
+	@ApiModelProperty(value = "库管员id")
+	private Long stockClerkId;
+
+	/**
+	 * 库管员名称
+	 */
+	@ApiModelProperty(value = "库管员名称")
+	private String stockClerkName;
 }

+ 29 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjStockDesc.java

@@ -157,5 +157,34 @@ public class PjStockDesc implements Serializable {
 		@ApiModelProperty(value = "所属公司名称")
 		private String salesCompanyName;
 
+	/**
+	 * 批次号
+	 */
+	@ApiModelProperty(value = "批次号")
+	private String dot;
+
+	/**
+	 * 商城库存
+	 */
+	@ApiModelProperty(value = "商城库存")
+	private BigDecimal storeInventory;
+
+	/**
+	 * 库存金额
+	 */
+	@ApiModelProperty(value = "库存金额")
+	private BigDecimal inventoryAmount;
+
+	/**
+	 * 库存成本价
+	 */
+	@ApiModelProperty(value = "库存成本价")
+	private BigDecimal inventoryCostPrice;
+
+	/**
+	 * 库存预警
+	 */
+	@ApiModelProperty(value = "库存预警")
+	private Integer inventoryAlert;
 
 }

+ 11 - 1
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/enums/OrderTypeEnum.java

@@ -74,6 +74,11 @@ public enum OrderTypeEnum {
 	TOBESHIPPEDOUT("待出库"),
 
 	/**
+	 * 入库工单状态待入库
+	 */
+	TREATWAREHOUSING("待入库"),
+
+	/**
 	 * 提交审批
 	 */
 	SUBMIT("提交审批"),
@@ -109,10 +114,15 @@ public enum OrderTypeEnum {
 	SHIPED("已发货"),
 
 	/**
-	 * 库工单状态已入库
+	 * 库工单状态已入库
 	 */
 	RECEIVED("已入库"),
 
+	/**
+	 * 采购订单状态已收货
+	 */
+	RECEIVEDGOODS("已收货"),
+
 	;
 
 	private final String type;

+ 36 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/HistoryVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.vo;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import org.springblade.salesPart.entity.PjHistory;
+
+/**
+ * 轮胎配件历史记录表视图实体类
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "HistoryVO对象", description = "轮胎配件历史记录表")
+public class HistoryVO extends PjHistory {
+	private static final long serialVersionUID = 1L;
+
+}

+ 2 - 2
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/receiving/ReCeVingController.java

@@ -247,8 +247,8 @@ public class ReCeVingController extends BladeController {
 		lambdaQueryWrapper.like(Func.isNotEmpty(delivery.getArrivalAddress()), Delivery::getArrivalAddress, delivery.getArrivalAddress());//收货地址
 		lambdaQueryWrapper.like(Func.isNotEmpty(delivery.getArrivalContact()), Delivery::getArrivalContact, delivery.getArrivalContact());//收货人
 		lambdaQueryWrapper.like(Func.isNotEmpty(delivery.getArrivalTel()), Delivery::getArrivalTel, delivery.getArrivalTel());//收货电话
-		lambdaQueryWrapper.ge(Func.isNotEmpty(delivery.getCreateStartTime()), Delivery::getCreateTime, delivery.getCreateStartTime());//制单日期开始
-		lambdaQueryWrapper.le(Func.isNotEmpty(delivery.getCreateEndTime()), Delivery::getCreateTime, delivery.getCreateEndTime());//制单日期结束
+		lambdaQueryWrapper.ge(Func.isNotEmpty(delivery.getCreateStartTime()), Delivery::getCreateTime, delivery.getCreateStartTime() + " 00:00:00");//制单日期开始
+		lambdaQueryWrapper.le(Func.isNotEmpty(delivery.getCreateEndTime()), Delivery::getCreateTime, delivery.getCreateEndTime() + " 23:59:59");//制单日期结束
 		lambdaQueryWrapper.ge(Func.isNotEmpty(delivery.getBusinessStartDate()), Delivery::getBusinessDate, delivery.getBusinessStartDate());//发货日期开始
 		lambdaQueryWrapper.le(Func.isNotEmpty(delivery.getBusinessEndDate()), Delivery::getBusinessDate, delivery.getBusinessEndDate());//发货日期结束
 		lambdaQueryWrapper.eq(Func.isNotEmpty(delivery.getCreateUser()), Delivery::getCreateUser, delivery.getCreateUser());//制单人

+ 2 - 2
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -909,7 +909,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 		}
 
 		//工厂发货凭证
-		if ("681169".equals(select.getTenantId())) {
+		/*if ("681169".equals(select.getTenantId())) {
 			String accountName = select.getBelongCompany();
 			if ("A青岛达沃特轮胎有限公司".equals(accountName)) {
 				accountName = "青岛达沃特轮胎有限公司";
@@ -924,7 +924,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 					throw new SecurityException(exception.getMessage());
 				}
 			}
-		}
+		}*/
 
 	}
 

+ 126 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/controller/HistoryController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.history.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.salesPart.entity.PjHistory;
+import org.springblade.salesPart.vo.HistoryVO;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.salesPart.history.service.IHistoryService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 轮胎配件历史记录表 控制器
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/history")
+@Api(value = "轮胎配件历史记录表", tags = "轮胎配件历史记录表接口")
+public class HistoryController extends BladeController {
+
+	private final IHistoryService historyService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入history")
+	public R<PjHistory> detail(PjHistory history) {
+		PjHistory detail = historyService.getOne(Condition.getQueryWrapper(history));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 轮胎配件历史记录表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入history")
+	public R<IPage<PjHistory>> list(PjHistory history, Query query) {
+		IPage<PjHistory> pages = historyService.page(Condition.getPage(query), Condition.getQueryWrapper(history));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 轮胎配件历史记录表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入history")
+	public R<IPage<HistoryVO>> page(HistoryVO history, Query query) {
+		IPage<HistoryVO> pages = historyService.selectHistoryPage(Condition.getPage(query), history);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 轮胎配件历史记录表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入history")
+	public R save(@Valid @RequestBody PjHistory history) {
+		return R.status(historyService.save(history));
+	}
+
+	/**
+	 * 修改 轮胎配件历史记录表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入history")
+	public R update(@Valid @RequestBody PjHistory history) {
+		return R.status(historyService.updateById(history));
+	}
+
+	/**
+	 * 新增或修改 轮胎配件历史记录表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入history")
+	public R submit(@Valid @RequestBody PjHistory history) {
+		return R.status(historyService.saveOrUpdate(history));
+	}
+
+
+	/**
+	 * 删除 轮胎配件历史记录表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(historyService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 43 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/mapper/HistoryMapper.java

@@ -0,0 +1,43 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.history.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.salesPart.entity.PjHistory;
+import org.springblade.salesPart.vo.HistoryVO;
+
+import java.util.List;
+
+/**
+ * 轮胎配件历史记录表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+public interface HistoryMapper extends BaseMapper<PjHistory> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param history
+	 * @return
+	 */
+	List<HistoryVO> selectHistoryPage(IPage page, HistoryVO history);
+
+}

+ 28 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/mapper/HistoryMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.salesPart.history.mapper.HistoryMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="historyResultMap" type="org.springblade.salesPart.entity.PjHistory">
+        <id column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="remarks" property="remarks"/>
+        <result column="status" property="status"/>
+        <result column="pid" property="pid"/>
+        <result column="operator_id" property="operatorId"/>
+        <result column="operator_name" property="operatorName"/>
+        <result column="operate_status" property="operateStatus"/>
+        <result column="operate_time" property="operateTime"/>
+    </resultMap>
+
+
+    <select id="selectHistoryPage" resultMap="historyResultMap">
+        select * from pjpf_history where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/service/IHistoryService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.history.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.salesPart.entity.PjHistory;
+import org.springblade.salesPart.vo.HistoryVO;
+
+/**
+ * 轮胎配件历史记录表 服务类
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+public interface IHistoryService extends IService<PjHistory> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param history
+	 * @return
+	 */
+	IPage<HistoryVO> selectHistoryPage(IPage<HistoryVO> page, HistoryVO history);
+
+}

+ 41 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/history/service/impl/HistoryServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.history.service.impl;
+
+import org.springblade.salesPart.entity.PjHistory;
+import org.springblade.salesPart.history.mapper.HistoryMapper;
+import org.springblade.salesPart.history.service.IHistoryService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.salesPart.vo.HistoryVO;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 轮胎配件历史记录表 服务实现类
+ *
+ * @author BladeX
+ * @since 2023-05-15
+ */
+@Service
+public class HistoryServiceImpl extends ServiceImpl<HistoryMapper, PjHistory> implements IHistoryService {
+
+	@Override
+	public IPage<HistoryVO> selectHistoryPage(IPage<HistoryVO> page, HistoryVO history) {
+		return page.setRecords(baseMapper.selectHistoryPage(page, history));
+	}
+
+}

+ 1 - 1
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java

@@ -222,7 +222,7 @@ public class OrderController extends BladeController {
 	@PostMapping("/inboundTask")
 	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "生成入库任务", notes = "传入order")
-	public R inboundTask(@RequestBody PjOrder order){
+	public R inboundTask(@Valid @RequestBody PjOrder order){
 		if (order.getId() == null){
 			throw new RuntimeException("来源信息错误");
 		}

+ 7 - 3
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -18,6 +18,7 @@ package org.springblade.salesPart.order.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -115,7 +116,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R saveOrderMessage(PjOrder order) {
 
 		//客户名称
@@ -243,7 +245,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R generateShipTask(PjOrder order) {
 		PjOrder pjOrder = baseMapper.selectById(order.getId());
 
@@ -283,7 +286,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R inboundTask(PjOrder order) {
 		PjOrder pjOrder = baseMapper.selectById(order.getId());
 

+ 57 - 12
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/controller/ShipController.java

@@ -17,6 +17,8 @@
 package org.springblade.salesPart.ship.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -30,18 +32,20 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.salesPart.entity.PjOrder;
-import org.springblade.salesPart.entity.PjOrderItems;
-import org.springblade.salesPart.entity.PjShipItems;
+import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.enums.OrderTypeEnum;
 import org.springblade.salesPart.ship.service.IShipItemsService;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.salesPart.entity.PjShip;
 import org.springblade.salesPart.vo.ShipVO;
 import org.springblade.salesPart.ship.service.IShipService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * 配件收发货表 控制器
  *
@@ -56,6 +60,7 @@ public class ShipController extends BladeController {
 
 	private final IShipService shipService;
 	private final IShipItemsService shipItemsService;
+	private final IUserClient userClient;
 
 	/**
 	 * 详情
@@ -95,6 +100,41 @@ public class ShipController extends BladeController {
 		}
 
 		IPage<PjShip> pages = shipService.page(Condition.getPage(query), lambdaQueryWrapper);
+
+		String updateUserIds = "";//修改人id拼接
+		String createUserIds = "";//创建人id拼接
+		for (PjShip items : pages.getRecords()){
+			if (ObjectUtil.isNotEmpty(items.getUpdateUser())){
+				updateUserIds = updateUserIds + items.getUpdateUser() + ",";
+			}
+			if (ObjectUtil.isNotEmpty(items.getCreateUser())){
+				createUserIds = createUserIds + items.getCreateUser() + ",";
+			}
+		}
+
+		//获得修改人信息
+		List<User> updateUserList = userClient.selectUserIds(updateUserIds);
+		//获得创建人信息
+		List<User> createUserList = userClient.selectUserIds(createUserIds);
+
+		if (CollectionUtils.isNotEmpty(pages.getRecords())) {
+			pages.getRecords().forEach(item -> {
+				if (ObjectUtil.isNotEmpty(updateUserList)) {
+					User user = updateUserList.stream().anyMatch(e -> e.getId().equals(item.getUpdateUser())) ? updateUserList.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						item.setUpdateUserName(user.getName());
+					}
+				}
+
+				if (ObjectUtil.isNotEmpty(createUserList)) {
+					User user = createUserList.stream().anyMatch(e -> e.getId().equals(item.getCreateUser())) ? createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						item.setCreateUserName(user.getName());
+					}
+				}
+			});
+		}
+
 		return R.data(pages);
 	}
 
@@ -125,20 +165,25 @@ public class ShipController extends BladeController {
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入ship")
-	public R update(@Valid @RequestBody PjShip ship) {
-		if (ObjectUtil.isEmpty(ship.getBizTypeName()) || ObjectUtil.isEmpty(ship.getId())){
-			throw new RuntimeException("缺少必要参数");
-		}
+	public R update(@RequestBody PjShip ship) {
+		PjShip pjShip = shipService.getById(ship.getId());
 
 		//发货任务删除判断
-		if (ship.getBizTypeName().equals(OrderTypeEnum.FHRW.getType())){
-			if (OrderTypeEnum.DISPATCHED.getType().equals(ship.getStatusName())){
+		if (pjShip.getBizTypeName().equals(OrderTypeEnum.FHRW.getType())){
+			if (OrderTypeEnum.DISPATCHED.getType().equals(pjShip.getStatusName())){
+				throw new RuntimeException("出库任务已生成工单无法删除");
+			}
+		}
+
+		//入库任务删除判断
+		if (pjShip.getBizTypeName().equals(OrderTypeEnum.SHRW.getType())){
+			if (OrderTypeEnum.DISPATCHED.getType().equals(pjShip.getStatusName())){
 				throw new RuntimeException("出库任务已生成工单无法删除");
 			}
 		}
 
-		ship.setIsDeleted(1);
-		shipService.updateById(ship);
+		pjShip.setIsDeleted(1);
+		shipService.updateById(pjShip);
 		return R.success("操作成功");
 	}
 

+ 145 - 13
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -19,6 +19,7 @@ package org.springblade.salesPart.ship.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.feign.ISerialClient;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -26,11 +27,13 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.purchase.sales.entity.OrderItems;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.enums.OrderTypeEnum;
+import org.springblade.salesPart.goods.mapper.GoodsDescMapper;
+import org.springblade.salesPart.history.mapper.HistoryMapper;
 import org.springblade.salesPart.order.mapper.OrderItemsMapper;
 import org.springblade.salesPart.order.mapper.OrderMapper;
+import org.springblade.salesPart.productLaunch.mapper.ProductLaunchMapper;
 import org.springblade.salesPart.ship.mapper.ShipItemsMapper;
 import org.springblade.salesPart.stock.mapper.StockDescMapper;
 import org.springblade.salesPart.vo.ShipVO;
@@ -39,15 +42,22 @@ import org.springblade.salesPart.ship.service.IShipService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import static org.springblade.core.secure.utils.AuthUtil.getUser;
+
 /**
  * 配件收发货表 服务实现类
  *
@@ -67,6 +77,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	private final OrderMapper orderMapper;
 	private final ISysClient sysClient;
 	private final StockDescMapper stockDescMapper;
+	private final GoodsDescMapper goodsDescMapper;
+	private final ProductLaunchMapper productLaunchMapper;
+	private final HistoryMapper historyMapper;
+	private final IUserClient userClient;
 
 	/**
 	 * 获取收发货订单详情
@@ -78,10 +92,27 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	public PjShip getMessageById(PjShip ship) {
 		PjShip detail = baseMapper.selectById(ship.getId());
 
+		//明细
 		LambdaQueryWrapper<PjShipItems> itemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
 		itemsLambdaQueryWrapper.eq(PjShipItems::getTenantId, AuthUtil.getTenantId())
 			.eq(PjShipItems::getIsDeleted, 0)
 			.eq(PjShipItems::getPid, detail.getId());
+		detail.setShipItemsList(shipItemsMapper.selectList(itemsLambdaQueryWrapper));
+
+		//订单信息
+		ShipVO vo = new ShipVO();
+		BeanUtil.copyProperties(detail, vo);
+		List<ShipVO> listVo = new ArrayList<>();
+		listVo.add(vo);
+		detail.setShipVOList(listVo);
+
+		//历史记录
+		LambdaQueryWrapper<PjHistory> historyLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		historyLambdaQueryWrapper.eq(PjHistory::getTenantId, AuthUtil.getTenantId())
+			.eq(PjHistory::getIsDeleted, 0)
+			.eq(PjHistory::getPid, detail.getId());
+		detail.setHistoryList(historyMapper.selectList(historyLambdaQueryWrapper));
+
 		return detail;
 	}
 
@@ -97,7 +128,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R saveShipMessage(PjShip ship) {
 
 		//获得所属公司
@@ -109,6 +141,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			throw new SecurityException("请选择所属公司");
 		}
 
+		//库管员名称
+		ship.setStockClerkName(userClient.userInfoById(ship.getStockClerkId()).getData().getRealName());
+
 		if (ship.getId() == null){
 			// 获取系统编号
 			R billNo = serialClient.getBillNo(ship.getBizTypeName(), ship.getBizTypeName(), ship.getBizTypeName());
@@ -159,7 +194,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R outboundWorkOrder(String ids) {
 		List<Long> shipIds = Func.toLongList(ids);
 		for (Long id : shipIds) {
@@ -206,8 +242,11 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					shipItems.setCreateTime(new Date());
 					shipItems.setCreateUser(AuthUtil.getUserId());
 					shipItems.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
-					shipItems.setSendNum(e.getGoodsNum());
-					shipItemsMapper.insert(shipItems);
+					shipItems.setSendNum(e.getGoodsNum().subtract(e.getSendNum()));
+					if (e.getGoodsNum().compareTo(e.getSendNum()) != 0){
+						shipItemsMapper.insert(shipItems);
+					}
+
 				});
 				gdShip.setNumberRows(list.size());
 			}
@@ -215,6 +254,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			//修改出库任务状态
 			rwShip.setStatusName(OrderTypeEnum.DISPATCHED.getType());
 			baseMapper.updateById(rwShip);
+
+			//生成出库工单历史记录
+			saveHistory(gdShip.getId(), OrderTypeEnum.TOBESHIPPEDOUT.getType());
 		}
 
 		return R.success("操作成功");
@@ -227,7 +269,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R outboundCompleted(PjShip ship) {
 		ship.setStatusName(OrderTypeEnum.OURTBOUND.getType());
 		if (ship.getId() == null){
@@ -279,6 +322,35 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				}else {
 					throw new RuntimeException("数据异常请联系管理员");
 				}
+
+				//获得商品
+				PjGoodsDesc goodsDesc = goodsDescMapper.selectById(item.getGoodsId());
+				if (ObjectUtil.isEmpty(goodsDesc)){
+					throw new RuntimeException("商品数据异常");
+				}
+				//修改库存账
+				LambdaQueryWrapper<PjStockDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+				lambdaQueryWrapper.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
+					.eq(PjStockDesc::getIsDeleted, 0)
+					.eq(PjStockDesc::getSalesCompanyId, ship.getSalesCompanyId())
+					.eq(PjStockDesc::getGoodsId, item.getGoodsId())
+					.eq(PjStockDesc::getStorageId, ship.getStorageId());
+				if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && goodsDesc.getWhether().equals("1")){//管理批次号
+					lambdaQueryWrapper.eq(PjStockDesc::getDot, item.getDot());
+				}else {
+					lambdaQueryWrapper.isNull(PjStockDesc::getDot);
+				}
+
+				PjStockDesc stockOne = stockDescMapper.selectOne(lambdaQueryWrapper);
+				if (ObjectUtil.isNotEmpty(stockOne)){
+					stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().subtract(item.getSendNum()));
+					stockOne.setStoreInventory(stockOne.getBalanceQuantity());
+					stockOne.setInventoryAmount(stockOne.getInventoryAmount().subtract(item.getSendNum().multiply(item.getCostprie())));
+					stockDescMapper.updateById(stockOne);
+				}else {
+					throw new RuntimeException("库存数据异常");
+				}
+
 			});
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
@@ -305,6 +377,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			}
 		}
 
+		//生成出库工单历史记录
+		saveHistory(ship.getId(), OrderTypeEnum.OURTBOUND.getType());
+
 		return R.data(ship);
 	}
 
@@ -315,7 +390,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R generateWarehousing(String ids) {
 		List<Long> shipIds = Func.toLongList(ids);
 		for (Long id : shipIds) {
@@ -337,7 +413,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 			gdShip.setId(null);
 			gdShip.setBillno((String) billNo.getData());
-			//gdShip.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
+			gdShip.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
 			gdShip.setTenantId(AuthUtil.getTenantId());
 			gdShip.setBizTypeName(OrderTypeEnum.SHGD.getType());
 			gdShip.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
@@ -371,6 +447,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			//修改入库任务状态
 			rwShip.setStatusName(OrderTypeEnum.DISPATCHED.getType());
 			baseMapper.updateById(rwShip);
+
+			//生成出库工单历史记录
+			saveHistory(gdShip.getId(), OrderTypeEnum.TREATWAREHOUSING.getType());
 		}
 
 		return R.success("操作成功");
@@ -383,7 +462,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 	 * @return
 	 */
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
 	public R WarehousingComplete(PjShip ship) {
 		ship.setStatusName(OrderTypeEnum.RECEIVED.getType());
 		if (ship.getId() == null){
@@ -422,7 +502,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					shipItemsMapper.updateById(item);
 				}
 
-				//修改销售明细
+				//修改采购明细
 				PjOrderItems orderItems = orderItemsMapper.selectById(item.getSrcItemId());
 				if (ObjectUtil.isNotEmpty(orderItems)){
 					orderItems.setSendNum(item.getSendNum());
@@ -431,6 +511,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					throw new RuntimeException("数据异常请联系管理员");
 				}
 
+				//获得商品
+				PjGoodsDesc goodsDesc = goodsDescMapper.selectById(item.getGoodsId());
+				if (ObjectUtil.isEmpty(goodsDesc)){
+					throw new RuntimeException("商品数据异常");
+				}
+
 				//生成库存账
 				PjStockDesc stockDesc = new PjStockDesc();
 
@@ -452,34 +538,80 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					.eq(PjStockDesc::getSalesCompanyId, ship.getSalesCompanyId())
 					.eq(PjStockDesc::getGoodsId, item.getGoodsId())
 					.eq(PjStockDesc::getStorageId, ship.getStorageId());
+				if (ObjectUtil.isNotEmpty(goodsDesc.getWhether()) && goodsDesc.getWhether().equals("1")){//管理批次号
+					lambdaQueryWrapper.eq(PjStockDesc::getDot, item.getDot());
+				}else {
+					lambdaQueryWrapper.isNull(PjStockDesc::getDot);
+				}
 
 				PjStockDesc stockOne = stockDescMapper.selectOne(lambdaQueryWrapper);
 				if (ObjectUtil.isEmpty(stockOne)){
 					stockDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
 					stockDesc.setCreateTime(new Date());
 					stockDesc.setCreateUser(AuthUtil.getUserId());
-					stockDesc.setBalanceQuantity(item.getGoodsNum());
+					stockDesc.setBalanceQuantity(item.getSendNum());
+					stockDesc.setStoreInventory(item.getSendNum());
+					stockDesc.setInventoryAmount(item.getSendNum().multiply(item.getPrice()));
+					stockDesc.setInventoryCostPrice(stockDesc.getInventoryAmount().divide(stockDesc.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
 					stockDescMapper.insert(stockDesc);
 				}else {
 					stockDesc.setUpdateTime(new Date());
 					stockDesc.setUpdateUser(AuthUtil.getUserId());
-					stockDesc.setBalanceQuantity(stockOne.getBalanceQuantity().add(item.getGoodsNum()));
+					stockDesc.setBalanceQuantity(stockOne.getBalanceQuantity().add(item.getSendNum()));
+					stockDesc.setStoreInventory(stockDesc.getBalanceQuantity());
+					stockDesc.setInventoryAmount(item.getSendNum().multiply(item.getPrice()));
+					stockDesc.setInventoryAmount(stockDesc.getInventoryAmount().add(stockOne.getInventoryAmount()));
+					stockDesc.setInventoryCostPrice(stockDesc.getInventoryAmount().divide(stockDesc.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
 					stockDescMapper.updateById(stockDesc);
 				}
+
+				//修改上架库存
+				LambdaQueryWrapper<PjProductLaunch> productLaunchQueryWrapper = new LambdaQueryWrapper<>();
+				productLaunchQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+					.eq(PjProductLaunch::getIsDeleted, 0)
+					.eq(PjProductLaunch::getGoodsId, stockDesc.getGoodsId())
+					.eq(PjProductLaunch::getBillType, 0);
+				PjProductLaunch productLaunch = productLaunchMapper.selectOne(productLaunchQueryWrapper);
+
+				if (ObjectUtil.isNotEmpty(productLaunch)){
+					productLaunch.setInventory(stockDesc.getBalanceQuantity());
+				}
+				productLaunchMapper.updateById(productLaunch);
 			});
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 		}
 
+		//修改采购订单状态
 		PjOrder order = orderMapper.selectById(ship.getOrdId());
 		if (ObjectUtil.isNotEmpty(order)){
-			order.setStatus(OrderTypeEnum.SHIPED.getType());
+			order.setStatus(OrderTypeEnum.RECEIVEDGOODS.getType());
 			orderMapper.updateById(order);
 		}else {
 			throw new RuntimeException("数据异常请联系管理员");
 		}
 
+		//生成出库工单历史记录
+		saveHistory(ship.getId(), OrderTypeEnum.RECEIVED.getType());
+
 		return R.data(ship);
 	}
 
+	/**
+	 * 生成出库工单历史记录
+	 */
+	public void saveHistory(Long pid, String status){
+		//生成出库工单历史记录
+		PjHistory history = new PjHistory();
+		history.setTenantId(AuthUtil.getTenantId());
+		history.setCreateUser(AuthUtil.getUserId());
+		history.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+		history.setCreateTime(new Date());
+		history.setPid(pid);
+		history.setOperatorId(AuthUtil.getUserId());
+		history.setOperatorName(getUser().getRoleName());
+		history.setOperateTime(new Date());
+		history.setOperateStatus(status);
+		historyMapper.insert(history);
+	}
 }

+ 7 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@@ -469,4 +469,11 @@ public class UserController {
 		return userSearchClient.listByRole(SysCache.getRoleIds(AuthUtil.getTenantId(),"库管员"));
 	}
 
+	/**
+	 * 轮胎配件用户列表(库管)
+	 */
+	@GetMapping("/stockClerkList")
+	public R<List<User>> stockClerkList() {
+		return userSearchClient.listByRole(SysCache.getRoleIds(AuthUtil.getTenantId(),"库管"));
+	}
 }