| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustNewParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.result.MobileAdjustResult; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.WrkDto; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private PackService packService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | |
| | | |
| | | // 商品上架 |
| | | @RequestMapping("/mat/onSale/auth") |
| | | @ManagerAuth |
| | | public R matOnSale(@RequestBody CombParam combParam){ |
| | | mobileService.onSale(combParam); |
| | | return R.ok("上架成功"); |
| | | } |
| | | // 商品下架 |
| | | @RequestMapping("/mat/offSale/auth") |
| | | //@ManagerAuth |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam){ |
| | | mobileService.offSale(offSaleParam); |
| | | return R.ok("下架成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | // 组托 ---------------------------------------------------------------------------------------------------- |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | ArrayList<OrderDetl> orderDetls2 = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls){ |
| | | orderDetl.setAnfme(new BigDecimal(orderDetl.getAnfme()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | orderDetl.setWorkQty(new BigDecimal(orderDetl.getWorkQty()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | orderDetl.setQty(new BigDecimal(orderDetl.getQty()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | orderDetls2.add(orderDetl); |
| | | } |
| | | if (Cools.isEmpty(orderDetls) || Cools.isEmpty(orderDetls2)) { |
| | | return R.ok(); |
| | | } |
| | | return R.ok().add(orderDetls); |
| | | return R.ok().add(orderDetls2); |
| | | } |
| | | |
| | | @RequestMapping("/comb/auth") |
| | |
| | | @RequestMapping("/pack/comb/auth") |
| | | @ManagerAuth(memo = "下线组托") |
| | | public R packComb(@RequestBody CombParam combParam){ |
| | | mobileService.packComb(combParam, getUserId()); |
| | | // mobileService.packComb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | |
| | | if (wrkMast != null) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | // 去除已出库确认的明细 |
| | | wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() == 1); |
| | | wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0); |
| | | return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 根据库位码和商品码搜索商品 |
| | | @RequestMapping("/mat/find/auth") |
| | | public R find(@RequestParam(required = false) String locNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr); |
| | | ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr); |
| | | return R.ok(manLocDetl); |
| | | //return R.ok(manLocDetlMapper.selectItem0(locNo, matnr)); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (Cools.isEmpty(list)) { |
| | | return R.ok(); |
| | | } |
| | | // todo:luxiaotao 拣料出库可修改工作档明细 |
| | | Set<Integer> wrkNos = new HashSet<>(); |
| | | List<WrkDto> dtos = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl : list) { |
| | | wrkNos.add(wrkDetl.getWrkNo()); |
| | | wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); |
| | | if (wrkNos.contains(wrkDetl.getWrkNo())) { |
| | | for (WrkDto dto : dtos) { |
| | | if (dto.getWrkNo().equals(wrkDetl.getWrkNo())) { |
| | | dto.getWrkDetls().add(wrkDetl); |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | wrkNos.add(wrkDetl.getWrkNo()); |
| | | dtos.add(new WrkDto(wrkDetl.getWrkNo(), wrkDetl)); |
| | | } |
| | | } |
| | | |
| | | for (WrkDto dto : dtos) { |
| | | WrkMast wrkMast = wrkMastService.selectById(dto.getWrkNo()); |
| | | if (wrkMast != null) { |
| | | // 101 |
| | | if (wrkMast.getIoType() == 101) { |
| | | for (WrkDetl wrkDetl : dto.getWrkDetls()) { |
| | | wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch()); |
| | | } |
| | | } |
| | | // 103 |
| | | if (wrkMast.getIoType() == 103) { |
| | | if (!wrkDetlService.delete(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()))) { |
| | | throw new CoolException("拣料出库确认失败"); |
| | | } |
| | | for (WrkDetl wrkDetl : dto.getWrkDetls()) { |
| | | wrkDetl.setInspect(1); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("拣料出库确认失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Integer wrkNo : wrkNos) { |
| | | WrkMast wrkMast = wrkMastService.selectById(wrkNo); |
| | | if (wrkMast.getWrkSts() == 14 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) { |
| | |
| | | return R.ok("盘点成功"); |
| | | } |
| | | |
| | | @RequestMapping("/adjustNew/auth") |
| | | @ManagerAuth(memo = "pda盘点") |
| | | public R adjustNew(@RequestBody MobileAdjustNewParam combParam){ |
| | | mobileService.adjustNew(combParam, getUserId()); |
| | | return R.ok("盘点成功"); |
| | | } |
| | | |
| | | @PostMapping("/order/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakoutByOrder(@RequestBody JSONObject param) { |
| | | if(!param.containsKey("staNo") || !param.containsKey("orderNo")){ |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | mobileService.pakoutByOrder(param,getUserId()); |
| | | return R.ok("出库成功"); |
| | | } |
| | | |
| | | //平库pda上架 |
| | | @RequestMapping("/manDetl/in") |
| | | @ManagerAuth(memo = "订单上架") |
| | | public R manDetlAdd(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlIn(json, getUser()); |
| | | } |
| | | |
| | | //平库pda下架 |
| | | @RequestMapping("/manDetl/out") |
| | | @ManagerAuth(memo = "订单下架") |
| | | public R manDetlDelete(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlOut(json , getUser()); |
| | | } |
| | | |
| | | @RequestMapping("/manDetl/in/barcode") |
| | | @ManagerAuth(memo = "订单上架(托盘码)") |
| | | public R manDetlAddbarcode(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlInBarcode(json,getUser()); |
| | | } |
| | | |
| | | @RequestMapping("/manDetl/in/origin") |
| | | @ManagerAuth(memo = "平库上架") |
| | | public R manDetlIn(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlOrigin(json,getUser()); |
| | | } |
| | | |
| | | @RequestMapping("/manDetl/in/no/origin") |
| | | @ManagerAuth(memo = "平库上架") |
| | | public R manDetlInNo(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlOrigInNo(json,getUser()); |
| | | } |
| | | |
| | | // @RequestMapping("/manDetl/out/origin") |
| | | // @ManagerAuth(memo = "平库下架") |
| | | // public R manDetlout(@RequestBody JSONObject json){ |
| | | // if (json == null){ |
| | | // return R.error("传入数据为空"); |
| | | // } |
| | | // return mobileService.manDetlOriginOut(json,getUser()); |
| | | // } |
| | | |
| | | @RequestMapping("/manDetl/out/origin") |
| | | @ManagerAuth(memo = "平库下架") |
| | | public R manDetlout2(@RequestBody JSONObject json){ |
| | | if (json == null){ |
| | | return R.error("传入数据为空"); |
| | | } |
| | | return mobileService.manDetlOriginOut(json,getUser()); |
| | | } |
| | | |
| | | @RequestMapping("/plaDetl/packin/v1") |
| | | //@ManagerAuth(memo="pla入库") |
| | | public R plaPackIn(@RequestBody JSONObject json){ |
| | | String locNo = json.get("locNo").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | String packageNo = json.get("packageNo").toString(); |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | //测试 |
| | | if(true){ |
| | | User user = new User(); |
| | | user.setUsername("test"); |
| | | mobileService.plaPakin(locNo,batch,packageNo,user); |
| | | return R.ok(); |
| | | } |
| | | mobileService.plaPakin(locNo,batch,packageNo,getUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/plaDetl/packout1/v1") |
| | | // @ManagerAuth(memo="pla出库") |
| | | public R plaPackOut1(@RequestBody JSONObject json){ |
| | | String locNo = json.get("locNo").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | String packageNo = json.get("packageNo").toString(); |
| | | String orderNo = json.get("orderNo").toString(); |
| | | String orderDetlId = json.get("orderDetlId").toString(); |
| | | String wrkNo = json.get("wrkNo").toString(); |
| | | Double anfme = Double.parseDouble(json.get("anfme").toString()); |
| | | |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | mobileService.plaPakout(locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/plaDetl/packout/v1") |
| | | // @ManagerAuth(memo="pla出库") |
| | | public R plaPackOut(@RequestBody JSONObject json){ |
| | | String locNo = json.get("locNo").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | String packageNo = json.get("packageNo").toString(); |
| | | String orderNo = json.get("orderNo").toString(); |
| | | String orderDetlId = json.get("orderDetlId").toString(); |
| | | String wrkNo = json.get("wrkNo").toString(); |
| | | Double anfme = Double.parseDouble(json.get("anfme").toString()); |
| | | |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | mobileService.plaPakout(locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme); |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String aa = "aabb"; |
| | | String[] ccs = aa.split("cc"); |
| | | System.out.println(ccs[0]); |
| | | } |
| | | |
| | | } |