Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

zhoux 1 год назад
Родитель
Сommit
230e1a8833

+ 14 - 0
src/main/java/com/dk/mdm/controller/ivt/outBound/OutboundSaleOrderController.java

@@ -48,6 +48,20 @@ public class OutboundSaleOrderController {
     }
 
     /**
+     * @desc :  销售出库新建和收款
+     * @date : 2024/3/18 15:22
+     * @author : 王英杰
+     */
+    @ApiOperation(
+            value = "销售出库新建",
+            notes = "销售出库新建"
+    )
+    @PostMapping({"outbound_insert_collection"})
+    public ResponseResultVO<?> saleOrderOutboundInsertCollection(@Valid @RequestBody OutboundVO outboundVO) {
+        return outboundSaleOrderService.saleOrderOutboundInsertCollection(outboundVO);
+    }
+
+    /**
      * @desc : 销售出库办理
      * @date : 2024/3/18 15:22
      * @author : 寇珊珊

+ 1 - 1
src/main/java/com/dk/mdm/controller/ivt/outBound/OutboundSaleReturnController.java

@@ -47,7 +47,7 @@ public class OutboundSaleReturnController {
     /**
      * @desc :  销售退货出库新建退款
      * @date : 2024/3/18 15:22
-     * @author : 寇珊珊
+     * @author : 王英杰
      */
     @ApiOperation(
             value = "销售退货出库新建退款",

+ 3 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -497,6 +497,7 @@
         tmgs.sku_images        as "skuImages",
         tmgs.remarks,
         tmgs.pack_box AS "packBox"
+        ,tmgu.decimal_places    as "decimalPlaces"
         from dkic_b.t_mst_goods_sku as tmgs
         left join dkic_b.t_mst_goods_brand as tmgb on tmgs.brand_id = tmgb.brand_id
         left join dkic_b.t_mst_goods_category as tmgc on tmgs.category_id = tmgc.cat_id
@@ -558,6 +559,7 @@
         tmgu.unit_name         as "unitName",
         tmgu.decimal_places    as "decimalPlaces",
         tmgs.sub_unit_id       as "subUnitId",
+        tmgus.unit_name        as "subUnitName",
         tmgs.conversion_factor as "conversionFactor",
         tmgs.series_id         as "seriesId",
         tmgseries.series_name  as "seriesName",
@@ -574,6 +576,7 @@
         left join dkic_b.t_mst_goods_category as tmgc on tmgs.category_id = tmgc.cat_id
         left join dkic_b.t_mst_goods_series as tmgseries on tmgs.series_id = tmgseries.series_id
         left join dkic_b.t_mst_unit as tmgu on tmgs.unit_id = tmgu.unit_id
+        left join dkic_b.t_mst_unit as tmgus on tmgs.sub_unit_id = tmgus.unit_id
         where tmgs.flg_valid
         AND tmgs.cp_id = #{cpId}
         <if test="skuCode != null">

+ 2 - 0
src/main/java/com/dk/mdm/mapper/ivt/OutboundMapper.xml

@@ -204,6 +204,7 @@
         <result column="outing_piece" property="outingPiece"/>
         <result column="out_box" property="box"/>
         <result column="out_piece" property="piece"/>
+        <result column="decimal_places" property="decimalPlaces"/>
     </resultMap>
     <!-- 通用条件列 -->
     <sql id="Condition">
@@ -1130,6 +1131,7 @@
                 ,tpoi.outing_piece  as "list_outing_piece"
                 ,tpoi.out_box  as "list_out_box"
                 ,tpoi.out_piece  as "list_out_piece"
+,tmgu.decimal_places as "list_decimal_places"
     </sql>
 
     <select id="countByCondDetail" resultType="Long">

+ 3 - 0
src/main/java/com/dk/mdm/mapper/mst/GoodsBrandMapper.java

@@ -5,6 +5,7 @@ import com.dk.common.mapper.BaseMapper;
 import com.dk.mdm.model.pojo.mst.Role;
 import com.dk.mdm.model.query.mst.GoodsBrandQuery;
 import com.dk.mdm.model.response.mst.GoodsBrandResponse;
+import com.dk.mdm.model.vo.mst.GoodsBrandVO;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -30,5 +31,7 @@ public interface GoodsBrandMapper extends BaseMapper<GoodsBrand>{
     Long countByCond(GoodsBrandQuery goodsBrandQuery);
 
     Integer saveSupplierBrand(String supId,String brandId);
+
+    Long checkNameDuplicated(GoodsBrand goodsBrand);
 }
 

+ 16 - 0
src/main/java/com/dk/mdm/mapper/mst/GoodsBrandMapper.xml

@@ -154,6 +154,22 @@
         for update
     </select>
 
+    <!-- 校验名称不重复 -->
+    <select id="checkNameDuplicated" resultType="java.lang.Long">
+        SELECT COUNT(brand_id)
+        FROM dkic_b.t_mst_goods_brand
+        WHERE
+        cp_id = #{cpId}
+        AND flg_valid = TRUE
+        <!-- 通过判断id是否存在判断为新增操作还是修改操作 -->
+        <if test="brandId != null and brandId != ''">
+            AND brand_id != #{brandId}::uuid
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND brand_name = #{brandName}
+        </if>
+    </select>
+
     <insert id="insertBatch">
         insert into dkic_b.t_mst_goods_brand
         (

+ 1 - 1
src/main/java/com/dk/mdm/mapper/mst/GoodsSkuMapper.xml

@@ -211,7 +211,7 @@
         ,tmgb.brand_name AS "brandName"
            ,tmgc.cat_name AS "catName"
         ,tmu.unit_name AS "unitName"
-        ,tmgu.decimal_places    as "decimalPlaces"
+        ,tmu.decimal_places    as "decimalPlaces"
         ,subtmu.unit_name AS "subUnitName"
         ,tmgsr.series_name AS "seriesName"
         ,(SELECT  count(1) FROM  dkic_b.t_psi_inventory tsic WHERE tsic.sku_id = tmgs.sku_id ) AS inventoryCount

+ 1 - 1
src/main/java/com/dk/mdm/mapper/sale/OrderItemMapper.xml

@@ -568,7 +568,7 @@
         t.return_amt,
         t.remarks,
         t.item_qty - coalesce(sumQty,0) as "transferableQuantity"
-        ,(select ul.decimal_places from  dkic_b.t_mst_unit ul where dkic_b.t_psi_order_item.unit_id = ul.unit_id) as "decimalPlaces"
+        ,(select ul.decimal_places from  dkic_b.t_mst_unit ul where t.unit_id = ul.unit_id) as "decimalPlaces"
         FROM dkic_b.t_psi_order_item as t
         left join dkic_b.t_psi_order as tpo on tpo.order_id = t.order_id
         inner join dkic_b.t_mst_goods_sku tmgs on t.sku_id = tmgs.sku_id

+ 6 - 1
src/main/java/com/dk/mdm/model/response/ivt/OutboundResponse.java

@@ -60,7 +60,12 @@ public class OutboundResponse extends PageInfo<OutboundResponse> implements Seri
     @Excel(name = "可用量")
     @ApiModelProperty(value = "可用量")
     private BigDecimal usableQty;
-
+    /**
+     * 小数位数 ([0-6]能改大,不能改小)
+     */
+    @ApiModelProperty(value = "小数位数 ([0-6]能改大,不能改小)")
+    @TableField(exist = false)
+    private Integer decimalPlaces;
 
     @Excel(name = "包装")
     @ApiModelProperty(value = "包装")

+ 27 - 0
src/main/java/com/dk/mdm/service/ivt/outbound/OutboundSaleOrderService.java

@@ -48,9 +48,11 @@ import com.dk.mdm.model.vo.ivt.InboundItemVO;
 import com.dk.mdm.model.vo.ivt.InboundVO;
 import com.dk.mdm.model.vo.ivt.OutboundItemVO;
 import com.dk.mdm.model.vo.ivt.OutboundVO;
+import com.dk.mdm.model.vo.mac.RecPayVO;
 import com.dk.mdm.service.common.CommonService;
 import com.dk.mdm.service.ivt.inventory.InventoryService;
 import com.dk.mdm.service.mac.AccountService;
+import com.dk.mdm.service.mac.ReceiptService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -122,6 +124,8 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     @Autowired
     private InboundItemConvert inboundItemConvert;
 
+    @Autowired
+    private ReceiptService receiptService;
     /**
      * @desc : 删除外协品生产外协入库单
      * @date : 2024/5/10 10:31
@@ -463,6 +467,29 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
     }
 
     /**
+     * @desc : 销售出库新建>>>收款
+     * @date : 2024/3/7 14:13
+     * @author : 寇珊珊
+     */
+    @Transactional(rollbackFor = {Exception.class})
+    public ResponseResultVO<?> saleOrderOutboundInsertCollection(OutboundVO outboundVO) {
+        //新建销售出库
+        saleOrderOutboundInsert(outboundVO);
+        //新建退款
+        RecPayVO recPayVO = new RecPayVO();
+        recPayVO.setObjectId(outboundVO.getObjectId());
+        recPayVO.setOrgId(outboundVO.getOrgId());
+        recPayVO.setStaffId(outboundVO.getStaffId());
+        recPayVO.setAccDate(outboundVO.getAccDate());
+        recPayVO.setMakeStaff(outboundVO.getMakeStaff());
+        recPayVO.setRpType(outboundVO.getRpType());
+        recPayVO.setSumAmtRec(outboundVO.getSumAmtRec());
+        recPayVO.setItemList(outboundVO.getItemListRecPayItemVO());
+        receiptService.insertReceipt(recPayVO);
+        return ResponseResultUtil.success();
+    }
+
+    /**
      * @desc : 销售出库编辑
      * @date : 2024/3/25 16:25
      * @author : 寇珊珊

+ 13 - 1
src/main/java/com/dk/mdm/service/mst/GoodsBrandService.java

@@ -1,8 +1,11 @@
 package com.dk.mdm.service.mst;
 
+import com.dk.common.exception.BaseBusinessException;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.infrastructure.enums.ErrorCodeEnum;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.infrastructure.convert.mst.GoodsBrandConvert;
@@ -89,6 +92,12 @@ public class GoodsBrandService extends BaseService<GoodsBrand> {
         goodsBrand.setDisplayNo(commonService.getMaxDisplayNo(Constant.DisplayNoTable.GOODSBRAND));
         //设置编码
         Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.BRAND.getName(), true);
+
+        // 判断是否存在相同名称 如果存在直接返回重复信息 不进行下一部操作
+        if(goodsBrandMapper.checkNameDuplicated(goodsBrand) > 0){
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISEXISTS_BRAVDNAME.getMessage());
+        }
+
         goodsBrand.setBrandId(uniqueNoteCode.get("outId").toString());
         goodsBrand.setBrandCode(uniqueNoteCode.get("outNote").toString());
         //新建
@@ -115,9 +124,12 @@ public class GoodsBrandService extends BaseService<GoodsBrand> {
     )
     public ResponseResultVO<?> updateGoodsBrand(GoodsBrandVO goodsBrandVO) {
         GoodsBrand goodsBrand = goodsBrandConvert.convertToPo(goodsBrandVO);
+        // 判断是否存在相同名称 如果存在直接返回重复信息 不进行下一部操作
+        if(goodsBrandMapper.checkNameDuplicated(goodsBrand) > 0){
+            throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.ISEXISTS_BRAVDNAME.getMessage());
+        }
         super.updateByUuid(goodsBrand);
         return ResponseResultUtil.success();
     }
 
-
 }