From 0e46bb0cfc8b59ad5527f0b70c49f95aeac4bbbd Mon Sep 17 00:00:00 2001 From: zyx <zyx123456> Date: 星期五, 05 一月 2024 13:38:05 +0800 Subject: [PATCH] # 入库拣货功能添加 --- src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java | 75 +++++++++++++++++++++++++++++++++++++ 1 files changed, 75 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java index 84df296..81a1491 100644 --- a/src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java @@ -1,12 +1,87 @@ package com.zy.asrs.service.impl; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.core.common.Cools; +import com.zy.asrs.entity.OrderDetl; import com.zy.asrs.entity.Pla; +import com.zy.asrs.entity.PlaQty; import com.zy.asrs.mapper.PlaMapper; +import com.zy.asrs.service.PlaQtyService; import com.zy.asrs.service.PlaService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; @Service("plaService") public class PlaServiceImpl extends ServiceImpl<PlaMapper, Pla> implements PlaService { + @Autowired + private PlaQtyService plaQtyService; + public Pla selectByBatchAndPackageNo(String batch, String packageNo) { + return this.selectOne(new EntityWrapper<Pla>().eq("batch",batch).eq("package_no",packageNo)); + } + + @Override + @Transactional + public void queryStock(OrderDetl orderDetl, List<PlaQty> plaQties) { + + //绛涢�夋潯浠� 鎵瑰彿銆佸寘濂姐�佺啍鐐广�佺啍鎸囥�侀粍搴︺�佷笉閫忔槑搴� + Wrapper<Pla> wrapper = new EntityWrapper<Pla>(); + if(!Cools.isEmpty(orderDetl.getBatch())){ + wrapper.eq("batch",orderDetl.getBatch()); + } + if(!Cools.isEmpty(orderDetl.getBrand())){ + wrapper.eq("package_no",orderDetl.getBrand()); + } + wrapper.eq("status","宸插叆搴�"); + wrapper.ge("finger_melting", orderDetl.getFingerMeltingMin()).le("finger_melting", orderDetl.getFingerMeltingMax()); + wrapper.ge("fusing_point", orderDetl.getFusingPointMin()).le("fusing_point", orderDetl.getFusingPointMax()); + wrapper.ge("yellowness", orderDetl.getYellownessMin()).le("yellowness", orderDetl.getYellownessMax()); + wrapper.ge("opacity", orderDetl.getOpacityMin()).le("opacity", orderDetl.getOpacityMax()); + wrapper.orderBy("pakin_time"); + + List<Pla> plas = this.selectList(wrapper); + //鎬诲叡鐨勫嚭搴撶殑鏁伴噺(鎬昏鍑哄簱鏁伴噺-浣滀笟鏁伴噺) + if(Cools.isEmpty(orderDetl.getWorkQty())){ + orderDetl.setWorkQty(0.0); + } + Double anfme = orderDetl.getAnfme() - orderDetl.getWorkQty(); + + for (Pla pla : plas){ + //搴撳瓨鏁伴噺(鍓╀綑閲嶉噺-搴撳瓨浣滀笟鏁伴噺) + Double weightAnfme = pla.getWeightAnfme() - pla.getQtyAnfme(); + if(weightAnfme <= 0){ + continue; + } + //闇�瑕佸噺鍘绘娆″嚭搴撻瑙堝叾浠栬鍗曢渶鍑哄簱鐨勬暟閲� + for (PlaQty plaQty : plaQties){ + if(Cools.eq(plaQty.getBatch(),pla.getBatch()) && Cools.eq(plaQty.getPackageNo(),pla.getPackageNo())){ + weightAnfme -= plaQty.getQtyAnfme(); + } + } + + if(weightAnfme > anfme){ + //濡傛灉璇ユ壒娆″寘鍙峰墿浣欓噸閲忓ぇ浜庤鍗曟槑缁嗘暟閲忥紝鍒欒繑鍥瀙laQties + PlaQty plaQty = new PlaQty(pla.getBatch(),pla.getPackageNo(),orderDetl.getId(),orderDetl.getOrderId(),orderDetl.getOrderNo(),anfme,pla.getLocNo(),new Date()); + anfme = 0.0; + plaQties.add(plaQty); + break; + }else { + PlaQty plaQty = new PlaQty(pla.getBatch(),pla.getPackageNo(),orderDetl.getId(),orderDetl.getOrderId(),orderDetl.getOrderNo(),weightAnfme,pla.getLocNo(),new Date()); + anfme -= weightAnfme; + plaQties.add(plaQty); + } + } + + if(anfme > 0){ + PlaQty plaQty = new PlaQty(orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getId(),orderDetl.getOrderId(),orderDetl.getOrderNo(),anfme,null,new Date()); + plaQties.add(plaQty); + } + + } } -- Gitblit v1.9.1