供应链采购、验货、入库等模块修改
This commit is contained in:
		
							parent
							
								
									61bdab8a4e
								
							
						
					
					
						commit
						c78029805e
					
				| 
						 | 
				
			
			@ -14,6 +14,7 @@ import com.bonus.common.log.enums.OperaType;
 | 
			
		|||
//import com.bonus.canteen.core.ims.common.annotation.PreventRepeatSubmit;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +120,20 @@ public class OrderGoodsController extends BaseController {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @ApiOperation(value = "结束采购订单主")
 | 
			
		||||
    //@PreventRepeatSubmit
 | 
			
		||||
    //@RequiresPermissions("ims:goods:edit")
 | 
			
		||||
    @SysLog(title = "结束采购订单主", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改采购订单主")
 | 
			
		||||
    @PostMapping("/finishOrder")
 | 
			
		||||
    public AjaxResult finishOrder(@RequestBody OrderGoodsUpdate orderGoodsUpdate) {
 | 
			
		||||
        try {
 | 
			
		||||
            return toAjax(orderGoodsService.finishOrder(orderGoodsUpdate.getOrderGoodsId()+""));
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            return error(e.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除采购订单主
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +141,7 @@ public class OrderGoodsController extends BaseController {
 | 
			
		|||
    //@PreventRepeatSubmit
 | 
			
		||||
    //@RequiresPermissions("ims:goods:remove")
 | 
			
		||||
    @SysLog(title = "采购订单主", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除采购订单主")
 | 
			
		||||
	@PostMapping("/del/{orderGoodsIds}")
 | 
			
		||||
	@PostMapping("/del/{ims_order_goods}")
 | 
			
		||||
    public AjaxResult remove(@PathVariable Long[] orderGoodsIds) {
 | 
			
		||||
        return toAjax(orderGoodsService.deleteOrderGoodsByOrderGoodsIds(orderGoodsIds));
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ public class OrderGoods extends BaseEntity {
 | 
			
		|||
 | 
			
		||||
    /** 订单状态(1待提交,2已提交) */
 | 
			
		||||
    @Excel(name = "订单状态(1待提交,2已提交)")
 | 
			
		||||
    @ApiModelProperty(value = "订单状态(1待提交,2已提交)")
 | 
			
		||||
    @ApiModelProperty(value = "订单状态(1待提交,2已提交,不允许修改,4订单结束)")
 | 
			
		||||
    private Long orderStatus;
 | 
			
		||||
 | 
			
		||||
    /** 订单总金额 */
 | 
			
		||||
| 
						 | 
				
			
			@ -195,4 +195,7 @@ public class OrderGoods extends BaseEntity {
 | 
			
		|||
 | 
			
		||||
    @ApiModelProperty(value = "是否全部入库 1-是 2-否")
 | 
			
		||||
    private Integer ifAllInto;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "页码/表单 默认为1")
 | 
			
		||||
    private int pageOrForm = 1;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,5 +92,7 @@ public class OrderGoodsQuery implements Serializable {
 | 
			
		|||
 | 
			
		||||
    private Long warehouseId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "页码/表单 默认为1")
 | 
			
		||||
    private int pageOrForm = 1;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ public class InspectGoodsSum {
 | 
			
		|||
    private BigDecimal totalQualifiedNum;
 | 
			
		||||
 | 
			
		||||
    /** 累计合格总数量 */
 | 
			
		||||
    @ApiModelProperty(value = "货品累计合格总数量")
 | 
			
		||||
    @ApiModelProperty(value = "货品累计合格(待入库)总数量")
 | 
			
		||||
    private Map<Long, BigDecimal> individualTotalQualifiedNum;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "货品累计累计送货数量")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ package com.bonus.canteen.core.ims.mapper;
 | 
			
		|||
import java.util.List;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.InspectGoodsDetail;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.vo.InspectGoodsDetailVO;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 验货单明细Mapper接口
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +28,9 @@ public interface InspectGoodsDetailMapper {
 | 
			
		|||
     */
 | 
			
		||||
    public List<InspectGoodsDetailVO> selectInspectGoodsDetailList(InspectGoodsDetail inspectGoodsDetail);
 | 
			
		||||
 | 
			
		||||
    public List<InspectGoodsDetailVO> selectInspectGoodsDetailListByInspectGoodsId(Long inspectGoodsId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增验货单明细
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -62,4 +66,6 @@ public interface InspectGoodsDetailMapper {
 | 
			
		|||
    public int deleteInspectGoodsDetailByInspectGoodsId(Long inspectGoodsId);
 | 
			
		||||
 | 
			
		||||
    public int deleteInspectGoodsDetailByInspectGoodsIds(Long[] inspectGoodsIds);
 | 
			
		||||
 | 
			
		||||
    String selectOrderGoodCodeByInspectGoodsId(@Param("inspectGoodsId") Long inspectGoodsId);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package com.bonus.canteen.core.ims.mapper;
 | 
			
		|||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.OrderGoods;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.param.OrderGoodsUpdate;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.vo.OrderGoodsVO;
 | 
			
		||||
import com.bonus.canteen.core.ims.dto.SupplyStatisticsDTO;
 | 
			
		||||
import com.bonus.canteen.core.ims.dto.SupplyStatisticsPageDTO;
 | 
			
		||||
| 
						 | 
				
			
			@ -68,4 +69,6 @@ public interface OrderGoodsMapper {
 | 
			
		|||
 | 
			
		||||
    OrderNumAndAmountModel selectOrderNumAndAmount(@Param("supplierId") Long supplierId, @Param("content") SupplyStatisticsDTO content, @Param("supplierConfirmStatus") Integer supplierConfirmStatus);
 | 
			
		||||
 | 
			
		||||
    int finishOrder(String orderGoodsUpdate);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,4 +60,6 @@ public interface IOrderGoodsService {
 | 
			
		|||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int deleteOrderGoodsByOrderGoodsId(Long orderGoodsId);
 | 
			
		||||
 | 
			
		||||
    int finishOrder(String orderGoodsUpdate);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,8 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private ReportInventoryBaseMapper reportInventoryBaseMapper;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -106,6 +108,10 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
 | 
			
		|||
    @Override
 | 
			
		||||
    public ImsIntoInventory insertImsIntoInventory(ImsIntoInventoryAdd imsIntoInventoryAdd)
 | 
			
		||||
    {
 | 
			
		||||
        //新增验货单 暂时不要了
 | 
			
		||||
//        if(!Objects.isNull(imsIntoInventoryAdd.getRelateOrderGoodsId())) {
 | 
			
		||||
//            addImsInspectGoods(imsIntoInventoryAdd);
 | 
			
		||||
//        }
 | 
			
		||||
        ImsIntoInventory imsIntoInventory = new ImsIntoInventory();
 | 
			
		||||
        BeanUtils.copyProperties(imsIntoInventoryAdd, imsIntoInventory);
 | 
			
		||||
        imsIntoInventory.setCreateTime(DateUtils.getNowDate());
 | 
			
		||||
| 
						 | 
				
			
			@ -117,8 +123,6 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
 | 
			
		|||
        long intoType = imsIntoInventoryAdd.getIntoType();
 | 
			
		||||
        System.err.println("intoType==================="+intoType);
 | 
			
		||||
        if(intoType == 4) {
 | 
			
		||||
            //新增验货单
 | 
			
		||||
 | 
			
		||||
            ImsOutInventoryAdd imsOutInventoryAdd = new ImsOutInventoryAdd();
 | 
			
		||||
            BeanUtils.copyProperties(imsIntoInventory, imsOutInventoryAdd);
 | 
			
		||||
            imsOutInventoryAdd.setOutType(intoType);
 | 
			
		||||
| 
						 | 
				
			
			@ -130,10 +134,35 @@ public class ImsIntoInventoryServiceImpl implements IImsIntoInventoryService
 | 
			
		|||
        return imsIntoInventoryVO;
 | 
			
		||||
       // return rows;
 | 
			
		||||
    }
 | 
			
		||||
    private void  addImsInspectGoods(Long orderGoodsId){
 | 
			
		||||
        OrderGoodsVO orderGoodsVO = orderGoodsService.selectOrderGoodsByOrderGoodsId(orderGoodsId);
 | 
			
		||||
        List<OrderGoodsDetailVO> orderGoodsDetailList = orderGoodsVO.getOrderGoodsDetailList();
 | 
			
		||||
    private void  addImsInspectGoods(ImsIntoInventoryAdd imsIntoInventoryAdd){
 | 
			
		||||
        InspectGoodsAdd inspectGoodsAdd = new InspectGoodsAdd();
 | 
			
		||||
        inspectGoodsAdd.setInspectDate(imsIntoInventoryAdd.getIntoDate());
 | 
			
		||||
        inspectGoodsAdd.setDeliverySupplierId(null);
 | 
			
		||||
        inspectGoodsAdd.setDeliveryWarehouseId(imsIntoInventoryAdd.getWarehouseId());
 | 
			
		||||
        inspectGoodsAdd.setDeliveryMan(SecurityUtils.getUsername());
 | 
			
		||||
        inspectGoodsAdd.setDeliveryPhone(SecurityUtils.getLoginUser().getSysUser().getPhonenumber());
 | 
			
		||||
        inspectGoodsAdd.setInspector(SecurityUtils.getUserKey());
 | 
			
		||||
        inspectGoodsAdd.setRemark("导入采购订单入库生成验货单");
 | 
			
		||||
        inspectGoodsAdd.setDeliveryTotalNum(imsIntoInventoryAdd.getTotalNum());
 | 
			
		||||
        inspectGoodsAdd.setInspectQualifiedNum(imsIntoInventoryAdd.getTotalNum());
 | 
			
		||||
        inspectGoodsAdd.setStatus(imsIntoInventoryAdd.getStatus());
 | 
			
		||||
        inspectGoodsAdd.setRelateOrderGoodsId(imsIntoInventoryAdd.getRelateOrderGoodsId());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        List<ImsIntoInventoryDetailAdd> imsIntoInventoryDetailAddList = imsIntoInventoryAdd.getImsIntoInventoryDetailAddList();
 | 
			
		||||
        List<InspectGoodsDetailAdd> inspectGoodsDetails = new ArrayList<>();
 | 
			
		||||
        for (ImsIntoInventoryDetailAdd bean:imsIntoInventoryDetailAddList) {
 | 
			
		||||
            InspectGoodsDetailAdd inspectGoodsDetailAdd = new InspectGoodsDetailAdd();
 | 
			
		||||
            inspectGoodsDetailAdd.setMaterialId(bean.getMaterialId());
 | 
			
		||||
            inspectGoodsDetailAdd.setOrderNum(bean.getPurNum());
 | 
			
		||||
            inspectGoodsDetailAdd.setQualifiedNum(bean.getPurNum());
 | 
			
		||||
            inspectGoodsDetailAdd.setDeliveryNum(bean.getPurNum());
 | 
			
		||||
            inspectGoodsDetailAdd.setUnitPrice(bean.getUnitPrice());
 | 
			
		||||
            inspectGoodsDetails.add(inspectGoodsDetailAdd);
 | 
			
		||||
            inspectGoodsAdd.setDeliverySupplierId(bean.getSupplierId());
 | 
			
		||||
        }
 | 
			
		||||
        inspectGoodsAdd.setInspectGoodsDetails(inspectGoodsDetails);
 | 
			
		||||
        inspectGoodsService.insertInspectGoods(inspectGoodsAdd);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private List<ImsOutInventoryDetailAdd> getImsOutInventoryDetailAddList(List<ImsIntoInventoryDetail> imsIntoInventoryDetailAddList) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,8 @@ import java.util.ArrayList;
 | 
			
		|||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.concurrent.atomic.AtomicBoolean;
 | 
			
		||||
import java.util.function.Function;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +16,7 @@ import com.bonus.canteen.core.ims.domain.*;
 | 
			
		|||
import com.bonus.canteen.core.ims.domain.param.*;
 | 
			
		||||
import com.bonus.canteen.core.ims.domain.vo.*;
 | 
			
		||||
import com.bonus.canteen.core.ims.enums.SupplierOrderGenerateTypeEnum;
 | 
			
		||||
import com.bonus.canteen.core.ims.mapper.InspectGoodsDetailMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.mapper.OrderGoodsDetailMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.mapper.OrderGoodsMapper;
 | 
			
		||||
import com.bonus.canteen.core.ims.service.*;
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +41,9 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		|||
public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private InspectGoodsMapper inspectGoodsMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private InspectGoodsDetailMapper inspectGoodsDetailMapper;
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private IInspectGoodsDetailService inspectGoodsDetailService;
 | 
			
		||||
    @Autowired
 | 
			
		||||
| 
						 | 
				
			
			@ -153,12 +159,22 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
            }
 | 
			
		||||
            OrderGoodsVO orderGoodsVO = orderGoodsMapper.selectOrderGoodsByOrderGoodsCode(inspectGoods.getRelateOrderGoodsId());
 | 
			
		||||
            this.selectOrderGoodsByOrderGoodsId(orderGoodsVO.getOrderGoodsId());
 | 
			
		||||
            if(2L==inspectGoodsAdd.getStatus()){
 | 
			
		||||
                updateOrderStatus(orderGoodsVO.getOrderGoodsId(),orderGoodsVO.getOrderGoodsCode());
 | 
			
		||||
            }
 | 
			
		||||
            return inspectGoods.getInspectGoodsId();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            throw new ServiceException(e.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void updateOrderStatus(Long orderGoodsId,String orderGoodsCode) {
 | 
			
		||||
        OrderGoods orderGoodsVO_update = new OrderGoods();
 | 
			
		||||
        orderGoodsVO_update.setOrderGoodsId(orderGoodsId);
 | 
			
		||||
        orderGoodsVO_update.setOrderStatus(3L);
 | 
			
		||||
        orderGoodsMapper.updateOrderGoods(orderGoodsVO_update);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改验货单
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			@ -211,6 +227,9 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
            }
 | 
			
		||||
            OrderGoodsVO orderGoodsVO = orderGoodsMapper.selectOrderGoodsByOrderGoodsCode(inspectGoods.getRelateOrderGoodsId());
 | 
			
		||||
            this.selectOrderGoodsByOrderGoodsId(orderGoodsVO.getOrderGoodsId());
 | 
			
		||||
            if(2L==inspectGoodsUpdate.getStatus()){
 | 
			
		||||
                updateOrderStatus(orderGoodsVO.getOrderGoodsId(),orderGoodsVO.getOrderGoodsCode());
 | 
			
		||||
            }
 | 
			
		||||
            return inspectGoodsMapper.updateInspectGoods(inspectGoods);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            throw new ServiceException(e.getMessage());
 | 
			
		||||
| 
						 | 
				
			
			@ -301,8 +320,61 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public int deleteInspectGoodsByInspectGoodsIds(Long[] inspectGoodsIds) {
 | 
			
		||||
        inspectGoodsDetailService.deleteInspectGoodsDetailByInspectGoodsIds(inspectGoodsIds);
 | 
			
		||||
        return inspectGoodsMapper.deleteInspectGoodsByInspectGoodsIds(inspectGoodsIds);
 | 
			
		||||
        try{
 | 
			
		||||
            if(inspectGoodsIds !=null||inspectGoodsIds.length >0){
 | 
			
		||||
                checkIfAllInspect(inspectGoodsIds[0]);
 | 
			
		||||
            }
 | 
			
		||||
            inspectGoodsDetailService.deleteInspectGoodsDetailByInspectGoodsIds(inspectGoodsIds);
 | 
			
		||||
            inspectGoodsMapper.deleteInspectGoodsByInspectGoodsIds(inspectGoodsIds);
 | 
			
		||||
 | 
			
		||||
        }catch (Exception e){
 | 
			
		||||
            throw new ServiceException("删除验货单失败,存在关联数据");
 | 
			
		||||
        }
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void checkIfAllInspect( Long inspectGoodsIds) {
 | 
			
		||||
 | 
			
		||||
        inspectGoodsDetailMapper.selectOrderGoodCodeByInspectGoodsId(inspectGoodsIds);
 | 
			
		||||
//            orderGoodsMapper.updateOrderGoods(new OrderGoods(){
 | 
			
		||||
//                {
 | 
			
		||||
//                    setOrderGoodsCode(inspectGoodsDetailMapper.selectOrderGoodCodeByInspectGoodsId(inspectGoodsIds));
 | 
			
		||||
//                    setIfAllInspect(2L);
 | 
			
		||||
//                }
 | 
			
		||||
//            });
 | 
			
		||||
//        List<InspectGoodsDetailVO> list =  inspectGoodsDetailMapper.selectInspectGoodsDetailListByInspectGoodsId(inspectGoodsIds);
 | 
			
		||||
//        List<InspectGoodsDetailVO> distinctList = list.stream()
 | 
			
		||||
//                .filter(Objects::nonNull)
 | 
			
		||||
//                .collect(Collectors.collectingAndThen(
 | 
			
		||||
//                        Collectors.toMap(
 | 
			
		||||
//                                InspectGoodsDetailVO::getMaterialId,
 | 
			
		||||
//                                Function.identity(),
 | 
			
		||||
//                                (existing, replacement) -> existing  // 保留第一个出现的
 | 
			
		||||
//                        ),
 | 
			
		||||
//                        map -> new ArrayList<>(map.values())
 | 
			
		||||
//                ));
 | 
			
		||||
//        AtomicBoolean tf = new AtomicBoolean(false);
 | 
			
		||||
//        distinctList.forEach(inspectGoodsDetailVO -> {
 | 
			
		||||
//            Long materialId =  inspectGoodsDetailVO.getMaterialId();
 | 
			
		||||
//            BigDecimal orderNum = inspectGoodsDetailVO.getOrderNum();
 | 
			
		||||
//            BigDecimal deliveryNum = list.stream()
 | 
			
		||||
//                    .filter(vo -> vo != null && Objects.equals(vo.getMaterialId(), materialId))
 | 
			
		||||
//                    .map(InspectGoodsDetailVO::getDeliveryNum)
 | 
			
		||||
//                    .reduce(BigDecimal.ZERO, BigDecimal::add);
 | 
			
		||||
//            System.err.println("订单数量:" + orderNum + "   送货数量:" + deliveryNum);
 | 
			
		||||
//            if(deliveryNum.compareTo(orderNum) < 0){
 | 
			
		||||
//                tf.set(true);
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//        });
 | 
			
		||||
//        if(tf.get()){
 | 
			
		||||
//            orderGoodsMapper.updateOrderGoods(new OrderGoods(){
 | 
			
		||||
//                {
 | 
			
		||||
//                    setOrderGoodsCode( inspectGoodsDetailMapper.selectOrderGoodCodeByInspectGoodsId(inspectGoodsIds));
 | 
			
		||||
//                    setIfAllInspect(1L);
 | 
			
		||||
//                }
 | 
			
		||||
//            });
 | 
			
		||||
//        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -343,7 +415,7 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
 | 
			
		||||
            List<OrderGoodsDetailVO> orderGoodsDetailList = orderGoodsDetailMapper.selectOrderGoodsDetailByOrderGoodsCode(orderGoodsCode);
 | 
			
		||||
 | 
			
		||||
            //计算累计合格数量
 | 
			
		||||
            //累计合格(待入库)总数量
 | 
			
		||||
            Map<Long, BigDecimal> result = inspectGoodsDetailListTotal.stream()
 | 
			
		||||
                    .filter(detail -> detail.getMaterialId() != null && detail.getQualifiedNum() != null)
 | 
			
		||||
                    .collect(Collectors.groupingBy(
 | 
			
		||||
| 
						 | 
				
			
			@ -355,7 +427,7 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
                    ));
 | 
			
		||||
            inspectGoodsSum.setIndividualTotalQualifiedNum(result);
 | 
			
		||||
 | 
			
		||||
            //累计验货数量
 | 
			
		||||
            //累计送货数量
 | 
			
		||||
            Map<Long, BigDecimal> totalDeliveryNum = inspectGoodsDetailListTotal.stream()
 | 
			
		||||
                    .filter(detail -> detail.getMaterialId() != null && detail.getDeliveryNum() != null)
 | 
			
		||||
                    .collect(Collectors.groupingBy(
 | 
			
		||||
| 
						 | 
				
			
			@ -367,6 +439,7 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
                    ));
 | 
			
		||||
            inspectGoodsSum.setIndividualDeliveryNum(totalDeliveryNum);
 | 
			
		||||
 | 
			
		||||
            //累计入库数量
 | 
			
		||||
            Map<Long, BigDecimal> totalIntoNum = orderGoodsDetailList.stream()
 | 
			
		||||
                    .filter(detail -> detail.getMaterialId() != null && detail.getIntoNum() != null)
 | 
			
		||||
                    .collect(Collectors.groupingBy(
 | 
			
		||||
| 
						 | 
				
			
			@ -379,6 +452,7 @@ public class InspectGoodsServiceImpl implements IInspectGoodsService {
 | 
			
		|||
 | 
			
		||||
            inspectGoodsSum.setIndividualIntoNum(totalIntoNum);
 | 
			
		||||
 | 
			
		||||
            //累计订单数量
 | 
			
		||||
            Map<Long, BigDecimal> totalOrderNum = orderGoodsDetailList.stream()
 | 
			
		||||
                    .filter(detail -> detail.getMaterialId() != null && detail.getOrderNum() != null)
 | 
			
		||||
                    .collect(Collectors.groupingBy(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -212,6 +212,8 @@ public class OrderGoodsServiceImpl implements IOrderGoodsService {
 | 
			
		|||
                }else{
 | 
			
		||||
                    orderGoodsVO.setTotalQualifiedNum(BigDecimal.ZERO);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return purchasePlanVOList;
 | 
			
		||||
| 
						 | 
				
			
			@ -352,4 +354,9 @@ public class OrderGoodsServiceImpl implements IOrderGoodsService {
 | 
			
		|||
        inspectGoodsDetailService.deleteOrderGoodsDetailByOrderGoodsId(orderGoodsId);
 | 
			
		||||
        return orderGoodsMapper.deleteOrderGoodsByOrderGoodsId(orderGoodsId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int finishOrder(String orderGoodsUpdate) {
 | 
			
		||||
        return orderGoodsMapper.finishOrder(orderGoodsUpdate);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
 | 
			
		||||
    <select id="selectInspectGoodsDetailByInspectGoodsDetailId" parameterType="Long" resultMap="InspectGoodsDetailResult">
 | 
			
		||||
        <include refid="selectInspectGoodsDetailVo"/>
 | 
			
		||||
        where iigd.inspect_goods_detail_id = #{inspectGoodsDetailId}
 | 
			
		||||
        where iig.relate_order_goods_id = (
 | 
			
		||||
        select DISTINCT relate_order_goods_id from ims_inspect_goods where inspect_goods_id = #{inspectGoodsId}  limit 1
 | 
			
		||||
        )
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <insert id="insertInspectGoodsDetail" parameterType="com.bonus.canteen.core.ims.domain.InspectGoodsDetail" useGeneratedKeys="true" keyProperty="inspectGoodsDetailId">
 | 
			
		||||
| 
						 | 
				
			
			@ -148,4 +150,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            #{inspectGoodsDetailId}
 | 
			
		||||
        </foreach>
 | 
			
		||||
    </delete>
 | 
			
		||||
 | 
			
		||||
    <select id="selectOrderGoodCodeByInspectGoodsId" resultType="java.lang.String">
 | 
			
		||||
        update ims_order_goods SET if_all_inspect = 2 where order_goods_code = (
 | 
			
		||||
        select DISTINCT iig.relate_order_goods_id from ims_inspect_goods iig
 | 
			
		||||
        where iig.inspect_goods_id = #{inspectGoodsId} limit 1)
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectInspectGoodsDetailListByInspectGoodsId" parameterType="Long" resultMap="InspectGoodsDetailResult">
 | 
			
		||||
        <include refid="selectInspectGoodsDetailVo"/>
 | 
			
		||||
        where iigd.inspect_goods_id = #{inspectGoodsId}
 | 
			
		||||
    </select>
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
               iog.create_time, iog.update_by, iog.update_time, isr.supplier_name, iwi.warehouse_name,
 | 
			
		||||
               ba.area_name, bc.canteen_name, bs.stall_name, contract_code, iogps.pay_money_date,
 | 
			
		||||
               iogps.pay_money_style, iogps.collect_money_account, iogps.collect_money_account_name,
 | 
			
		||||
               iogps.collect_money_bank, iog.supplier_id, iog.warehouse_id,IFNULL(iig.delivery_total_num,0) as total_qualified_num
 | 
			
		||||
               iogps.collect_money_bank, iog.supplier_id, iog.warehouse_id,IFNULL(delivery_total_num,0) as total_qualified_num
 | 
			
		||||
        from ims_order_goods iog
 | 
			
		||||
        left join ims_order_goods_pay_style iogps on iogps.order_goods_id = iog.order_goods_code
 | 
			
		||||
        left join ims_supplier isr on isr.supplier_id = iog.supplier_id
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        <include refid="selectOrderGoodsVo"/>
 | 
			
		||||
        <where>
 | 
			
		||||
            iog.del_flag = '0'
 | 
			
		||||
            <if test="pageOrForm == 1 ">
 | 
			
		||||
                and order_status in (2,3)
 | 
			
		||||
            </if>
 | 
			
		||||
 | 
			
		||||
            <if test="isInspect != null and isInspect != '' and isInspect != 0 and isInspect != '0'.toString()">
 | 
			
		||||
                and iog.if_all_inspect = #{isInspect}
 | 
			
		||||
            </if>
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
                and iig.delivery_total_num > 0
 | 
			
		||||
            </if>
 | 
			
		||||
            <if test="supplierId != null "> and iog.supplier_id = #{supplierId}</if>
 | 
			
		||||
            <if test="orderStatus != null "> and iog.order_status = #{orderStatus}</if>
 | 
			
		||||
<!--            <if test="orderStatus != null "> and iog.order_status = #{orderStatus}</if>-->
 | 
			
		||||
            <if test="orderAmount != null "> and iog.order_amount = #{orderAmount}</if>
 | 
			
		||||
            <if test="requestArrivalTime != null "> and iog.request_arrival_time = #{requestArrivalTime}</if>
 | 
			
		||||
            <if test="supplyAddress != null  and supplyAddress != ''"> and iog.supply_address = #{supplyAddress}</if>
 | 
			
		||||
| 
						 | 
				
			
			@ -274,4 +278,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            AND DATE_FORMAT( create_time, '%Y-%m-%d' ) <![CDATA[ <= ]]> #{content.endTime}
 | 
			
		||||
        </if>
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <update id="finishOrder" >
 | 
			
		||||
        update ims_order_goods set order_status = 4 ,if_all_inspect = 1 ,if_all_into = 1
 | 
			
		||||
        where order_goods_id = #{orderGoodsId}
 | 
			
		||||
    </update>
 | 
			
		||||
</mapper>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue