| | |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.integration.iot.biz.IotInstructionService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private OrderPakinService orderPakinService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | @Autowired |
| | | private IotInstructionService iotInstructionService; |
| | | |
| | | @Value("${erp.switch.ErpReportOld}") |
| | | private boolean erpReportOld; |
| | |
| | | if (!Cools.isEmpty(erpReport) && !"true".equalsIgnoreCase(erpReport)) { |
| | | return false; |
| | | } |
| | | if (wrkMast == null || Cools.isEmpty(wrkMast.getBarcode())) { |
| | | if (wrkMast == null) { |
| | | return false; |
| | | } |
| | | Integer ioType = wrkMast.getIoType(); |
| | | return ioType != null && (ioType == 101 || ioType == 108 || ioType == 110); |
| | | if (ioType == null || (ioType != 101 && ioType != 108 && ioType != 110)) { |
| | | return false; |
| | | } |
| | | return !Cools.isEmpty(resolveOutboundPalletId(wrkMast)); |
| | | } |
| | | |
| | | private String resolveOutboundPalletId(WrkMast wrkMast) { |
| | | if (!Cools.isEmpty(wrkMast.getBarcode())) { |
| | | return wrkMast.getBarcode(); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | if (Cools.isEmpty(wrkDetls)) { |
| | | return null; |
| | | } |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (!Cools.isEmpty(wrkDetl.getZpallet())) { |
| | | return wrkDetl.getZpallet(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public ReturnT<String> doIn(WrkMast wrkMast) { |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("更新入库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | iotInstructionService.queueWorkCompletion(wrkMast); |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | e.printStackTrace(); |
| | |
| | | if (locMast.getLocSts().equals("R")) { |
| | | locMast.setLocSts("O"); |
| | | locMast.setBarcode(""); |
| | | locMast.setScWeight(BigDecimal.ZERO); |
| | | locMast.setModiTime(now); |
| | | locMast.setIoTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | |
| | | if (locMast.getLocSts().equals("R")) { |
| | | locMast.setLocSts("O"); |
| | | locMast.setBarcode(""); |
| | | locMast.setScWeight(BigDecimal.ZERO); |
| | | locMast.setModiTime(now); |
| | | locMast.setIoTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("更新出库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | iotInstructionService.queueWorkCompletion(wrkMast); |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | e.printStackTrace(); |
| | |
| | | return SUCCESS; |
| | | } |
| | | } |
| | | |