| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/pingKu/unShelves/auth") |
| | | @ManagerAuth(memo = "平库下架") |
| | | public R pingKuUnShelves(@RequestBody CombParam combParam){ |
| | | if (Cools.isEmpty(combParam.getLocno(), combParam.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | mobileService.pingKuUnShelves(combParam, getUserId()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/pack/get/auth") |
| | | @ManagerAuth |
| | | public R packGet(@RequestParam String barcode){ |
| | |
| | | return R.ok().add(orderPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/list/pda/page/out/auth") |
| | | @ManagerAuth |
| | | public R pdaPageListOut(@RequestParam(required = true)Long tagId, |
| | | @RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit){ |
| | | List<DocType> docTypes = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); |
| | | ArrayList<Integer> arrayList = new ArrayList<>(); |
| | | docTypes.forEach(docType -> { |
| | | arrayList.add(docType.getDocId().intValue()); |
| | | }); |
| | | EntityWrapper<Order> wrapper = new EntityWrapper<>(); |
| | | // wrapper.eq("tag_id", tagId); |
| | | wrapper.in("doc_type", arrayList); |
| | | wrapper.in("settle",1,2); |
| | | wrapper.orderBy("create_time", false); |
| | | Page<Order> orderPage = orderService.selectPage(new Page<>(curr, limit), wrapper); |
| | | return R.ok().add(orderPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | | public R navList(@RequestParam(required = false) String orderNo){ |
| | |
| | | if (!Cools.isEmpty(locMast)){ |
| | | return String.valueOf(locMast.getLocNo()); |
| | | } |
| | | return null; |
| | | return this.sourceLocNo; |
| | | } |
| | | |
| | | public String getIoTime$(){ |
| | |
| | | // 规格 |
| | | private String specs; |
| | | |
| | | private String supp; |
| | | |
| | | private String temp1; |
| | | |
| | | private String temp2; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | |
| | | // ------------------------------------------------- |
| | | |
| | | List<ManLocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos, @Param("supp")String supp, @Param("temp1")String temp1, @Param("temp2")String temp2); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | |
| | | |
| | | // -------------------------------------------------- |
| | | |
| | | List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos,String supp,String temp1,String temp2); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | |
| | | void inventoryUpload(String orderId); |
| | | |
| | | void pingKuShelves(CombParam combParam, Long userId); |
| | | |
| | | void pingKuUnShelves(CombParam combParam, Long userId); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); |
| | | public List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos,String supp,String temp1,String temp2) { |
| | | return this.baseMapper.queryStock(matnr, batch, orderNo, locNos,supp,temp1,temp2); |
| | | } |
| | | |
| | | @Override |
| | |
| | | wrkDetl.setSuppCode(detlDto.getFromOrderNo()); //来源单号 |
| | | wrkDetl.setTemp1(detlDto.getTemp1()); |
| | | wrkDetl.setTemp2(detlDto.getTemp2()); |
| | | wrkDetl.setTemp3(detlDto.getSuppName()); |
| | | wrkDetl.setTemp4(detlDto.getTemp4()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void pingKuUnShelves(CombParam combParam, Long userId) { |
| | | String orderNo = combParam.getOrderNo(); |
| | | |
| | | Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", combParam.getLocno()).eq("type", 3)); |
| | | if (Cools.isEmpty(node)){ |
| | | throw new CoolException("未找到库位信息"); |
| | | } |
| | | //根据订单号生成出库任务工作档 |
| | | Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); |
| | | if (order.getSettle() != 1 && order.getSettle() != 2){ |
| | | throw new CoolException("该订单已处理"); |
| | | } |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | for (CombParam.CombMat elem : combParam.getCombMats()) { |
| | | Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", combParam.getLocno()) |
| | | .eq("matnr", elem.getMatnr()).eq("batch", elem.getBatch()) |
| | | .eq("temp3", elem.getSupp()).eq("temp1", elem.getTemp1()).eq("temp2", elem.getTemp2()); |
| | | ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper); |
| | | |
| | | if (Cools.isEmpty(manLocDetl)){ |
| | | throw new CoolException("该库位未查询到货物信息"); |
| | | } |
| | | if (elem.getAnfme()> manLocDetl.getAnfme()){ |
| | | throw new CoolException("出库数量大于库位剩余数量"); |
| | | } |
| | | |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | throw new CoolException("该单据中未找到对应物料明细"); |
| | | } |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getSuppCode() |
| | | , orderDetl.getManu(),orderDetl.getSku(),orderDetl.getSupp(),orderDetl.getTemp1(),orderDetl.getTemp2(),orderDetl.getTemp3(),orderDetl.getTemp4()); |
| | | |
| | | |
| | | int workNo = commonService.getWorkNo(4); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(14L); // 工作状态:生成入库ID |
| | | wrkMast.setIoType(301); // 入出库状态:301.平库出库 |
| | | wrkMast.setIoPri(12D); // 优先级 |
| | | wrkMast.setSourceLocNo(node.getName()); |
| | | wrkMast.setBarcode(""); // 托盘码 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("Y"); |
| | | wrkMast.setSheetNo(order.getOrderNo()); |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | |
| | | wrkDetl.sync(detlDto); |
| | | wrkDetl.sync(mat); |
| | | |
| | | wrkDetl.setOrderNo(order.getOrderNo()); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setManu(detlDto.getMark()); //标记 |
| | | wrkDetl.setOrigin(order.getItemName());//仓库 |
| | | wrkDetl.setSupp(detlDto.getSuppName()); //供应商 |
| | | wrkDetl.setSku(detlDto.getCustomer()); //客户名称 |
| | | wrkDetl.setThreeCode(detlDto.getOrderNo()); //u8发过来的订单号 |
| | | wrkDetl.setSuppCode(detlDto.getFromOrderNo()); //来源单号 |
| | | wrkDetl.setTemp1(detlDto.getTemp1()); |
| | | wrkDetl.setTemp2(detlDto.getTemp2()); |
| | | wrkDetl.setTemp3(detlDto.getTemp3()); |
| | | wrkDetl.setTemp4(detlDto.getTemp4()); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | |
| | | if (new BigDecimal(manLocDetl.getAnfme()).subtract(new BigDecimal(elem.getAnfme())).doubleValue() == 0){ |
| | | manLocDetlService.delete(manLocDetlWrapper); |
| | | }else { |
| | | manLocDetl.setAnfme(new BigDecimal(manLocDetl.getAnfme()).subtract(new BigDecimal(elem.getAnfme())).doubleValue()); |
| | | if (!manLocDetlService.update(manLocDetl,manLocDetlWrapper)) { |
| | | throw new CoolException("更新明细失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | |
| | |
| | | Date now = new Date(); |
| | | LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | try { |
| | | Node node = null; |
| | | if (wrkMast.getIoType() == 301){ |
| | | node = nodeService.selectOne(new EntityWrapper<Node>().eq("name",wrkMast.getSourceLocNo()).eq("type",3)); |
| | | if (null == node) { |
| | | // exceptionHandle("工作档[workNo={0}]库位号错误[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("工作档[workNo=" + wrkMast.getWrkNo() + "]库位号错误[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | assert node != null; |
| | | }else { |
| | | locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (null == locMast) { |
| | | // exceptionHandle("工作档[workNo={0}]库位号错误[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("工作档库位号错误; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | return FAIL.setMsg("工作档[workNo=" + wrkMast.getWrkNo() + "]库位号错误[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | assert locMast != null; |
| | | } |
| | | switch (wrkMast.getIoType()) { |
| | | // 全板出库 |
| | | case 101: |
| | |
| | | } |
| | | } |
| | | break; |
| | | case 301: |
| | | List<WrkDetl> wrkDetls301 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | for (WrkDetl wrkDetl : wrkDetls301) { |
| | | // 更新订单完成数量 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); |
| | | if (orderDetl==null){ |
| | | orderDetl = orderDetlService.selectItem(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), null); |
| | | } |
| | | try { |
| | | if(!Cools.isEmpty(orderDetl)){ |
| | | if(!orderDetlService.increaseQtyByOrderNo(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), |
| | | orderDetl.getBatch(),wrkDetl.getAnfme())){ |
| | | // exceptionHandle("全板出库 ===>> 更新订单完成数量失败;[workNo={0}],[locNo={1}]", |
| | | // wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("全板出库 ===>> 更新订单完成数量失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | } |
| | | } catch (Exception ignore){} |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | <select id="sum" resultType="java.lang.Double"> |
| | | SELECT SUM(anfme) FROM man_loc_detl |
| | | </select> |
| | | <select id="queryStock" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from man_loc_detl a |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | <if test="supp != null and supp != ''"> |
| | | and a.supp = #{supp} |
| | | </if> |
| | | <if test="temp1 != null and temp1 != ''"> |
| | | and a.temp1 = #{temp1} |
| | | </if> |
| | | <if test="temp2 != null and temp2 != ''"> |
| | | and a.temp2 = #{temp2} |
| | | </if> |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.order_no = #{orderNo} |
| | | </if> |
| | | |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and b.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme |
| | | desc |
| | | |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | <update id="updateLocNo0"> |
| | |
| | | <select id="selectToBeHistoryData" resultMap="BaseResultMap"> |
| | | select * from asr_wrk_mast |
| | | where wrk_sts=5 |
| | | or (wrk_sts=15 and io_type= 301) |
| | | or (wrk_sts=15 and ove_mk='Y' and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | or (wrk_sts=15 and (dateadd(mi,5,crn_end_time) <= getdate() or dateadd(mi,1,modi_time) <= getdate()) and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | or (wrk_sts=15 and (dateadd(mi,5,crn_end_time) <= getdate() or dateadd(mi,1,modi_time) <= getdate()) and crn_end_time is null and wrk_no not in (select wrk_no from asr_bas_devp)) |