| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.ManPakOut; |
| | | import com.zy.asrs.entity.Pla; |
| | | import com.zy.asrs.entity.PlaQty; |
| | | import com.zy.asrs.service.ManPakOutService; |
| | | import com.zy.asrs.service.PlaQtyService; |
| | | import com.zy.asrs.service.PlaService; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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 java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private PlaService plaService; |
| | | @Autowired |
| | | private PlaQtyService plaQtyService; |
| | | @Autowired |
| | | private ManPakOutService manPakOutService; |
| | | |
| | | @RequestMapping(value = "/pla/list/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/delivery/auth") |
| | | @ManagerAuth |
| | | public R delivery() { |
| | | return R.ok(plaQtyService.getDeliveryDate()); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/sellout/auth") |
| | | @ManagerAuth |
| | | public R sellout(@RequestBody List<Pla> plas) { |
| | | |
| | | plas.forEach(pla -> { |
| | | |
| | | if(pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0){ |
| | | throw new CoolException("该库存剩余重量不足,请调整出库重量"); |
| | | } |
| | | pla.setQtyAnfme(pla.getQtyAnfme() + pla.getOrderWeight()); |
| | | pla.setHandlerBy(getUser().getUsername()); |
| | | pla.setStatus("待出库"); |
| | | pla.setPakoutTime(pla.getPakoutTime().split("\\(")[0]); |
| | | PlaQty plaQty = new PlaQty(); |
| | | BeanUtils.copyProperties(pla,plaQty); |
| | | plaQty.setCreateTime(new Date()); |
| | | plaQty.setId(null); |
| | | |
| | | plaService.updateById(pla); |
| | | plaQtyService.insert(plaQty); |
| | | |
| | | //生成拣货单 |
| | | addPakOUT(plaQty); |
| | | |
| | | }); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/returned/auth") |
| | | @ManagerAuth |
| | | public R returned(@RequestBody List<PlaQty> plaQties) { |
| | | plaService.returned(plaQties,getUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/rework/auth") |
| | | @ManagerAuth |
| | | public R rework(@RequestBody List<Pla> plas) { |
| | | plas.forEach(pla -> { |
| | | Double anfme = pla.getWeightAnfme(); |
| | | pla.setStatus("全部出库"); |
| | | pla.setModifyTime(new Date()); |
| | | pla.setWeightAnfme(0.0); |
| | | plaService.updateById(pla); |
| | | SaasUtils.insertLog(1,pla.getLocNo(),pla.getBatch()+","+pla.getPackageNo(),anfme,getUser().getUsername()); |
| | | }); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | |
| | | } |
| | | } |
| | | |
| | | private R addPakOUT(PlaQty plaQty){ |
| | | ManPakOut manPakOut=new ManPakOut(); |
| | | manPakOut.setWrkNo(plaQty.getOrderNo()+"-"+System.currentTimeMillis()); |
| | | manPakOut.setWrkSts((long)1); |
| | | manPakOut.setAnfme(plaQty.getOrderWeight()); |
| | | manPakOut.setLocNo(plaQty.getLocNo()); |
| | | manPakOut.setBatch(plaQty.getBatch()); |
| | | manPakOut.setBarcode(plaQty.getPackageNo()); |
| | | manPakOut.setUuid(String.valueOf(System.currentTimeMillis())); |
| | | manPakOut.setCreateTime(new Date()); |
| | | manPakOut.setUpdateTime(new Date()); |
| | | manPakOut.setCount(0.0); |
| | | manPakOut.setDocNum(plaQty.getOrderNo()); |
| | | manPakOut.setStatus(0); |
| | | manPakOut.setNodeId(plaQty.getId()); |
| | | //manPakOut.setNodeId(plaQty.getOrderDetlId()); |
| | | manPakOutService.insert(manPakOut); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |