| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.OrderDomainParam; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | |
| | | @Transactional |
| | | public R formAdd(@RequestBody OrderDomainParam param){ |
| | | if(Cools.isEmpty(param.getOrderNo())){ |
| | | param.setOrderNo("HAND" + snowflakeIdWorker.nextId()); |
| | | String prefix = ""; |
| | | DocType docType = docTypeService.selectById(param.getDocType()); |
| | | if(!Cools.isEmpty(docType)){ |
| | | prefix = docType.getPakin() == 1 ? "RK" : "CK"; |
| | | } |
| | | param.setOrderNo(prefix + snowflakeIdWorker.nextId()); |
| | | } |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (order != null) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // ------------------------------------------------------------------------------------------------ |
| | | |
| | | @RequestMapping(value = "/order/{id}/auth") |
| | |
| | | if (Cools.isEmpty(order) || null == order.getId()){ |
| | | return R.error(); |
| | | } |
| | | |
| | | //订单完结前,判断是否存在作业中数据,存在则不能完结 |
| | | if(order.getSettle() == 4){ |
| | | int wrkCount = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("order_no",order.getOrderNo())); |
| | | int pakinCount = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("order_no",order.getOrderNo())); |
| | | if (wrkCount > 0 || pakinCount > 0) { |
| | | throw new CoolException("存在作业中数据,不能完结。请检查入库通知档和工作档"); |
| | | } |
| | | } |
| | | |
| | | order.setUpdateBy(getUserId()); |
| | | order.setUpdateTime(new Date()); |
| | | if (!orderService.updateById(order)) { |