diff --git a/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java b/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java index d7f9dd3..ce0432d 100644 --- a/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java +++ b/src/main/java/com/bonus/gzgqj/business/app/service/PartApplyAppServiceImp.java @@ -107,7 +107,7 @@ public class PartApplyAppServiceImp { if(num<1){ return ServerResponse.createErroe("配件申请失败"); } - int num2= mapper.insertDetails(list,dto); + int num2= mapper.insertDetails(list,dto); if(num2==list.size()){ return ServerResponse.createSuccess("申请成功","申请成功"); } diff --git a/src/main/java/com/bonus/gzgqj/business/bases/entity/PartInputDetails.java b/src/main/java/com/bonus/gzgqj/business/bases/entity/PartInputDetails.java index fd58f67..27459ca 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/entity/PartInputDetails.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/entity/PartInputDetails.java @@ -60,4 +60,6 @@ public class PartInputDetails { */ private String partUnit; + private String remark; + } diff --git a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PaTypeMapper.java b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PaTypeMapper.java index 4f2a42f..d8bd8cb 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PaTypeMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PaTypeMapper.java @@ -2,7 +2,7 @@ package com.bonus.gzgqj.business.bases.mapper; import com.bonus.gzgqj.business.bases.entity.PaTypeVo; import com.bonus.gzgqj.business.bases.entity.VendVo; -import io.lettuce.core.dynamic.annotation.Param; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartApplyMapper.java b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartApplyMapper.java index b517fd7..3c09aa1 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartApplyMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartApplyMapper.java @@ -3,7 +3,7 @@ package com.bonus.gzgqj.business.bases.mapper; import com.bonus.gzgqj.business.app.entity.PartApplyAppVo; import com.bonus.gzgqj.business.app.entity.PartApplyDetailAppVo; import com.bonus.gzgqj.business.bases.entity.AuditRecord; -import org.omg.CORBA.INTERNAL; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; diff --git a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartInputMapper.java b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartInputMapper.java index 70ac111..f72c5b1 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartInputMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/mapper/PartInputMapper.java @@ -2,10 +2,9 @@ package com.bonus.gzgqj.business.bases.mapper; import com.bonus.gzgqj.business.bases.entity.PartInputDetails; import com.bonus.gzgqj.business.bases.entity.PartInputVo; -import io.lettuce.core.dynamic.annotation.Param; -import org.springframework.security.core.parameters.P; -import org.springframework.stereotype.Repository; +import org.springframework.stereotype.Repository; +import org.apache.ibatis.annotations.Param; import java.util.List; /** @@ -34,7 +33,7 @@ public interface PartInputMapper { * @param vo * @param list */ - int addDetails(@Param("param") PartInputVo vo,@Param("list") List list); + int addDetails(@Param("param")PartInputVo vo,@Param("list") List list); /** * 查询类型数量 diff --git a/src/main/java/com/bonus/gzgqj/business/bases/service/PartInputServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/bases/service/PartInputServiceImpl.java index 8a04526..521b10d 100644 --- a/src/main/java/com/bonus/gzgqj/business/bases/service/PartInputServiceImpl.java +++ b/src/main/java/com/bonus/gzgqj/business/bases/service/PartInputServiceImpl.java @@ -92,7 +92,7 @@ public class PartInputServiceImpl implements PartInputService{ vo.setUpdater(userId.toString()); AtomicReference isFlag= new AtomicReference<>("1"); final int[] inputNum = {0}; - BigDecimal allPrice = new BigDecimal("0"); + final BigDecimal[] allPrice = {new BigDecimal("0")}; list.forEach(detail->{ inputNum[0] = inputNum[0] +detail.getInputNum(); //单价 @@ -104,11 +104,12 @@ public class PartInputServiceImpl implements PartInputService{ BigDecimal num = new BigDecimal(detail.getInputNum()); //总价 BigDecimal totalPrice = price.multiply(num); + System.err.println(totalPrice); detail.setTotalPrice(totalPrice.toString()); - allPrice.add(totalPrice); + allPrice[0] = allPrice[0].add(totalPrice); }); - vo.setAllPrice(allPrice.toString()); + vo.setAllPrice(allPrice[0].toString()); vo.setInputNum(inputNum[0]); vo.setIsFlag(isFlag.get()); int num=mapper.addInputData(vo); @@ -123,8 +124,9 @@ public class PartInputServiceImpl implements PartInputService{ //更新 库存数量-及平准单价 int typeNum=mapper.getPaTypeById(detail); int nowNum= detail.getInputNum()+typeNum; - String pzPrice=mapper.getPzPrice(detail); - mapper.updateTypeNum(detail.getPartId(),nowNum,pzPrice); + // String pzPrice=mapper.getPzPrice(detail); + //最后入库就是最终价格 + mapper.updateTypeNum(detail.getPartId(),nowNum,detail.getPartPrice()); }); return ServerResponse.createSuccess("入库成功"); } @@ -181,8 +183,9 @@ public class PartInputServiceImpl implements PartInputService{ }else{ list.forEach(detail->{ //更新 -及平准单价 - String pzPrice=mapper.getPzPrice(detail); - mapper.updateTypeNum2(detail.getPartId(),pzPrice); + // String pzPrice=mapper.getPzPrice(detail); + + mapper.updateTypeNum2(detail.getPartId(),detail.getPartPrice()); }); } } diff --git a/src/main/resources/mappers/bases/PaTypeMapper.xml b/src/main/resources/mappers/bases/PaTypeMapper.xml index 475d8a0..27f05c7 100644 --- a/src/main/resources/mappers/bases/PaTypeMapper.xml +++ b/src/main/resources/mappers/bases/PaTypeMapper.xml @@ -3,7 +3,7 @@ - insert into pa_type(parent_id, name,remarks,unit,is_active,level)VALUES(#{parentId},#{name},#{remarks},#{unit},1,#{level}) + insert into pa_type(parent_id, name,remarks,unit,is_active,level,price)VALUES(#{parentId},#{name},#{remarks},#{unit},1,#{level},0) update pa_type set name=#{name},remarks=#{remarks},unit=#{unit} where id=#{id} diff --git a/src/main/resources/mappers/bases/PartInputMapper.xml b/src/main/resources/mappers/bases/PartInputMapper.xml index 2a387a5..bac9424 100644 --- a/src/main/resources/mappers/bases/PartInputMapper.xml +++ b/src/main/resources/mappers/bases/PartInputMapper.xml @@ -11,11 +11,11 @@ insert into t_part_put_details( put_id,part_id,part_type,part_name,part_model,part_unit,input_num,part_price, - total_price,vender_id,vender_name) values + total_price,vender_id,vender_name,remark) values (#{param.id},#{item.partId},#{item.partType},#{item.partName}, #{item.partModel},#{item.partUnit},#{item.inputNum},#{item.partPrice}, - #{item.totalPrice},#{item.vendId},#{item.vendName}) + #{item.totalPrice},#{item.vendId},#{item.vendName},#{item.remark}) @@ -93,7 +93,7 @@ \ No newline at end of file