1.修改新增盘点相关接口

feature-order-fix
x_z 3 years ago
parent 679dea3892
commit eb300dec08

@ -49,7 +49,7 @@ public class InvCountCodesController {
* @return * @return
*/ */
@PostMapping("/invCount/codes/deleteCode") @PostMapping("/invCount/codes/deleteCode")
public BaseResponse deleteCode(FilterInvCountCodesRequest codesRequest) { public BaseResponse deleteCode(@RequestBody FilterInvCountCodesRequest codesRequest) {
if (null == codesRequest || StrUtil.isBlank(codesRequest.getOrderIdFk()) || StrUtil.isBlank(codesRequest.getProductId()) || StrUtil.isBlank(codesRequest.getCode())) { if (null == codesRequest || StrUtil.isBlank(codesRequest.getOrderIdFk()) || StrUtil.isBlank(codesRequest.getProductId()) || StrUtil.isBlank(codesRequest.getCode())) {
return ResultVOUtils.success(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.success(ResultEnum.PARAM_VERIFY_FALL);
} }

@ -51,7 +51,7 @@ public class InvCountOrderDetailController {
* @return * @return
*/ */
@PostMapping("/invCount/order/detail/deleteOrderDetail") @PostMapping("/invCount/order/detail/deleteOrderDetail")
public BaseResponse deleteOrderDetail(FilterInvCountOrderDetailRequest detailRequest) { public BaseResponse deleteOrderDetail(@RequestBody FilterInvCountOrderDetailRequest detailRequest) {
if (null == detailRequest || null == detailRequest.getId()) { if (null == detailRequest || null == detailRequest.getId()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} }

@ -59,19 +59,19 @@ public interface InvCountOrderDetailDao {
List<InvCountOrderDetailResponse> filterCountDetail(FilterInvCountOrderDetailRequest detailRequest); List<InvCountOrderDetailResponse> filterCountDetail(FilterInvCountOrderDetailRequest detailRequest);
/** /**
* * ID
* *
* @param orderIdFk * @param orderIdFk
* @param productId * @param productId
* @return
*/ */
InvCountOrderDetail selectByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") String productId); void deleteByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") String productId);
/** /**
* ID * DI
* *
* @param orderIdFk * @param orderIdFk
* @param productId * @param nameCode
* @return
*/ */
void deleteByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") String productId); InvCountOrderDetail selectByOrderIdAndNameCode(@Param("orderIdFk") String orderIdFk, @Param("nameCode") String nameCode);
} }

@ -20,6 +20,11 @@ public class InvCountOrderDetail {
*/ */
private String productId; private String productId;
/**
* DI
*/
private String nameCode;
/** /**
* *
*/ */

@ -53,7 +53,8 @@ public class InvCountCodesServiceImpl implements InvCountCodesService {
return ResultVOUtils.error(ResultEnum.DATA_NOT); return ResultVOUtils.error(ResultEnum.DATA_NOT);
} }
InvCountOrderDetail invCountOrderDetail = invCountOrderDetailDao.selectByOrderIdAndProductId(list.get(0).getOrderIdFk(), list.get(0).getProductId()); UdiEntity udi = FilterUdiUtils.getUdi(list.get(0).getCode());
InvCountOrderDetail invCountOrderDetail = invCountOrderDetailDao.selectByOrderIdAndNameCode(list.get(0).getOrderIdFk(), udi.getUdi());
if (list.size() == 1) { if (list.size() == 1) {
//条码数量为1删除此产品的盘点单据详情 //条码数量为1删除此产品的盘点单据详情
invCountOrderDetailDao.deleteByPrimaryKey(invCountOrderDetail.getId()); invCountOrderDetailDao.deleteByPrimaryKey(invCountOrderDetail.getId());
@ -76,11 +77,14 @@ public class InvCountCodesServiceImpl implements InvCountCodesService {
} }
//解析条码 //解析条码
UdiEntity udi = FilterUdiUtils.getUdi(invCountCodes.getCode()); UdiEntity udi = FilterUdiUtils.getUdi(invCountCodes.getCode());
String productId = udiRelevanceDao.selectProductId(udi.getUdi(), invCountCodes.getOrderIdFk());
//查询单据详情,单据详情添加 //查询单据详情,单据详情添加
InvCountOrderDetail invCountOrderDetail = invCountOrderDetailDao.selectByOrderIdAndProductId(invCountCodes.getOrderIdFk(), productId); InvCountOrderDetail invCountOrderDetail = invCountOrderDetailDao.selectByOrderIdAndNameCode(invCountCodes.getOrderIdFk(), udi.getUdi());
if (null == invCountOrderDetail) {
return ResultVOUtils.error(ResultEnum.DATA_NOT, "当前仓库不存在此产品");
}
invCountOrderDetail.setCountNum(invCountOrderDetail.getCountNum() + 1); invCountOrderDetail.setCountNum(invCountOrderDetail.getCountNum() + 1);
invCountCodes.setProductId(productId); invCountCodes.setProductId(invCountOrderDetail.getProductId());
invCountOrderDetailDao.updateByPrimaryKey(invCountOrderDetail); invCountOrderDetailDao.updateByPrimaryKey(invCountOrderDetail);
invCountCodesDao.insert(invCountCodes); invCountCodesDao.insert(invCountCodes);
return ResultVOUtils.success(); return ResultVOUtils.success();

@ -820,6 +820,6 @@
<select id="selectProductId" resultType="java.lang.String"> <select id="selectProductId" resultType="java.lang.String">
select id select id
from basic_udirel from basic_udirel
where uuid = (select uuid from basic_products where nameCode = #{nameCode}) where uuid = (select uuid from basic_products where nameCode = #{nameCode} limit 1)
</select> </select>
</mapper> </mapper>

@ -5,6 +5,7 @@
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/> <result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/>
<result column="productId" jdbcType="VARCHAR" property="productId"/> <result column="productId" jdbcType="VARCHAR" property="productId"/>
<result column="nameCode" jdbcType="VARCHAR" property="nameCode"/>
<result column="batchNo" jdbcType="VARCHAR" property="batchNo"/> <result column="batchNo" jdbcType="VARCHAR" property="batchNo"/>
<result column="produceDate" jdbcType="VARCHAR" property="produceDate"/> <result column="produceDate" jdbcType="VARCHAR" property="produceDate"/>
<result column="expireDate" jdbcType="VARCHAR" property="expireDate"/> <result column="expireDate" jdbcType="VARCHAR" property="expireDate"/>
@ -20,6 +21,7 @@
id, id,
orderIdFk, orderIdFk,
productId, productId,
nameCode,
batchNo, batchNo,
produceDate, produceDate,
expireDate, expireDate,
@ -46,11 +48,12 @@
<insert id="insert" keyColumn="id" keyProperty="id" <insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.InvCountOrderDetail" useGeneratedKeys="true"> parameterType="com.glxp.api.admin.entity.inventory.InvCountOrderDetail" useGeneratedKeys="true">
insert into inv_count_order_detail (orderIdFk, productId, batchNo, insert into inv_count_order_detail (orderIdFk, productId, nameCode, batchNo,
produceDate, expireDate, serialNo, produceDate, expireDate, serialNo,
countNum, invNum, profitNum, countNum, invNum, profitNum,
lossNum, `status`) lossNum, `status`)
values (#{orderIdFk,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, values (#{orderIdFk,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{nameCode,jdbcType=VARCHAR},
#{batchNo,jdbcType=VARCHAR},
#{produceDate,jdbcType=VARCHAR}, #{expireDate,jdbcType=VARCHAR}, #{serialNo,jdbcType=VARCHAR}, #{produceDate,jdbcType=VARCHAR}, #{expireDate,jdbcType=VARCHAR}, #{serialNo,jdbcType=VARCHAR},
#{countNum,jdbcType=INTEGER}, #{invNum,jdbcType=INTEGER}, #{profitNum,jdbcType=INTEGER}, #{countNum,jdbcType=INTEGER}, #{invNum,jdbcType=INTEGER}, #{profitNum,jdbcType=INTEGER},
#{lossNum,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}) #{lossNum,jdbcType=INTEGER}, #{status,jdbcType=INTEGER})
@ -66,6 +69,9 @@
<if test="productId != null"> <if test="productId != null">
productId, productId,
</if> </if>
<if test="nameCode != null">
nameCode,
</if>
<if test="batchNo != null"> <if test="batchNo != null">
batchNo, batchNo,
</if> </if>
@ -101,6 +107,9 @@
<if test="productId != null"> <if test="productId != null">
#{productId,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR},
</if> </if>
<if test="nameCode != null">
#{nameCode,jdbcType=VARCHAR},
</if>
<if test="batchNo != null"> <if test="batchNo != null">
#{batchNo,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR},
</if> </if>
@ -140,6 +149,9 @@
<if test="productId != null"> <if test="productId != null">
productId = #{productId,jdbcType=VARCHAR}, productId = #{productId,jdbcType=VARCHAR},
</if> </if>
<if test="nameCode != null">
nameCode = #{nameCode,jdbcType=VARCHAR},
</if>
<if test="batchNo != null"> <if test="batchNo != null">
batchNo = #{batchNo,jdbcType=VARCHAR}, batchNo = #{batchNo,jdbcType=VARCHAR},
</if> </if>
@ -175,6 +187,7 @@
update inv_count_order_detail update inv_count_order_detail
set orderIdFk = #{orderIdFk,jdbcType=VARCHAR}, set orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
productId = #{productId,jdbcType=VARCHAR}, productId = #{productId,jdbcType=VARCHAR},
nameCode = #{nameCode,jdbcType=VARCHAR},
batchNo = #{batchNo,jdbcType=VARCHAR}, batchNo = #{batchNo,jdbcType=VARCHAR},
produceDate = #{produceDate,jdbcType=VARCHAR}, produceDate = #{produceDate,jdbcType=VARCHAR},
expireDate = #{expireDate,jdbcType=VARCHAR}, expireDate = #{expireDate,jdbcType=VARCHAR},
@ -200,6 +213,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.productId,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.productId,jdbcType=VARCHAR}
</foreach> </foreach>
</trim> </trim>
<trim prefix="nameCode = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.nameCode,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="batchNo = case" suffix="end,"> <trim prefix="batchNo = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.batchNo,jdbcType=VARCHAR} when id = #{item.id,jdbcType=INTEGER} then #{item.batchNo,jdbcType=VARCHAR}
@ -254,11 +272,12 @@
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true"> <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into inv_count_order_detail insert into inv_count_order_detail
(orderIdFk, productId, batchNo, produceDate, expireDate, serialNo, countNum, invNum, (orderIdFk, productId, nameCode, batchNo, produceDate, expireDate, serialNo, countNum, invNum,
profitNum, lossNum, `status`) profitNum, lossNum, `status`)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.orderIdFk,jdbcType=VARCHAR}, #{item.productId,jdbcType=VARCHAR}, #{item.batchNo,jdbcType=VARCHAR}, (#{item.orderIdFk,jdbcType=VARCHAR}, #{item.productId,jdbcType=VARCHAR}, #{item.nameCode,jdbcType=VARCHAR},
#{item.batchNo,jdbcType=VARCHAR},
#{item.produceDate,jdbcType=VARCHAR}, #{item.expireDate,jdbcType=VARCHAR}, #{item.produceDate,jdbcType=VARCHAR}, #{item.expireDate,jdbcType=VARCHAR},
#{item.serialNo,jdbcType=VARCHAR}, #{item.countNum,jdbcType=INTEGER}, #{item.invNum,jdbcType=INTEGER}, #{item.serialNo,jdbcType=VARCHAR}, #{item.countNum,jdbcType=INTEGER}, #{item.invNum,jdbcType=INTEGER},
#{item.profitNum,jdbcType=INTEGER}, #{item.lossNum,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER}) #{item.profitNum,jdbcType=INTEGER}, #{item.lossNum,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER})
@ -295,17 +314,14 @@
group by od.id group by od.id
</select> </select>
<select id="selectByOrderIdAndProductId" resultMap="BaseResultMap">
select *
from inv_count_order_detail
where orderIdFk = #{orderIdFk}
and productId = #{productId}
</select>
<delete id="deleteByOrderIdAndProductId"> <delete id="deleteByOrderIdAndProductId">
delete delete
from inv_count_codes from inv_count_codes
where orderIdFk = #{orderIdFk} where orderIdFk = #{orderIdFk}
and productId = #{productId} and productId = #{productId}
</delete> </delete>
<select id="selectByOrderIdAndNameCode" resultMap="BaseResultMap">
select * from inv_count_order_detail where orderIdFk = #{orderIdFk} and nameCode = #{nameCode}
</select>
</mapper> </mapper>

@ -33,9 +33,10 @@ CREATE TABLE `inv_count_order_detail` (
`id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id', `id` int(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点单号', `orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '盘点单号',
`productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID', `productId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品ID',
`nameCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '产品DI',
`batchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号', `batchNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
`produceDate` varchar(255) NULL DEFAULT NULL COMMENT '生产日期', `produceDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '生产日期',
`expireDate` varchar(255) NULL DEFAULT NULL COMMENT '失效日期', `expireDate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '失效日期',
`serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号', `serialNo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '序列号',
`countNum` int(0) NULL DEFAULT NULL COMMENT '盘点数量', `countNum` int(0) NULL DEFAULT NULL COMMENT '盘点数量',
`invNum` int(0) NULL DEFAULT NULL COMMENT '账面数量', `invNum` int(0) NULL DEFAULT NULL COMMENT '账面数量',
@ -43,7 +44,7 @@ CREATE TABLE `inv_count_order_detail` (
`lossNum` int(0) NULL DEFAULT NULL COMMENT '盘亏数量', `lossNum` int(0) NULL DEFAULT NULL COMMENT '盘亏数量',
`status` tinyint(1) NULL DEFAULT NULL COMMENT '盈亏状态 0亏损 1盈利', `status` tinyint(1) NULL DEFAULT NULL COMMENT '盈亏状态 0亏损 1盈利',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点单详情' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '盘点单详情' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

Loading…
Cancel
Save