自动化立体仓库 - WMS系统
#
Junjie
3 天以前 b87fd470a866ffcf50bb5c5d55ff9b2dd11fc20c
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -19,10 +19,11 @@
import com.zy.common.model.DetlDto;
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.Synchro;
import com.zy.common.utils.HttpHandler;
import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,6 +39,9 @@
@Slf4j
@Service
public class MobileServiceImpl implements MobileService {
    @Value("${wcs.url}")
    private String wcsUrl;
    @Autowired
    private MatService matService;
@@ -600,6 +604,7 @@
                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
                detlDto.setWeight(elem.getWeight());
                detlDto.setCstateid(elem.getCstateid());
                if (DetlDto.has(detlDtos, detlDto)) {
                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
                    assert one != null;
@@ -635,6 +640,7 @@
                waitPakin.setStandby2(detlDto.getStandby2());
                waitPakin.setStandby3(detlDto.getStandby3());
                waitPakin.setTkFlag(param.getTkFlag());
                waitPakin.setCstateid(detlDto.getCstateid());
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存入库通知档失败");
                }
@@ -671,6 +677,7 @@
                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
                detlDto.setOrderNo(elem.getOrderNo());
                detlDto.setWeight(elem.getWeight());
                detlDto.setCstateid(elem.getCstateid());
                if (DetlDto.has(detlDtos, detlDto)) {
                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
                    assert one != null;
@@ -706,6 +713,7 @@
                waitPakin.setStandby2(detlDto.getStandby2());
                waitPakin.setStandby3(detlDto.getStandby3());
                waitPakin.setWeight(detlDto.getWeight());
                waitPakin.setCstateid(detlDto.getCstateid());
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存入库通知档失败");
                }
@@ -740,13 +748,13 @@
                }
                // 订单明细数量校验
                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getBrand(), waitPakin.getStandby1(), waitPakin.getStandby2(), waitPakin.getStandby3(),
                OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getBrand(), waitPakin.getStandby1(), waitPakin.getStandby2(), waitPakin.getStandby3(),
                        waitPakin.getBoxType1(), waitPakin.getBoxType2(), waitPakin.getBoxType3());
                if (orderDetl == null) {
                if (orderDetlPakin == null) {
                    continue;
                }
                Double workQty = orderDetl.getWorkQty();
                Double workQty = orderDetlPakin.getWorkQty();
                BigDecimal workQtyDecimal = new BigDecimal(workQty);
                workQtyDecimal = workQtyDecimal.subtract(BigDecimal.valueOf(waitPakin.getAnfme()));
@@ -754,8 +762,8 @@
                if (newWorkQty <= 0) {
                    newWorkQty = 0D;
                }
                orderDetl.setWorkQty(newWorkQty);
                orderDetlService.updateById(orderDetl);
                orderDetlPakin.setWorkQty(newWorkQty);
                orderDetlPakinService.updateById(orderDetlPakin);
            }
        }
@@ -1264,4 +1272,65 @@
            throw new CoolException("盘点未完成无法上报");
        }
    }
    @Override
    public void toOutSta(PalletToOutStaParam param, Long userId) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
        if (wrkMast == null) {
            throw new CoolException("工作档不存在");
        }
        if (wrkMast.getIoType() != 103) {
            throw new CoolException("工作档类型不是拣料出库");
        }
        if (wrkMast.getWrkSts() != 14) {
            throw new CoolException("工作状态未处于已出库");
        }
        String response = "";
        try {
            HashMap<String, Object> map = new HashMap<>();
            map.put("wrkNo", wrkMast.getWrkNo());
            map.put("sourceStaNo", wrkMast.getStaNo());
            map.put("staNo", 1075);
            response = new HttpHandler.Builder()
                    .setUri(wcsUrl)
                    .setPath("/open/toOutSta")
                    .setJson(JSON.toJSONString(map))
                    .build()
                    .doPost();
            log.info("toOutSta:{}", response);
        } catch (Exception e) {
            log.error("fail", e);
        }
    }
    @Override
    public void toAllOut(PalletToAllOutParam param, Long userId) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
        if (wrkMast == null) {
            throw new CoolException("工作档不存在");
        }
        if (wrkMast.getIoType() != 103) {
            throw new CoolException("工作档类型不是拣料出库");
        }
        if (wrkMast.getWrkSts() != 14) {
            throw new CoolException("工作状态未处于已出库");
        }
        wrkMast.setBarcode(param.getNewBarcode());
        wrkMast.setModiTime(new Date());
        wrkMast.setModiUser(userId);
        wrkMastService.updateById(wrkMast);
        WrkDetl wrkDetl = new WrkDetl();
        wrkDetl.setZpallet(param.getNewBarcode());
        wrkDetl.setModiTime(new Date());
        wrkDetl.setModiUser(userId);
        wrkDetlService.update(wrkDetl, new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
    }
}